responsive-nav-rails 1.0.20 → 1.0.21
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 +4 -4
- data/.gitignore +17 -17
- data/Gemfile +4 -4
- data/LICENSE.md +22 -22
- data/README.md +22 -26
- data/Rakefile +1 -1
- data/lib/responsive-nav-rails.rb +1 -1
- data/lib/responsive-nav-rails/engine.rb +3 -3
- data/lib/responsive-nav-rails/version.rb +2 -2
- data/responsive-nav-rails.gemspec +18 -18
- data/vendor/assets/.DS_Store +0 -0
- data/vendor/assets/javascripts/responsive-nav.js +428 -429
- data/vendor/assets/stylesheets/responsive-nav.css +48 -38
- metadata +3 -3
- data/vendor/assets/javascripts/responsive-nav.min.js +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 191f7e38994dcfec9b7ec6829ba7396de0895f17
|
4
|
+
data.tar.gz: 0becc2f1fa02ed4decde3f80c0b9642a4915356b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d2230aec5f8fdc709a7294d61142283da08ceb246655b9671a4d277b4ec2a04cc14767f6cbe114cf9c15565559d11e39cba7917e12314977afc16f014514510
|
7
|
+
data.tar.gz: 841aee4335f4856ef57fcd9055dbf2958df31620211d8d1a22ba4168df8d62f70a578adf0fb5bc3fc8434df9dbd2a6bccab70b08080e4a1ad0696758bf4af6c8
|
data/.gitignore
CHANGED
@@ -1,17 +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
|
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
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source "http://rubygems.org"
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in responsive-nav-rails.gemspec
|
4
|
-
gemspec
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in responsive-nav-rails.gemspec
|
4
|
+
gemspec
|
data/LICENSE.md
CHANGED
@@ -1,22 +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.
|
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
CHANGED
@@ -1,27 +1,23 @@
|
|
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
|
-
|
22
|
-
|
23
|
-
//= responsive-nav.min
|
24
|
-
|
25
|
-
## License
|
26
|
-
|
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
|
+
## License
|
22
|
+
|
27
23
|
[The MIT License](https://github.com/vevix/responsive-nav-rails/blob/master/LICENSE.md)
|
data/Rakefile
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/responsive-nav-rails.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require "responsive-nav-rails/version"
|
1
|
+
require "responsive-nav-rails/version"
|
2
2
|
require "responsive-nav-rails/engine"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module ResponsiveNavRails
|
2
|
-
class Engine < ::Rails::Engine
|
3
|
-
end
|
1
|
+
module ResponsiveNavRails
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
end
|
4
4
|
end
|
@@ -1,3 +1,3 @@
|
|
1
|
-
module ResponsiveNavRails
|
2
|
-
VERSION = "1.0.
|
1
|
+
module ResponsiveNavRails
|
2
|
+
VERSION = "1.0.21"
|
3
3
|
end
|
@@ -1,18 +1,18 @@
|
|
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
|
-
end
|
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
|
+
end
|
Binary file
|
@@ -1,429 +1,428 @@
|
|
1
|
-
/*! responsive-nav.js v1.0.
|
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 =
|
14
|
-
|
15
|
-
var computed = !!window.getComputedStyle;
|
16
|
-
|
17
|
-
// getComputedStyle polyfill
|
18
|
-
if (!
|
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
|
-
styleElement = document.createElement("style"),
|
41
|
-
hasAnimFinished,
|
42
|
-
navOpen,
|
43
|
-
|
44
|
-
// fn arg can be an object or a function, thanks to handleEvent
|
45
|
-
// read more at: http://www.thecssninja.com/javascript/handleevent
|
46
|
-
addEvent = function (el, evt, fn, bubble) {
|
47
|
-
if ("addEventListener" in el) {
|
48
|
-
// BBOS6 doesn't support handleEvent, catch and polyfill
|
49
|
-
try {
|
50
|
-
el.addEventListener(evt, fn, bubble);
|
51
|
-
} catch (e) {
|
52
|
-
if (typeof fn === "object" && fn.handleEvent) {
|
53
|
-
el.addEventListener(evt, function (e) {
|
54
|
-
// Bind fn as this and set first arg as event object
|
55
|
-
fn.handleEvent.call(fn, e);
|
56
|
-
}, bubble);
|
57
|
-
} else {
|
58
|
-
throw e;
|
59
|
-
}
|
60
|
-
}
|
61
|
-
} else if ("attachEvent" in el) {
|
62
|
-
// check if the callback is an object and contains handleEvent
|
63
|
-
if (typeof fn === "object" && fn.handleEvent) {
|
64
|
-
el.attachEvent("on" + evt, function () {
|
65
|
-
// Bind fn as this
|
66
|
-
fn.handleEvent.call(fn);
|
67
|
-
});
|
68
|
-
} else {
|
69
|
-
el.attachEvent("on" + evt, fn);
|
70
|
-
}
|
71
|
-
}
|
72
|
-
},
|
73
|
-
|
74
|
-
removeEvent = function (el, evt, fn, bubble) {
|
75
|
-
if ("removeEventListener" in el) {
|
76
|
-
try {
|
77
|
-
el.removeEventListener(evt, fn, bubble);
|
78
|
-
} catch (e) {
|
79
|
-
if (typeof fn === "object" && fn.handleEvent) {
|
80
|
-
el.removeEventListener(evt, function (e) {
|
81
|
-
fn.handleEvent.call(fn, e);
|
82
|
-
}, bubble);
|
83
|
-
} else {
|
84
|
-
throw e;
|
85
|
-
}
|
86
|
-
}
|
87
|
-
} else if ("detachEvent" in el) {
|
88
|
-
if (typeof fn === "object" && fn.handleEvent) {
|
89
|
-
el.detachEvent("on" + evt, function () {
|
90
|
-
fn.handleEvent.call(fn);
|
91
|
-
});
|
92
|
-
} else {
|
93
|
-
el.detachEvent("on" + evt, fn);
|
94
|
-
}
|
95
|
-
}
|
96
|
-
},
|
97
|
-
|
98
|
-
getChildren = function (e) {
|
99
|
-
if (e.children.length < 1) {
|
100
|
-
throw new Error("The Nav container has no containing elements");
|
101
|
-
}
|
102
|
-
// Store all children in array
|
103
|
-
var children = [];
|
104
|
-
// Loop through children and store in array if child != TextNode
|
105
|
-
for (var i = 0; i < e.children.length; i++) {
|
106
|
-
if (e.children[i].nodeType === 1) {
|
107
|
-
children.push(e.children[i]);
|
108
|
-
}
|
109
|
-
}
|
110
|
-
return children;
|
111
|
-
},
|
112
|
-
|
113
|
-
setAttributes = function (el, attrs) {
|
114
|
-
for (var key in attrs) {
|
115
|
-
el.setAttribute(key, attrs[key]);
|
116
|
-
}
|
117
|
-
},
|
118
|
-
|
119
|
-
addClass = function (el, cls) {
|
120
|
-
el.className
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
//
|
171
|
-
this.
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
nav
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
removeEvent(
|
189
|
-
removeEvent(
|
190
|
-
removeEvent(navToggle, "
|
191
|
-
removeEvent(navToggle, "
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
case "
|
239
|
-
this.
|
240
|
-
break;
|
241
|
-
case "
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
case "
|
246
|
-
this.
|
247
|
-
break;
|
248
|
-
case "
|
249
|
-
this.
|
250
|
-
break;
|
251
|
-
case "
|
252
|
-
this.
|
253
|
-
break;
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
addEvent(
|
272
|
-
addEvent(
|
273
|
-
addEvent(navToggle, "
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
}
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
},
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
var
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
}
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
}
|
369
|
-
},
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
}
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
}
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
}
|
425
|
-
|
426
|
-
}
|
427
|
-
|
428
|
-
|
429
|
-
})(window, document);
|
1
|
+
/*! responsive-nav.js v1.0.21
|
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 (el, options) {
|
14
|
+
|
15
|
+
var computed = !!window.getComputedStyle;
|
16
|
+
|
17
|
+
// getComputedStyle polyfill
|
18
|
+
if (!computed) {
|
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
|
+
styleElement = document.createElement("style"),
|
41
|
+
hasAnimFinished,
|
42
|
+
navOpen,
|
43
|
+
|
44
|
+
// fn arg can be an object or a function, thanks to handleEvent
|
45
|
+
// read more at: http://www.thecssninja.com/javascript/handleevent
|
46
|
+
addEvent = function (el, evt, fn, bubble) {
|
47
|
+
if ("addEventListener" in el) {
|
48
|
+
// BBOS6 doesn't support handleEvent, catch and polyfill
|
49
|
+
try {
|
50
|
+
el.addEventListener(evt, fn, bubble);
|
51
|
+
} catch (e) {
|
52
|
+
if (typeof fn === "object" && fn.handleEvent) {
|
53
|
+
el.addEventListener(evt, function (e) {
|
54
|
+
// Bind fn as this and set first arg as event object
|
55
|
+
fn.handleEvent.call(fn, e);
|
56
|
+
}, bubble);
|
57
|
+
} else {
|
58
|
+
throw e;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
} else if ("attachEvent" in el) {
|
62
|
+
// check if the callback is an object and contains handleEvent
|
63
|
+
if (typeof fn === "object" && fn.handleEvent) {
|
64
|
+
el.attachEvent("on" + evt, function () {
|
65
|
+
// Bind fn as this
|
66
|
+
fn.handleEvent.call(fn);
|
67
|
+
});
|
68
|
+
} else {
|
69
|
+
el.attachEvent("on" + evt, fn);
|
70
|
+
}
|
71
|
+
}
|
72
|
+
},
|
73
|
+
|
74
|
+
removeEvent = function (el, evt, fn, bubble) {
|
75
|
+
if ("removeEventListener" in el) {
|
76
|
+
try {
|
77
|
+
el.removeEventListener(evt, fn, bubble);
|
78
|
+
} catch (e) {
|
79
|
+
if (typeof fn === "object" && fn.handleEvent) {
|
80
|
+
el.removeEventListener(evt, function (e) {
|
81
|
+
fn.handleEvent.call(fn, e);
|
82
|
+
}, bubble);
|
83
|
+
} else {
|
84
|
+
throw e;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
} else if ("detachEvent" in el) {
|
88
|
+
if (typeof fn === "object" && fn.handleEvent) {
|
89
|
+
el.detachEvent("on" + evt, function () {
|
90
|
+
fn.handleEvent.call(fn);
|
91
|
+
});
|
92
|
+
} else {
|
93
|
+
el.detachEvent("on" + evt, fn);
|
94
|
+
}
|
95
|
+
}
|
96
|
+
},
|
97
|
+
|
98
|
+
getChildren = function (e) {
|
99
|
+
if (e.children.length < 1) {
|
100
|
+
throw new Error("The Nav container has no containing elements");
|
101
|
+
}
|
102
|
+
// Store all children in array
|
103
|
+
var children = [];
|
104
|
+
// Loop through children and store in array if child != TextNode
|
105
|
+
for (var i = 0; i < e.children.length; i++) {
|
106
|
+
if (e.children[i].nodeType === 1) {
|
107
|
+
children.push(e.children[i]);
|
108
|
+
}
|
109
|
+
}
|
110
|
+
return children;
|
111
|
+
},
|
112
|
+
|
113
|
+
setAttributes = function (el, attrs) {
|
114
|
+
for (var key in attrs) {
|
115
|
+
el.setAttribute(key, attrs[key]);
|
116
|
+
}
|
117
|
+
},
|
118
|
+
|
119
|
+
addClass = function (el, cls) {
|
120
|
+
if (el.className.indexOf(cls) !== 0) {
|
121
|
+
el.className += " " + cls;
|
122
|
+
el.className = el.className.replace(/(^\s*)|(\s*$)/g,"");
|
123
|
+
}
|
124
|
+
},
|
125
|
+
|
126
|
+
removeClass = function (el, cls) {
|
127
|
+
var reg = new RegExp("(\\s|^)" + cls + "(\\s|$)");
|
128
|
+
el.className = el.className.replace(reg, " ").replace(/(^\s*)|(\s*$)/g,"");
|
129
|
+
},
|
130
|
+
|
131
|
+
ResponsiveNav = function (el, options) {
|
132
|
+
var i;
|
133
|
+
|
134
|
+
// Default options
|
135
|
+
this.options = {
|
136
|
+
animate: true, // Boolean: Use CSS3 transitions, true or false
|
137
|
+
transition: 250, // Integer: Speed of the transition, in milliseconds
|
138
|
+
label: "Menu", // String: Label for the navigation toggle
|
139
|
+
insert: "after", // String: Insert the toggle before or after the navigation
|
140
|
+
customToggle: "", // Selector: Specify the ID of a custom toggle
|
141
|
+
openPos: "relative", // String: Position of the opened nav, relative or static
|
142
|
+
jsClass: "js", // String: 'JS enabled' class which is added to <html> el
|
143
|
+
init: function(){}, // Function: Init callback
|
144
|
+
open: function(){}, // Function: Open callback
|
145
|
+
close: function(){} // Function: Close callback
|
146
|
+
};
|
147
|
+
|
148
|
+
// User defined options
|
149
|
+
for (i in options) {
|
150
|
+
this.options[i] = options[i];
|
151
|
+
}
|
152
|
+
|
153
|
+
// Adds "js" class for <html>
|
154
|
+
addClass(document.documentElement, this.options.jsClass);
|
155
|
+
|
156
|
+
// Wrapper
|
157
|
+
this.wrapperEl = el.replace("#", "");
|
158
|
+
if (document.getElementById(this.wrapperEl)) {
|
159
|
+
this.wrapper = document.getElementById(this.wrapperEl);
|
160
|
+
} else if (document.querySelector(this.wrapperEl)) {
|
161
|
+
this.wrapper = document.querySelector(this.wrapperEl);
|
162
|
+
} else {
|
163
|
+
// If el doesn't exists, stop here.
|
164
|
+
throw new Error("The nav element you are trying to select doesn't exist");
|
165
|
+
}
|
166
|
+
|
167
|
+
// Inner wrapper
|
168
|
+
this.wrapper.inner = getChildren(this.wrapper);
|
169
|
+
|
170
|
+
// For minification
|
171
|
+
opts = this.options;
|
172
|
+
nav = this.wrapper;
|
173
|
+
|
174
|
+
// Init
|
175
|
+
this._init(this);
|
176
|
+
};
|
177
|
+
|
178
|
+
ResponsiveNav.prototype = {
|
179
|
+
// Public methods
|
180
|
+
destroy: function () {
|
181
|
+
this._removeStyles();
|
182
|
+
removeClass(nav, "closed");
|
183
|
+
removeClass(nav, "opened");
|
184
|
+
nav.removeAttribute("style");
|
185
|
+
nav.removeAttribute("aria-hidden");
|
186
|
+
nav = null;
|
187
|
+
|
188
|
+
removeEvent(window, "resize", this, false);
|
189
|
+
removeEvent(document.body, "touchmove", this, false);
|
190
|
+
removeEvent(navToggle, "touchstart", this, false);
|
191
|
+
removeEvent(navToggle, "touchend", this, false);
|
192
|
+
removeEvent(navToggle, "mouseup", this, false);
|
193
|
+
removeEvent(navToggle, "keyup", this, false);
|
194
|
+
removeEvent(navToggle, "click", this, false);
|
195
|
+
|
196
|
+
if (!opts.customToggle) {
|
197
|
+
navToggle.parentNode.removeChild(navToggle);
|
198
|
+
} else {
|
199
|
+
navToggle.removeAttribute("aria-hidden");
|
200
|
+
}
|
201
|
+
},
|
202
|
+
|
203
|
+
toggle: function () {
|
204
|
+
if (hasAnimFinished === true) {
|
205
|
+
if (!navOpen) {
|
206
|
+
removeClass(nav, "closed");
|
207
|
+
addClass(nav, "opened");
|
208
|
+
nav.style.position = opts.openPos;
|
209
|
+
setAttributes(nav, {"aria-hidden": "false"});
|
210
|
+
|
211
|
+
navOpen = true;
|
212
|
+
opts.open();
|
213
|
+
} else {
|
214
|
+
removeClass(nav, "opened");
|
215
|
+
addClass(nav, "closed");
|
216
|
+
setAttributes(nav, {"aria-hidden": "true"});
|
217
|
+
|
218
|
+
if (opts.animate) {
|
219
|
+
hasAnimFinished = false;
|
220
|
+
setTimeout(function () {
|
221
|
+
nav.style.position = "absolute";
|
222
|
+
hasAnimFinished = true;
|
223
|
+
}, opts.transition + 10);
|
224
|
+
} else {
|
225
|
+
nav.style.position = "absolute";
|
226
|
+
}
|
227
|
+
|
228
|
+
navOpen = false;
|
229
|
+
opts.close();
|
230
|
+
}
|
231
|
+
}
|
232
|
+
},
|
233
|
+
|
234
|
+
handleEvent: function (e) {
|
235
|
+
var evt = e || window.event;
|
236
|
+
|
237
|
+
switch (evt.type) {
|
238
|
+
case "touchstart":
|
239
|
+
this._onTouchStart(evt);
|
240
|
+
break;
|
241
|
+
case "touchmove":
|
242
|
+
this._onTouchMove(evt);
|
243
|
+
break;
|
244
|
+
case "touchend":
|
245
|
+
case "mouseup":
|
246
|
+
this._onTouchEnd(evt);
|
247
|
+
break;
|
248
|
+
case "click":
|
249
|
+
this._preventDefault(evt);
|
250
|
+
break;
|
251
|
+
case "keyup":
|
252
|
+
this._onKeyUp(evt);
|
253
|
+
break;
|
254
|
+
case "resize":
|
255
|
+
this._resize(evt);
|
256
|
+
break;
|
257
|
+
}
|
258
|
+
},
|
259
|
+
|
260
|
+
// Private methods
|
261
|
+
_init: function () {
|
262
|
+
addClass(nav, "nav-collapse");
|
263
|
+
addClass(nav, "closed");
|
264
|
+
hasAnimFinished = true;
|
265
|
+
navOpen = false;
|
266
|
+
|
267
|
+
this._createToggle();
|
268
|
+
this._transitions();
|
269
|
+
this._resize();
|
270
|
+
|
271
|
+
addEvent(window, "resize", this, false);
|
272
|
+
addEvent(document.body, "touchmove", this, false);
|
273
|
+
addEvent(navToggle, "touchstart", this, false);
|
274
|
+
addEvent(navToggle, "touchend", this, false);
|
275
|
+
addEvent(navToggle, "mouseup", this, false);
|
276
|
+
addEvent(navToggle, "keyup", this, false);
|
277
|
+
addEvent(navToggle, "click", this, false);
|
278
|
+
|
279
|
+
// Init callback
|
280
|
+
opts.init();
|
281
|
+
},
|
282
|
+
|
283
|
+
_createStyles: function () {
|
284
|
+
if (!styleElement.parentNode) {
|
285
|
+
styleElement.type = "text/css";
|
286
|
+
document.getElementsByTagName("head")[0].appendChild(styleElement);
|
287
|
+
}
|
288
|
+
},
|
289
|
+
|
290
|
+
_removeStyles: function () {
|
291
|
+
if (styleElement.parentNode) {
|
292
|
+
styleElement.parentNode.removeChild(styleElement);
|
293
|
+
}
|
294
|
+
},
|
295
|
+
|
296
|
+
_createToggle: function () {
|
297
|
+
if (!opts.customToggle) {
|
298
|
+
var toggle = document.createElement("a");
|
299
|
+
toggle.innerHTML = opts.label;
|
300
|
+
setAttributes(toggle, {
|
301
|
+
"href": "#",
|
302
|
+
"class": "nav-toggle"
|
303
|
+
});
|
304
|
+
|
305
|
+
if (opts.insert === "after") {
|
306
|
+
nav.parentNode.insertBefore(toggle, nav.nextSibling);
|
307
|
+
} else {
|
308
|
+
nav.parentNode.insertBefore(toggle, nav);
|
309
|
+
}
|
310
|
+
|
311
|
+
navToggle = toggle;
|
312
|
+
} else {
|
313
|
+
var toggleEl = opts.customToggle.replace("#", "");
|
314
|
+
|
315
|
+
if (document.getElementById(toggleEl)) {
|
316
|
+
navToggle = document.getElementById(toggleEl);
|
317
|
+
} else if (document.querySelector(toggleEl)) {
|
318
|
+
navToggle = document.querySelector(toggleEl);
|
319
|
+
} else {
|
320
|
+
throw new Error("The custom nav toggle you are trying to select doesn't exist");
|
321
|
+
}
|
322
|
+
}
|
323
|
+
},
|
324
|
+
|
325
|
+
_preventDefault: function(e) {
|
326
|
+
if (e.preventDefault) {
|
327
|
+
e.preventDefault();
|
328
|
+
e.stopPropagation();
|
329
|
+
} else {
|
330
|
+
e.returnValue = false;
|
331
|
+
}
|
332
|
+
},
|
333
|
+
|
334
|
+
_onTouchStart: function (e) {
|
335
|
+
e.stopPropagation();
|
336
|
+
this.startX = e.touches[0].clientX;
|
337
|
+
this.startY = e.touches[0].clientY;
|
338
|
+
this.touchHasMoved = false;
|
339
|
+
removeEvent(navToggle, "mouseup", this, false);
|
340
|
+
},
|
341
|
+
|
342
|
+
_onTouchMove: function (e) {
|
343
|
+
if (Math.abs(e.touches[0].clientX - this.startX) > 10 ||
|
344
|
+
Math.abs(e.touches[0].clientY - this.startY) > 10) {
|
345
|
+
this.touchHasMoved = true;
|
346
|
+
}
|
347
|
+
},
|
348
|
+
|
349
|
+
_onTouchEnd: function (e) {
|
350
|
+
this._preventDefault(e);
|
351
|
+
if (!this.touchHasMoved) {
|
352
|
+
if (e.type === "touchend") {
|
353
|
+
this.toggle(e);
|
354
|
+
// Prevent click on the underlying menu on Android 2.3
|
355
|
+
var that = this;
|
356
|
+
nav.addEventListener("click", that._preventDefault, true);
|
357
|
+
setTimeout(function () {
|
358
|
+
nav.removeEventListener("click", that._preventDefault, true);
|
359
|
+
}, opts.transition + 100);
|
360
|
+
return;
|
361
|
+
} else {
|
362
|
+
var evt = e || window.event;
|
363
|
+
// If it isn't a right click
|
364
|
+
if (!(evt.which === 3 || evt.button === 2)) {
|
365
|
+
this.toggle(e);
|
366
|
+
}
|
367
|
+
}
|
368
|
+
}
|
369
|
+
},
|
370
|
+
|
371
|
+
_onKeyUp: function (e) {
|
372
|
+
var evt = e || window.event;
|
373
|
+
if (evt.keyCode === 13) {
|
374
|
+
this.toggle(e);
|
375
|
+
}
|
376
|
+
},
|
377
|
+
|
378
|
+
_transitions: function () {
|
379
|
+
if (opts.animate) {
|
380
|
+
var objStyle = nav.style,
|
381
|
+
transition = "max-height " + opts.transition + "ms";
|
382
|
+
|
383
|
+
objStyle.WebkitTransition = transition;
|
384
|
+
objStyle.MozTransition = transition;
|
385
|
+
objStyle.OTransition = transition;
|
386
|
+
objStyle.transition = transition;
|
387
|
+
}
|
388
|
+
},
|
389
|
+
|
390
|
+
_calcHeight: function () {
|
391
|
+
var savedHeight = 0;
|
392
|
+
for (var i = 0; i < nav.inner.length; i++) {
|
393
|
+
savedHeight += nav.inner[i].offsetHeight;
|
394
|
+
}
|
395
|
+
var innerStyles = ".nav-collapse.opened{max-height:" + savedHeight + "px}";
|
396
|
+
|
397
|
+
if (styleElement.styleSheet) {
|
398
|
+
styleElement.styleSheet.cssText = innerStyles;
|
399
|
+
} else {
|
400
|
+
styleElement.innerHTML = innerStyles;
|
401
|
+
}
|
402
|
+
|
403
|
+
innerStyles = "";
|
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
|
+
|
426
|
+
};
|
427
|
+
return new ResponsiveNav(el, options);
|
428
|
+
};
|
@@ -1,39 +1,49 @@
|
|
1
|
-
/*! responsive-nav.js v1.0.
|
2
|
-
|
3
|
-
|
4
|
-
margin: 0;
|
5
|
-
padding: 0;
|
6
|
-
width: 100%;
|
7
|
-
display: block;
|
8
|
-
list-style: none;
|
9
|
-
}
|
10
|
-
|
11
|
-
|
12
|
-
width: 100%;
|
13
|
-
display: block;
|
14
|
-
}
|
15
|
-
|
16
|
-
.js
|
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
|
-
|
26
|
-
max-height: 9999px;
|
27
|
-
}
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
1
|
+
/*! responsive-nav.js v1.0.21 by @viljamis */
|
2
|
+
|
3
|
+
.nav-collapse ul {
|
4
|
+
margin: 0;
|
5
|
+
padding: 0;
|
6
|
+
width: 100%;
|
7
|
+
display: block;
|
8
|
+
list-style: none;
|
9
|
+
}
|
10
|
+
|
11
|
+
.nav-collapse li {
|
12
|
+
width: 100%;
|
13
|
+
display: block;
|
14
|
+
}
|
15
|
+
|
16
|
+
.js .nav-collapse {
|
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-collapse.opened {
|
26
|
+
max-height: 9999px;
|
27
|
+
}
|
28
|
+
|
29
|
+
.nav-toggle {
|
30
|
+
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
31
|
+
-webkit-touch-callout: none;
|
32
|
+
-webkit-user-select: none;
|
33
|
+
-moz-user-select: none;
|
34
|
+
-ms-user-select: none;
|
35
|
+
-o-user-select: none;
|
36
|
+
user-select: none;
|
37
|
+
}
|
38
|
+
|
39
|
+
@media screen and (min-width: 40em) {
|
40
|
+
.js .nav-collapse {
|
41
|
+
position: relative;
|
42
|
+
}
|
43
|
+
.js .nav-collapse.closed {
|
44
|
+
max-height: none;
|
45
|
+
}
|
46
|
+
.nav-toggle {
|
47
|
+
display: none;
|
48
|
+
}
|
39
49
|
}
|
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.21
|
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-
|
11
|
+
date: 2013-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: responsive-nav.com for the rails asset pipeline
|
14
14
|
email:
|
@@ -26,8 +26,8 @@ files:
|
|
26
26
|
- lib/responsive-nav-rails/engine.rb
|
27
27
|
- lib/responsive-nav-rails/version.rb
|
28
28
|
- responsive-nav-rails.gemspec
|
29
|
+
- vendor/assets/.DS_Store
|
29
30
|
- vendor/assets/javascripts/responsive-nav.js
|
30
|
-
- vendor/assets/javascripts/responsive-nav.min.js
|
31
31
|
- vendor/assets/stylesheets/responsive-nav.css
|
32
32
|
homepage: https://github.com/vevix/responsive-nav-rails
|
33
33
|
licenses:
|
@@ -1,12 +0,0 @@
|
|
1
|
-
/*! responsive-nav.js v1.0.20 by @viljamis, http://responsive-nav.com, MIT license */
|
2
|
-
var responsiveNav=function(h,g){var v=!!h.getComputedStyle;h.getComputedStyle||(h.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,n=g.createElement("style"),p,q,l=function(a,b,c,d){if("addEventListener"in a)try{a.addEventListener(b,c,d)}catch(e){if("object"===typeof c&&c.handleEvent)a.addEventListener(b,
|
3
|
-
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))},k=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"===typeof c&&c.handleEvent?a.detachEvent("on"+b,function(){c.handleEvent.call(c)}):
|
4
|
-
a.detachEvent("on"+b,c))},w=function(a){if(1>a.children.length)throw 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},m=function(a,b){for(var c in b)a.setAttribute(c,b[c])},r=function(a,b){a.className+=" "+b;a.className=a.className.replace(/(^\s*)|(\s*$)/g,"")},s=function(a,b){a.className=a.className.replace(RegExp("(\\s|^)"+b+"(\\s|$)")," ").replace(/(^\s*)|(\s*$)/g,"")},u=function(a,b){var c;
|
5
|
-
this.options={animate:!0,transition:350,label:"Menu",insert:"after",customToggle:"",openPos:"relative",jsClass:"js",init:function(){},open:function(){},close:function(){}};for(c in b)this.options[c]=b[c];r(g.documentElement,this.options.jsClass);this.wrapperEl=a.replace("#","");if(g.getElementById(this.wrapperEl))this.wrapper=g.getElementById(this.wrapperEl);else throw Error("The nav element you are trying to select doesn't exist");this.wrapper.inner=w(this.wrapper);f=this.options;d=this.wrapper;
|
6
|
-
this._init(this)};u.prototype={destroy:function(){this._removeStyles();s(d,"closed");s(d,"opened");d.removeAttribute("style");d.removeAttribute("aria-hidden");t=d=null;k(h,"resize",this,!1);k(g.body,"touchmove",this,!1);k(e,"touchstart",this,!1);k(e,"touchend",this,!1);k(e,"keyup",this,!1);k(e,"click",this,!1);k(e,"mouseup",this,!1);f.customToggle?e.removeAttribute("aria-hidden"):e.parentNode.removeChild(e)},toggle:function(){!0===p&&(q?(s(d,"opened"),r(d,"closed"),m(d,{"aria-hidden":"true"}),f.animate?
|
7
|
-
(p=!1,setTimeout(function(){d.style.position="absolute";p=!0},f.transition+10)):d.style.position="absolute",q=!1,f.close()):(s(d,"closed"),r(d,"opened"),d.style.position=f.openPos,m(d,{"aria-hidden":"false"}),q=!0,f.open()))},handleEvent:function(a){a=a||h.event;switch(a.type){case "touchstart":this._onTouchStart(a);break;case "touchmove":this._onTouchMove(a);break;case "touchend":case "mouseup":this._onTouchEnd(a);break;case "click":this._preventDefault(a);break;case "keyup":this._onKeyUp(a);break;
|
8
|
-
case "resize":this._resize(a)}},_init:function(){r(d,"closed");p=!0;q=!1;this._createToggle();this._transitions();this._resize();l(h,"resize",this,!1);l(g.body,"touchmove",this,!1);l(e,"touchstart",this,!1);l(e,"touchend",this,!1);l(e,"mouseup",this,!1);l(e,"keyup",this,!1);l(e,"click",this,!1);f.init()},_createStyles:function(){n.parentNode||g.getElementsByTagName("head")[0].appendChild(n)},_removeStyles:function(){n.parentNode&&n.parentNode.removeChild(n)},_createToggle:function(){if(f.customToggle){var a=
|
9
|
-
f.customToggle.replace("#","");if(g.getElementById(a))e=g.getElementById(a);else throw Error("The custom nav toggle you are trying to select doesn't exist");}else a=g.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,d),e=g.getElementById("nav-toggle")},_preventDefault:function(a){a.preventDefault?(a.preventDefault(),a.stopPropagation()):a.returnValue=!1},_onTouchStart:function(a){a.stopPropagation();
|
10
|
-
this.startX=a.touches[0].clientX;this.startY=a.touches[0].clientY;this.touchHasMoved=!1;k(e,"mouseup",this,!1)},_onTouchMove:function(a){if(10<Math.abs(a.touches[0].clientX-this.startX)||10<Math.abs(a.touches[0].clientY-this.startY))this.touchHasMoved=!0},_onTouchEnd:function(a){this._preventDefault(a);if(!this.touchHasMoved)if("touchend"===a.type){this.toggle(a);var b=this;d.addEventListener("click",b._preventDefault,!0);setTimeout(function(){d.removeEventListener("click",b._preventDefault,!0)},
|
11
|
-
f.transition+100)}else{var c=a||h.event;3!==c.which&&2!==c.button&&this.toggle(a)}},_onKeyUp:function(a){13===(a||h.event).keyCode&&this.toggle(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(){for(var a=0,b=0;b<d.inner.length;b++)a+=d.inner[b].offsetHeight;a="#"+this.wrapperEl+".opened{max-height:"+a+"px}";v&&(n.innerHTML=a)},_resize:function(){"none"!==h.getComputedStyle(e,
|
12
|
-
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())}};var t;return function(a,b){t||(t=new u(a,b));return t}}(window,document);
|