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: f3565b66b413a18ab3631284af710816193289b0
4
- data.tar.gz: 0deafc3fda76e1f752067ff77bed98ce1f9bc38c
3
+ metadata.gz: ca1bed6b25ccd912c7bc44e71d82e75b8a8ac115
4
+ data.tar.gz: dcf31c8cdf895cbef60e7f080bc6372f419439a9
5
5
  SHA512:
6
- metadata.gz: 4714b436bd8f038987ef0b8efeec0c62eabd93645b8b3daf62df88405e5b30410bc7d6d9ec9c94be2a2e5bbe16b8d7617f3c24d69d4876940a26a857d396a4e2
7
- data.tar.gz: c296ea76249abf21ba5a57ae279f8fe9a1320621e82f5e95e76fb54849e645362ca546b22877cbd8d36413c342d28d040dfb997e2c3bce3b25bc80a19adf35ef
6
+ metadata.gz: a3ff2e6216632989393df23af3db02f2d12587dd7f4eabe1321986520b626db24779e28e7593f4c92d5f3cbf78663c34c6783754e0a49ad90546c98bb86bfd89
7
+ data.tar.gz: 3c290234eb741fdd1e594c19cc99730f95d7621604eaedc905d402b22505c5710715e9d9dbd1e523bd1835e993ceeeb444b45c08a40bebb9b20f6cbc75b9ff7d
@@ -1,3 +1,3 @@
1
1
  module ResponsiveNavRails
2
- VERSION = "1.0.13"
2
+ VERSION = "1.0.14"
3
3
  end
@@ -1,4 +1,4 @@
1
- /*! responsive-nav.js v1.0.13
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
- if (i in this.options) {
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.13 by @viljamis, http://responsive-nav.com, MIT license */
2
- var responsiveNav=function(g,j){var u=!!g.getComputedStyle;g.getComputedStyle||(g.getComputedStyle=function(a){this.el=a;this.getPropertyValue=function(b){var c=/(\-([a-z]){1})/g;"float"===b&&(b="styleFloat");c.test(b)&&(b=b.replace(c,function(a,b,c){return c.toUpperCase()}));return a.currentStyle[b]?a.currentStyle[b]:null};return this});var d,f,e,v=j.documentElement,w=j.getElementsByTagName("head")[0],n=j.createElement("style"),s=!1,k=function(a,b,c,d){if("addEventListener"in a)try{a.addEventListener(b,
3
- c,d)}catch(e){if("object"===typeof c&&c.handleEvent)a.addEventListener(b,function(a){c.handleEvent.call(c,a)},d);else throw e;}else"attachEvent"in a&&("object"===typeof c&&c.handleEvent?a.attachEvent("on"+b,function(){c.handleEvent.call(c)}):a.attachEvent("on"+b,c))},l=function(a,b,c,d){if("removeEventListener"in a)try{a.removeEventListener(b,c,d)}catch(e){if("object"===typeof c&&c.handleEvent)a.removeEventListener(b,function(a){c.handleEvent.call(c,a)},d);else throw e;}else"detachEvent"in a&&("object"===
4
- typeof c&&c.handleEvent?a.detachEvent("on"+b,function(){c.handleEvent.call(c)}):a.detachEvent("on"+b,c))},m=function(a,b){for(var c in b)a.setAttribute(c,b[c])},p=function(a,b){a.className+=" "+b;a.className=a.className.replace(/(^\s*)|(\s*$)/g,"")},q=function(a,b){a.className=a.className.replace(RegExp("(\\s|^)"+b+"(\\s|$)")," ").replace(/(^\s*)|(\s*$)/g,"")},h=function(){},t=function(a,b){var c;this.options={animate:!0,transition:400,label:"Menu",insert:"after",customToggle:"",openPos:"relative",
5
- jsClass:"js",debug:!1,init:function(){},open:function(){},close:function(){}};for(c in b)if(c in this.options)this.options[c]=b[c];else throw Error("Responsive Nav doesn't support option: "+c);p(v,this.options.jsClass);this.options.debug&&(h=function(a){try{console.log(a)}catch(b){alert(a)}});this.wrapperEl=a.replace("#","");if(j.getElementById(this.wrapperEl))this.wrapper=j.getElementById(this.wrapperEl);else throw Error("The nav element you are trying to select doesn't exist");c=this.wrapper;for(var e=
6
- this.wrapper.firstChild;null!==e&&1!==e.nodeType;)e=e.nextSibling;c.inner=e;f=this.options;d=this.wrapper;this._init(this)};t.prototype={destroy:function(){this._removeStyles();q(d,"closed");q(d,"opened");d.removeAttribute("style");d.removeAttribute("aria-hidden");r=d=null;l(g,"load",this,!1);l(g,"resize",this,!1);l(e,"mousedown",this,!1);l(e,"touchstart",this,!1);l(e,"touchend",this,!1);l(e,"keyup",this,!1);l(e,"click",this,!1);f.customToggle?e.removeAttribute("aria-hidden"):e.parentNode.removeChild(e);
7
- h("Destroyed!")},toggle:function(){s?(q(d,"opened"),p(d,"closed"),m(d,{"aria-hidden":"true"}),f.animate?setTimeout(function(){d.style.position="absolute"},f.transition+10):d.style.position="absolute",s=!1,f.close(),h("Closed nav")):(q(d,"closed"),p(d,"opened"),d.style.position=f.openPos,m(d,{"aria-hidden":"false"}),s=!0,f.open(),h("Opened nav"))},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);
8
- 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(){h("Inited Responsive Nav");p(d,"closed");this._createToggle();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)},_createStyles:function(){n.parentNode||(w.appendChild(n),h("Created 'styleElement' to <head>"))},
9
- _removeStyles:function(){n.parentNode&&(n.parentNode.removeChild(n),h("Removed 'styleElement' from <head>"))},_createToggle:function(){if(f.customToggle){var a=f.customToggle.replace("#","");if(j.getElementById(a))e=j.getElementById(a),h("Custom nav toggle created");else throw Error("The custom nav toggle you are trying to select doesn't exist");}else a=j.createElement("a"),a.innerHTML=f.label,m(a,{href:"#",id:"nav-toggle"}),"after"===f.insert?d.parentNode.insertBefore(a,d.nextSibling):d.parentNode.insertBefore(a,
10
- d),e=j.getElementById("nav-toggle"),h("Default nav toggle created")},_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)},_ontouchend:function(){var a=this;d.addEventListener("click",a._preventDefault,!0);setTimeout(function(){d.removeEventListener("click",
11
- 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=d.style,b="max-height "+f.transition+"ms";a.WebkitTransition=b;a.MozTransition=b;a.OTransition=b;a.transition=b}},_calcHeight:function(){var a=d.inner.offsetHeight,b="#"+this.wrapperEl+".opened{max-height:"+a+"px}";u&&(n.innerHTML=b);h("Calculated max-height of "+a+"px and updated 'styleElement'")},_resize:function(){"none"!==
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);
@@ -1,4 +1,4 @@
1
- /*! responsive-nav.js v1.0.13 by @viljamis */
1
+ /*! responsive-nav.js v1.0.14 by @viljamis */
2
2
 
3
3
  #nav ul {
4
4
  margin: 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.13
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 00:00:00.000000000 Z
11
+ date: 2013-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties