From 0a04c997c78d02166c6a5ef16527fe12e6aabc78 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Mon, 26 Nov 2018 15:34:22 +0100 Subject: [PATCH 01/18] Use `vh` sized for min canvas height Thanks to @zeroconso https://github.com/adchsm/Slidebars/issues/251#issuecomment-441389364 --- css/off-canvas-sidebars.css | 3 ++- css/off-canvas-sidebars.min.css | 4 ++-- js/off-canvas-sidebars.js | 10 +--------- js/off-canvas-sidebars.min.js | 4 ++-- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/css/off-canvas-sidebars.css b/css/off-canvas-sidebars.css index 97ed580..28534b1 100644 --- a/css/off-canvas-sidebars.css +++ b/css/off-canvas-sidebars.css @@ -4,7 +4,7 @@ * @author Jory Hogeveen * @package Off_Canvas_Sidebars * @since 0.2.0 - * @version 0.5.0 + * @version 0.5.4 * @preserve */ @@ -32,6 +32,7 @@ html.ocs-scroll-lock.ocs-scroll-fixed body { .ocs-initialized [canvas=container] { overflow-y: hidden; height: auto; + min-height: 100vh; } diff --git a/css/off-canvas-sidebars.min.css b/css/off-canvas-sidebars.min.css index fb2e317..ef6df3e 100644 --- a/css/off-canvas-sidebars.min.css +++ b/css/off-canvas-sidebars.min.css @@ -4,7 +4,7 @@ * @author Jory Hogeveen * @package Off_Canvas_Sidebars * @since 0.2.0 - * @version 0.5.0 + * @version 0.5.4 * @preserve */ -html,html.ocs-initialized{overflow-y:auto;height:auto}html.ocs-scroll-lock{overflow-y:hidden}html.ocs-scroll-lock.ocs-scroll-fixed{position:fixed;overflow-y:scroll}html.ocs-scroll-lock.ocs-scroll-fixed body{position:relative}[canvas=container],.ocs-initialized [canvas=container]{overflow-y:hidden;height:auto}.ocs-legacy [canvas]{top:0;right:0;bottom:0;left:0}.ocs-legacy [canvas],.ocs-legacy [off-canvas]{-webkit-transform:none;-moz-transform:none;-ms-transform:none;-o-transform:none;transform:none;-webkit-transition:-webkit-transform 300ms,top 300ms,bottom 300ms,left 300ms,right 300ms,clip-path 0;-moz-transition:-moz-transform 300ms,top 300ms,bottom 300ms,left 300ms,right 300ms,clip-path 0;-o-transition:-o-transform 300ms,top 300ms,bottom 300ms,left 300ms,right 300ms,clip-path 0;transition:transform 300ms,top 300ms,bottom 300ms,left 300ms,right 300ms,clip-path 0}[off-canvas*=" top"][off-canvas*=" reveal"],[off-canvas*=" top"][off-canvas*=" shift"],[off-canvas*=" bottom"][off-canvas*=" reveal"],[off-canvas*=" bottom"][off-canvas*=" shift"]{z-index:1}.ocs-size-default.ocs-location-left,.ocs-size-default.ocs-location-right{width:30%}.ocs-size-small.ocs-location-left,.ocs-size-small.ocs-location-right{width:15%}.ocs-size-large.ocs-location-left,.ocs-size-large.ocs-location-right{width:45%}.ocs-size-default.ocs-location-top,.ocs-size-default.ocs-location-bottom{height:30%}.ocs-size-small.ocs-location-top,.ocs-size-small.ocs-location-bottom{height:15%}.ocs-size-large.ocs-location-top,.ocs-size-large.ocs-location-bottom{height:45%}@media(max-width:480px){.ocs-size-default.ocs-location-left,.ocs-size-default.ocs-location-right{width:60%}.ocs-size-small.ocs-location-left,.ocs-size-small.ocs-location-right{width:35%}.ocs-size-large.ocs-location-left,.ocs-size-large.ocs-location-right{width:85%}.ocs-size-default.ocs-location-top,.ocs-size-default.ocs-location-bottom{height:40%}.ocs-size-small.ocs-location-top,.ocs-size-small.ocs-location-bottom{height:20%}.ocs-size-large.ocs-location-top,.ocs-size-large.ocs-location-bottom{height:60%}}@media(min-width:481px){.ocs-size-default.ocs-location-left,.ocs-size-default.ocs-location-right{width:50%}.ocs-size-small.ocs-location-left,.ocs-size-small.ocs-location-right{width:30%}.ocs-size-large.ocs-location-left,.ocs-size-large.ocs-location-right{width:70%}.ocs-size-default.ocs-location-top,.ocs-size-default.ocs-location-bottom{height:40%}.ocs-size-small.ocs-location-top,.ocs-size-small.ocs-location-bottom{height:20%}.ocs-size-large.ocs-location-top,.ocs-size-large.ocs-location-bottom{height:60%}}@media(min-width:768px){.ocs-size-default.ocs-location-left,.ocs-size-default.ocs-location-right{width:40%}.ocs-size-small.ocs-location-left,.ocs-size-small.ocs-location-right{width:25%}.ocs-size-large.ocs-location-left,.ocs-size-large.ocs-location-right{width:55%}.ocs-size-default.ocs-location-top,.ocs-size-default.ocs-location-bottom{height:35%}.ocs-size-small.ocs-location-top,.ocs-size-small.ocs-location-bottom{height:20%}.ocs-size-large.ocs-location-top,.ocs-size-large.ocs-location-bottom{height:55%}}@media(min-width:992px){.ocs-size-default.ocs-location-left,.ocs-size-default.ocs-location-right{width:30%}.ocs-size-small.ocs-location-left,.ocs-size-small.ocs-location-right{width:15%}.ocs-size-large.ocs-location-left,.ocs-size-large.ocs-location-right{width:45%}.ocs-size-default.ocs-location-top,.ocs-size-default.ocs-location-bottom{height:30%}.ocs-size-small.ocs-location-top,.ocs-size-small.ocs-location-bottom{height:15%}.ocs-size-large.ocs-location-top,.ocs-size-large.ocs-location-bottom{height:45%}}@media(min-width:1200px){.ocs-size-default.ocs-location-left,.ocs-size-default.ocs-location-right{width:25%}.ocs-size-small.ocs-location-left,.ocs-size-small.ocs-location-right{width:10%}.ocs-size-large.ocs-location-left,.ocs-size-large.ocs-location-right{width:40%}.ocs-size-default.ocs-location-top,.ocs-size-default.ocs-location-bottom{height:25%}.ocs-size-small.ocs-location-top,.ocs-size-small.ocs-location-bottom{height:10%}.ocs-size-large.ocs-location-top,.ocs-size-large.ocs-location-bottom{height:40%}} \ No newline at end of file +html,html.ocs-initialized{overflow-y:auto;height:auto}html.ocs-scroll-lock{overflow-y:hidden}html.ocs-scroll-lock.ocs-scroll-fixed{position:fixed;overflow-y:scroll}html.ocs-scroll-lock.ocs-scroll-fixed body{position:relative}[canvas=container],.ocs-initialized [canvas=container]{overflow-y:hidden;height:auto;min-height:100vh}.ocs-legacy [canvas]{top:0;right:0;bottom:0;left:0}.ocs-legacy [canvas],.ocs-legacy [off-canvas]{-webkit-transform:none;-moz-transform:none;-ms-transform:none;-o-transform:none;transform:none;-webkit-transition:-webkit-transform 300ms,top 300ms,bottom 300ms,left 300ms,right 300ms,clip-path 0;-moz-transition:-moz-transform 300ms,top 300ms,bottom 300ms,left 300ms,right 300ms,clip-path 0;-o-transition:-o-transform 300ms,top 300ms,bottom 300ms,left 300ms,right 300ms,clip-path 0;transition:transform 300ms,top 300ms,bottom 300ms,left 300ms,right 300ms,clip-path 0}[off-canvas*=" top"][off-canvas*=" reveal"],[off-canvas*=" top"][off-canvas*=" shift"],[off-canvas*=" bottom"][off-canvas*=" reveal"],[off-canvas*=" bottom"][off-canvas*=" shift"]{z-index:1}.ocs-size-default.ocs-location-left,.ocs-size-default.ocs-location-right{width:30%}.ocs-size-small.ocs-location-left,.ocs-size-small.ocs-location-right{width:15%}.ocs-size-large.ocs-location-left,.ocs-size-large.ocs-location-right{width:45%}.ocs-size-default.ocs-location-top,.ocs-size-default.ocs-location-bottom{height:30%}.ocs-size-small.ocs-location-top,.ocs-size-small.ocs-location-bottom{height:15%}.ocs-size-large.ocs-location-top,.ocs-size-large.ocs-location-bottom{height:45%}@media(max-width:480px){.ocs-size-default.ocs-location-left,.ocs-size-default.ocs-location-right{width:60%}.ocs-size-small.ocs-location-left,.ocs-size-small.ocs-location-right{width:35%}.ocs-size-large.ocs-location-left,.ocs-size-large.ocs-location-right{width:85%}.ocs-size-default.ocs-location-top,.ocs-size-default.ocs-location-bottom{height:40%}.ocs-size-small.ocs-location-top,.ocs-size-small.ocs-location-bottom{height:20%}.ocs-size-large.ocs-location-top,.ocs-size-large.ocs-location-bottom{height:60%}}@media(min-width:481px){.ocs-size-default.ocs-location-left,.ocs-size-default.ocs-location-right{width:50%}.ocs-size-small.ocs-location-left,.ocs-size-small.ocs-location-right{width:30%}.ocs-size-large.ocs-location-left,.ocs-size-large.ocs-location-right{width:70%}.ocs-size-default.ocs-location-top,.ocs-size-default.ocs-location-bottom{height:40%}.ocs-size-small.ocs-location-top,.ocs-size-small.ocs-location-bottom{height:20%}.ocs-size-large.ocs-location-top,.ocs-size-large.ocs-location-bottom{height:60%}}@media(min-width:768px){.ocs-size-default.ocs-location-left,.ocs-size-default.ocs-location-right{width:40%}.ocs-size-small.ocs-location-left,.ocs-size-small.ocs-location-right{width:25%}.ocs-size-large.ocs-location-left,.ocs-size-large.ocs-location-right{width:55%}.ocs-size-default.ocs-location-top,.ocs-size-default.ocs-location-bottom{height:35%}.ocs-size-small.ocs-location-top,.ocs-size-small.ocs-location-bottom{height:20%}.ocs-size-large.ocs-location-top,.ocs-size-large.ocs-location-bottom{height:55%}}@media(min-width:992px){.ocs-size-default.ocs-location-left,.ocs-size-default.ocs-location-right{width:30%}.ocs-size-small.ocs-location-left,.ocs-size-small.ocs-location-right{width:15%}.ocs-size-large.ocs-location-left,.ocs-size-large.ocs-location-right{width:45%}.ocs-size-default.ocs-location-top,.ocs-size-default.ocs-location-bottom{height:30%}.ocs-size-small.ocs-location-top,.ocs-size-small.ocs-location-bottom{height:15%}.ocs-size-large.ocs-location-top,.ocs-size-large.ocs-location-bottom{height:45%}}@media(min-width:1200px){.ocs-size-default.ocs-location-left,.ocs-size-default.ocs-location-right{width:25%}.ocs-size-small.ocs-location-left,.ocs-size-small.ocs-location-right{width:10%}.ocs-size-large.ocs-location-left,.ocs-size-large.ocs-location-right{width:40%}.ocs-size-default.ocs-location-top,.ocs-size-default.ocs-location-bottom{height:25%}.ocs-size-small.ocs-location-top,.ocs-size-small.ocs-location-bottom{height:10%}.ocs-size-large.ocs-location-top,.ocs-size-large.ocs-location-bottom{height:40%}} \ No newline at end of file diff --git a/js/off-canvas-sidebars.js b/js/off-canvas-sidebars.js index 241db9b..a3395da 100644 --- a/js/off-canvas-sidebars.js +++ b/js/off-canvas-sidebars.js @@ -5,7 +5,7 @@ * @author Jory Hogeveen * @package Off_Canvas_Sidebars * @since 0.2.0 - * @version 0.5.3 + * @version 0.5.4 * @global ocsOffCanvasSidebars * @preserve */ @@ -486,14 +486,6 @@ if ( 'undefined' === typeof ocsOffCanvasSidebars ) { disableOver(); $window.on( 'resize', disableOver ); - /** - * @fixme Fix for reveal and shift styles when page does not have enough height. - * @since 0.4 - */ - $window.on( 'load resize', function() { - ocsOffCanvasSidebars.container.css( 'min-height', $window.innerHeight() - parseInt( $html.css('margin-top'), 10 ) ); - } ); - }; /** diff --git a/js/off-canvas-sidebars.min.js b/js/off-canvas-sidebars.min.js index c184715..4895cea 100644 --- a/js/off-canvas-sidebars.min.js +++ b/js/off-canvas-sidebars.min.js @@ -4,8 +4,8 @@ * @author Jory Hogeveen * @package Off_Canvas_Sidebars * @since 0.2.0 - * @version 0.5.3 + * @version 0.5.4 * @global ocsOffCanvasSidebars * @preserve */ -if("undefined"===typeof ocsOffCanvasSidebars){var ocsOffCanvasSidebars={site_close:true,link_close:true,disable_over:false,hide_control_classes:false,scroll_lock:false,legacy_css:false,css_prefix:"ocs",sidebars:{},_debug:false}}(function($){var $document=$(document),$window=$(window),$html=$("html"),$body=$("body");ocsOffCanvasSidebars.slidebarsController=false;ocsOffCanvasSidebars.useAttributeSettings=false;ocsOffCanvasSidebars.container=false;ocsOffCanvasSidebars._touchmove=false;ocsOffCanvasSidebars._toolbar=$body.hasClass("admin-bar");ocsOffCanvasSidebars.init=function(){ocsOffCanvasSidebars._checkDisableOver=function(sidebarId){var check=true;var disableOver=parseInt(ocsOffCanvasSidebars._getSetting("disable_over",sidebarId),10);if(disableOver&&!isNaN(disableOver)){if($window.width()>disableOver){check=false}}return check};ocsOffCanvasSidebars._getSetting=function(key,sidebarId){var overwrite,setting,prefix=ocsOffCanvasSidebars.css_prefix;if("undefined"!==typeof sidebarId){if(!sidebarId&&null!==sidebarId){sidebarId=ocsOffCanvasSidebars.slidebarsController.getActiveSlidebar()}}if(sidebarId){if(!$.isEmptyObject(ocsOffCanvasSidebars.sidebars)&&!ocsOffCanvasSidebars.useAttributeSettings){sidebarId=sidebarId.replace(prefix+"-","");if(ocsOffCanvasSidebars.sidebars[sidebarId].overwrite_global_settings){setting=ocsOffCanvasSidebars.sidebars[sidebarId][key];if(setting){return setting}else{return false}}}else{var sidebarElement=$("#"+sidebarId);overwrite=sidebarElement.attr("data-ocs-overwrite_global_settings");if(overwrite){setting=sidebarElement.attr("data-ocs-"+key);if("undefined"!==typeof setting){return setting}else{return false}}}}if(ocsOffCanvasSidebars.hasOwnProperty(key)&&!ocsOffCanvasSidebars.useAttributeSettings){return ocsOffCanvasSidebars[key]}else{setting=$("#"+prefix+"-site").attr("data-ocs-"+key);if("undefined"!==typeof setting){return setting}}return false};ocsOffCanvasSidebars._getTranslateAxis=function(obj,axis){obj=$(obj);var transformMatrix=obj.css("-webkit-transform")||obj.css("-moz-transform")||obj.css("-ms-transform")||obj.css("-o-transform")||obj.css("transform");if(transformMatrix){var matrix=transformMatrix.replace(/[^0-9\-.,]/g,"").split(",");var val=0;switch(axis){case"x":val=matrix[12]||matrix[4];break;case"y":val=matrix[13]||matrix[5];break;case"z":val=matrix[14]||matrix[6];break}return parseFloat(val)}else{return 0}};ocsOffCanvasSidebars.container=$("[canvas=container]");$window.trigger("ocs_before",this);ocsOffCanvasSidebars.slidebarsController=new slidebars;if(false===ocsOffCanvasSidebars.slidebarsController){return}if(ocsOffCanvasSidebars.legacy_css){ocsOffCanvasSidebars.slidebarsController.legacy=true;$html.addClass("ocs-legacy")}$window.trigger("ocs_loaded",this);ocsOffCanvasSidebars.slidebarsController.init();$html.addClass("ocs-initialized");$window.trigger("ocs_initialized",this);if(ocsOffCanvasSidebars._toolbar){$window.on("load",function(){var bodyOffset=$body.offset(),$sidebars=$("."+ocsOffCanvasSidebars.css_prefix+"-slidebar");$sidebars.each(function(){var $this=$(this);if(!$this.hasClass("ocs-location-bottom")){$this.css("margin-top","+="+bodyOffset.top)}});$(ocsOffCanvasSidebars.slidebarsController.events).on("css",function(){$sidebars.each(function(){var $this=$(this);if($this.hasClass("ocs-location-top")){$this.css("margin-top","+="+bodyOffset.top)}})})})}$(ocsOffCanvasSidebars.slidebarsController.events).on("opening opened closing closed",function(e,sidebar_id){var slidebar=ocsOffCanvasSidebars.slidebarsController.getSlidebar(sidebar_id);var duration=parseFloat(slidebar.element.css("transitionDuration"))*1e3;if("top"===slidebar.side||"bottom"===slidebar.side){var elements=ocsOffCanvasSidebars.getFixedElements();elements.attr({"canvas-fixed":"fixed"});if(ocsOffCanvasSidebars.legacy_css&&"top"===slidebar.side&&("overlay"!==slidebar.style&&"reveal"!==slidebar.style)){var offset;offset=parseInt(slidebar.element.css("margin-top").replace("px","").replace("-",""),10);if(ocsOffCanvasSidebars._toolbar){var bodyOffset=$body.offset();offset+=bodyOffset.top}elements.each(function(){var $this=$(this);if("opening"===e.type){ocsOffCanvasSidebars.cssCompat($this,"transition","top "+duration+"ms");$this.css("top",parseInt($this.css("top").replace("px",""),10)+offset+"px")}else if("closing"===e.type){$this.css("top",parseInt($this.css("top").replace("px",""),10)-offset+"px");setTimeout(function(){ocsOffCanvasSidebars.cssCompat($this,"transition","")},duration)}})}else{elements.each(function(){var $this=$(this);if("opening"===e.type||"closing"===e.type){ocsOffCanvasSidebars.cssCompat($this,"transition","transform "+duration+"ms")}else if("opened"===e.type||"closed"===e.type){ocsOffCanvasSidebars.cssCompat($this,"transition","")}})}$window.trigger("slidebar_event",[e.type,slidebar])}});$document.on("touchmove",function(){ocsOffCanvasSidebars._touchmove=true});$document.on("touchstart",function(){ocsOffCanvasSidebars._touchmove=false});if("function"===typeof ocsOffCanvasSidebars.setupTriggers){ocsOffCanvasSidebars.setupTriggers()}$window.trigger("ocs_after",this)};ocsOffCanvasSidebars.setSidebarDefaultSettings=function(sidebarId){if("undefined"===typeof ocsOffCanvasSidebars.sidebars[sidebarId]){ocsOffCanvasSidebars.sidebars[sidebarId]={overwrite_global_settings:false,site_close:ocsOffCanvasSidebars.site_close,disable_over:ocsOffCanvasSidebars.disable_over,hide_control_classes:ocsOffCanvasSidebars.hide_control_classes,scroll_lock:ocsOffCanvasSidebars.scroll_lock}}};ocsOffCanvasSidebars.setupTriggers=function(){var controller=ocsOffCanvasSidebars.slidebarsController,prefix=ocsOffCanvasSidebars.css_prefix,$sidebarElements=$("."+prefix+"-slidebar");$sidebarElements.each(function(){var $this=$(this),id=$this.data("ocs-sidebar-id"),css_id=prefix+"-"+id;ocsOffCanvasSidebars.setSidebarDefaultSettings(id);$document.on("touchend click","."+prefix+"-toggle-"+id,function(e){e.stopPropagation();e.preventDefault();if(true===ocsOffCanvasSidebars._touchmove){return}if(ocsOffCanvasSidebars._checkDisableOver(css_id)){controller.toggle(css_id)}});$document.on("touchend click","."+prefix+"-open-"+id,function(e){e.stopPropagation();e.preventDefault();if(true===ocsOffCanvasSidebars._touchmove){return}if(ocsOffCanvasSidebars._checkDisableOver(css_id)){controller.open(css_id)}});$document.on("touchend click","."+prefix+"-close-"+id,function(e){e.stopPropagation();e.preventDefault();if(true===ocsOffCanvasSidebars._touchmove){return}controller.close(css_id)})});$document.on("touchend click","."+prefix+"-close--all",function(e){if(ocsOffCanvasSidebars._getSetting("site_close",false)){e.preventDefault();e.stopPropagation();controller.close()}});$("a").not("."+prefix+"-trigger").on("touchend click",function(){if(true===ocsOffCanvasSidebars._touchmove){return}if(ocsOffCanvasSidebars._getSetting("link_close",false)){if(!$(this).parents("."+prefix+"-trigger").length){controller.close()}}});$(controller.events).on("opening",function(e,sidebar_id){$("[canvas]").addClass(prefix+"-close--all");$html.addClass("ocs-sidebar-active ocs-sidebar-active-"+sidebar_id);if(ocsOffCanvasSidebars._getSetting("scroll_lock",false)){$html.addClass("ocs-scroll-lock");if($html[0].scrollHeight>$html[0].clientHeight){var scrollTop=$html.scrollTop();$body.css({top:"-="+scrollTop});$html.data("ocs-scroll-fixed",scrollTop);$html.addClass("ocs-scroll-fixed")}}});$(controller.events).on("closing",function(e,sidebar_id){$("[canvas]").removeClass(prefix+"-close--all");var scrollTop=false;if($html.hasClass("ocs-scroll-fixed")){scrollTop=true}$html.removeClass("ocs-sidebar-active ocs-scroll-lock ocs-scroll-fixed ocs-sidebar-active-"+sidebar_id);if(scrollTop){scrollTop=parseInt($html.data("ocs-scroll-fixed"),10);$body.css({top:"+="+scrollTop});$html.removeAttr("ocs-scroll-fixed");$html.scrollTop(scrollTop);$window.trigger("resize")}});var disableOver=function(){var prefix=ocsOffCanvasSidebars.css_prefix;$sidebarElements.each(function(){var id=$(this).data("ocs-sidebar-id"),sidebar_id=prefix+"-"+id,control_classes="."+prefix+"-toggle-"+id+", ."+prefix+"-open-"+id,hide_control_classes=ocsOffCanvasSidebars._getSetting("hide_control_classes",sidebar_id);if(!ocsOffCanvasSidebars._checkDisableOver(sidebar_id)){if(controller.isActiveSlidebar(sidebar_id)){controller.close()}if(hide_control_classes){$(control_classes).hide()}}else if(hide_control_classes){$(control_classes).show()}})};disableOver();$window.on("resize",disableOver);$window.on("load resize",function(){ocsOffCanvasSidebars.container.css("min-height",$window.innerHeight()-parseInt($html.css("margin-top"),10))})};ocsOffCanvasSidebars.getFixedElements=function(){return $("#"+ocsOffCanvasSidebars.css_prefix+"-site *").filter(function(){return"fixed"===$(this).css("position")})};ocsOffCanvasSidebars.cssCompat=function(elem,prop,value){var data={};data["-webkit-"+prop]=value;data["-moz-"+prop]=value;data["-o-"+prop]=value;data[prop]=value;$(elem).css(data)};if($("#"+ocsOffCanvasSidebars.css_prefix+"-site").length&&"undefined"!==typeof slidebars){ocsOffCanvasSidebars.init()}})(jQuery); \ No newline at end of file +if("undefined"===typeof ocsOffCanvasSidebars){var ocsOffCanvasSidebars={site_close:true,link_close:true,disable_over:false,hide_control_classes:false,scroll_lock:false,legacy_css:false,css_prefix:"ocs",sidebars:{},_debug:false}}(function($){var $document=$(document),$window=$(window),$html=$("html"),$body=$("body");ocsOffCanvasSidebars.slidebarsController=false;ocsOffCanvasSidebars.useAttributeSettings=false;ocsOffCanvasSidebars.container=false;ocsOffCanvasSidebars._touchmove=false;ocsOffCanvasSidebars._toolbar=$body.hasClass("admin-bar");ocsOffCanvasSidebars.init=function(){ocsOffCanvasSidebars._checkDisableOver=function(sidebarId){var check=true;var disableOver=parseInt(ocsOffCanvasSidebars._getSetting("disable_over",sidebarId),10);if(disableOver&&!isNaN(disableOver)){if($window.width()>disableOver){check=false}}return check};ocsOffCanvasSidebars._getSetting=function(key,sidebarId){var overwrite,setting,prefix=ocsOffCanvasSidebars.css_prefix;if("undefined"!==typeof sidebarId){if(!sidebarId&&null!==sidebarId){sidebarId=ocsOffCanvasSidebars.slidebarsController.getActiveSlidebar()}}if(sidebarId){if(!$.isEmptyObject(ocsOffCanvasSidebars.sidebars)&&!ocsOffCanvasSidebars.useAttributeSettings){sidebarId=sidebarId.replace(prefix+"-","");if(ocsOffCanvasSidebars.sidebars[sidebarId].overwrite_global_settings){setting=ocsOffCanvasSidebars.sidebars[sidebarId][key];if(setting){return setting}else{return false}}}else{var sidebarElement=$("#"+sidebarId);overwrite=sidebarElement.attr("data-ocs-overwrite_global_settings");if(overwrite){setting=sidebarElement.attr("data-ocs-"+key);if("undefined"!==typeof setting){return setting}else{return false}}}}if(ocsOffCanvasSidebars.hasOwnProperty(key)&&!ocsOffCanvasSidebars.useAttributeSettings){return ocsOffCanvasSidebars[key]}else{setting=$("#"+prefix+"-site").attr("data-ocs-"+key);if("undefined"!==typeof setting){return setting}}return false};ocsOffCanvasSidebars._getTranslateAxis=function(obj,axis){obj=$(obj);var transformMatrix=obj.css("-webkit-transform")||obj.css("-moz-transform")||obj.css("-ms-transform")||obj.css("-o-transform")||obj.css("transform");if(transformMatrix){var matrix=transformMatrix.replace(/[^0-9\-.,]/g,"").split(",");var val=0;switch(axis){case"x":val=matrix[12]||matrix[4];break;case"y":val=matrix[13]||matrix[5];break;case"z":val=matrix[14]||matrix[6];break}return parseFloat(val)}else{return 0}};ocsOffCanvasSidebars.container=$("[canvas=container]");$window.trigger("ocs_before",this);ocsOffCanvasSidebars.slidebarsController=new slidebars;if(false===ocsOffCanvasSidebars.slidebarsController){return}if(ocsOffCanvasSidebars.legacy_css){ocsOffCanvasSidebars.slidebarsController.legacy=true;$html.addClass("ocs-legacy")}$window.trigger("ocs_loaded",this);ocsOffCanvasSidebars.slidebarsController.init();$html.addClass("ocs-initialized");$window.trigger("ocs_initialized",this);if(ocsOffCanvasSidebars._toolbar){$window.on("load",function(){var bodyOffset=$body.offset(),$sidebars=$("."+ocsOffCanvasSidebars.css_prefix+"-slidebar");$sidebars.each(function(){var $this=$(this);if(!$this.hasClass("ocs-location-bottom")){$this.css("margin-top","+="+bodyOffset.top)}});$(ocsOffCanvasSidebars.slidebarsController.events).on("css",function(){$sidebars.each(function(){var $this=$(this);if($this.hasClass("ocs-location-top")){$this.css("margin-top","+="+bodyOffset.top)}})})})}$(ocsOffCanvasSidebars.slidebarsController.events).on("opening opened closing closed",function(e,sidebar_id){var slidebar=ocsOffCanvasSidebars.slidebarsController.getSlidebar(sidebar_id);var duration=parseFloat(slidebar.element.css("transitionDuration"))*1e3;if("top"===slidebar.side||"bottom"===slidebar.side){var elements=ocsOffCanvasSidebars.getFixedElements();elements.attr({"canvas-fixed":"fixed"});if(ocsOffCanvasSidebars.legacy_css&&"top"===slidebar.side&&("overlay"!==slidebar.style&&"reveal"!==slidebar.style)){var offset;offset=parseInt(slidebar.element.css("margin-top").replace("px","").replace("-",""),10);if(ocsOffCanvasSidebars._toolbar){var bodyOffset=$body.offset();offset+=bodyOffset.top}elements.each(function(){var $this=$(this);if("opening"===e.type){ocsOffCanvasSidebars.cssCompat($this,"transition","top "+duration+"ms");$this.css("top",parseInt($this.css("top").replace("px",""),10)+offset+"px")}else if("closing"===e.type){$this.css("top",parseInt($this.css("top").replace("px",""),10)-offset+"px");setTimeout(function(){ocsOffCanvasSidebars.cssCompat($this,"transition","")},duration)}})}else{elements.each(function(){var $this=$(this);if("opening"===e.type||"closing"===e.type){ocsOffCanvasSidebars.cssCompat($this,"transition","transform "+duration+"ms")}else if("opened"===e.type||"closed"===e.type){ocsOffCanvasSidebars.cssCompat($this,"transition","")}})}$window.trigger("slidebar_event",[e.type,slidebar])}});$document.on("touchmove",function(){ocsOffCanvasSidebars._touchmove=true});$document.on("touchstart",function(){ocsOffCanvasSidebars._touchmove=false});if("function"===typeof ocsOffCanvasSidebars.setupTriggers){ocsOffCanvasSidebars.setupTriggers()}$window.trigger("ocs_after",this)};ocsOffCanvasSidebars.setSidebarDefaultSettings=function(sidebarId){if("undefined"===typeof ocsOffCanvasSidebars.sidebars[sidebarId]){ocsOffCanvasSidebars.sidebars[sidebarId]={overwrite_global_settings:false,site_close:ocsOffCanvasSidebars.site_close,disable_over:ocsOffCanvasSidebars.disable_over,hide_control_classes:ocsOffCanvasSidebars.hide_control_classes,scroll_lock:ocsOffCanvasSidebars.scroll_lock}}};ocsOffCanvasSidebars.setupTriggers=function(){var controller=ocsOffCanvasSidebars.slidebarsController,prefix=ocsOffCanvasSidebars.css_prefix,$sidebarElements=$("."+prefix+"-slidebar");$sidebarElements.each(function(){var $this=$(this),id=$this.data("ocs-sidebar-id"),css_id=prefix+"-"+id;ocsOffCanvasSidebars.setSidebarDefaultSettings(id);$document.on("touchend click","."+prefix+"-toggle-"+id,function(e){e.stopPropagation();e.preventDefault();if(true===ocsOffCanvasSidebars._touchmove){return}if(ocsOffCanvasSidebars._checkDisableOver(css_id)){controller.toggle(css_id)}});$document.on("touchend click","."+prefix+"-open-"+id,function(e){e.stopPropagation();e.preventDefault();if(true===ocsOffCanvasSidebars._touchmove){return}if(ocsOffCanvasSidebars._checkDisableOver(css_id)){controller.open(css_id)}});$document.on("touchend click","."+prefix+"-close-"+id,function(e){e.stopPropagation();e.preventDefault();if(true===ocsOffCanvasSidebars._touchmove){return}controller.close(css_id)})});$document.on("touchend click","."+prefix+"-close--all",function(e){if(ocsOffCanvasSidebars._getSetting("site_close",false)){e.preventDefault();e.stopPropagation();controller.close()}});$("a").not("."+prefix+"-trigger").on("touchend click",function(){if(true===ocsOffCanvasSidebars._touchmove){return}if(ocsOffCanvasSidebars._getSetting("link_close",false)){if(!$(this).parents("."+prefix+"-trigger").length){controller.close()}}});$(controller.events).on("opening",function(e,sidebar_id){$("[canvas]").addClass(prefix+"-close--all");$html.addClass("ocs-sidebar-active ocs-sidebar-active-"+sidebar_id);if(ocsOffCanvasSidebars._getSetting("scroll_lock",false)){$html.addClass("ocs-scroll-lock");if($html[0].scrollHeight>$html[0].clientHeight){var scrollTop=$html.scrollTop();$body.css({top:"-="+scrollTop});$html.data("ocs-scroll-fixed",scrollTop);$html.addClass("ocs-scroll-fixed")}}});$(controller.events).on("closing",function(e,sidebar_id){$("[canvas]").removeClass(prefix+"-close--all");var scrollTop=false;if($html.hasClass("ocs-scroll-fixed")){scrollTop=true}$html.removeClass("ocs-sidebar-active ocs-scroll-lock ocs-scroll-fixed ocs-sidebar-active-"+sidebar_id);if(scrollTop){scrollTop=parseInt($html.data("ocs-scroll-fixed"),10);$body.css({top:"+="+scrollTop});$html.removeAttr("ocs-scroll-fixed");$html.scrollTop(scrollTop);$window.trigger("resize")}});var disableOver=function(){var prefix=ocsOffCanvasSidebars.css_prefix;$sidebarElements.each(function(){var id=$(this).data("ocs-sidebar-id"),sidebar_id=prefix+"-"+id,control_classes="."+prefix+"-toggle-"+id+", ."+prefix+"-open-"+id,hide_control_classes=ocsOffCanvasSidebars._getSetting("hide_control_classes",sidebar_id);if(!ocsOffCanvasSidebars._checkDisableOver(sidebar_id)){if(controller.isActiveSlidebar(sidebar_id)){controller.close()}if(hide_control_classes){$(control_classes).hide()}}else if(hide_control_classes){$(control_classes).show()}})};disableOver();$window.on("resize",disableOver)};ocsOffCanvasSidebars.getFixedElements=function(){return $("#"+ocsOffCanvasSidebars.css_prefix+"-site *").filter(function(){return"fixed"===$(this).css("position")})};ocsOffCanvasSidebars.cssCompat=function(elem,prop,value){var data={};data["-webkit-"+prop]=value;data["-moz-"+prop]=value;data["-o-"+prop]=value;data[prop]=value;$(elem).css(data)};if($("#"+ocsOffCanvasSidebars.css_prefix+"-site").length&&"undefined"!==typeof slidebars){ocsOffCanvasSidebars.init()}})(jQuery); \ No newline at end of file From 7ea04f88e62bae923b5c3473b75459b877946a42 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Thu, 4 Apr 2019 16:24:55 +0200 Subject: [PATCH 02/18] Composer keywords --- composer.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 881daf4..69d9e0b 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,13 @@ "name": "JoryHogeveen/off-canvas-sidebars", "type": "wordpress-plugin", "description": "Add off-canvas sidebars using the Slidebars jQuery plugin", - "keywords": [], + "keywords": [ + "wordpress", + "off-canvas-sidebars", + "canvas", + "mobile menu", + "slidebars" + ], "homepage": "https://github.com/JoryHogeveen/off-canvas-sidebars/", "license": "GPL-2.0+", "authors": [ From e37f810cb8a61f34bff24f3cde8b4453402d98a9 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Thu, 4 Apr 2019 16:25:06 +0200 Subject: [PATCH 03/18] Typo --- slidebars/slidebars.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slidebars/slidebars.js b/slidebars/slidebars.js index e1acb18..0ee1ad9 100644 --- a/slidebars/slidebars.js +++ b/slidebars/slidebars.js @@ -14,7 +14,7 @@ * @author Jory Hogeveen * * @since 0.4 Add scope for this reference + Add legacy CSS support (no hardware acceleration) - * @since 0.4.2 Parse slidebar widths/heights are rounded pixels (like jQuery does) to prevent 1px differences + * @since 0.4.2 Parse slidebar widths/heights to rounded pixels (like jQuery does) to prevent 1px differences * @version 0.4.2 * @global slidebars * @preserve From 37d568c45137c0c47e1d920d6c848b0bf6a52c35 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Thu, 4 Apr 2019 16:26:21 +0200 Subject: [PATCH 04/18] Codestyle & version dev tag --- includes/class-frontend.php | 33 +++--- includes/class-tab-sidebars.php | 10 +- js/off-canvas-sidebars-settings.js | 159 +++++++++++++++-------------- js/off-canvas-sidebars.js | 81 ++++++++------- off-canvas-sidebars.php | 8 +- 5 files changed, 151 insertions(+), 140 deletions(-) diff --git a/includes/class-frontend.php b/includes/class-frontend.php index a681ece..13d7b6d 100644 --- a/includes/class-frontend.php +++ b/includes/class-frontend.php @@ -248,7 +248,7 @@ public function do_sidebar( $sidebar_id ) { /** * Filter nav menu args. * - * Please note that the theme_location property will be overwritten! + * Please note that the `theme_location` and `echo` properties will be overwritten! * * @since 0.3.0 * @@ -261,7 +261,7 @@ public function do_sidebar( $sidebar_id ) { */ apply_filters( 'ocs_wp_nav_menu_args', $args, $sidebar_id, $sidebar_data ); - // Force the set theme location. + // Force the theme location. $args['theme_location'] = 'off-canvas-' . $sidebar_id; // Force echo. $args['echo'] = true; @@ -443,7 +443,7 @@ public function do_control_trigger( $sidebar_id, $args = array() ) { public function add_styles_scripts() { // @todo Validate and use minified files - $suffix = '';//defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; + $suffix = '';//defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; $version = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? time() : OCS_PLUGIN_VERSION; // FastClick library https://github.com/ftlabs/fastclick @@ -467,17 +467,22 @@ public function add_styles_scripts() { $sidebars[ $sidebar_id ] = $sidebar_data; } } - wp_localize_script( 'off-canvas-sidebars', 'ocsOffCanvasSidebars', array( - 'site_close' => (bool) $this->get_settings( 'site_close' ), - 'link_close' => (bool) $this->get_settings( 'link_close' ), - 'disable_over' => (int) $this->get_settings( 'disable_over' ), - 'hide_control_classes' => (bool) $this->get_settings( 'hide_control_classes' ), - 'scroll_lock' => (bool) $this->get_settings( 'scroll_lock' ), - 'legacy_css' => (bool) ( 'legacy-css' === $this->get_settings( 'compatibility_position_fixed' ) ), - 'css_prefix' => $this->get_settings( 'css_prefix' ), - 'sidebars' => $sidebars, - '_debug' => (bool) ( defined( 'WP_DEBUG' ) && WP_DEBUG ), - ) ); + wp_localize_script( + 'off-canvas-sidebars', + 'ocsOffCanvasSidebars', + array( + 'site_close' => (bool) $this->get_settings( 'site_close' ), + 'link_close' => (bool) $this->get_settings( 'link_close' ), + 'disable_over' => (int) $this->get_settings( 'disable_over' ), + 'hide_control_classes' => (bool) $this->get_settings( 'hide_control_classes' ), + 'scroll_lock' => (bool) $this->get_settings( 'scroll_lock' ), + 'legacy_css' => (bool) ( 'legacy-css' === $this->get_settings( 'compatibility_position_fixed' ) ), + 'fixed_elements' => $this->get_settings( 'fixed_elements' ), + 'css_prefix' => $this->get_settings( 'css_prefix' ), + 'sidebars' => $sidebars, + '_debug' => (bool) ( defined( 'WP_DEBUG' ) && WP_DEBUG ), + ) + ); } /** diff --git a/includes/class-tab-sidebars.php b/includes/class-tab-sidebars.php index f3b7f80..54deefd 100644 --- a/includes/class-tab-sidebars.php +++ b/includes/class-tab-sidebars.php @@ -465,11 +465,11 @@ protected function get_tab_fields() { ), // @fixme See above. This only makes sure the fields gets recognized. 'size_input_type' => array( - 'name' => 'size_input_type', - 'hidden' => true, - 'default' => '%', - 'type' => 'radio', - 'options' => array( + 'name' => 'size_input_type', + 'hidden' => true, + 'default' => '%', + 'type' => 'radio', + 'options' => array( 'px' => array( 'name' => 'px', 'label' => 'px', diff --git a/js/off-canvas-sidebars-settings.js b/js/off-canvas-sidebars-settings.js index c25cca4..4dbef11 100644 --- a/js/off-canvas-sidebars-settings.js +++ b/js/off-canvas-sidebars-settings.js @@ -25,20 +25,21 @@ if ( 'undefined' === typeof ocsOffCanvasSidebarsSettings ) { var $document = $(document); ocsOffCanvasSidebarsSettings.init = function() { - var tab = $('#ocs_tab'); - var postbox = $('.postbox'); + var $tab = $( '#ocs_tab' ); + var $postbox = $( '.postbox' ); // Close postboxes that should be closed. - $('.if-js-closed').removeClass('if-js-closed').addClass('closed'); + $( '.if-js-closed' ).removeClass( 'if-js-closed' ).addClass( 'closed' ); // Postboxes setup. postboxes.add_postbox_toggles( ocsOffCanvasSidebarsSettings.plugin_key ); - - if ( 'ocs-sidebars' === tab.val() ) { - postbox.each( function() { - var prefix = 'off_canvas_sidebars_options_sidebars_', - sidebar_id = $(this).attr('id').replace('section_sidebar_', ''), - sidebar_prefix = prefix + sidebar_id; + if ( 'ocs-sidebars' === $tab.val() ) { + $postbox.each( function() { + var $this = $( this ), + prefix = 'off_canvas_sidebars_options_sidebars_', + sidebar_id = $this.attr( 'id' ).replace( 'section_sidebar_', '' ), + sidebar_prefix = prefix + sidebar_id, + global_settings_trigger = '.' + sidebar_prefix + '_overwrite_global_settings'; ocs_show_hide_options_radio( '.' + sidebar_prefix + '_background_color_type', @@ -53,11 +54,11 @@ if ( 'undefined' === typeof ocsOffCanvasSidebarsSettings ) { 'label' ); - ocs_show_hide_options( '.' + sidebar_prefix + '_overwrite_global_settings', '.' + sidebar_prefix + '_site_close', 'tr' ); - ocs_show_hide_options( '.' + sidebar_prefix + '_overwrite_global_settings', '.' + sidebar_prefix + '_link_close', 'tr' ); - ocs_show_hide_options( '.' + sidebar_prefix + '_overwrite_global_settings', '.' + sidebar_prefix + '_disable_over', 'tr' ); - ocs_show_hide_options( '.' + sidebar_prefix + '_overwrite_global_settings', '.' + sidebar_prefix + '_hide_control_classes', 'tr' ); - ocs_show_hide_options( '.' + sidebar_prefix + '_overwrite_global_settings', '.' + sidebar_prefix + '_scroll_lock', 'tr' ); + ocs_show_hide_options( global_settings_trigger, '.' + sidebar_prefix + '_site_close', 'tr' ); + ocs_show_hide_options( global_settings_trigger, '.' + sidebar_prefix + '_link_close', 'tr' ); + ocs_show_hide_options( global_settings_trigger, '.' + sidebar_prefix + '_disable_over', 'tr' ); + ocs_show_hide_options( global_settings_trigger, '.' + sidebar_prefix + '_hide_control_classes', 'tr' ); + ocs_show_hide_options( global_settings_trigger, '.' + sidebar_prefix + '_scroll_lock', 'tr' ); } ); } else { ocs_show_hide_options_radio( @@ -80,14 +81,14 @@ if ( 'undefined' === typeof ocsOffCanvasSidebarsSettings ) { if ( parent ) { target = $( target ).closest( parent ); } - if ( ! $( trigger ).is(':checked') ) { - $( target ).slideUp('fast'); + if ( ! $( trigger ).is( ':checked' ) ) { + $( target ).slideUp( 'fast' ); } - $( trigger ).change( function() { - if ( $(this).is(':checked') ) { - $( target ).slideDown('fast'); + $( trigger ).on( 'change', function() { + if ( $( this ).is( ':checked' ) ) { + $( target ).slideDown( 'fast' ); } else { - $( target ).slideUp('fast'); + $( target ).slideUp( 'fast' ); } } ); } @@ -106,28 +107,28 @@ if ( 'undefined' === typeof ocsOffCanvasSidebarsSettings ) { } if ( parent ) { parent += ', ' + parent + ' + br'; - target = $( target ).closest( parent ); + target = $( target ).closest( parent ); } $( trigger ).change( function() { if ( 0 <= $.inArray( $( trigger + ':checked' ).val(), compare ) ) { - $( target ).slideDown('fast'); + $( target ).slideDown( 'fast' ); } else { - $( target ).slideUp('fast'); + $( target ).slideUp( 'fast' ); } } ).trigger( 'change' ); } // Enable the WP Color Picker. - $('input.color-picker').wpColorPicker(); + $( 'input.color-picker' ).wpColorPicker(); // Validate required fields. - $('input.required').each( function() { - var $this = $(this); + $( 'input.required' ).each( function() { + var $this = $( this ); $this.on( 'change', function() { if ( ! $this.val() ) { - $this.parents('tr').addClass('form-invalid'); + $this.parents( 'tr' ).addClass( 'form-invalid' ); } else { - $this.parents('tr').removeClass('form-invalid'); + $this.parents( 'tr' ).removeClass( 'form-invalid' ); } } ); } ); @@ -137,8 +138,9 @@ if ( 'undefined' === typeof ocsOffCanvasSidebarsSettings ) { var valid = true; //var errors = {}; $( 'input.required', this ).each( function() { - if ( ! $(this).val() ) { - $(this).trigger('change'); + var $this = $( this ); + if ( ! $this.val() ) { + $this.trigger( 'change' ); valid = false; } } ); @@ -148,83 +150,84 @@ if ( 'undefined' === typeof ocsOffCanvasSidebarsSettings ) { } } ); - if ( 'ocs-sidebars' === tab.val() ) { + if ( 'ocs-sidebars' === $tab.val() ) { // Half opacity for closed disabled sidebars. // @todo Use classes instead of CSS. - postbox.each( function() { - var sidebar = this, - $sidebar = $( sidebar ), + $postbox.each( function() { + var sidebar = this, + $sidebar = $( sidebar ), $dynamic_id = $( '.js-dynamic-id', sidebar ); // Dynamic sidebar ID. if ( $dynamic_id.length ) { var $dynamic_id_input = $( 'input.off_canvas_sidebars_options_sidebars_id', sidebar ); $dynamic_id.text( $dynamic_id_input.val() ); - $('.sidebar_classes').show(); - $dynamic_id_input.on('keyup', function() { - $dynamic_id.text( $(this).val() ); + $( '.sidebar_classes' ).show(); + $dynamic_id_input.on( 'keyup', function() { + $dynamic_id.text( $( this ).val() ); } ); } - $sidebar.css({'border-left':'5px solid #eee'}); - if ( ! $( 'input.off_canvas_sidebars_options_sidebars_enable', sidebar ).is(':checked') ) { - if ( $sidebar.hasClass('closed') ) { - $sidebar.css('opacity', '0.75'); + $sidebar.css( { 'border-left': '5px solid #eee' } ); + if ( ! $( 'input.off_canvas_sidebars_options_sidebars_enable', sidebar ).is( ':checked' ) ) { + if ( $sidebar.hasClass( 'closed' ) ) { + $sidebar.css( 'opacity', '0.75' ); } - $sidebar.css('border-left-color','#ffb900'); + $sidebar.css( 'border-left-color', '#ffb900' ); } else { - $sidebar.css('border-left-color','#46b450'); + $sidebar.css( 'border-left-color', '#46b450' ); } $( 'input.off_canvas_sidebars_options_sidebars_enable', sidebar ).on( 'change', function() { - if ( ! $(this).is(':checked') ) { - $sidebar.css('border-left-color','#ffb900'); - if ( $sidebar.hasClass('closed') ) { - $sidebar.css('opacity', '0.75'); + if ( ! $( this ).is( ':checked' ) ) { + $sidebar.css( 'border-left-color','#ffb900' ); + if ( $sidebar.hasClass( 'closed' ) ) { + $sidebar.css( 'opacity', '0.75' ); } else { - $sidebar.css('opacity', ''); + $sidebar.css( 'opacity', '' ); } } else { - $sidebar.css('border-left-color','#46b450'); - $sidebar.css('opacity', ''); + $sidebar.css( 'border-left-color','#46b450' ); + $sidebar.css( 'opacity', '' ); } } ); - $sidebar.on('click', function() { - if ( ! $( 'input.off_canvas_sidebars_options_sidebars_enable', sidebar ).is(':checked') && $sidebar.hasClass('closed') ) { - $sidebar.css('opacity', '0.75'); + $sidebar.on( 'click', function() { + if ( ! $( 'input.off_canvas_sidebars_options_sidebars_enable', sidebar ).is( ':checked' ) && $sidebar.hasClass( 'closed' ) ) { + $sidebar.css( 'opacity', '0.75' ); } else { - $sidebar.css('opacity', ''); + $sidebar.css( 'opacity', '' ); } } ); } ); // Hide options when set to delete. $document.on( 'change', '.off_canvas_sidebars_options_sidebars_delete', function() { - var $this = $(this), - sidebar = $this.parents('.postbox'), + var $this = $(this), + sidebar = $this.parents('.postbox'), $sidebar = $( sidebar ); - if ( $this.is(':checked') ) { - var parent_row = $this.parents('tr'); + if ( $this.is( ':checked' ) ) { + var parent_row = $this.parents( 'tr' ); $( 'tr', sidebar ).hide( 'fast', function() { $( 'tr', sidebar ).each(function(){ - if ( $(this).is( parent_row ) ) { - $(this).show( 'fast' ); + var $this = $( this ); + if ( $this.is( parent_row ) ) { + $this.show( 'fast' ); } }); } ); - $sidebar.css('opacity', '0.5'); - $sidebar.css('border-left-color','#dc3232'); + $sidebar.css( 'opacity', '0.5' ); + $sidebar.css( 'border-left-color', '#dc3232' ); } else { - $sidebar.css('opacity', ''); + $sidebar.css( 'opacity', '' ); $( 'tr', sidebar ).show( 'fast' ); - $('input.off_canvas_sidebars_options_sidebars_enable', sidebar).trigger('change'); + $( 'input.off_canvas_sidebars_options_sidebars_enable', sidebar ).trigger( 'change' ); } } ); } - if ( 'ocs-shortcode' === tab.val() ) { + if ( 'ocs-shortcode' === $tab.val() ) { var fields = [ 'id', 'text', 'icon', 'icon_location', 'action', 'element', 'class', 'attr', 'nested' ]; @@ -256,7 +259,7 @@ if ( 'undefined' === typeof ocsOffCanvasSidebarsSettings ) { for ( var field in field_data ) { if ( 'undefined' !== typeof field_data[ field ] ) { if ( 'text' !== field && 'nested' !== field ) { - if ( field_data[ field ].is(':checked') ) { + if ( field_data[ field ].is( ':checked' ) ) { shortcode_str += ' ' + field + '="1"'; } else if ( field_data[ field ].val().length ) { shortcode_str += ' ' + field + '="' + field_data[ field ].val().replace( /(\r\n|\n|\r)/gm, '' ) + '"'; @@ -271,7 +274,7 @@ if ( 'undefined' === typeof ocsOffCanvasSidebarsSettings ) { } // Add panel text. - if ( field_data.nested.is(':checked') ) { + if ( field_data.nested.is( ':checked' ) ) { shortcode_str += ']' + field_data.text.val() + '[/' + shortcode + ']'; } else { if ( field_data.text.val().length ) { @@ -280,7 +283,7 @@ if ( 'undefined' === typeof ocsOffCanvasSidebarsSettings ) { shortcode_str += ']'; } - $('textarea#ocs_shortcode').val( shortcode_str ); + $( 'textarea#ocs_shortcode' ).val( shortcode_str ); create_shortcode_preview( field_data ); } @@ -294,14 +297,14 @@ if ( 'undefined' === typeof ocsOffCanvasSidebarsSettings ) { */ function create_shortcode_preview( field_data ) { - var element = ( field_data.element.val() ) ? field_data.element.val() : 'button', + var element = ( field_data.element.val() ) ? field_data.element.val() : 'button', attributes = ( field_data.attr.val() ) ? attrStringToObject( field_data.attr.val() ) : {}, - prefix = ocsOffCanvasSidebarsSettings.css_prefix, - action = ( field_data.action.val() ) ? field_data.action.val() : 'toggle', - classes = prefix + '-trigger ' + prefix + '-' + action, - text = field_data.text.val(), - icon = field_data.icon.val(), - html = ''; + prefix = ocsOffCanvasSidebarsSettings.css_prefix, + action = ( field_data.action.val() ) ? field_data.action.val() : 'toggle', + classes = prefix + '-trigger ' + prefix + '-' + action, + text = field_data.text.val(), + icon = field_data.icon.val(), + html = ''; if ( field_data.id.val() ) { classes += ' ' + prefix + '-' + action + '-' + field_data.id.val(); @@ -355,7 +358,7 @@ if ( 'undefined' === typeof ocsOffCanvasSidebarsSettings ) { * @return {object} The attribute object. */ function attrHTMLToObject( attrString ) { - var arr = attrString.trim().split( '" ' ), + var arr = attrString.trim().split( '" ' ), atts = {}; for ( var key in arr ) { if ( arr.hasOwnProperty( key ) ) { @@ -379,7 +382,7 @@ if ( 'undefined' === typeof ocsOffCanvasSidebarsSettings ) { * @return {object} The attribute object. */ function attrStringToObject( attrString ) { - var arr = attrString.split( ';' ), + var arr = attrString.split( ';' ), atts = {}; for ( var key in arr ) { if ( arr.hasOwnProperty( key ) ) { @@ -443,7 +446,7 @@ if ( 'undefined' === typeof ocsOffCanvasSidebarsSettings ) { */ function getAttr( s, a, f ) { var n = new RegExp( a + '=\"([^\"]+)\"', 'g' ).exec( s ); - if ( true === f && !n && -1 === s.indexOf( a + '="' ) ) { + if ( true === f && ! n && -1 === s.indexOf( a + '="' ) ) { // Attribute does not exist return false; } diff --git a/js/off-canvas-sidebars.js b/js/off-canvas-sidebars.js index a3395da..886e872 100644 --- a/js/off-canvas-sidebars.js +++ b/js/off-canvas-sidebars.js @@ -27,16 +27,16 @@ if ( 'undefined' === typeof ocsOffCanvasSidebars ) { ( function( $ ) { - var $document = $(document), - $window = $(window), - $html = $('html'), - $body = $('body'); + var $document = $( document ), + $window = $( window ), + $html = $( 'html' ), + $body = $( 'body' ); - ocsOffCanvasSidebars.slidebarsController = false; + ocsOffCanvasSidebars.slidebarsController = false; ocsOffCanvasSidebars.useAttributeSettings = false; - ocsOffCanvasSidebars.container = false; - ocsOffCanvasSidebars._touchmove = false; - ocsOffCanvasSidebars._toolbar = $body.hasClass('admin-bar'); + ocsOffCanvasSidebars.container = false; + ocsOffCanvasSidebars._touchmove = false; + ocsOffCanvasSidebars._toolbar = $body.hasClass( 'admin-bar' ); ocsOffCanvasSidebars.init = function() { @@ -48,8 +48,8 @@ if ( 'undefined' === typeof ocsOffCanvasSidebars ) { * @return {boolean} disableOver status. */ ocsOffCanvasSidebars._checkDisableOver = function( sidebarId ) { - var check = true; - var disableOver = parseInt( ocsOffCanvasSidebars._getSetting( 'disable_over', sidebarId ), 10 ); + var check = true, + disableOver = parseInt( ocsOffCanvasSidebars._getSetting( 'disable_over', sidebarId ), 10 ); if ( disableOver && ! isNaN( disableOver ) ) { if ( $window.width() > disableOver ) { check = false; @@ -96,6 +96,7 @@ if ( 'undefined' === typeof ocsOffCanvasSidebars ) { // Fallback/Overwrite to enable sidebar settings from available attributes. } else { var sidebarElement = $( '#' + sidebarId ); + overwrite = sidebarElement.attr( 'data-ocs-overwrite_global_settings' ); if ( overwrite ) { setting = sidebarElement.attr( 'data-ocs-' + key ); @@ -130,14 +131,15 @@ if ( 'undefined' === typeof ocsOffCanvasSidebars ) { */ ocsOffCanvasSidebars._getTranslateAxis = function( obj, axis ) { obj = $( obj ); - var transformMatrix = obj.css("-webkit-transform") || - obj.css("-moz-transform") || - obj.css("-ms-transform") || - obj.css("-o-transform") || - obj.css("transform"); + + var transformMatrix = obj.css( "-webkit-transform" ) + || obj.css( "-moz-transform" ) + || obj.css( "-ms-transform" ) + || obj.css( "-o-transform" ) + || obj.css( "transform" ); if ( transformMatrix ) { - var matrix = transformMatrix.replace(/[^0-9\-.,]/g, '').split(','); - var val = 0; + var matrix = transformMatrix.replace( /[^0-9\-.,]/g, '' ).split( ',' ), + val = 0; switch ( axis ) { case 'x': val = matrix[12] || matrix[4]; //translate x. @@ -169,7 +171,7 @@ if ( 'undefined' === typeof ocsOffCanvasSidebars ) { // Legacy CSS mode? if ( ocsOffCanvasSidebars.legacy_css ) { ocsOffCanvasSidebars.slidebarsController.legacy = true; - $html.addClass('ocs-legacy'); + $html.addClass( 'ocs-legacy' ); } $window.trigger( 'ocs_loaded', this ); @@ -177,7 +179,7 @@ if ( 'undefined' === typeof ocsOffCanvasSidebars ) { // Initialize slidebars. ocsOffCanvasSidebars.slidebarsController.init(); - $html.addClass('ocs-initialized'); + $html.addClass( 'ocs-initialized' ); $window.trigger( 'ocs_initialized', this ); @@ -192,7 +194,7 @@ if ( 'undefined' === typeof ocsOffCanvasSidebars ) { $sidebars = $( '.' + ocsOffCanvasSidebars.css_prefix + '-slidebar' ); $sidebars.each( function() { - var $this = $(this); + var $this = $( this ); // Apply top offset on load. Not for bottom sidebars. if ( ! $this.hasClass( 'ocs-location-bottom' ) ) { $this.css( 'margin-top', '+=' + bodyOffset.top ); @@ -202,7 +204,7 @@ if ( 'undefined' === typeof ocsOffCanvasSidebars ) { // css event is triggers after resize. $( ocsOffCanvasSidebars.slidebarsController.events ).on( 'css', function() { $sidebars.each( function() { - var $this = $(this); + var $this = $( this ); // Apply top offset on css reset. Only for top sidebars. if ( $this.hasClass( 'ocs-location-top' ) ) { $this.css( 'margin-top', '+=' + bodyOffset.top ); @@ -237,20 +239,19 @@ if ( 'undefined' === typeof ocsOffCanvasSidebars ) { //Compatibility with WP Admin Bar. // @todo, condition for setting if ( ocsOffCanvasSidebars._toolbar ) { - var bodyOffset = $body.offset(); - offset += bodyOffset.top; + offset += $body.offset().top; } elements.each( function() { - var $this = $(this); + var $this = $( this ); // Set animation. if ( 'opening' === e.type ) { ocsOffCanvasSidebars.cssCompat( $this, 'transition', 'top ' + duration + 'ms' ); - $this.css( 'top', parseInt( $this.css('top').replace('px', ''), 10 ) + offset + 'px' ); + $this.css( 'top', parseInt( $this.css( 'top' ).replace( 'px', '' ), 10 ) + offset + 'px' ); } // Remove animation. else if ( 'closing' === e.type ) { - $this.css( 'top', parseInt( $this.css('top').replace('px', ''), 10 ) - offset + 'px' ); + $this.css( 'top', parseInt( $this.css( 'top' ).replace( 'px', '' ), 10 ) - offset + 'px' ); setTimeout( function() { ocsOffCanvasSidebars.cssCompat( $this, 'transition', '' ); }, duration ); @@ -260,12 +261,12 @@ if ( 'undefined' === typeof ocsOffCanvasSidebars ) { // Normal mode (only sets a transition for use in fixed-scrolltop.js). else { elements.each( function() { - var $this = $(this); + var $this = $( this ); //var curVal = ocsOffCanvasSidebars._getTranslateAxis( this, 'y' ); //console.log( curVal ); if ( 'opening' === e.type || 'closing' === e.type ) { ocsOffCanvasSidebars.cssCompat( $this, 'transition', 'transform ' + duration + 'ms' ); - //$(this).css('transform', 'translate( 0px, ' + curVal + slidebar.element.height() + 'px )' ); + //$( this ).css('transform', 'translate( 0px, ' + curVal + slidebar.element.height() + 'px )' ); } else if ( 'opened' === e.type || 'closed' === e.type ) { ocsOffCanvasSidebars.cssCompat( $this, 'transition', '' ); } @@ -316,8 +317,8 @@ if ( 'undefined' === typeof ocsOffCanvasSidebars ) { * @return {null} Nothing. */ ocsOffCanvasSidebars.setupTriggers = function() { - var controller = ocsOffCanvasSidebars.slidebarsController, - prefix = ocsOffCanvasSidebars.css_prefix, + var controller = ocsOffCanvasSidebars.slidebarsController, + prefix = ocsOffCanvasSidebars.css_prefix, $sidebarElements = $( '.' + prefix + '-slidebar' ); $sidebarElements.each( function() { @@ -428,7 +429,7 @@ if ( 'undefined' === typeof ocsOffCanvasSidebars ) { // Add close class to canvas container when Slidebar is opened. $( controller.events ).on( 'opening', function ( e, sidebar_id ) { $( '[canvas]' ).addClass( prefix + '-close--all' ); - $html.addClass( 'ocs-sidebar-active ocs-sidebar-active-' + sidebar_id ); + $html.addClass( 'ocs-sidebar-active ocs-sidebar-active-' + sidebar_id ); if ( ocsOffCanvasSidebars._getSetting( 'scroll_lock', false ) ) { $html.addClass( 'ocs-scroll-lock' ); if ( $html[0].scrollHeight > $html[0].clientHeight ) { @@ -464,9 +465,9 @@ if ( 'undefined' === typeof ocsOffCanvasSidebars ) { var disableOver = function() { var prefix = ocsOffCanvasSidebars.css_prefix; $sidebarElements.each( function() { - var id = $( this ).data( 'ocs-sidebar-id' ), - sidebar_id = prefix + '-' + id, - control_classes = '.' + prefix + '-toggle-' + id + ', .' + prefix + '-open-' + id, // @todo Close classes? + var id = $( this ).data( 'ocs-sidebar-id' ), + sidebar_id = prefix + '-' + id, + control_classes = '.' + prefix + '-toggle-' + id + ', .' + prefix + '-open-' + id, // @todo Close classes? hide_control_classes = ocsOffCanvasSidebars._getSetting( 'hide_control_classes', sidebar_id ); if ( ! ocsOffCanvasSidebars._checkDisableOver( sidebar_id ) ) { @@ -494,8 +495,8 @@ if ( 'undefined' === typeof ocsOffCanvasSidebars ) { * @return {object} A jQuery selection of fixed elements. */ ocsOffCanvasSidebars.getFixedElements = function() { - return $('#' + ocsOffCanvasSidebars.css_prefix + '-site *').filter( function() { - return ( 'fixed' === $(this).css('position') ); + return $( '#' + ocsOffCanvasSidebars.css_prefix + '-site *' ).filter( function() { + return ( 'fixed' === $( this ).css( 'position' ) ); } ); }; @@ -509,10 +510,12 @@ if ( 'undefined' === typeof ocsOffCanvasSidebars ) { */ ocsOffCanvasSidebars.cssCompat = function( elem, prop, value ) { var data = {}; + data[ '-webkit-' + prop ] = value; - data[ '-moz-' + prop ] = value; - data[ '-o-' + prop ] = value; - data[ prop ] = value; + data[ '-moz-' + prop ] = value; + data[ '-o-' + prop ] = value; + data[ prop ] = value; + $( elem ).css( data ); }; diff --git a/off-canvas-sidebars.php b/off-canvas-sidebars.php index fef09d1..6066152 100644 --- a/off-canvas-sidebars.php +++ b/off-canvas-sidebars.php @@ -3,7 +3,7 @@ * @author Jory Hogeveen * @package Off_Canvas_Sidebars * @since 0.1.0 - * @version 0.5.3 + * @version 0.5.4-dev * @licence GPL-2.0+ * @link https://github.com/JoryHogeveen/off-canvas-sidebars * @@ -11,7 +11,7 @@ * Plugin Name: Off-Canvas Sidebars & Menus (Slidebars) * Description: Add off-canvas sidebars using the Slidebars jQuery plugin * Plugin URI: https://wordpress.org/plugins/off-canvas-sidebars/ - * Version: 0.5.3 + * Version: 0.5.4-dev * Author: Jory Hogeveen * Author URI: http://www.keraweb.nl * Text Domain: off-canvas-sidebars @@ -20,7 +20,7 @@ * License URI: http://www.gnu.org/licenses/gpl-2.0.html * GitHub Plugin URI: https://github.com/JoryHogeveen/off-canvas-sidebars * - * @copyright 2015-2018 Jory Hogeveen + * @copyright 2015-2019 Jory Hogeveen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ if ( ! class_exists( 'OCS_Off_Canvas_Sidebars' ) && ! function_exists( 'off_canvas_sidebars' ) ) { - define( 'OCS_PLUGIN_VERSION', '0.5.3' ); + define( 'OCS_PLUGIN_VERSION', '0.5.4-dev' ); define( 'OCS_DOMAIN', 'off-canvas-sidebars' ); define( 'OCS_FILE', __FILE__ ); define( 'OCS_BASENAME', plugin_basename( OCS_FILE ) ); From 53ae507a79526b8ec03b5067c4dd8988f31dcf2d Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Thu, 4 Apr 2019 16:26:37 +0200 Subject: [PATCH 05/18] Wrong usage of apply_filters() --- includes/class-frontend.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-frontend.php b/includes/class-frontend.php index 13d7b6d..1107c0f 100644 --- a/includes/class-frontend.php +++ b/includes/class-frontend.php @@ -259,7 +259,7 @@ public function do_sidebar( $sidebar_id ) { * @param string $sidebar_id The ID of this sidebar as configured in: Appearance > Off-Canvas Sidebars > Sidebars. * @param array $sidebar_data The sidebar settings. */ - apply_filters( 'ocs_wp_nav_menu_args', $args, $sidebar_id, $sidebar_data ); + $args = apply_filters( 'ocs_wp_nav_menu_args', $args, $sidebar_id, $sidebar_data ); // Force the theme location. $args['theme_location'] = 'off-canvas-' . $sidebar_id; From c8fc377770c52ea96ffe82453167b5e8d2558279 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Thu, 4 Apr 2019 16:26:46 +0200 Subject: [PATCH 06/18] Only add ocs classes if prefix is different --- includes/class-frontend.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/class-frontend.php b/includes/class-frontend.php index 1107c0f..dd63257 100644 --- a/includes/class-frontend.php +++ b/includes/class-frontend.php @@ -379,8 +379,10 @@ public function get_sidebar_attributes( $sidebar_id, $data ) { $atts['class'] = array(); $atts['class'][] = $prefix . '-slidebar'; $atts['class'][] = $prefix . '-' . $sidebar_id; - $atts['class'][] = 'ocs-slidebar'; - $atts['class'][] = 'ocs-' . $sidebar_id; + if ( 'ocs' !== $prefix ) { + $atts['class'][] = 'ocs-slidebar'; + $atts['class'][] = 'ocs-' . $sidebar_id; + } $atts['class'][] = 'ocs-size-' . $data['size']; $atts['class'][] = 'ocs-location-' . $data['location']; $atts['class'][] = 'ocs-style-' . $data['style']; From 36e9aa442f3bb016234185573ce8d95298a80e02 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Thu, 4 Apr 2019 16:27:05 +0200 Subject: [PATCH 07/18] Fix minor admin UI issues --- css/off-canvas-sidebars-admin.css | 1 + includes/class-tab-shortcode.php | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/css/off-canvas-sidebars-admin.css b/css/off-canvas-sidebars-admin.css index 99ec892..b49e1ae 100644 --- a/css/off-canvas-sidebars-admin.css +++ b/css/off-canvas-sidebars-admin.css @@ -16,6 +16,7 @@ box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05); } +.ocs-credits .inside { padding: 0; margin: 0; } .ocs-credits .inner { padding-left: 10px; padding-right: 10px; } .ocs-credits h3 { font-size: 14px; line-height: 1.4; margin: 0; padding: 8px 12px; border-bottom: 1px solid #eee; } diff --git a/includes/class-tab-shortcode.php b/includes/class-tab-shortcode.php index a06c772..fe4d9af 100644 --- a/includes/class-tab-shortcode.php +++ b/includes/class-tab-shortcode.php @@ -72,14 +72,14 @@ public function register_settings() { public function tab_content() { ?> -
+

