responsive-nav-rails 1.0.33 → 1.0.38
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b86d05c1ee7e6ff6e98352e3d032d99dc343d2cd
|
4
|
+
data.tar.gz: f57ff37df16a8661a1c1661f386b779c7d7654e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 805918e52543a7525d3d94316cc8a5536c96abcf4dfe981bca11698d8f32ee97b15eeba17c1de6caf65433a323b7aefb99941b8fe6892350e87e3ecdc1533289
|
7
|
+
data.tar.gz: 8d7a76df514a941f823173920df608322b015182e5b8036d71fde8faa11c7e97a66f4da6299192abfcee88374219a6fd300403a3cfa59d25cbd8fcbb26881d80
|
@@ -1,11 +1,12 @@
|
|
1
|
-
/*! responsive-nav.js 1.0.
|
1
|
+
/*! responsive-nav.js 1.0.38
|
2
2
|
* https://github.com/viljamis/responsive-nav.js
|
3
3
|
* http://responsive-nav.com
|
4
4
|
*
|
5
|
-
* Copyright (c)
|
5
|
+
* Copyright (c) 2015 @viljamis
|
6
6
|
* Available under the MIT license
|
7
7
|
*/
|
8
8
|
|
9
|
+
/* global Event */
|
9
10
|
(function (document, window, index) {
|
10
11
|
// Index is used to keep multiple navs on the same page namespaced
|
11
12
|
|
@@ -286,9 +287,6 @@
|
|
286
287
|
} else {
|
287
288
|
this.close();
|
288
289
|
}
|
289
|
-
|
290
|
-
// Enable pointer events again
|
291
|
-
this._enablePointerEvents();
|
292
290
|
}
|
293
291
|
},
|
294
292
|
|
@@ -499,7 +497,7 @@
|
|
499
497
|
},
|
500
498
|
|
501
499
|
/**
|
502
|
-
* Closes the navigation when a link inside is clicked
|
500
|
+
* Closes the navigation when a link inside is clicked.
|
503
501
|
*/
|
504
502
|
_closeOnNavClick: function () {
|
505
503
|
if (opts.closeOnNavClick) {
|
@@ -516,7 +514,7 @@
|
|
516
514
|
},
|
517
515
|
|
518
516
|
/**
|
519
|
-
* Prevents the default
|
517
|
+
* Prevents the default functionality.
|
520
518
|
*
|
521
519
|
* @param {event} event
|
522
520
|
*/
|
@@ -536,42 +534,39 @@
|
|
536
534
|
},
|
537
535
|
|
538
536
|
/**
|
539
|
-
* On touch start get the location of the touch
|
540
|
-
* and disable pointer events on the body.
|
537
|
+
* On touch start we get the location of the touch.
|
541
538
|
*
|
542
539
|
* @param {event} event
|
543
540
|
*/
|
544
541
|
_onTouchStart: function (e) {
|
545
|
-
|
546
|
-
|
542
|
+
if (!Event.prototype.stopImmediatePropagation) {
|
543
|
+
this._preventDefault(e);
|
544
|
+
}
|
547
545
|
this.startX = e.touches[0].clientX;
|
548
546
|
this.startY = e.touches[0].clientY;
|
549
547
|
this.touchHasMoved = false;
|
550
548
|
|
551
549
|
/**
|
552
|
-
*
|
553
|
-
* double triggering
|
550
|
+
* Remove mouseup event completely here to avoid
|
551
|
+
* double triggering the event.
|
554
552
|
*/
|
555
553
|
removeEvent(navToggle, "mouseup", this, false);
|
556
554
|
},
|
557
555
|
|
558
556
|
/**
|
559
|
-
* Check if the user is scrolling instead of tapping
|
560
|
-
* re-enable pointer events if movement happed.
|
557
|
+
* Check if the user is scrolling instead of tapping.
|
561
558
|
*
|
562
559
|
* @param {event} event
|
563
560
|
*/
|
564
561
|
_onTouchMove: function (e) {
|
565
562
|
if (Math.abs(e.touches[0].clientX - this.startX) > 10 ||
|
566
563
|
Math.abs(e.touches[0].clientY - this.startY) > 10) {
|
567
|
-
this._enablePointerEvents();
|
568
564
|
this.touchHasMoved = true;
|
569
565
|
}
|
570
566
|
},
|
571
567
|
|
572
568
|
/**
|
573
|
-
* On touch end toggle
|
574
|
-
* a sub-navigation depending on which one was tapped.
|
569
|
+
* On touch end toggle the navigation.
|
575
570
|
*
|
576
571
|
* @param {event} event
|
577
572
|
*/
|
@@ -587,11 +582,6 @@
|
|
587
582
|
// If the event type is touch
|
588
583
|
if (e.type === "touchend") {
|
589
584
|
this.toggle();
|
590
|
-
if (opts.insert === "after") {
|
591
|
-
setTimeout(function () {
|
592
|
-
removeClass(document.body, "disable-pointer-events");
|
593
|
-
}, opts.transition + 300);
|
594
|
-
}
|
595
585
|
return;
|
596
586
|
|
597
587
|
// Event type was click, not touch
|
@@ -608,8 +598,7 @@
|
|
608
598
|
|
609
599
|
/**
|
610
600
|
* For keyboard accessibility, toggle the navigation on Enter
|
611
|
-
* keypress too
|
612
|
-
* which explains the complexity here)
|
601
|
+
* keypress too.
|
613
602
|
*
|
614
603
|
* @param {event} event
|
615
604
|
*/
|
@@ -620,13 +609,6 @@
|
|
620
609
|
}
|
621
610
|
},
|
622
611
|
|
623
|
-
/**
|
624
|
-
* Enable pointer events
|
625
|
-
*/
|
626
|
-
_enablePointerEvents: function () {
|
627
|
-
removeClass(document.body, "disable-pointer-events");
|
628
|
-
},
|
629
|
-
|
630
612
|
/**
|
631
613
|
* Adds the needed CSS transitions if animations are enabled
|
632
614
|
*/
|
@@ -635,9 +617,9 @@
|
|
635
617
|
var objStyle = nav.style,
|
636
618
|
transition = "max-height " + opts.transition + "ms";
|
637
619
|
|
638
|
-
objStyle.WebkitTransition =
|
639
|
-
objStyle.MozTransition =
|
640
|
-
objStyle.OTransition =
|
620
|
+
objStyle.WebkitTransition =
|
621
|
+
objStyle.MozTransition =
|
622
|
+
objStyle.OTransition =
|
641
623
|
objStyle.transition = transition;
|
642
624
|
}
|
643
625
|
},
|
@@ -652,9 +634,7 @@
|
|
652
634
|
savedHeight += nav.inner[i].offsetHeight;
|
653
635
|
}
|
654
636
|
|
655
|
-
|
656
|
-
var innerStyles = "." + opts.jsClass + " ." + opts.navClass + "-" + this.index + ".opened{max-height:" + savedHeight + "px !important} ." + opts.jsClass + " .disable-pointer-events{pointer-events:none !important} ." + opts.jsClass + " ." + opts.navClass + "-" + this.index + ".opened.dropdown-active {max-height:9999px !important}";
|
657
|
-
|
637
|
+
var innerStyles = "." + opts.jsClass + " ." + opts.navClass + "-" + this.index + ".opened{max-height:" + savedHeight + "px !important} ." + opts.jsClass + " ." + opts.navClass + "-" + this.index + ".opened.dropdown-active {max-height:9999px !important}";
|
658
638
|
|
659
639
|
if (styleElement.styleSheet) {
|
660
640
|
styleElement.styleSheet.cssText = innerStyles;
|
@@ -1 +1 @@
|
|
1
|
-
!function(a,b,c){"use strict";var d=function(d,e){var f=!!b.getComputedStyle;f||(b.getComputedStyle=function(a){return this.el=a,this.getPropertyValue=function(b){var c=/(\-([a-z]){1})/g;return"float"===b&&(b="styleFloat"),c.test(b)&&(b=b.replace(c,function(){return arguments[2].toUpperCase()})),a.currentStyle[b]?a.currentStyle[b]:null},this});var g,h,i,j,k,l,m=function(a,b,c,d){if("addEventListener"in a)try{a.addEventListener(b,c,d)}catch(e){if("object"!=typeof c||!c.handleEvent)throw e;a.addEventListener(b,function(a){c.handleEvent.call(c,a)},d)}else"attachEvent"in a&&("object"==typeof c&&c.handleEvent?a.attachEvent("on"+b,function(){c.handleEvent.call(c)}):a.attachEvent("on"+b,c))},n=function(a,b,c,d){if("removeEventListener"in a)try{a.removeEventListener(b,c,d)}catch(e){if("object"!=typeof c||!c.handleEvent)throw e;a.removeEventListener(b,function(a){c.handleEvent.call(c,a)},d)}else"detachEvent"in a&&("object"==typeof c&&c.handleEvent?a.detachEvent("on"+b,function(){c.handleEvent.call(c)}):a.detachEvent("on"+b,c))},o=function(a){if(a.children.length<1)throw new Error("The Nav container has no containing elements");for(var b=[],c=0;c<a.children.length;c++)1===a.children[c].nodeType&&b.push(a.children[c]);return b},p=function(a,b){for(var c in b)a.setAttribute(c,b[c])},q=function(a,b){0!==a.className.indexOf(b)&&(a.className+=" "+b,a.className=a.className.replace(/(^\s*)|(\s*$)/g,""))},r=function(a,b){var c=new RegExp("(\\s|^)"+b+"(\\s|$)");a.className=a.className.replace(c," ").replace(/(^\s*)|(\s*$)/g,"")},s=function(a,b,c){for(var d=0;d<a.length;d++)b.call(c,d,a[d])},t=a.createElement("style"),u=a.documentElement,v=function(b,c){var d;this.options={animate:!0,transition:284,label:"Menu",insert:"before",customToggle:"",closeOnNavClick:!1,openPos:"relative",navClass:"nav-collapse",navActiveClass:"js-nav-active",jsClass:"js",init:function(){},open:function(){},close:function(){}};for(d in c)this.options[d]=c[d];if(q(u,this.options.jsClass),this.wrapperEl=b.replace("#",""),a.getElementById(this.wrapperEl))this.wrapper=a.getElementById(this.wrapperEl);else{if(!a.querySelector(this.wrapperEl))throw new Error("The nav element you are trying to select doesn't exist");this.wrapper=a.querySelector(this.wrapperEl)}this.wrapper.inner=o(this.wrapper),h=this.options,g=this.wrapper,this._init(this)};return v.prototype={destroy:function(){this._removeStyles(),r(g,"closed"),r(g,"opened"),r(g,h.navClass),r(g,h.navClass+"-"+this.index),r(u,h.navActiveClass),g.removeAttribute("style"),g.removeAttribute("aria-hidden"),n(b,"resize",this,!1),n(b,"focus",this,!1),n(a.body,"touchmove",this,!1),n(i,"touchstart",this,!1),n(i,"touchend",this,!1),n(i,"mouseup",this,!1),n(i,"keyup",this,!1),n(i,"click",this,!1),h.customToggle?i.removeAttribute("aria-hidden"):i.parentNode.removeChild(i)},toggle:function(){j===!0&&(l?this.close():this.open()
|
1
|
+
!function(a,b,c){"use strict";var d=function(d,e){var f=!!b.getComputedStyle;f||(b.getComputedStyle=function(a){return this.el=a,this.getPropertyValue=function(b){var c=/(\-([a-z]){1})/g;return"float"===b&&(b="styleFloat"),c.test(b)&&(b=b.replace(c,function(){return arguments[2].toUpperCase()})),a.currentStyle[b]?a.currentStyle[b]:null},this});var g,h,i,j,k,l,m=function(a,b,c,d){if("addEventListener"in a)try{a.addEventListener(b,c,d)}catch(e){if("object"!=typeof c||!c.handleEvent)throw e;a.addEventListener(b,function(a){c.handleEvent.call(c,a)},d)}else"attachEvent"in a&&("object"==typeof c&&c.handleEvent?a.attachEvent("on"+b,function(){c.handleEvent.call(c)}):a.attachEvent("on"+b,c))},n=function(a,b,c,d){if("removeEventListener"in a)try{a.removeEventListener(b,c,d)}catch(e){if("object"!=typeof c||!c.handleEvent)throw e;a.removeEventListener(b,function(a){c.handleEvent.call(c,a)},d)}else"detachEvent"in a&&("object"==typeof c&&c.handleEvent?a.detachEvent("on"+b,function(){c.handleEvent.call(c)}):a.detachEvent("on"+b,c))},o=function(a){if(a.children.length<1)throw new Error("The Nav container has no containing elements");for(var b=[],c=0;c<a.children.length;c++)1===a.children[c].nodeType&&b.push(a.children[c]);return b},p=function(a,b){for(var c in b)a.setAttribute(c,b[c])},q=function(a,b){0!==a.className.indexOf(b)&&(a.className+=" "+b,a.className=a.className.replace(/(^\s*)|(\s*$)/g,""))},r=function(a,b){var c=new RegExp("(\\s|^)"+b+"(\\s|$)");a.className=a.className.replace(c," ").replace(/(^\s*)|(\s*$)/g,"")},s=function(a,b,c){for(var d=0;d<a.length;d++)b.call(c,d,a[d])},t=a.createElement("style"),u=a.documentElement,v=function(b,c){var d;this.options={animate:!0,transition:284,label:"Menu",insert:"before",customToggle:"",closeOnNavClick:!1,openPos:"relative",navClass:"nav-collapse",navActiveClass:"js-nav-active",jsClass:"js",init:function(){},open:function(){},close:function(){}};for(d in c)this.options[d]=c[d];if(q(u,this.options.jsClass),this.wrapperEl=b.replace("#",""),a.getElementById(this.wrapperEl))this.wrapper=a.getElementById(this.wrapperEl);else{if(!a.querySelector(this.wrapperEl))throw new Error("The nav element you are trying to select doesn't exist");this.wrapper=a.querySelector(this.wrapperEl)}this.wrapper.inner=o(this.wrapper),h=this.options,g=this.wrapper,this._init(this)};return v.prototype={destroy:function(){this._removeStyles(),r(g,"closed"),r(g,"opened"),r(g,h.navClass),r(g,h.navClass+"-"+this.index),r(u,h.navActiveClass),g.removeAttribute("style"),g.removeAttribute("aria-hidden"),n(b,"resize",this,!1),n(b,"focus",this,!1),n(a.body,"touchmove",this,!1),n(i,"touchstart",this,!1),n(i,"touchend",this,!1),n(i,"mouseup",this,!1),n(i,"keyup",this,!1),n(i,"click",this,!1),h.customToggle?i.removeAttribute("aria-hidden"):i.parentNode.removeChild(i)},toggle:function(){j===!0&&(l?this.close():this.open())},open:function(){l||(r(g,"closed"),q(g,"opened"),q(u,h.navActiveClass),q(i,"active"),g.style.position=h.openPos,p(g,{"aria-hidden":"false"}),l=!0,h.open())},close:function(){l&&(q(g,"closed"),r(g,"opened"),r(u,h.navActiveClass),r(i,"active"),p(g,{"aria-hidden":"true"}),h.animate?(j=!1,setTimeout(function(){g.style.position="absolute",j=!0},h.transition+10)):g.style.position="absolute",l=!1,h.close())},resize:function(){"none"!==b.getComputedStyle(i,null).getPropertyValue("display")?(k=!0,p(i,{"aria-hidden":"false"}),g.className.match(/(^|\s)closed(\s|$)/)&&(p(g,{"aria-hidden":"true"}),g.style.position="absolute"),this._createStyles(),this._calcHeight()):(k=!1,p(i,{"aria-hidden":"true"}),p(g,{"aria-hidden":"false"}),g.style.position=h.openPos,this._removeStyles())},handleEvent:function(a){var c=a||b.event;switch(c.type){case"touchstart":this._onTouchStart(c);break;case"touchmove":this._onTouchMove(c);break;case"touchend":case"mouseup":this._onTouchEnd(c);break;case"click":this._preventDefault(c);break;case"keyup":this._onKeyUp(c);break;case"focus":case"resize":this.resize(c)}},_init:function(){this.index=c++,q(g,h.navClass),q(g,h.navClass+"-"+this.index),q(g,"closed"),j=!0,l=!1,this._closeOnNavClick(),this._createToggle(),this._transitions(),this.resize();var d=this;setTimeout(function(){d.resize()},20),m(b,"resize",this,!1),m(b,"focus",this,!1),m(a.body,"touchmove",this,!1),m(i,"touchstart",this,!1),m(i,"touchend",this,!1),m(i,"mouseup",this,!1),m(i,"keyup",this,!1),m(i,"click",this,!1),h.init()},_createStyles:function(){t.parentNode||(t.type="text/css",a.getElementsByTagName("head")[0].appendChild(t))},_removeStyles:function(){t.parentNode&&t.parentNode.removeChild(t)},_createToggle:function(){if(h.customToggle){var b=h.customToggle.replace("#","");if(a.getElementById(b))i=a.getElementById(b);else{if(!a.querySelector(b))throw new Error("The custom nav toggle you are trying to select doesn't exist");i=a.querySelector(b)}}else{var c=a.createElement("a");c.innerHTML=h.label,p(c,{href:"#","class":"nav-toggle"}),"after"===h.insert?g.parentNode.insertBefore(c,g.nextSibling):g.parentNode.insertBefore(c,g),i=c}},_closeOnNavClick:function(){if(h.closeOnNavClick){var a=g.getElementsByTagName("a"),b=this;s(a,function(c){m(a[c],"click",function(){k&&b.toggle()},!1)})}},_preventDefault:function(a){return a.preventDefault?(a.stopImmediatePropagation&&a.stopImmediatePropagation(),a.preventDefault(),a.stopPropagation(),!1):void(a.returnValue=!1)},_onTouchStart:function(a){Event.prototype.stopImmediatePropagation||this._preventDefault(a),this.startX=a.touches[0].clientX,this.startY=a.touches[0].clientY,this.touchHasMoved=!1,n(i,"mouseup",this,!1)},_onTouchMove:function(a){(Math.abs(a.touches[0].clientX-this.startX)>10||Math.abs(a.touches[0].clientY-this.startY)>10)&&(this.touchHasMoved=!0)},_onTouchEnd:function(a){if(this._preventDefault(a),k&&!this.touchHasMoved){if("touchend"===a.type)return void this.toggle();var c=a||b.event;3!==c.which&&2!==c.button&&this.toggle()}},_onKeyUp:function(a){var c=a||b.event;13===c.keyCode&&this.toggle()},_transitions:function(){if(h.animate){var a=g.style,b="max-height "+h.transition+"ms";a.WebkitTransition=a.MozTransition=a.OTransition=a.transition=b}},_calcHeight:function(){for(var a=0,b=0;b<g.inner.length;b++)a+=g.inner[b].offsetHeight;var c="."+h.jsClass+" ."+h.navClass+"-"+this.index+".opened{max-height:"+a+"px !important} ."+h.jsClass+" ."+h.navClass+"-"+this.index+".opened.dropdown-active {max-height:9999px !important}";t.styleSheet?t.styleSheet.cssText=c:t.innerHTML=c,c=""}},new v(d,e)};b.responsiveNav=d}(document,window,0);
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: responsive-nav-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.38
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas McNiven
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: responsive-nav.com for the rails asset pipeline
|
14
14
|
email:
|
@@ -49,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
49
|
version: '0'
|
50
50
|
requirements: []
|
51
51
|
rubyforge_project:
|
52
|
-
rubygems_version: 2.
|
52
|
+
rubygems_version: 2.4.5
|
53
53
|
signing_key:
|
54
54
|
specification_version: 4
|
55
55
|
summary: an asset gemification of the responsive-nav plugin
|