responsive-nav-rails 1.0.13

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f3565b66b413a18ab3631284af710816193289b0
4
+ data.tar.gz: 0deafc3fda76e1f752067ff77bed98ce1f9bc38c
5
+ SHA512:
6
+ metadata.gz: 4714b436bd8f038987ef0b8efeec0c62eabd93645b8b3daf62df88405e5b30410bc7d6d9ec9c94be2a2e5bbe16b8d7617f3c24d69d4876940a26a857d396a4e2
7
+ data.tar.gz: c296ea76249abf21ba5a57ae279f8fe9a1320621e82f5e95e76fb54849e645362ca546b22877cbd8d36413c342d28d040dfb997e2c3bce3b25bc80a19adf35ef
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in responsive-nav-rails.gemspec
4
+ gemspec
data/LICENSE.md ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Thomas McNiven
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # responsive-nav-rails
2
+
3
+ [responsive-nav](http://responsive-nav.com) for the Rails asset pipeline
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem "responsive-nav-rails"
10
+
11
+ ## Usage
12
+
13
+ In your CSS manifest file:
14
+
15
+ *= responsive-nav
16
+
17
+ In your JavaScript manifest file:
18
+
19
+ //= responsive-nav
20
+
21
+ or for the minified version
22
+
23
+ //= responsive-nav.min
24
+
25
+ ## License
26
+
27
+ [The MIT License](https://github.com/vevix/responsive-nav-rails/blob/master/LICENSE.md)
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,4 @@
1
+ module ResponsiveNavRails
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ module ResponsiveNavRails
2
+ VERSION = "1.0.13"
3
+ end
@@ -0,0 +1,2 @@
1
+ require "responsive-nav-rails/version"
2
+ require "responsive-nav-rails/engine"
@@ -0,0 +1,20 @@
1
+ # coding: utf-8
2
+ require File.expand_path("../lib/responsive-nav-rails/version", __FILE__)
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.name = "responsive-nav-rails"
6
+ spec.version = ResponsiveNavRails::VERSION
7
+ spec.authors = ["Thomas McNiven"]
8
+ spec.email = ["trmcniven@vevix.net"]
9
+ spec.description = "responsive-nav.com for the rails asset pipeline"
10
+ spec.summary = "an asset gemification of the responsive-nav plugin"
11
+ spec.homepage = "https://github.com/vevix/responsive-nav-rails"
12
+ spec.license = "MIT"
13
+
14
+ spec.files = `git ls-files`.split($/)
15
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
+ spec.require_paths = ["lib"]
18
+
19
+ spec.add_dependency "railties", ">= 3.1"
20
+ end
@@ -0,0 +1,440 @@
1
+ /*! responsive-nav.js v1.0.13
2
+ * https://github.com/viljamis/responsive-nav.js
3
+ * http://responsive-nav.com
4
+ *
5
+ * Copyright (c) 2013 @viljamis
6
+ * Available under the MIT license
7
+ */
8
+
9
+ /* jshint strict:false, forin:false, noarg:true, noempty:true, eqeqeq:true,
10
+ boss:true, bitwise:true, browser:true, devel:true, indent:2 */
11
+ /* exported responsiveNav */
12
+
13
+ var responsiveNav = (function (window, document) {
14
+
15
+ var computed = !!window.getComputedStyle;
16
+
17
+ // getComputedStyle polyfill
18
+ if (!window.getComputedStyle) {
19
+ window.getComputedStyle = function(el) {
20
+ this.el = el;
21
+ this.getPropertyValue = function(prop) {
22
+ var re = /(\-([a-z]){1})/g;
23
+ if (prop === "float") {
24
+ prop = "styleFloat";
25
+ }
26
+ if (re.test(prop)) {
27
+ prop = prop.replace(re, function () {
28
+ return arguments[2].toUpperCase();
29
+ });
30
+ }
31
+ return el.currentStyle[prop] ? el.currentStyle[prop] : null;
32
+ };
33
+ return this;
34
+ };
35
+ }
36
+
37
+ var nav,
38
+ opts,
39
+ navToggle,
40
+ docEl = document.documentElement,
41
+ head = document.getElementsByTagName("head")[0],
42
+ styleElement = document.createElement("style"),
43
+ navOpen = false,
44
+
45
+ // fn arg can be an object or a function, thanks to handleEvent
46
+ // read more at: http://www.thecssninja.com/javascript/handleevent
47
+ addEvent = function (el, evt, fn, bubble) {
48
+ if ("addEventListener" in el) {
49
+ // BBOS6 doesn't support handleEvent, catch and polyfill
50
+ try {
51
+ el.addEventListener(evt, fn, bubble);
52
+ } catch (e) {
53
+ if (typeof fn === "object" && fn.handleEvent) {
54
+ el.addEventListener(evt, function (e) {
55
+ // Bind fn as this and set first arg as event object
56
+ fn.handleEvent.call(fn, e);
57
+ }, bubble);
58
+ } else {
59
+ throw e;
60
+ }
61
+ }
62
+ } else if ("attachEvent" in el) {
63
+ // check if the callback is an object and contains handleEvent
64
+ if (typeof fn === "object" && fn.handleEvent) {
65
+ el.attachEvent("on" + evt, function () {
66
+ // Bind fn as this
67
+ fn.handleEvent.call(fn);
68
+ });
69
+ } else {
70
+ el.attachEvent("on" + evt, fn);
71
+ }
72
+ }
73
+ },
74
+
75
+ removeEvent = function (el, evt, fn, bubble) {
76
+ if ("removeEventListener" in el) {
77
+ try {
78
+ el.removeEventListener(evt, fn, bubble);
79
+ } catch (e) {
80
+ if (typeof fn === "object" && fn.handleEvent) {
81
+ el.removeEventListener(evt, function (e) {
82
+ fn.handleEvent.call(fn, e);
83
+ }, bubble);
84
+ } else {
85
+ throw e;
86
+ }
87
+ }
88
+ } else if ("detachEvent" in el) {
89
+ if (typeof fn === "object" && fn.handleEvent) {
90
+ el.detachEvent("on" + evt, function () {
91
+ fn.handleEvent.call(fn);
92
+ });
93
+ } else {
94
+ el.detachEvent("on" + evt, fn);
95
+ }
96
+ }
97
+ },
98
+
99
+ getFirstChild = function (e) {
100
+ var firstChild = e.firstChild;
101
+ // skip TextNodes
102
+ while (firstChild !== null && firstChild.nodeType !== 1) {
103
+ firstChild = firstChild.nextSibling;
104
+ }
105
+ return firstChild;
106
+ },
107
+
108
+ setAttributes = function (el, attrs) {
109
+ for (var key in attrs) {
110
+ el.setAttribute(key, attrs[key]);
111
+ }
112
+ },
113
+
114
+ addClass = function (el, cls) {
115
+ el.className += " " + cls;
116
+ el.className = el.className.replace(/(^\s*)|(\s*$)/g,"");
117
+ },
118
+
119
+ removeClass = function (el, cls) {
120
+ var reg = new RegExp("(\\s|^)" + cls + "(\\s|$)");
121
+ el.className = el.className.replace(reg, " ").replace(/(^\s*)|(\s*$)/g,"");
122
+ },
123
+
124
+ log = function () {},
125
+
126
+ ResponsiveNav = function (el, options) {
127
+ var i;
128
+
129
+ // Default options
130
+ this.options = {
131
+ animate: true, // Boolean: Use CSS3 transitions, true or false
132
+ transition: 400, // Integer: Speed of the transition, in milliseconds
133
+ label: "Menu", // String: Label for the navigation toggle
134
+ insert: "after", // String: Insert the toggle before or after the navigation
135
+ customToggle: "", // Selector: Specify the ID of a custom toggle
136
+ openPos: "relative", // String: Position of the opened nav, relative or static
137
+ 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
+ init: function(){}, // Function: Init callback
140
+ open: function(){}, // Function: Open callback
141
+ close: function(){} // Function: Close callback
142
+ };
143
+
144
+ // User defined options
145
+ 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
+ }
151
+ }
152
+
153
+ // Adds "js" class for <html>
154
+ addClass(docEl, this.options.jsClass);
155
+
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
+ // Wrapper
168
+ this.wrapperEl = el.replace("#", "");
169
+ if (document.getElementById(this.wrapperEl)) {
170
+ this.wrapper = document.getElementById(this.wrapperEl);
171
+ } else {
172
+ // If el doesn't exists, stop here.
173
+ throw new Error("The nav element you are trying to select doesn't exist");
174
+ }
175
+
176
+ // Inner wrapper
177
+ this.wrapper.inner = getFirstChild(this.wrapper);
178
+
179
+ // For minification
180
+ opts = this.options;
181
+ nav = this.wrapper;
182
+
183
+ // Init
184
+ this._init(this);
185
+ };
186
+
187
+ ResponsiveNav.prototype = {
188
+
189
+ // Public methods
190
+ destroy: function () {
191
+ this._removeStyles();
192
+ removeClass(nav, "closed");
193
+ removeClass(nav, "opened");
194
+ nav.removeAttribute("style");
195
+ nav.removeAttribute("aria-hidden");
196
+ nav = null;
197
+ _instance = null;
198
+
199
+ removeEvent(window, "load", this, false);
200
+ removeEvent(window, "resize", this, false);
201
+ removeEvent(navToggle, "mousedown", this, false);
202
+ removeEvent(navToggle, "touchstart", this, false);
203
+ removeEvent(navToggle, "touchend", this, false);
204
+ removeEvent(navToggle, "keyup", this, false);
205
+ removeEvent(navToggle, "click", this, false);
206
+
207
+ if (!opts.customToggle) {
208
+ navToggle.parentNode.removeChild(navToggle);
209
+ } else {
210
+ navToggle.removeAttribute("aria-hidden");
211
+ }
212
+
213
+ log("Destroyed!");
214
+ },
215
+
216
+ toggle: function () {
217
+ if (!navOpen) {
218
+ removeClass(nav, "closed");
219
+ addClass(nav, "opened");
220
+ nav.style.position = opts.openPos;
221
+ setAttributes(nav, {"aria-hidden": "false"});
222
+
223
+ navOpen = true;
224
+ opts.open();
225
+ log("Opened nav");
226
+
227
+ } else {
228
+ removeClass(nav, "opened");
229
+ addClass(nav, "closed");
230
+ setAttributes(nav, {"aria-hidden": "true"});
231
+
232
+ if (opts.animate) {
233
+ setTimeout(function () {
234
+ nav.style.position = "absolute";
235
+ }, opts.transition + 10);
236
+ } else {
237
+ nav.style.position = "absolute";
238
+ }
239
+
240
+ navOpen = false;
241
+ opts.close();
242
+ log("Closed nav");
243
+ }
244
+ },
245
+
246
+ handleEvent: function (e) {
247
+ var evt = e || window.event;
248
+
249
+ switch (evt.type) {
250
+ case "mousedown":
251
+ this._onmousedown(evt);
252
+ break;
253
+ case "touchstart":
254
+ this._ontouchstart(evt);
255
+ break;
256
+ case "touchend":
257
+ this._ontouchend(evt);
258
+ break;
259
+ case "keyup":
260
+ this._onkeyup(evt);
261
+ break;
262
+ case "click":
263
+ this._onclick(evt);
264
+ break;
265
+ case "load":
266
+ this._transitions(evt);
267
+ this._resize(evt);
268
+ break;
269
+ case "resize":
270
+ this._resize(evt);
271
+ break;
272
+ }
273
+ },
274
+
275
+ // Private methods
276
+ _init: function () {
277
+ log("Inited Responsive Nav");
278
+ addClass(nav, "closed");
279
+ this._createToggle();
280
+
281
+ addEvent(window, "load", this, false);
282
+ addEvent(window, "resize", this, false);
283
+ addEvent(navToggle, "mousedown", this, false);
284
+ addEvent(navToggle, "touchstart", this, false);
285
+ addEvent(navToggle, "touchend", this, false);
286
+ addEvent(navToggle, "keyup", this, false);
287
+ addEvent(navToggle, "click", this, false);
288
+ },
289
+
290
+ _createStyles: function () {
291
+ if (!styleElement.parentNode) {
292
+ head.appendChild(styleElement);
293
+ log("Created 'styleElement' to <head>");
294
+ }
295
+ },
296
+
297
+ _removeStyles: function () {
298
+ if (styleElement.parentNode) {
299
+ styleElement.parentNode.removeChild(styleElement);
300
+ log("Removed 'styleElement' from <head>");
301
+ }
302
+ },
303
+
304
+ _createToggle: function () {
305
+ if (!opts.customToggle) {
306
+ var toggle = document.createElement("a");
307
+ toggle.innerHTML = opts.label;
308
+ setAttributes(toggle, {
309
+ "href": "#",
310
+ "id": "nav-toggle"
311
+ });
312
+
313
+ if (opts.insert === "after") {
314
+ nav.parentNode.insertBefore(toggle, nav.nextSibling);
315
+ } else {
316
+ nav.parentNode.insertBefore(toggle, nav);
317
+ }
318
+
319
+ navToggle = document.getElementById("nav-toggle");
320
+ log("Default nav toggle created");
321
+
322
+ } else {
323
+ var toggleEl = opts.customToggle.replace("#", "");
324
+
325
+ if (document.getElementById(toggleEl)) {
326
+ navToggle = document.getElementById(toggleEl);
327
+ log("Custom nav toggle created");
328
+ } else {
329
+ throw new Error("The custom nav toggle you are trying to select doesn't exist");
330
+ }
331
+ }
332
+ },
333
+
334
+ _preventDefault: function(e) {
335
+ if (e.preventDefault) {
336
+ e.preventDefault();
337
+ e.stopPropagation();
338
+ } else {
339
+ e.returnValue = false;
340
+ }
341
+ },
342
+
343
+ _onmousedown: function (e) {
344
+ var evt = e || window.event;
345
+ // If the user isn't right clicking:
346
+ if (!(evt.which === 3 || evt.button === 2)) {
347
+ this._preventDefault(e);
348
+ this.toggle(e);
349
+ }
350
+ },
351
+
352
+ _ontouchstart: function (e) {
353
+ // Touchstart event fires before
354
+ // the mousedown and can wipe it
355
+ navToggle.onmousedown = null;
356
+ this._preventDefault(e);
357
+ this.toggle(e);
358
+ },
359
+
360
+ _ontouchend: function () {
361
+ // Prevents ghost click from happening on some Android browsers
362
+ var that = this;
363
+ nav.addEventListener("click", that._preventDefault, true);
364
+ setTimeout(function () {
365
+ nav.removeEventListener("click", that._preventDefault, true);
366
+ }, opts.transition);
367
+ },
368
+
369
+ _onkeyup: function (e) {
370
+ var evt = e || window.event;
371
+ if (evt.keyCode === 13) {
372
+ this.toggle(e);
373
+ }
374
+ },
375
+
376
+ _onclick: function (e) {
377
+ // For older browsers (looking at IE)
378
+ this._preventDefault(e);
379
+ },
380
+
381
+ _transitions: function () {
382
+ if (opts.animate) {
383
+ var objStyle = nav.style,
384
+ transition = "max-height " + opts.transition + "ms";
385
+
386
+ objStyle.WebkitTransition = transition;
387
+ objStyle.MozTransition = transition;
388
+ objStyle.OTransition = transition;
389
+ objStyle.transition = transition;
390
+ }
391
+ },
392
+
393
+ _calcHeight: function () {
394
+ var savedHeight = nav.inner.offsetHeight,
395
+ innerStyles = "#" + this.wrapperEl + ".opened{max-height:" + savedHeight + "px}";
396
+
397
+ // Hide from old IE
398
+ if (computed) {
399
+ styleElement.innerHTML = innerStyles;
400
+ innerStyles = "";
401
+ }
402
+
403
+ log("Calculated max-height of " + savedHeight + "px and updated 'styleElement'");
404
+ },
405
+
406
+ _resize: function () {
407
+ if (window.getComputedStyle(navToggle, null).getPropertyValue("display") !== "none") {
408
+ setAttributes(navToggle, {"aria-hidden": "false"});
409
+
410
+ // If the navigation is hidden
411
+ if (nav.className.match(/(^|\s)closed(\s|$)/)) {
412
+ setAttributes(nav, {"aria-hidden": "true"});
413
+ nav.style.position = "absolute";
414
+ }
415
+
416
+ this._createStyles();
417
+ this._calcHeight();
418
+ } else {
419
+ setAttributes(navToggle, {"aria-hidden": "true"});
420
+ setAttributes(nav, {"aria-hidden": "false"});
421
+ nav.style.position = opts.openPos;
422
+ this._removeStyles();
423
+ }
424
+
425
+ // Init callback
426
+ opts.init();
427
+ }
428
+
429
+ };
430
+
431
+ var _instance;
432
+ function rn (el, options) {
433
+ if (!_instance) {
434
+ _instance = new ResponsiveNav(el, options);
435
+ }
436
+ return _instance;
437
+ }
438
+
439
+ return rn;
440
+ })(window, document);
@@ -0,0 +1,12 @@
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);
@@ -0,0 +1,37 @@
1
+ /*! responsive-nav.js v1.0.13 by @viljamis */
2
+
3
+ #nav ul {
4
+ margin: 0;
5
+ padding: 0;
6
+ width: 100%;
7
+ display: block;
8
+ list-style: none;
9
+ }
10
+
11
+ #nav li {
12
+ width: 100%;
13
+ display: block;
14
+ }
15
+
16
+ .js #nav {
17
+ clip: rect(0 0 0 0);
18
+ max-height: 0;
19
+ position: absolute;
20
+ display: block;
21
+ overflow: hidden;
22
+ zoom: 1;
23
+ }
24
+
25
+ #nav.opened {
26
+ max-height: 9999px;
27
+ }
28
+
29
+ @media screen and (min-width: 40em) {
30
+ .js #nav {
31
+ position: relative;
32
+ max-height: none;
33
+ }
34
+ #nav-toggle {
35
+ display: none;
36
+ }
37
+ }
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: responsive-nav-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.13
5
+ platform: ruby
6
+ authors:
7
+ - Thomas McNiven
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-04-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '3.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '3.1'
27
+ description: responsive-nav.com for the rails asset pipeline
28
+ email:
29
+ - trmcniven@vevix.net
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - .gitignore
35
+ - Gemfile
36
+ - LICENSE.md
37
+ - README.md
38
+ - Rakefile
39
+ - lib/responsive-nav-rails.rb
40
+ - lib/responsive-nav-rails/engine.rb
41
+ - lib/responsive-nav-rails/version.rb
42
+ - responsive-nav-rails.gemspec
43
+ - vendor/assets/javascripts/responsive-nav.js
44
+ - vendor/assets/javascripts/responsive-nav.min.js
45
+ - vendor/assets/stylesheets/responsive-nav.css
46
+ homepage: https://github.com/vevix/responsive-nav-rails
47
+ licenses:
48
+ - MIT
49
+ metadata: {}
50
+ post_install_message:
51
+ rdoc_options: []
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ requirements: []
65
+ rubyforge_project:
66
+ rubygems_version: 2.0.0
67
+ signing_key:
68
+ specification_version: 4
69
+ summary: an asset gemification of the responsive-nav plugin
70
+ test_files: []