responsive-nav-rails 1.0.13 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca1bed6b25ccd912c7bc44e71d82e75b8a8ac115
|
4
|
+
data.tar.gz: dcf31c8cdf895cbef60e7f080bc6372f419439a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3ff2e6216632989393df23af3db02f2d12587dd7f4eabe1321986520b626db24779e28e7593f4c92d5f3cbf78663c34c6783754e0a49ad90546c98bb86bfd89
|
7
|
+
data.tar.gz: 3c290234eb741fdd1e594c19cc99730f95d7621604eaedc905d402b22505c5710715e9d9dbd1e523bd1835e993ceeeb444b45c08a40bebb9b20f6cbc75b9ff7d
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! responsive-nav.js v1.0.
|
1
|
+
/*! responsive-nav.js v1.0.14
|
2
2
|
* https://github.com/viljamis/responsive-nav.js
|
3
3
|
* http://responsive-nav.com
|
4
4
|
*
|
@@ -121,8 +121,6 @@ var responsiveNav = (function (window, document) {
|
|
121
121
|
el.className = el.className.replace(reg, " ").replace(/(^\s*)|(\s*$)/g,"");
|
122
122
|
},
|
123
123
|
|
124
|
-
log = function () {},
|
125
|
-
|
126
124
|
ResponsiveNav = function (el, options) {
|
127
125
|
var i;
|
128
126
|
|
@@ -135,7 +133,6 @@ var responsiveNav = (function (window, document) {
|
|
135
133
|
customToggle: "", // Selector: Specify the ID of a custom toggle
|
136
134
|
openPos: "relative", // String: Position of the opened nav, relative or static
|
137
135
|
jsClass: "js", // String: 'JS enabled' class which is added to <html> el
|
138
|
-
debug: false, // Boolean: Log debug messages to console, true or false
|
139
136
|
init: function(){}, // Function: Init callback
|
140
137
|
open: function(){}, // Function: Open callback
|
141
138
|
close: function(){} // Function: Close callback
|
@@ -143,27 +140,12 @@ var responsiveNav = (function (window, document) {
|
|
143
140
|
|
144
141
|
// User defined options
|
145
142
|
for (i in options) {
|
146
|
-
|
147
|
-
this.options[i] = options[i];
|
148
|
-
} else {
|
149
|
-
throw new Error("Responsive Nav doesn't support option: " + i);
|
150
|
-
}
|
143
|
+
this.options[i] = options[i];
|
151
144
|
}
|
152
145
|
|
153
146
|
// Adds "js" class for <html>
|
154
147
|
addClass(docEl, this.options.jsClass);
|
155
148
|
|
156
|
-
// Debug logger
|
157
|
-
if (this.options.debug) {
|
158
|
-
log = function (s) {
|
159
|
-
try {
|
160
|
-
console.log(s);
|
161
|
-
} catch (e) {
|
162
|
-
alert(s);
|
163
|
-
}
|
164
|
-
};
|
165
|
-
}
|
166
|
-
|
167
149
|
// Wrapper
|
168
150
|
this.wrapperEl = el.replace("#", "");
|
169
151
|
if (document.getElementById(this.wrapperEl)) {
|
@@ -185,7 +167,6 @@ var responsiveNav = (function (window, document) {
|
|
185
167
|
};
|
186
168
|
|
187
169
|
ResponsiveNav.prototype = {
|
188
|
-
|
189
170
|
// Public methods
|
190
171
|
destroy: function () {
|
191
172
|
this._removeStyles();
|
@@ -209,8 +190,6 @@ var responsiveNav = (function (window, document) {
|
|
209
190
|
} else {
|
210
191
|
navToggle.removeAttribute("aria-hidden");
|
211
192
|
}
|
212
|
-
|
213
|
-
log("Destroyed!");
|
214
193
|
},
|
215
194
|
|
216
195
|
toggle: function () {
|
@@ -222,8 +201,6 @@ var responsiveNav = (function (window, document) {
|
|
222
201
|
|
223
202
|
navOpen = true;
|
224
203
|
opts.open();
|
225
|
-
log("Opened nav");
|
226
|
-
|
227
204
|
} else {
|
228
205
|
removeClass(nav, "opened");
|
229
206
|
addClass(nav, "closed");
|
@@ -239,7 +216,6 @@ var responsiveNav = (function (window, document) {
|
|
239
216
|
|
240
217
|
navOpen = false;
|
241
218
|
opts.close();
|
242
|
-
log("Closed nav");
|
243
219
|
}
|
244
220
|
},
|
245
221
|
|
@@ -274,7 +250,6 @@ var responsiveNav = (function (window, document) {
|
|
274
250
|
|
275
251
|
// Private methods
|
276
252
|
_init: function () {
|
277
|
-
log("Inited Responsive Nav");
|
278
253
|
addClass(nav, "closed");
|
279
254
|
this._createToggle();
|
280
255
|
|
@@ -290,14 +265,12 @@ var responsiveNav = (function (window, document) {
|
|
290
265
|
_createStyles: function () {
|
291
266
|
if (!styleElement.parentNode) {
|
292
267
|
head.appendChild(styleElement);
|
293
|
-
log("Created 'styleElement' to <head>");
|
294
268
|
}
|
295
269
|
},
|
296
270
|
|
297
271
|
_removeStyles: function () {
|
298
272
|
if (styleElement.parentNode) {
|
299
273
|
styleElement.parentNode.removeChild(styleElement);
|
300
|
-
log("Removed 'styleElement' from <head>");
|
301
274
|
}
|
302
275
|
},
|
303
276
|
|
@@ -317,14 +290,11 @@ var responsiveNav = (function (window, document) {
|
|
317
290
|
}
|
318
291
|
|
319
292
|
navToggle = document.getElementById("nav-toggle");
|
320
|
-
log("Default nav toggle created");
|
321
|
-
|
322
293
|
} else {
|
323
294
|
var toggleEl = opts.customToggle.replace("#", "");
|
324
295
|
|
325
296
|
if (document.getElementById(toggleEl)) {
|
326
297
|
navToggle = document.getElementById(toggleEl);
|
327
|
-
log("Custom nav toggle created");
|
328
298
|
} else {
|
329
299
|
throw new Error("The custom nav toggle you are trying to select doesn't exist");
|
330
300
|
}
|
@@ -399,8 +369,6 @@ var responsiveNav = (function (window, document) {
|
|
399
369
|
styleElement.innerHTML = innerStyles;
|
400
370
|
innerStyles = "";
|
401
371
|
}
|
402
|
-
|
403
|
-
log("Calculated max-height of " + savedHeight + "px and updated 'styleElement'");
|
404
372
|
},
|
405
373
|
|
406
374
|
_resize: function () {
|
@@ -1,12 +1,11 @@
|
|
1
|
-
/*! responsive-nav.js v1.0.
|
2
|
-
var responsiveNav=function(g,
|
3
|
-
c,
|
4
|
-
typeof c&&c.handleEvent?a.detachEvent("on"+
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
g.getComputedStyle(e,null).getPropertyValue("display")?(m(e,{"aria-hidden":"false"}),d.className.match(/(^|\s)closed(\s|$)/)&&(m(d,{"aria-hidden":"true"}),d.style.position="absolute"),this._createStyles(),this._calcHeight()):(m(e,{"aria-hidden":"true"}),m(d,{"aria-hidden":"false"}),d.style.position=f.openPos,this._removeStyles());f.init()}};var r;return function(a,b){r||(r=new t(a,b));return r}}(window,document);
|
1
|
+
/*! responsive-nav.js v1.0.14 by @viljamis, http://responsive-nav.com, MIT license */
|
2
|
+
var responsiveNav=function(g,h){var t=!!g.getComputedStyle;g.getComputedStyle||(g.getComputedStyle=function(a){this.el=a;this.getPropertyValue=function(d){var c=/(\-([a-z]){1})/g;"float"===d&&(d="styleFloat");c.test(d)&&(d=d.replace(c,function(a,d,c){return c.toUpperCase()}));return a.currentStyle[d]?a.currentStyle[d]:null};return this});var b,f,e,u=h.documentElement,v=h.getElementsByTagName("head")[0],m=h.createElement("style"),r=!1,j=function(a,d,c,b){if("addEventListener"in a)try{a.addEventListener(d,
|
3
|
+
c,b)}catch(e){if("object"===typeof c&&c.handleEvent)a.addEventListener(d,function(a){c.handleEvent.call(c,a)},b);else throw e;}else"attachEvent"in a&&("object"===typeof c&&c.handleEvent?a.attachEvent("on"+d,function(){c.handleEvent.call(c)}):a.attachEvent("on"+d,c))},k=function(a,d,c,b){if("removeEventListener"in a)try{a.removeEventListener(d,c,b)}catch(e){if("object"===typeof c&&c.handleEvent)a.removeEventListener(d,function(a){c.handleEvent.call(c,a)},b);else throw e;}else"detachEvent"in a&&("object"===
|
4
|
+
typeof c&&c.handleEvent?a.detachEvent("on"+d,function(){c.handleEvent.call(c)}):a.detachEvent("on"+d,c))},l=function(a,d){for(var b in d)a.setAttribute(b,d[b])},n=function(a,b){a.className+=" "+b;a.className=a.className.replace(/(^\s*)|(\s*$)/g,"")},p=function(a,b){a.className=a.className.replace(RegExp("(\\s|^)"+b+"(\\s|$)")," ").replace(/(^\s*)|(\s*$)/g,"")},s=function(a,d){var c;this.options={animate:!0,transition:400,label:"Menu",insert:"after",customToggle:"",openPos:"relative",jsClass:"js",
|
5
|
+
init:function(){},open:function(){},close:function(){}};for(c in d)this.options[c]=d[c];n(u,this.options.jsClass);this.wrapperEl=a.replace("#","");if(h.getElementById(this.wrapperEl))this.wrapper=h.getElementById(this.wrapperEl);else throw Error("The nav element you are trying to select doesn't exist");c=this.wrapper;for(var e=this.wrapper.firstChild;null!==e&&1!==e.nodeType;)e=e.nextSibling;c.inner=e;f=this.options;b=this.wrapper;this._init(this)};s.prototype={destroy:function(){this._removeStyles();
|
6
|
+
p(b,"closed");p(b,"opened");b.removeAttribute("style");b.removeAttribute("aria-hidden");q=b=null;k(g,"load",this,!1);k(g,"resize",this,!1);k(e,"mousedown",this,!1);k(e,"touchstart",this,!1);k(e,"touchend",this,!1);k(e,"keyup",this,!1);k(e,"click",this,!1);f.customToggle?e.removeAttribute("aria-hidden"):e.parentNode.removeChild(e)},toggle:function(){r?(p(b,"opened"),n(b,"closed"),l(b,{"aria-hidden":"true"}),f.animate?setTimeout(function(){b.style.position="absolute"},f.transition+10):b.style.position=
|
7
|
+
"absolute",r=!1,f.close()):(p(b,"closed"),n(b,"opened"),b.style.position=f.openPos,l(b,{"aria-hidden":"false"}),r=!0,f.open())},handleEvent:function(a){a=a||g.event;switch(a.type){case "mousedown":this._onmousedown(a);break;case "touchstart":this._ontouchstart(a);break;case "touchend":this._ontouchend(a);break;case "keyup":this._onkeyup(a);break;case "click":this._onclick(a);break;case "load":this._transitions(a);this._resize(a);break;case "resize":this._resize(a)}},_init:function(){n(b,"closed");
|
8
|
+
this._createToggle();j(g,"load",this,!1);j(g,"resize",this,!1);j(e,"mousedown",this,!1);j(e,"touchstart",this,!1);j(e,"touchend",this,!1);j(e,"keyup",this,!1);j(e,"click",this,!1)},_createStyles:function(){m.parentNode||v.appendChild(m)},_removeStyles:function(){m.parentNode&&m.parentNode.removeChild(m)},_createToggle:function(){if(f.customToggle){var a=f.customToggle.replace("#","");if(h.getElementById(a))e=h.getElementById(a);else throw Error("The custom nav toggle you are trying to select doesn't exist");
|
9
|
+
}else a=h.createElement("a"),a.innerHTML=f.label,l(a,{href:"#",id:"nav-toggle"}),"after"===f.insert?b.parentNode.insertBefore(a,b.nextSibling):b.parentNode.insertBefore(a,b),e=h.getElementById("nav-toggle")},_preventDefault:function(a){a.preventDefault?(a.preventDefault(),a.stopPropagation()):a.returnValue=!1},_onmousedown:function(a){var b=a||g.event;3===b.which||2===b.button||(this._preventDefault(a),this.toggle(a))},_ontouchstart:function(a){e.onmousedown=null;this._preventDefault(a);this.toggle(a)},
|
10
|
+
_ontouchend:function(){var a=this;b.addEventListener("click",a._preventDefault,!0);setTimeout(function(){b.removeEventListener("click",a._preventDefault,!0)},f.transition)},_onkeyup:function(a){13===(a||g.event).keyCode&&this.toggle(a)},_onclick:function(a){this._preventDefault(a)},_transitions:function(){if(f.animate){var a=b.style,d="max-height "+f.transition+"ms";a.WebkitTransition=d;a.MozTransition=d;a.OTransition=d;a.transition=d}},_calcHeight:function(){var a="#"+this.wrapperEl+".opened{max-height:"+
|
11
|
+
b.inner.offsetHeight+"px}";t&&(m.innerHTML=a)},_resize:function(){"none"!==g.getComputedStyle(e,null).getPropertyValue("display")?(l(e,{"aria-hidden":"false"}),b.className.match(/(^|\s)closed(\s|$)/)&&(l(b,{"aria-hidden":"true"}),b.style.position="absolute"),this._createStyles(),this._calcHeight()):(l(e,{"aria-hidden":"true"}),l(b,{"aria-hidden":"false"}),b.style.position=f.openPos,this._removeStyles());f.init()}};var q;return function(a,b){q||(q=new s(a,b));return q}}(window,document);
|
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.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas McNiven
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|