ShiftNav – Responsive Mobile Menu - Version 1.6.1.2

Version Description

  • Fix: For new toggle padding CSS insertion compatibility enhancement, make sure it can work even if an optimizer externalizes the ShiftNav head style tag
Download this release

Release Info

Developer sevenspark
Plugin Icon 128x128 ShiftNav – Responsive Mobile Menu
Version 1.6.1.2
Comparing to
See all releases

Code changes from version 1.6.1 to 1.6.1.2

assets/js/shiftnav.js CHANGED
@@ -182,8 +182,22 @@ var shift_supports = (function() {
182
  // var css = document.createElement("style");
183
  // css.type = "text/css";
184
  var style = '@media screen and (max-width:'+(shiftnav_data.breakpoint-1)+'px){ body.shiftnav-disable-shift-body{ padding-top:'+ toggleHeight + 'px; } }';
185
- var sheet = document.getElementById( 'shiftnav-dynamic-css' ).sheet;
186
- if( "insertRule" in sheet ){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  sheet.insertRule( style , 0 );
188
  }
189
  // else{
182
  // var css = document.createElement("style");
183
  // css.type = "text/css";
184
  var style = '@media screen and (max-width:'+(shiftnav_data.breakpoint-1)+'px){ body.shiftnav-disable-shift-body{ padding-top:'+ toggleHeight + 'px; } }';
185
+ var sheet = null;
186
+
187
+ //Get the existing style element in the site head, or create one if it does not exist
188
+ var style_el = document.getElementById( 'shiftnav-dynamic-css' );
189
+ if( style_el ){
190
+ sheet = style_el.sheet;
191
+ }
192
+ else{
193
+ style_el = document.createElement("style");
194
+ style_el.appendChild(document.createTextNode(""));
195
+ document.head.appendChild(style_el);
196
+ sheet = style_el.sheet;
197
+ }
198
+
199
+ //Add the rule to the style element
200
+ if( sheet && "insertRule" in sheet ){
201
  sheet.insertRule( style , 0 );
202
  }
203
  // else{
assets/js/shiftnav.min.js CHANGED
@@ -4,13 +4,13 @@ var shift_supports=function(){var b=document.createElement("div"),g=["Khtml","Ms
4
  this.touchMove="MSPointerMove"):(this.touchStart="touchstart",this.touchEnd="touchend",this.touchMove="touchmove");this.toggleevent="touchend"==this.touchEnd?this.touchEnd+" click":this.touchEnd;this.transitionend="transitionend.shiftnav webkitTransitionEnd.shiftnav msTransitionEnd.shiftnav oTransitionEnd.shiftnav";this.settings.clicktest&&(this.touchEnd="click");this.init()}var m={mouseEvents:!0,retractors:!0,touchOffClose:!0,clicktest:!1,windowstest:!1,debug:!1,open_current:!1,collapse_accordions:!1,
5
  scroll_offset:100,disable_transforms:!1};k.prototype={init:function(){this.$shiftnav.removeClass("shiftnav-nojs");this.$toggles=b('.shiftnav-toggle[data-shiftnav-target="'+this.$shiftnav.data("shiftnav-id")+'"]');this.initializeShiftNav();this.initializeTargets();this.initializeSubmenuToggleMouseEvents();this.initializeRetractors();this.initializeResponsiveToggle()},initializeShiftNav:function(){var a=b("body"),d=this;if(!a.hasClass("shiftnav-enabled")){a.addClass("shiftnav-enabled");"on"==shiftnav_data.lock_body&&
6
  a.addClass("shiftnav-lock");"on"==shiftnav_data.lock_body_x&&a.addClass("shiftnav-lock-x");"off"!=shiftnav_data.shift_body?""!=shiftnav_data.shift_body_wrapper?b(shiftnav_data.shift_body_wrapper).addClass("shiftnav-wrap"):(a.wrapInner('<div class="shiftnav-wrap"></div>'),b("video[autoplay]").each(function(){b(this).get(0).play()})):a.addClass("shiftnav-disable-shift-body");b("#shiftnav-toggle-main, #wpadminbar, .shiftnav-fixed-left, .shiftnav-fixed-right").appendTo("body");var c=b(".shiftnav-wrap"),
7
- e=b("#shiftnav-toggle-main");if(!e.hasClass("shiftnav-toggle-style-burger_only")&&e.hasClass("shiftnav-togglebar-gap-auto")||e.hasClass("shiftnav-togglebar-gap-on")){var f=e.outerHeight();c.css("padding-top",f);e.addClass("shiftnav-togglebar-gap-on");"off"==shiftnav_data.shift_body&&(c="@media screen and (max-width:"+(shiftnav_data.breakpoint-1)+"px){ body.shiftnav-disable-shift-body{ padding-top:"+f+"px; } }",e=h.getElementById("shiftnav-dynamic-css").sheet,"insertRule"in e&&e.insertRule(c,0))}else b("body").hasClass("admin-bar")&&
8
- b("html").addClass("shiftnav-nogap");c=!1;e=navigator.userAgent.toLowerCase();/android/.test(e)&&(c=!0,/android [1-3]/.test(e)?c=!0:/chrome/.test(e)?c=!1:/firefox/.test(e)&&(c=!1));(!shift_supports("transform")||c||d.settings.disable_transforms)&&a.addClass("shiftnav-no-transforms");b(".shiftnav-searchbar-toggle").on(this.toggleevent,function(a){a.stopPropagation();a.preventDefault();a=b(this).next(".shiftnav-searchbar-drop");a.hasClass("shiftnav-searchbar-drop-open")?(a.removeClass("shiftnav-searchbar-drop-open"),
9
- b("body").off("click.shiftnav-searchbar-drop")):(a.addClass("shiftnav-searchbar-drop-open"),a.find(".shiftnav-search-input").focus(),d.settings.touchOffClose&&setTimeout(function(){b("body").on("click.shiftnav-searchbar-drop",function(a){b(".shiftnav-searchbar-drop").removeClass("shiftnav-searchbar-drop-open");b("body").off("click.shiftnav-searchbar-drop")})},100))});b(".shiftnav-searchbar-drop").on(this.toggleevent,function(a){a.stopPropagation()});if(this.settings.touchOffClose)b(".shiftnav-searchbar-drop .shiftnav-search-input").on("blur",
10
- function(a){""!=b(this).val()||l||b(this).parents(".shiftnav-searchbar-drop").removeClass("shiftnav-searchbar-drop-open")});var l;b(".shiftnav-searchbar-toggle").on("mousedown",function(a){l=!0});b(".shiftnav-searchbar-toggle").on("mouseup",function(a){l=!1});b(".shiftnav").css("max-height",g.innerHeight);b(g).shiftsmartresize(function(){b(".shiftnav").css("max-height",g.innerHeight)})}this.$shiftnav.appendTo("body");this.$shiftnav.hasClass("shiftnav-right-edge")?this.edge="right":this.edge="left";
11
- this.openclass="shiftnav-open shiftnav-open-"+this.edge;this.$shiftnav.find(".shiftnav-panel-close").on("click",function(){d.closeShiftNav()});this.$shiftnav.find(".shiftnav-submenu-activation").each(function(){var a=b(this).siblings(".shiftnav-target").outerHeight();b(this).css({height:a,width:a})});d.settings.open_current&&b(".shiftnav .shiftnav-sub-accordion.current-menu-item, .shiftnav .shiftnav-sub-accordion.current-menu-ancestor").addClass("shiftnav-active")},initializeTargets:function(){var a=
12
- this;this.$shiftnav.find(".shiftnav-scrollto").removeClass("current-menu-item").removeClass("current-menu-ancestor");this.$shiftnav.on("click",".shiftnav-target",function(d){var c=b(this).data("shiftnav-scrolltarget");if(c){var e=b(c).first();if(0<e.length)return d=b(this).parent(".menu-item"),d.siblings().removeClass("current-menu-item").removeClass("current-menu-ancestor"),d.addClass("current-menu-item"),d=e.offset().top,d-=a.settings.scroll_offset,b("html,body").animate({scrollTop:d},1E3,"swing",
13
- function(){a.closeShiftNav()}),!1;(e=b(this).attr("href"))&&-1==e.indexOf("#")&&(-1==c.indexOf("#")&&(c="#"+c),g.location=e+c,d.preventDefault())}else b(this).is("span")&&(d=b(this).parent(".menu-item"),d.hasClass("shiftnav-active")?a.closeSubmenu(d,"disabledLink",a):a.openSubmenu(d,"disabledLink",a))})},initializeSubmenuToggleMouseEvents:function(){if(this.settings.mouseEvents&&!this.settings.clicktest&&!this.settings.windowstest){this.settings.debug&&console.log("initializeSubmenuToggleMouseEvents");
14
  var a=this;this.$shiftnav.on("mouseup.shift-submenu-toggle",".shiftnav-submenu-activation",function(b){a.handleMouseActivation(b,this,a)})}},disableSubmenuToggleMouseEvents:function(){this.settings.debug&&console.log("disableSubmenuToggleMouseEvents");$shiftnav.off("mouseover.shift-submenu-toggle");$shiftnav.off("mouseout.shift-submenu-toggle")},initializeRetractors:function(){if(this.settings.retractors){var a=this;this.$shiftnav.on("mouseup.shiftnav",".shiftnav-retract",function(b){a.handleSubmenuRetractorEnd(b,
15
  this,a)})}},initializeResponsiveToggle:function(){var a=this;this.$toggles.on("click","a",function(a){a.stopPropagation()});this.$toggles.on("click",function(d){a.toggle(b(this),a,d)})},toggle:function(a,d,c){c.preventDefault();c.stopPropagation();if("click"!=c.originalEvent.type||!b(this).data("disableToggle")){if(d.$shiftnav.hasClass("shiftnav-open-target"))d.closeShiftNav();else{a=a.attr("id");var e="shiftnav-toggle-main"==a?"[Main Toggle Bar]":'"'+b(this).text()+'"';"shiftnav-toggle-main-button"!=
16
  a&&"shiftnav-toggle-main"!=a||!b("body").hasClass("shiftnav-open")?d.openShiftNav("toggle: "+e):b(".shiftnav.shiftnav-open-target").shiftnav("closeShiftNav")}"click"!=c.originalEvent.type&&(b(this).data("disableToggle",!0),setTimeout(function(){b(this).data("disableToggle",!1)},1E3));return!1}},openShiftNav:function(a){var d=this;this.settings.debug&&console.log("openShiftNav "+(a||"?"));b("body").removeClass("shiftnav-open-right shiftnav-open-left").addClass(this.openclass).addClass("shiftnav-transitioning");
4
  this.touchMove="MSPointerMove"):(this.touchStart="touchstart",this.touchEnd="touchend",this.touchMove="touchmove");this.toggleevent="touchend"==this.touchEnd?this.touchEnd+" click":this.touchEnd;this.transitionend="transitionend.shiftnav webkitTransitionEnd.shiftnav msTransitionEnd.shiftnav oTransitionEnd.shiftnav";this.settings.clicktest&&(this.touchEnd="click");this.init()}var m={mouseEvents:!0,retractors:!0,touchOffClose:!0,clicktest:!1,windowstest:!1,debug:!1,open_current:!1,collapse_accordions:!1,
5
  scroll_offset:100,disable_transforms:!1};k.prototype={init:function(){this.$shiftnav.removeClass("shiftnav-nojs");this.$toggles=b('.shiftnav-toggle[data-shiftnav-target="'+this.$shiftnav.data("shiftnav-id")+'"]');this.initializeShiftNav();this.initializeTargets();this.initializeSubmenuToggleMouseEvents();this.initializeRetractors();this.initializeResponsiveToggle()},initializeShiftNav:function(){var a=b("body"),d=this;if(!a.hasClass("shiftnav-enabled")){a.addClass("shiftnav-enabled");"on"==shiftnav_data.lock_body&&
6
  a.addClass("shiftnav-lock");"on"==shiftnav_data.lock_body_x&&a.addClass("shiftnav-lock-x");"off"!=shiftnav_data.shift_body?""!=shiftnav_data.shift_body_wrapper?b(shiftnav_data.shift_body_wrapper).addClass("shiftnav-wrap"):(a.wrapInner('<div class="shiftnav-wrap"></div>'),b("video[autoplay]").each(function(){b(this).get(0).play()})):a.addClass("shiftnav-disable-shift-body");b("#shiftnav-toggle-main, #wpadminbar, .shiftnav-fixed-left, .shiftnav-fixed-right").appendTo("body");var c=b(".shiftnav-wrap"),
7
+ e=b("#shiftnav-toggle-main");if(!e.hasClass("shiftnav-toggle-style-burger_only")&&e.hasClass("shiftnav-togglebar-gap-auto")||e.hasClass("shiftnav-togglebar-gap-on")){var f=e.outerHeight();c.css("padding-top",f);e.addClass("shiftnav-togglebar-gap-on");"off"==shiftnav_data.shift_body&&(c="@media screen and (max-width:"+(shiftnav_data.breakpoint-1)+"px){ body.shiftnav-disable-shift-body{ padding-top:"+f+"px; } }",e=null,e=h.getElementById("shiftnav-dynamic-css"),e||(e=h.createElement("style"),e.appendChild(h.createTextNode("")),
8
+ h.head.appendChild(e)),(e=e.sheet)&&"insertRule"in e&&e.insertRule(c,0))}else b("body").hasClass("admin-bar")&&b("html").addClass("shiftnav-nogap");c=!1;e=navigator.userAgent.toLowerCase();/android/.test(e)&&(c=!0,/android [1-3]/.test(e)?c=!0:/chrome/.test(e)?c=!1:/firefox/.test(e)&&(c=!1));(!shift_supports("transform")||c||d.settings.disable_transforms)&&a.addClass("shiftnav-no-transforms");b(".shiftnav-searchbar-toggle").on(this.toggleevent,function(a){a.stopPropagation();a.preventDefault();a=b(this).next(".shiftnav-searchbar-drop");
9
+ a.hasClass("shiftnav-searchbar-drop-open")?(a.removeClass("shiftnav-searchbar-drop-open"),b("body").off("click.shiftnav-searchbar-drop")):(a.addClass("shiftnav-searchbar-drop-open"),a.find(".shiftnav-search-input").focus(),d.settings.touchOffClose&&setTimeout(function(){b("body").on("click.shiftnav-searchbar-drop",function(a){b(".shiftnav-searchbar-drop").removeClass("shiftnav-searchbar-drop-open");b("body").off("click.shiftnav-searchbar-drop")})},100))});b(".shiftnav-searchbar-drop").on(this.toggleevent,
10
+ function(a){a.stopPropagation()});if(this.settings.touchOffClose)b(".shiftnav-searchbar-drop .shiftnav-search-input").on("blur",function(a){""!=b(this).val()||l||b(this).parents(".shiftnav-searchbar-drop").removeClass("shiftnav-searchbar-drop-open")});var l;b(".shiftnav-searchbar-toggle").on("mousedown",function(a){l=!0});b(".shiftnav-searchbar-toggle").on("mouseup",function(a){l=!1});b(".shiftnav").css("max-height",g.innerHeight);b(g).shiftsmartresize(function(){b(".shiftnav").css("max-height",g.innerHeight)})}this.$shiftnav.appendTo("body");
11
+ this.$shiftnav.hasClass("shiftnav-right-edge")?this.edge="right":this.edge="left";this.openclass="shiftnav-open shiftnav-open-"+this.edge;this.$shiftnav.find(".shiftnav-panel-close").on("click",function(){d.closeShiftNav()});this.$shiftnav.find(".shiftnav-submenu-activation").each(function(){var a=b(this).siblings(".shiftnav-target").outerHeight();b(this).css({height:a,width:a})});d.settings.open_current&&b(".shiftnav .shiftnav-sub-accordion.current-menu-item, .shiftnav .shiftnav-sub-accordion.current-menu-ancestor").addClass("shiftnav-active")},
12
+ initializeTargets:function(){var a=this;this.$shiftnav.find(".shiftnav-scrollto").removeClass("current-menu-item").removeClass("current-menu-ancestor");this.$shiftnav.on("click",".shiftnav-target",function(d){var c=b(this).data("shiftnav-scrolltarget");if(c){var e=b(c).first();if(0<e.length)return d=b(this).parent(".menu-item"),d.siblings().removeClass("current-menu-item").removeClass("current-menu-ancestor"),d.addClass("current-menu-item"),d=e.offset().top,d-=a.settings.scroll_offset,b("html,body").animate({scrollTop:d},
13
+ 1E3,"swing",function(){a.closeShiftNav()}),!1;(e=b(this).attr("href"))&&-1==e.indexOf("#")&&(-1==c.indexOf("#")&&(c="#"+c),g.location=e+c,d.preventDefault())}else b(this).is("span")&&(d=b(this).parent(".menu-item"),d.hasClass("shiftnav-active")?a.closeSubmenu(d,"disabledLink",a):a.openSubmenu(d,"disabledLink",a))})},initializeSubmenuToggleMouseEvents:function(){if(this.settings.mouseEvents&&!this.settings.clicktest&&!this.settings.windowstest){this.settings.debug&&console.log("initializeSubmenuToggleMouseEvents");
14
  var a=this;this.$shiftnav.on("mouseup.shift-submenu-toggle",".shiftnav-submenu-activation",function(b){a.handleMouseActivation(b,this,a)})}},disableSubmenuToggleMouseEvents:function(){this.settings.debug&&console.log("disableSubmenuToggleMouseEvents");$shiftnav.off("mouseover.shift-submenu-toggle");$shiftnav.off("mouseout.shift-submenu-toggle")},initializeRetractors:function(){if(this.settings.retractors){var a=this;this.$shiftnav.on("mouseup.shiftnav",".shiftnav-retract",function(b){a.handleSubmenuRetractorEnd(b,
15
  this,a)})}},initializeResponsiveToggle:function(){var a=this;this.$toggles.on("click","a",function(a){a.stopPropagation()});this.$toggles.on("click",function(d){a.toggle(b(this),a,d)})},toggle:function(a,d,c){c.preventDefault();c.stopPropagation();if("click"!=c.originalEvent.type||!b(this).data("disableToggle")){if(d.$shiftnav.hasClass("shiftnav-open-target"))d.closeShiftNav();else{a=a.attr("id");var e="shiftnav-toggle-main"==a?"[Main Toggle Bar]":'"'+b(this).text()+'"';"shiftnav-toggle-main-button"!=
16
  a&&"shiftnav-toggle-main"!=a||!b("body").hasClass("shiftnav-open")?d.openShiftNav("toggle: "+e):b(".shiftnav.shiftnav-open-target").shiftnav("closeShiftNav")}"click"!=c.originalEvent.type&&(b(this).data("disableToggle",!0),setTimeout(function(){b(this).data("disableToggle",!1)},1E3));return!1}},openShiftNav:function(a){var d=this;this.settings.debug&&console.log("openShiftNav "+(a||"?"));b("body").removeClass("shiftnav-open-right shiftnav-open-left").addClass(this.openclass).addClass("shiftnav-transitioning");
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://shiftnav.io/pro
4
  Tags: responsive, menu, navigation, mobile, off-canvas, app, slide, sidebar
5
  Requires at least: 4.0
6
  Tested up to: 4.8
7
- Stable tag: 1.6.1
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -56,6 +56,10 @@ Please see the [ShiftNav Quick Setup Guide](http://sevenspark.com/docs/shiftnav-
56
 
57
  == Changelog ==
58
 
 
 
 
 
59
  = 1.6.1 =
60
 
61
  * [Pro] Feature: Setting to choose the open and close icons for accordion menus
@@ -64,8 +68,8 @@ Please see the [ShiftNav Quick Setup Guide](http://sevenspark.com/docs/shiftnav-
64
 
65
  = 1.6 =
66
 
67
- * Feature: Configure whether to automatically generate each secondary instance or not
68
- * Feature: Improved license updater to allow for re-checking and re-registration when necessary, and show expiration date
69
  * Enhancement: Touch-off close setting now applies to search dropdown as well as menu panel
70
  * Security hardening: Rewrite fragment handling to remove potential DOM-based (client-side) XSS (thanks, Martin Hall!)
71
 
4
  Tags: responsive, menu, navigation, mobile, off-canvas, app, slide, sidebar
5
  Requires at least: 4.0
6
  Tested up to: 4.8
7
+ Stable tag: 1.6.1.2
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
56
 
57
  == Changelog ==
58
 
59
+ = 1.6.1.2 =
60
+
61
+ * Fix: For new toggle padding CSS insertion compatibility enhancement, make sure it can work even if an optimizer externalizes the ShiftNav head style tag
62
+
63
  = 1.6.1 =
64
 
65
  * [Pro] Feature: Setting to choose the open and close icons for accordion menus
68
 
69
  = 1.6 =
70
 
71
+ * [Pro] Feature: Configure whether to automatically generate each secondary instance or not
72
+ * [Pro] Feature: Improved license updater to allow for re-checking and re-registration when necessary, and show expiration date
73
  * Enhancement: Touch-off close setting now applies to search dropdown as well as menu panel
74
  * Security hardening: Rewrite fragment handling to remove potential DOM-based (client-side) XSS (thanks, Martin Hall!)
75
 
shiftnav-responsive-mobile-menu.php CHANGED
@@ -6,7 +6,7 @@ Description: An off-canvas mobile menu for WordPress
6
  Author: Chris Mavricos, SevenSpark
7
  Author URI: http://sevenspark.com
8
  License: GPLv2
9
- Version: 1.6.1
10
  */
11
 
12
  /* Copyright 2014-2017 Chris Mavricos, SevenSpark */
@@ -53,7 +53,7 @@ final class ShiftNav {
53
  // Plugin version
54
 
55
  if( ! defined( 'SHIFTNAV_VERSION' ) )
56
- define( 'SHIFTNAV_VERSION', '1.6.1' );
57
 
58
  if( ! defined( 'SHIFTNAV_PRO' ) )
59
  define( 'SHIFTNAV_PRO', false );
6
  Author: Chris Mavricos, SevenSpark
7
  Author URI: http://sevenspark.com
8
  License: GPLv2
9
+ Version: 1.6.1.2
10
  */
11
 
12
  /* Copyright 2014-2017 Chris Mavricos, SevenSpark */
53
  // Plugin version
54
 
55
  if( ! defined( 'SHIFTNAV_VERSION' ) )
56
+ define( 'SHIFTNAV_VERSION', '1.6.1.2' );
57
 
58
  if( ! defined( 'SHIFTNAV_PRO' ) )
59
  define( 'SHIFTNAV_PRO', false );