:

'; + echo '
'; echo '

' . esc_html__( 'Basic options', OCS_DOMAIN ) . ':

'; @@ -90,7 +90,7 @@ public function tab_content() { echo '
'; - echo '
'; + echo '
'; echo '

' . esc_html__( 'Advanced options', OCS_DOMAIN ) . ':

'; @@ -110,7 +110,7 @@ public function tab_content() { echo '
'; ?> -
+

:

From b9b739d669e0669502efc16552bed7115770147d Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Thu, 4 Apr 2019 16:27:29 +0200 Subject: [PATCH 08/18] Enhance tab class with get_settings_fields_by() --- includes/class-tab.php | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/includes/class-tab.php b/includes/class-tab.php index cdaa2b1..41ba772 100644 --- a/includes/class-tab.php +++ b/includes/class-tab.php @@ -16,7 +16,7 @@ * @author Jory Hogeveen * @package Off_Canvas_Sidebars * @since 0.5.0 - * @version 0.5.3 + * @version 0.5.4 * @uses \OCS_Off_Canvas_Sidebars_Base Extends class */ abstract class OCS_Off_Canvas_Sidebars_Tab extends OCS_Off_Canvas_Sidebars_Base @@ -171,7 +171,7 @@ public function add_settings_field( $key, $args ) { /** * Get a registered field. * @since 0.5.0 - * @param string $key + * @param string $key The field setting key. * @return array */ public function get_settings_fields( $key = '' ) { @@ -186,15 +186,16 @@ public function get_settings_fields( $key = '' ) { /** * Get a registered field by type. - * @since 0.5.0 - * @param string $type + * @since 0.5.4 + * @param string $prop The field property key. + * @param string $value The field property value. * @param bool $return_keys Return field keys only? * @return array */ - public function get_settings_fields_by_type( $type = '', $return_keys = false ) { + public function get_settings_fields_by( $prop = '', $value = '', $return_keys = false ) { $fields = $this->get_settings_fields(); foreach ( $fields as $key => $field ) { - if ( empty( $field['type'] ) || $field['type'] !== $type ) { + if ( empty( $field[ $prop ] ) || $field[ $prop ] !== $value ) { unset( $fields[ $key ] ); } } @@ -204,6 +205,17 @@ public function get_settings_fields_by_type( $type = '', $return_keys = false ) return $fields; } + /** + * Get a registered field by type. + * @since 0.5.0 + * @param string $type + * @param bool $return_keys Return field keys only? + * @return array + */ + public function get_settings_fields_by_type( $type = '', $return_keys = false ) { + return $this->get_settings_fields_by( 'type', $type, $return_keys ); + } + /** * Get a registered field by section. * @since 0.5.0 @@ -212,16 +224,7 @@ public function get_settings_fields_by_type( $type = '', $return_keys = false ) * @return array */ public function get_settings_fields_by_section( $section = '', $return_keys = false ) { - $fields = $this->get_settings_fields(); - foreach ( $fields as $key => $field ) { - if ( empty( $field['section'] ) || $field['section'] !== $section ) { - unset( $fields[ $key ] ); - } - } - if ( $return_keys ) { - return array_keys( $fields ); - } - return $fields; + return $this->get_settings_fields_by( 'section', $section, $return_keys ); } /** From b799d6e255d69a4fac0609c850e6b717bf83d338 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Thu, 4 Apr 2019 16:30:03 +0200 Subject: [PATCH 09/18] Codestyle --- includes/class-frontend.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-frontend.php b/includes/class-frontend.php index dd63257..6d56702 100644 --- a/includes/class-frontend.php +++ b/includes/class-frontend.php @@ -352,7 +352,7 @@ public function get_container_attributes() { 'id' => $this->get_settings( 'css_prefix' ) . '-site', 'canvas' => 'container', 'data-ocs-site_close' => (bool) $this->get_settings( 'site_close' ), - 'data-ocs-disable_over' => (int) $this->get_settings( 'disable_over' ), + 'data-ocs-disable_over' => (int) $this->get_settings( 'disable_over' ), 'data-ocs-hide_control_classes' => (bool) $this->get_settings( 'hide_control_classes' ), 'data-ocs-scroll_lock' => (bool) $this->get_settings( 'scroll_lock' ), ); From 1d9ad11c004d9237377d0255c6a8aa86dd5d3173 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Thu, 4 Apr 2019 16:30:13 +0200 Subject: [PATCH 10/18] Remove `stuffbox` from classes --- includes/class-page.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class-page.php b/includes/class-page.php index 0a691c3..11ab412 100644 --- a/includes/class-page.php +++ b/includes/class-page.php @@ -284,7 +284,7 @@ public function options_page() { protected function do_page_sidebar() { ?>
-
+

@@ -342,7 +342,7 @@ protected function do_settings_sections( $page ) { } foreach ( (array) $wp_settings_sections[ $page ] as $section ) { - $box_classes = apply_filters( 'ocs_page_form_section_box_classes', 'stuffbox postbox ' . $section['id'], $section, $page ); + $box_classes = apply_filters( 'ocs_page_form_section_box_classes', 'postbox ' . $section['id'], $section, $page ); echo '
'; echo '