wpa_cli_web 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.bowerrc +3 -0
- data/lib/wpa_cli_web.rb +19 -31
- data/lib/wpa_cli_web/public/bower_components/house-style/.bower.json +14 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/.bowerrc +3 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/.gitignore +2 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/Gemfile +6 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/Gruntfile.js +99 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/Guardfile +19 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/bower.json +7 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/bower_components/normalize-css/LICENSE.md +19 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/bower_components/normalize-css/README.md +49 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/bower_components/normalize-css/bower.json +23 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/bower_components/normalize-css/normalize.css +396 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/house-style.css +860 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/house-style.min.css +1 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/modules/base/base.css +37 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/modules/button/button.css +26 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/modules/grid/grid.css +151 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/modules/grid/grid.png +0 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/modules/grid/images.html +208 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/modules/grid/index.html +141 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/modules/loading/index.html +22 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/modules/loading/loading.css +41 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/modules/loading/spinner.svg +11 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/modules/masthead/bbc-blocks-white.png +0 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/modules/masthead/index.html +20 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/modules/masthead/masthead.css +23 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/modules/panel/panel.css +71 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/modules/project-header/index.html +22 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/modules/project-header/project-header.css +37 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/modules/table/index.html +26 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/modules/table/table.css +6 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/modules/transitions/transitions.css +11 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/package.json +21 -0
- data/lib/wpa_cli_web/public/bower_components/house-style/vendor/prefixfree.min.js +5 -0
- data/lib/wpa_cli_web/public/bower_components/normalize-css/.bower.json +21 -0
- data/lib/wpa_cli_web/public/bower_components/normalize-css/LICENSE.md +19 -0
- data/lib/wpa_cli_web/public/bower_components/normalize-css/README.md +49 -0
- data/lib/wpa_cli_web/public/bower_components/normalize-css/bower.json +12 -0
- data/lib/wpa_cli_web/public/bower_components/normalize-css/normalize.css +396 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/.bower.json +14 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/.gitignore +3 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/.travis.yml +10 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/LICENSE +7 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/Makefile +6 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/README.md +167 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/config/smoosh.json +35 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/integration/ender.js +1033 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/integration/integration.html +26 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/mobile/ender.js +62 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/mobile/package.json +14 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/mobile/qwery-mobile.js +79 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/mobile/qwery-mobile.min.js +7 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/mobile/src/mobile.js +72 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/package.json +25 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/pseudos/package.json +17 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/pseudos/qwery-pseudos.js +106 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/pseudos/qwery-pseudos.min.js +7 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/pseudos/src/pseudos.js +99 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/qwery.js +369 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/qwery.min.js +7 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/src/copyright.js +6 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/src/ender.js +62 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/src/qwery.js +362 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/tests/W3C-Selector-tests.html +1372 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/tests/benchmarks.html +220 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/tests/index.html +132 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/tests/mobile.html +58 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/tests/phantom.js +43 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/tests/test-env.js +25 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/tests/tests.js +533 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/vendor/nw.js +1680 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/vendor/sink.css +79 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/vendor/sink.js +181 -0
- data/lib/wpa_cli_web/public/bower_components/qwery/vendor/sizzle.js +1400 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/.bower.json +14 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/.gitignore +1 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/.jshintrc +61 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/Makefile +8 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/README.md +308 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/build.json +74 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/make/tests.js +89 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/package.json +27 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/reqwest.js +565 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/reqwest.min.js +7 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/src/copyright.js +6 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/src/ender.js +26 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/src/reqwest.js +559 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/tests/ender.js +117 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/badfixtures.xml +1 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/fixtures.html +1 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/fixtures.js +1 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/fixtures.json +1 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/fixtures.xml +1 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/fixtures_jsonp.jsonp +1 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/fixtures_jsonp2.jsonp +1 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/fixtures_jsonp3.jsonp +1 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/fixtures_jsonp_multi.jsonp +1 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/fixtures_jsonp_multi_b.jsonp +1 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/fixtures_jsonp_multi_c.jsonp +1 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/fixtures_with_prefix.json +1 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/invalidJSON.json +5 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/tests/tests.html +105 -0
- data/lib/wpa_cli_web/public/bower_components/reqwest/tests/tests.js +1723 -0
- data/lib/wpa_cli_web/views/access_points.erb +5 -0
- data/lib/wpa_cli_web/views/access_points_list.erb +19 -0
- data/lib/wpa_cli_web/views/layout.erb +141 -0
- data/lib/wpa_cli_web/views/networks_edit.erb +15 -0
- data/lib/wpa_cli_web/views/restart.erb +7 -0
- data/lib/wpa_cli_web/views/restarting.erb +14 -0
- data/wpa_cli_web.gemspec +1 -1
- metadata +111 -2
@@ -0,0 +1,35 @@
|
|
1
|
+
{
|
2
|
+
"JAVASCRIPT": {
|
3
|
+
"DIST_DIR": "./"
|
4
|
+
, "qwery": [
|
5
|
+
"./src/copyright.js"
|
6
|
+
, "./src/qwery.js"
|
7
|
+
]
|
8
|
+
, "mobile/qwery-mobile": [
|
9
|
+
"./src/copyright.js"
|
10
|
+
, "./mobile/src/mobile.js"
|
11
|
+
]
|
12
|
+
, "pseudos/qwery-pseudos": [
|
13
|
+
"./src/copyright.js"
|
14
|
+
, "./pseudos/src/pseudos.js"
|
15
|
+
]
|
16
|
+
}
|
17
|
+
, "JSHINT_OPTS": {
|
18
|
+
"boss": true
|
19
|
+
, "forin": false
|
20
|
+
, "curly": false
|
21
|
+
, "debug": false
|
22
|
+
, "devel": false
|
23
|
+
, "evil": false
|
24
|
+
, "regexp": false
|
25
|
+
, "undef": false
|
26
|
+
, "sub": true
|
27
|
+
, "white": false
|
28
|
+
, "indent": 2
|
29
|
+
, "asi": true
|
30
|
+
, "laxbreak": true
|
31
|
+
, "eqeqeq": false
|
32
|
+
, "eqnull": true
|
33
|
+
, "laxcomma": true
|
34
|
+
}
|
35
|
+
}
|
@@ -0,0 +1,1033 @@
|
|
1
|
+
/*!
|
2
|
+
* =============================================================
|
3
|
+
* Ender: open module JavaScript framework (https://ender.no.de)
|
4
|
+
* Build: ender build domready bonzo
|
5
|
+
* =============================================================
|
6
|
+
*/
|
7
|
+
|
8
|
+
/*!
|
9
|
+
* Ender: open module JavaScript framework (client-lib)
|
10
|
+
* copyright Dustin Diaz & Jacob Thornton 2011 (@ded @fat)
|
11
|
+
* http://ender.no.de
|
12
|
+
* License MIT
|
13
|
+
*/
|
14
|
+
!function (context) {
|
15
|
+
|
16
|
+
// a global object for node.js module compatiblity
|
17
|
+
// ============================================
|
18
|
+
|
19
|
+
context['global'] = context
|
20
|
+
|
21
|
+
// Implements simple module system
|
22
|
+
// losely based on CommonJS Modules spec v1.1.1
|
23
|
+
// ============================================
|
24
|
+
|
25
|
+
var modules = {}
|
26
|
+
, old = context.$
|
27
|
+
|
28
|
+
function require (identifier) {
|
29
|
+
// modules can be required from ender's build system, or found on the window
|
30
|
+
var module = modules[identifier] || window[identifier]
|
31
|
+
if (!module) throw new Error("Requested module '" + identifier + "' has not been defined.")
|
32
|
+
return module
|
33
|
+
}
|
34
|
+
|
35
|
+
function provide (name, what) {
|
36
|
+
return (modules[name] = what)
|
37
|
+
}
|
38
|
+
|
39
|
+
context['provide'] = provide
|
40
|
+
context['require'] = require
|
41
|
+
|
42
|
+
function aug(o, o2) {
|
43
|
+
for (var k in o2) k != 'noConflict' && k != '_VERSION' && (o[k] = o2[k])
|
44
|
+
return o
|
45
|
+
}
|
46
|
+
|
47
|
+
function boosh(s, r, els) {
|
48
|
+
// string || node || nodelist || window
|
49
|
+
if (typeof s == 'string' || s.nodeName || (s.length && 'item' in s) || s == window) {
|
50
|
+
els = ender._select(s, r)
|
51
|
+
els.selector = s
|
52
|
+
} else els = isFinite(s.length) ? s : [s]
|
53
|
+
return aug(els, boosh)
|
54
|
+
}
|
55
|
+
|
56
|
+
function ender(s, r) {
|
57
|
+
return boosh(s, r)
|
58
|
+
}
|
59
|
+
|
60
|
+
aug(ender, {
|
61
|
+
_VERSION: '0.3.6'
|
62
|
+
, fn: boosh // for easy compat to jQuery plugins
|
63
|
+
, ender: function (o, chain) {
|
64
|
+
aug(chain ? boosh : ender, o)
|
65
|
+
}
|
66
|
+
, _select: function (s, r) {
|
67
|
+
return (r || document).querySelectorAll(s)
|
68
|
+
}
|
69
|
+
})
|
70
|
+
|
71
|
+
aug(boosh, {
|
72
|
+
forEach: function (fn, scope, i) {
|
73
|
+
// opt out of native forEach so we can intentionally call our own scope
|
74
|
+
// defaulting to the current item and be able to return self
|
75
|
+
for (i = 0, l = this.length; i < l; ++i) i in this && fn.call(scope || this[i], this[i], i, this)
|
76
|
+
// return self for chaining
|
77
|
+
return this
|
78
|
+
},
|
79
|
+
$: ender // handy reference to self
|
80
|
+
})
|
81
|
+
|
82
|
+
ender.noConflict = function () {
|
83
|
+
context.$ = old
|
84
|
+
return this
|
85
|
+
}
|
86
|
+
|
87
|
+
if (typeof module !== 'undefined' && module.exports) module.exports = ender
|
88
|
+
// use subscript notation as extern for Closure compilation
|
89
|
+
context['ender'] = context['$'] = context['ender'] || ender
|
90
|
+
|
91
|
+
}(this);
|
92
|
+
|
93
|
+
!function () {
|
94
|
+
|
95
|
+
var module = { exports: {} }, exports = module.exports;
|
96
|
+
|
97
|
+
!function (name, definition) {
|
98
|
+
if (typeof define == 'function') define(definition)
|
99
|
+
else if (typeof module != 'undefined') module.exports = definition()
|
100
|
+
else this[name] = this['domReady'] = definition()
|
101
|
+
}('domready', function (ready) {
|
102
|
+
|
103
|
+
var fns = [], fn, f = false
|
104
|
+
, doc = document
|
105
|
+
, testEl = doc.documentElement
|
106
|
+
, hack = testEl.doScroll
|
107
|
+
, domContentLoaded = 'DOMContentLoaded'
|
108
|
+
, addEventListener = 'addEventListener'
|
109
|
+
, onreadystatechange = 'onreadystatechange'
|
110
|
+
, loaded = /^loade|c/.test(doc.readyState)
|
111
|
+
|
112
|
+
function flush(f) {
|
113
|
+
loaded = 1
|
114
|
+
while (f = fns.shift()) f()
|
115
|
+
}
|
116
|
+
|
117
|
+
doc[addEventListener] && doc[addEventListener](domContentLoaded, fn = function () {
|
118
|
+
doc.removeEventListener(domContentLoaded, fn, f)
|
119
|
+
flush()
|
120
|
+
}, f)
|
121
|
+
|
122
|
+
|
123
|
+
hack && doc.attachEvent(onreadystatechange, (fn = function () {
|
124
|
+
if (/^c/.test(doc.readyState)) {
|
125
|
+
doc.detachEvent(onreadystatechange, fn)
|
126
|
+
flush()
|
127
|
+
}
|
128
|
+
}))
|
129
|
+
|
130
|
+
return (ready = hack ?
|
131
|
+
function (fn) {
|
132
|
+
self != top ?
|
133
|
+
loaded ? fn() : fns.push(fn) :
|
134
|
+
function () {
|
135
|
+
try {
|
136
|
+
testEl.doScroll('left')
|
137
|
+
} catch (e) {
|
138
|
+
return setTimeout(function() { ready(fn) }, 50)
|
139
|
+
}
|
140
|
+
fn()
|
141
|
+
}()
|
142
|
+
} :
|
143
|
+
function (fn) {
|
144
|
+
loaded ? fn() : fns.push(fn)
|
145
|
+
})
|
146
|
+
})
|
147
|
+
|
148
|
+
provide("domready", module.exports);
|
149
|
+
|
150
|
+
!function ($) {
|
151
|
+
var ready = require('domready')
|
152
|
+
$.ender({domReady: ready})
|
153
|
+
$.ender({
|
154
|
+
ready: function (f) {
|
155
|
+
ready(f)
|
156
|
+
return this
|
157
|
+
}
|
158
|
+
}, true)
|
159
|
+
}(ender);
|
160
|
+
|
161
|
+
}();
|
162
|
+
|
163
|
+
!function () {
|
164
|
+
|
165
|
+
var module = { exports: {} }, exports = module.exports;
|
166
|
+
|
167
|
+
/*!
|
168
|
+
* Bonzo: DOM Utility (c) Dustin Diaz 2011
|
169
|
+
* https://github.com/ded/bonzo
|
170
|
+
* License MIT
|
171
|
+
*/
|
172
|
+
!function (name, definition) {
|
173
|
+
if (typeof module != 'undefined') module.exports = definition()
|
174
|
+
else if (typeof define == 'function' && define.amd) define(name, definition)
|
175
|
+
else this[name] = definition()
|
176
|
+
}('bonzo', function() {
|
177
|
+
var context = this
|
178
|
+
, old = context.bonzo
|
179
|
+
, win = window
|
180
|
+
, doc = win.document
|
181
|
+
, html = doc.documentElement
|
182
|
+
, parentNode = 'parentNode'
|
183
|
+
, query = null
|
184
|
+
, specialAttributes = /^checked|value|selected$/
|
185
|
+
, specialTags = /select|fieldset|table|tbody|tfoot|td|tr|colgroup/i
|
186
|
+
, table = [ '<table>', '</table>', 1 ]
|
187
|
+
, td = [ '<table><tbody><tr>', '</tr></tbody></table>', 3 ]
|
188
|
+
, option = [ '<select>', '</select>', 1 ]
|
189
|
+
, tagMap = {
|
190
|
+
thead: table, tbody: table, tfoot: table, colgroup: table, caption: table
|
191
|
+
, tr: [ '<table><tbody>', '</tbody></table>', 2 ]
|
192
|
+
, th: td , td: td
|
193
|
+
, col: [ '<table><colgroup>', '</colgroup></table>', 2 ]
|
194
|
+
, fieldset: [ '<form>', '</form>', 1 ]
|
195
|
+
, legend: [ '<form><fieldset>', '</fieldset></form>', 2 ]
|
196
|
+
, option: option
|
197
|
+
, optgroup: option }
|
198
|
+
, stateAttributes = /^checked|selected$/
|
199
|
+
, ie = /msie/i.test(navigator.userAgent)
|
200
|
+
, uidMap = {}
|
201
|
+
, uuids = 0
|
202
|
+
, digit = /^-?[\d\.]+$/
|
203
|
+
, dattr = /^data-(.+)$/
|
204
|
+
, px = 'px'
|
205
|
+
, setAttribute = 'setAttribute'
|
206
|
+
, getAttribute = 'getAttribute'
|
207
|
+
, byTag = 'getElementsByTagName'
|
208
|
+
, features = function() {
|
209
|
+
var e = doc.createElement('p')
|
210
|
+
e.innerHTML = '<a href="#x">x</a><table style="float:left;"></table>'
|
211
|
+
return {
|
212
|
+
hrefExtended: e[byTag]('a')[0][getAttribute]('href') != '#x' // IE < 8
|
213
|
+
, autoTbody: e[byTag]('tbody').length !== 0 // IE < 8
|
214
|
+
, computedStyle: doc.defaultView && doc.defaultView.getComputedStyle
|
215
|
+
, cssFloat: e[byTag]('table')[0].style.styleFloat ? 'styleFloat' : 'cssFloat'
|
216
|
+
, transform: function () {
|
217
|
+
var props = ['webkitTransform', 'MozTransform', 'OTransform', 'msTransform', 'Transform'], i
|
218
|
+
for (i = 0; i < props.length; i++) {
|
219
|
+
if (props[i] in e.style) return props[i]
|
220
|
+
}
|
221
|
+
}()
|
222
|
+
}
|
223
|
+
}()
|
224
|
+
, trimReplace = /(^\s*|\s*$)/g
|
225
|
+
, unitless = { lineHeight: 1, zoom: 1, zIndex: 1, opacity: 1 }
|
226
|
+
, trim = String.prototype.trim ?
|
227
|
+
function (s) {
|
228
|
+
return s.trim()
|
229
|
+
} :
|
230
|
+
function (s) {
|
231
|
+
return s.replace(trimReplace, '')
|
232
|
+
}
|
233
|
+
|
234
|
+
function classReg(c) {
|
235
|
+
return new RegExp("(^|\\s+)" + c + "(\\s+|$)")
|
236
|
+
}
|
237
|
+
|
238
|
+
function each(ar, fn, scope) {
|
239
|
+
for (var i = 0, l = ar.length; i < l; i++) fn.call(scope || ar[i], ar[i], i, ar)
|
240
|
+
return ar
|
241
|
+
}
|
242
|
+
|
243
|
+
function deepEach(ar, fn, scope) {
|
244
|
+
for (var i = 0, l = ar.length; i < l; i++) {
|
245
|
+
if (isNode(ar[i])) {
|
246
|
+
deepEach(ar[i].childNodes, fn, scope);
|
247
|
+
fn.call(scope || ar[i], ar[i], i, ar);
|
248
|
+
}
|
249
|
+
}
|
250
|
+
return ar;
|
251
|
+
}
|
252
|
+
|
253
|
+
function camelize(s) {
|
254
|
+
return s.replace(/-(.)/g, function (m, m1) {
|
255
|
+
return m1.toUpperCase()
|
256
|
+
})
|
257
|
+
}
|
258
|
+
|
259
|
+
function decamelize(s) {
|
260
|
+
return s ? s.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase() : s
|
261
|
+
}
|
262
|
+
|
263
|
+
function data(el) {
|
264
|
+
el[getAttribute]('data-node-uid') || el[setAttribute]('data-node-uid', ++uuids)
|
265
|
+
uid = el[getAttribute]('data-node-uid')
|
266
|
+
return uidMap[uid] || (uidMap[uid] = {})
|
267
|
+
}
|
268
|
+
|
269
|
+
function clearData(el) {
|
270
|
+
uid = el[getAttribute]('data-node-uid')
|
271
|
+
uid && (delete uidMap[uid])
|
272
|
+
}
|
273
|
+
|
274
|
+
function dataValue(d) {
|
275
|
+
try {
|
276
|
+
return d === 'true' ? true : d === 'false' ? false : d === 'null' ? null : !isNaN(d) ? parseFloat(d) : d;
|
277
|
+
} catch(e) {}
|
278
|
+
return undefined
|
279
|
+
}
|
280
|
+
|
281
|
+
function isNode(node) {
|
282
|
+
return node && node.nodeName && node.nodeType == 1
|
283
|
+
}
|
284
|
+
|
285
|
+
function some(ar, fn, scope, i) {
|
286
|
+
for (i = 0, j = ar.length; i < j; ++i) if (fn.call(scope, ar[i], i, ar)) return true
|
287
|
+
return false
|
288
|
+
}
|
289
|
+
|
290
|
+
function styleProperty(p) {
|
291
|
+
(p == 'transform' && (p = features.transform)) ||
|
292
|
+
(/^transform-?[Oo]rigin$/.test(p) && (p = features.transform + "Origin")) ||
|
293
|
+
(p == 'float' && (p = features.cssFloat))
|
294
|
+
return p ? camelize(p) : null
|
295
|
+
}
|
296
|
+
|
297
|
+
var getStyle = features.computedStyle ?
|
298
|
+
function (el, property) {
|
299
|
+
var value = null
|
300
|
+
, computed = doc.defaultView.getComputedStyle(el, '')
|
301
|
+
computed && (value = computed[property])
|
302
|
+
return el.style[property] || value
|
303
|
+
} :
|
304
|
+
|
305
|
+
(ie && html.currentStyle) ?
|
306
|
+
|
307
|
+
function (el, property) {
|
308
|
+
if (property == 'opacity') {
|
309
|
+
var val = 100
|
310
|
+
try {
|
311
|
+
val = el.filters['DXImageTransform.Microsoft.Alpha'].opacity
|
312
|
+
} catch (e1) {
|
313
|
+
try {
|
314
|
+
val = el.filters('alpha').opacity
|
315
|
+
} catch (e2) {}
|
316
|
+
}
|
317
|
+
return val / 100
|
318
|
+
}
|
319
|
+
var value = el.currentStyle ? el.currentStyle[property] : null
|
320
|
+
return el.style[property] || value
|
321
|
+
} :
|
322
|
+
|
323
|
+
function (el, property) {
|
324
|
+
return el.style[property]
|
325
|
+
}
|
326
|
+
|
327
|
+
// this insert method is intense
|
328
|
+
function insert(target, host, fn) {
|
329
|
+
var i = 0, self = host || this, r = []
|
330
|
+
// target nodes could be a css selector if it's a string and a selector engine is present
|
331
|
+
// otherwise, just use target
|
332
|
+
, nodes = query && typeof target == 'string' && target.charAt(0) != '<' ? query(target) : target
|
333
|
+
// normalize each node in case it's still a string and we need to create nodes on the fly
|
334
|
+
each(normalize(nodes), function (t) {
|
335
|
+
each(self, function (el) {
|
336
|
+
var n = !el[parentNode] || (el[parentNode] && !el[parentNode][parentNode]) ?
|
337
|
+
function () {
|
338
|
+
var c = el.cloneNode(true)
|
339
|
+
// check for existence of an event cloner
|
340
|
+
// preferably https://github.com/fat/bean
|
341
|
+
// otherwise Bonzo won't do this for you
|
342
|
+
self.$ && self.cloneEvents && self.$(c).cloneEvents(el)
|
343
|
+
return c
|
344
|
+
}() : el
|
345
|
+
fn(t, n)
|
346
|
+
r[i] = n
|
347
|
+
i++
|
348
|
+
})
|
349
|
+
}, this)
|
350
|
+
each(r, function (e, i) {
|
351
|
+
self[i] = e
|
352
|
+
})
|
353
|
+
self.length = i
|
354
|
+
return self
|
355
|
+
}
|
356
|
+
|
357
|
+
function xy(el, x, y) {
|
358
|
+
var $el = bonzo(el)
|
359
|
+
, style = $el.css('position')
|
360
|
+
, offset = $el.offset()
|
361
|
+
, rel = 'relative'
|
362
|
+
, isRel = style == rel
|
363
|
+
, delta = [parseInt($el.css('left'), 10), parseInt($el.css('top'), 10)]
|
364
|
+
|
365
|
+
if (style == 'static') {
|
366
|
+
$el.css('position', rel)
|
367
|
+
style = rel
|
368
|
+
}
|
369
|
+
|
370
|
+
isNaN(delta[0]) && (delta[0] = isRel ? 0 : el.offsetLeft)
|
371
|
+
isNaN(delta[1]) && (delta[1] = isRel ? 0 : el.offsetTop)
|
372
|
+
|
373
|
+
x != null && (el.style.left = x - offset.left + delta[0] + px)
|
374
|
+
y != null && (el.style.top = y - offset.top + delta[1] + px)
|
375
|
+
|
376
|
+
}
|
377
|
+
|
378
|
+
function hasClass(el, c) {
|
379
|
+
return classReg(c).test(el.className)
|
380
|
+
}
|
381
|
+
function addClass(el, c) {
|
382
|
+
el.className = trim(el.className + ' ' + c)
|
383
|
+
}
|
384
|
+
function removeClass(el, c) {
|
385
|
+
el.className = trim(el.className.replace(classReg(c), ' '))
|
386
|
+
}
|
387
|
+
|
388
|
+
// this allows method calling for setting values
|
389
|
+
// example:
|
390
|
+
|
391
|
+
// bonzo(elements).css('color', function (el) {
|
392
|
+
// return el.getAttribute('data-original-color')
|
393
|
+
// })
|
394
|
+
|
395
|
+
function setter(el, v) {
|
396
|
+
return typeof v == 'function' ? v(el) : v
|
397
|
+
}
|
398
|
+
|
399
|
+
function Bonzo(elements) {
|
400
|
+
this.length = 0
|
401
|
+
if (elements) {
|
402
|
+
elements = typeof elements !== 'string' &&
|
403
|
+
!elements.nodeType &&
|
404
|
+
typeof elements.length !== 'undefined' ?
|
405
|
+
elements :
|
406
|
+
[elements]
|
407
|
+
this.length = elements.length
|
408
|
+
for (var i = 0; i < elements.length; i++) {
|
409
|
+
this[i] = elements[i]
|
410
|
+
}
|
411
|
+
}
|
412
|
+
}
|
413
|
+
|
414
|
+
Bonzo.prototype = {
|
415
|
+
|
416
|
+
get: function (index) {
|
417
|
+
return this[index]
|
418
|
+
}
|
419
|
+
|
420
|
+
, each: function (fn, scope) {
|
421
|
+
return each(this, fn, scope)
|
422
|
+
}
|
423
|
+
|
424
|
+
, deepEach: function (fn, scope) {
|
425
|
+
return deepEach(this, fn, scope)
|
426
|
+
}
|
427
|
+
|
428
|
+
, map: function (fn, reject) {
|
429
|
+
var m = [], n, i
|
430
|
+
for (i = 0; i < this.length; i++) {
|
431
|
+
n = fn.call(this, this[i], i)
|
432
|
+
reject ? (reject(n) && m.push(n)) : m.push(n)
|
433
|
+
}
|
434
|
+
return m
|
435
|
+
}
|
436
|
+
|
437
|
+
, first: function () {
|
438
|
+
return bonzo(this.length ? this[0] : [])
|
439
|
+
}
|
440
|
+
|
441
|
+
, last: function () {
|
442
|
+
return bonzo(this.length ? this[this.length - 1] : [])
|
443
|
+
}
|
444
|
+
|
445
|
+
, html: function (h, text) {
|
446
|
+
var method = text ?
|
447
|
+
html.textContent === undefined ?
|
448
|
+
'innerText' :
|
449
|
+
'textContent' :
|
450
|
+
'innerHTML', m;
|
451
|
+
function append(el) {
|
452
|
+
each(normalize(h), function (node) {
|
453
|
+
el.appendChild(node)
|
454
|
+
})
|
455
|
+
}
|
456
|
+
return typeof h !== 'undefined' ?
|
457
|
+
this.empty().each(function (el) {
|
458
|
+
!text && (m = el.tagName.match(specialTags)) ?
|
459
|
+
append(el, m[0]) :
|
460
|
+
(el[method] = h)
|
461
|
+
}) :
|
462
|
+
this[0] ? this[0][method] : ''
|
463
|
+
}
|
464
|
+
|
465
|
+
, text: function (text) {
|
466
|
+
return this.html(text, 1)
|
467
|
+
}
|
468
|
+
|
469
|
+
, addClass: function (c) {
|
470
|
+
return this.each(function (el) {
|
471
|
+
hasClass(el, setter(el, c)) || addClass(el, setter(el, c))
|
472
|
+
})
|
473
|
+
}
|
474
|
+
|
475
|
+
, removeClass: function (c) {
|
476
|
+
return this.each(function (el) {
|
477
|
+
hasClass(el, setter(el, c)) && removeClass(el, setter(el, c))
|
478
|
+
})
|
479
|
+
}
|
480
|
+
|
481
|
+
, hasClass: function (c) {
|
482
|
+
return some(this, function (el) {
|
483
|
+
return hasClass(el, c)
|
484
|
+
})
|
485
|
+
}
|
486
|
+
|
487
|
+
, toggleClass: function (c, condition) {
|
488
|
+
return this.each(function (el) {
|
489
|
+
typeof condition !== 'undefined' ?
|
490
|
+
condition ? addClass(el, c) : removeClass(el, c) :
|
491
|
+
hasClass(el, c) ? removeClass(el, c) : addClass(el, c)
|
492
|
+
})
|
493
|
+
}
|
494
|
+
|
495
|
+
, show: function (type) {
|
496
|
+
return this.each(function (el) {
|
497
|
+
el.style.display = type || ''
|
498
|
+
})
|
499
|
+
}
|
500
|
+
|
501
|
+
, hide: function () {
|
502
|
+
return this.each(function (el) {
|
503
|
+
el.style.display = 'none'
|
504
|
+
})
|
505
|
+
}
|
506
|
+
|
507
|
+
, append: function (node) {
|
508
|
+
return this.each(function (el) {
|
509
|
+
each(normalize(node), function (i) {
|
510
|
+
el.appendChild(i)
|
511
|
+
})
|
512
|
+
})
|
513
|
+
}
|
514
|
+
|
515
|
+
, prepend: function (node) {
|
516
|
+
return this.each(function (el) {
|
517
|
+
var first = el.firstChild
|
518
|
+
each(normalize(node), function (i) {
|
519
|
+
el.insertBefore(i, first)
|
520
|
+
})
|
521
|
+
})
|
522
|
+
}
|
523
|
+
|
524
|
+
, appendTo: function (target, host) {
|
525
|
+
return insert.call(this, target, host, function (t, el) {
|
526
|
+
t.appendChild(el)
|
527
|
+
})
|
528
|
+
}
|
529
|
+
|
530
|
+
, prependTo: function (target, host) {
|
531
|
+
return insert.call(this, target, host, function (t, el) {
|
532
|
+
t.insertBefore(el, t.firstChild)
|
533
|
+
})
|
534
|
+
}
|
535
|
+
|
536
|
+
, next: function () {
|
537
|
+
return this.related('nextSibling')
|
538
|
+
}
|
539
|
+
|
540
|
+
, previous: function () {
|
541
|
+
return this.related('previousSibling')
|
542
|
+
}
|
543
|
+
|
544
|
+
, related: function (method) {
|
545
|
+
return this.map(
|
546
|
+
function (el) {
|
547
|
+
el = el[method]
|
548
|
+
while (el && el.nodeType !== 1) {
|
549
|
+
el = el[method]
|
550
|
+
}
|
551
|
+
return el || 0
|
552
|
+
},
|
553
|
+
function (el) {
|
554
|
+
return el
|
555
|
+
}
|
556
|
+
)
|
557
|
+
}
|
558
|
+
|
559
|
+
, before: function (node) {
|
560
|
+
return this.each(function (el) {
|
561
|
+
each(bonzo.create(node), function (i) {
|
562
|
+
el[parentNode].insertBefore(i, el)
|
563
|
+
})
|
564
|
+
})
|
565
|
+
}
|
566
|
+
|
567
|
+
, after: function (node) {
|
568
|
+
return this.each(function (el) {
|
569
|
+
each(bonzo.create(node), function (i) {
|
570
|
+
el[parentNode].insertBefore(i, el.nextSibling)
|
571
|
+
})
|
572
|
+
})
|
573
|
+
}
|
574
|
+
|
575
|
+
, insertBefore: function (target, host) {
|
576
|
+
return insert.call(this, target, host, function (t, el) {
|
577
|
+
t[parentNode].insertBefore(el, t)
|
578
|
+
})
|
579
|
+
}
|
580
|
+
|
581
|
+
, insertAfter: function (target, host) {
|
582
|
+
return insert.call(this, target, host, function (t, el) {
|
583
|
+
var sibling = t.nextSibling
|
584
|
+
if (sibling) {
|
585
|
+
t[parentNode].insertBefore(el, sibling);
|
586
|
+
}
|
587
|
+
else {
|
588
|
+
t[parentNode].appendChild(el)
|
589
|
+
}
|
590
|
+
})
|
591
|
+
}
|
592
|
+
|
593
|
+
, replaceWith: function(html) {
|
594
|
+
this.deepEach(clearData)
|
595
|
+
|
596
|
+
return this.each(function (el) {
|
597
|
+
el.parentNode.replaceChild(bonzo.create(html)[0], el)
|
598
|
+
})
|
599
|
+
}
|
600
|
+
|
601
|
+
, css: function (o, v, p) {
|
602
|
+
// is this a request for just getting a style?
|
603
|
+
if (v === undefined && typeof o == 'string') {
|
604
|
+
// repurpose 'v'
|
605
|
+
v = this[0]
|
606
|
+
if (!v) {
|
607
|
+
return null
|
608
|
+
}
|
609
|
+
if (v === doc || v === win) {
|
610
|
+
p = (v === doc) ? bonzo.doc() : bonzo.viewport()
|
611
|
+
return o == 'width' ? p.width : o == 'height' ? p.height : ''
|
612
|
+
}
|
613
|
+
return (o = styleProperty(o)) ? getStyle(v, o) : null
|
614
|
+
}
|
615
|
+
var iter = o
|
616
|
+
if (typeof o == 'string') {
|
617
|
+
iter = {}
|
618
|
+
iter[o] = v
|
619
|
+
}
|
620
|
+
|
621
|
+
if (ie && iter.opacity) {
|
622
|
+
// oh this 'ol gamut
|
623
|
+
iter.filter = 'alpha(opacity=' + (iter.opacity * 100) + ')'
|
624
|
+
// give it layout
|
625
|
+
iter.zoom = o.zoom || 1;
|
626
|
+
delete iter.opacity;
|
627
|
+
}
|
628
|
+
|
629
|
+
function fn(el, p, v) {
|
630
|
+
for (var k in iter) {
|
631
|
+
if (iter.hasOwnProperty(k)) {
|
632
|
+
v = iter[k];
|
633
|
+
// change "5" to "5px" - unless you're line-height, which is allowed
|
634
|
+
(p = styleProperty(k)) && digit.test(v) && !(p in unitless) && (v += px)
|
635
|
+
el.style[p] = setter(el, v)
|
636
|
+
}
|
637
|
+
}
|
638
|
+
}
|
639
|
+
return this.each(fn)
|
640
|
+
}
|
641
|
+
|
642
|
+
, offset: function (x, y) {
|
643
|
+
if (typeof x == 'number' || typeof y == 'number') {
|
644
|
+
return this.each(function (el) {
|
645
|
+
xy(el, x, y)
|
646
|
+
})
|
647
|
+
}
|
648
|
+
if (!this[0]) return {
|
649
|
+
top: 0
|
650
|
+
, left: 0
|
651
|
+
, height: 0
|
652
|
+
, width: 0
|
653
|
+
}
|
654
|
+
var el = this[0]
|
655
|
+
, width = el.offsetWidth
|
656
|
+
, height = el.offsetHeight
|
657
|
+
, top = el.offsetTop
|
658
|
+
, left = el.offsetLeft
|
659
|
+
while (el = el.offsetParent) {
|
660
|
+
top = top + el.offsetTop
|
661
|
+
left = left + el.offsetLeft
|
662
|
+
}
|
663
|
+
|
664
|
+
return {
|
665
|
+
top: top
|
666
|
+
, left: left
|
667
|
+
, height: height
|
668
|
+
, width: width
|
669
|
+
}
|
670
|
+
}
|
671
|
+
|
672
|
+
, dim: function () {
|
673
|
+
var el = this[0]
|
674
|
+
, orig = !el.offsetWidth && !el.offsetHeight ?
|
675
|
+
// el isn't visible, can't be measured properly, so fix that
|
676
|
+
function (t, s) {
|
677
|
+
s = {
|
678
|
+
position: el.style.position || ''
|
679
|
+
, visibility: el.style.visibility || ''
|
680
|
+
, display: el.style.display || ''
|
681
|
+
}
|
682
|
+
t.first().css({
|
683
|
+
position: 'absolute'
|
684
|
+
, visibility: 'hidden'
|
685
|
+
, display: 'block'
|
686
|
+
})
|
687
|
+
return s
|
688
|
+
}(this) : null
|
689
|
+
, width = el.offsetWidth
|
690
|
+
, height = el.offsetHeight
|
691
|
+
|
692
|
+
orig && this.first().css(orig)
|
693
|
+
return {
|
694
|
+
height: height
|
695
|
+
, width: width
|
696
|
+
}
|
697
|
+
}
|
698
|
+
|
699
|
+
, attr: function (k, v) {
|
700
|
+
var el = this[0]
|
701
|
+
if (typeof k != 'string' && !(k instanceof String)) {
|
702
|
+
for (var n in k) {
|
703
|
+
k.hasOwnProperty(n) && this.attr(n, k[n])
|
704
|
+
}
|
705
|
+
return this
|
706
|
+
}
|
707
|
+
return typeof v == 'undefined' ?
|
708
|
+
specialAttributes.test(k) ?
|
709
|
+
stateAttributes.test(k) && typeof el[k] == 'string' ?
|
710
|
+
true : el[k] : (k == 'href' || k =='src') && features.hrefExtended ?
|
711
|
+
el[getAttribute](k, 2) : el[getAttribute](k) :
|
712
|
+
this.each(function (el) {
|
713
|
+
specialAttributes.test(k) ? (el[k] = setter(el, v)) : el[setAttribute](k, setter(el, v))
|
714
|
+
})
|
715
|
+
}
|
716
|
+
|
717
|
+
, val: function (s) {
|
718
|
+
return (typeof s == 'string') ? this.attr('value', s) : this[0].value
|
719
|
+
}
|
720
|
+
|
721
|
+
, removeAttr: function (k) {
|
722
|
+
return this.each(function (el) {
|
723
|
+
stateAttributes.test(k) ? (el[k] = false) : el.removeAttribute(k)
|
724
|
+
})
|
725
|
+
}
|
726
|
+
|
727
|
+
, data: function (k, v) {
|
728
|
+
var el = this[0], uid, o, m
|
729
|
+
if (typeof v === 'undefined') {
|
730
|
+
o = data(el)
|
731
|
+
if (typeof k === 'undefined') {
|
732
|
+
each(el.attributes, function(a) {
|
733
|
+
(m = (''+a.name).match(dattr)) && (o[camelize(m[1])] = dataValue(a.value))
|
734
|
+
})
|
735
|
+
return o
|
736
|
+
} else {
|
737
|
+
return typeof o[k] === 'undefined' ?
|
738
|
+
(o[k] = dataValue(this.attr('data-' + decamelize(k)))) : o[k]
|
739
|
+
}
|
740
|
+
} else {
|
741
|
+
return this.each(function (el) { data(el)[k] = v })
|
742
|
+
}
|
743
|
+
}
|
744
|
+
|
745
|
+
, remove: function () {
|
746
|
+
this.deepEach(clearData)
|
747
|
+
|
748
|
+
return this.each(function (el) {
|
749
|
+
el[parentNode] && el[parentNode].removeChild(el)
|
750
|
+
})
|
751
|
+
}
|
752
|
+
|
753
|
+
, empty: function () {
|
754
|
+
return this.each(function (el) {
|
755
|
+
deepEach(el.childNodes, clearData)
|
756
|
+
|
757
|
+
while (el.firstChild) {
|
758
|
+
el.removeChild(el.firstChild)
|
759
|
+
}
|
760
|
+
})
|
761
|
+
}
|
762
|
+
|
763
|
+
, detach: function () {
|
764
|
+
return this.map(function (el) {
|
765
|
+
return el[parentNode].removeChild(el)
|
766
|
+
})
|
767
|
+
}
|
768
|
+
|
769
|
+
, scrollTop: function (y) {
|
770
|
+
return scroll.call(this, null, y, 'y')
|
771
|
+
}
|
772
|
+
|
773
|
+
, scrollLeft: function (x) {
|
774
|
+
return scroll.call(this, x, null, 'x')
|
775
|
+
}
|
776
|
+
|
777
|
+
, toggle: function (callback, type) {
|
778
|
+
this.each(function (el) {
|
779
|
+
el.style.display = (el.offsetWidth || el.offsetHeight) ? 'none' : type || ''
|
780
|
+
})
|
781
|
+
callback && callback()
|
782
|
+
return this
|
783
|
+
}
|
784
|
+
}
|
785
|
+
|
786
|
+
function normalize(node) {
|
787
|
+
return typeof node == 'string' ? bonzo.create(node) : isNode(node) ? [node] : node // assume [nodes]
|
788
|
+
}
|
789
|
+
|
790
|
+
function scroll(x, y, type) {
|
791
|
+
var el = this[0]
|
792
|
+
if (x == null && y == null) {
|
793
|
+
return (isBody(el) ? getWindowScroll() : { x: el.scrollLeft, y: el.scrollTop })[type]
|
794
|
+
}
|
795
|
+
if (isBody(el)) {
|
796
|
+
win.scrollTo(x, y)
|
797
|
+
} else {
|
798
|
+
x != null && (el.scrollLeft = x)
|
799
|
+
y != null && (el.scrollTop = y)
|
800
|
+
}
|
801
|
+
return this
|
802
|
+
}
|
803
|
+
|
804
|
+
function isBody(element) {
|
805
|
+
return element === win || (/^(?:body|html)$/i).test(element.tagName)
|
806
|
+
}
|
807
|
+
|
808
|
+
function getWindowScroll() {
|
809
|
+
return { x: win.pageXOffset || html.scrollLeft, y: win.pageYOffset || html.scrollTop }
|
810
|
+
}
|
811
|
+
|
812
|
+
function bonzo(els, host) {
|
813
|
+
return new Bonzo(els, host)
|
814
|
+
}
|
815
|
+
|
816
|
+
bonzo.setQueryEngine = function (q) {
|
817
|
+
query = q;
|
818
|
+
delete bonzo.setQueryEngine
|
819
|
+
}
|
820
|
+
|
821
|
+
bonzo.aug = function (o, target) {
|
822
|
+
for (var k in o) {
|
823
|
+
o.hasOwnProperty(k) && ((target || Bonzo.prototype)[k] = o[k])
|
824
|
+
}
|
825
|
+
}
|
826
|
+
|
827
|
+
bonzo.create = function (node) {
|
828
|
+
return typeof node == 'string' && node !== '' ?
|
829
|
+
function () {
|
830
|
+
var tag = /^\s*<([^\s>]+)/.exec(node)
|
831
|
+
, el = doc.createElement('div')
|
832
|
+
, els = []
|
833
|
+
, p = tag ? tagMap[tag[1].toLowerCase()] : null
|
834
|
+
, dep = p ? p[2] + 1 : 1
|
835
|
+
, pn = parentNode
|
836
|
+
, tb = features.autoTbody && p && p[0] == '<table>' && !(/<tbody/i).test(node)
|
837
|
+
|
838
|
+
el.innerHTML = p ? (p[0] + node + p[1]) : node
|
839
|
+
while (dep--) el = el.firstChild
|
840
|
+
do {
|
841
|
+
// tbody special case for IE<8, creates tbody on any empty table
|
842
|
+
// we don't want it if we're just after a <thead>, <caption>, etc.
|
843
|
+
if ((!tag || el.nodeType == 1) && (!tb || el.tagName.toLowerCase() != 'tbody')) {
|
844
|
+
els.push(el)
|
845
|
+
}
|
846
|
+
} while (el = el.nextSibling)
|
847
|
+
// IE < 9 gives us a parentNode which messes up insert() check for cloning
|
848
|
+
// `dep` > 1 can also cause problems with the insert() check (must do this last)
|
849
|
+
each(els, function(el) { el[pn] && el[pn].removeChild(el) })
|
850
|
+
return els
|
851
|
+
|
852
|
+
}() : isNode(node) ? [node.cloneNode(true)] : []
|
853
|
+
}
|
854
|
+
|
855
|
+
bonzo.doc = function () {
|
856
|
+
var vp = bonzo.viewport()
|
857
|
+
return {
|
858
|
+
width: Math.max(doc.body.scrollWidth, html.scrollWidth, vp.width)
|
859
|
+
, height: Math.max(doc.body.scrollHeight, html.scrollHeight, vp.height)
|
860
|
+
}
|
861
|
+
}
|
862
|
+
|
863
|
+
bonzo.firstChild = function (el) {
|
864
|
+
for (var c = el.childNodes, i = 0, j = (c && c.length) || 0, e; i < j; i++) {
|
865
|
+
if (c[i].nodeType === 1) e = c[j = i]
|
866
|
+
}
|
867
|
+
return e
|
868
|
+
}
|
869
|
+
|
870
|
+
bonzo.viewport = function () {
|
871
|
+
return {
|
872
|
+
width: ie ? html.clientWidth : self.innerWidth
|
873
|
+
, height: ie ? html.clientHeight : self.innerHeight
|
874
|
+
}
|
875
|
+
}
|
876
|
+
|
877
|
+
bonzo.isAncestor = 'compareDocumentPosition' in html ?
|
878
|
+
function (container, element) {
|
879
|
+
return (container.compareDocumentPosition(element) & 16) == 16
|
880
|
+
} : 'contains' in html ?
|
881
|
+
function (container, element) {
|
882
|
+
return container !== element && container.contains(element);
|
883
|
+
} :
|
884
|
+
function (container, element) {
|
885
|
+
while (element = element[parentNode]) {
|
886
|
+
if (element === container) {
|
887
|
+
return true
|
888
|
+
}
|
889
|
+
}
|
890
|
+
return false
|
891
|
+
}
|
892
|
+
|
893
|
+
bonzo.noConflict = function () {
|
894
|
+
context.bonzo = old
|
895
|
+
return this
|
896
|
+
}
|
897
|
+
|
898
|
+
return bonzo
|
899
|
+
})
|
900
|
+
|
901
|
+
|
902
|
+
provide("bonzo", module.exports);
|
903
|
+
|
904
|
+
!function ($) {
|
905
|
+
|
906
|
+
var b = require('bonzo')
|
907
|
+
b.setQueryEngine($)
|
908
|
+
$.ender(b)
|
909
|
+
$.ender(b(), true)
|
910
|
+
$.ender({
|
911
|
+
create: function (node) {
|
912
|
+
return $(b.create(node))
|
913
|
+
}
|
914
|
+
})
|
915
|
+
|
916
|
+
$.id = function (id) {
|
917
|
+
return $([document.getElementById(id)])
|
918
|
+
}
|
919
|
+
|
920
|
+
function indexOf(ar, val) {
|
921
|
+
for (var i = 0; i < ar.length; i++) if (ar[i] === val) return i
|
922
|
+
return -1
|
923
|
+
}
|
924
|
+
|
925
|
+
function uniq(ar) {
|
926
|
+
var a = [], i, j
|
927
|
+
label:
|
928
|
+
for (i = 0; i < ar.length; i++) {
|
929
|
+
for (j = 0; j < a.length; j++) {
|
930
|
+
if (a[j] == ar[i]) {
|
931
|
+
continue label
|
932
|
+
}
|
933
|
+
}
|
934
|
+
a[a.length] = ar[i]
|
935
|
+
}
|
936
|
+
return a
|
937
|
+
}
|
938
|
+
|
939
|
+
$.ender({
|
940
|
+
parents: function (selector, closest) {
|
941
|
+
var collection = $(selector), j, k, p, r = []
|
942
|
+
for (j = 0, k = this.length; j < k; j++) {
|
943
|
+
p = this[j]
|
944
|
+
while (p = p.parentNode) {
|
945
|
+
if (~indexOf(collection, p)) {
|
946
|
+
r.push(p)
|
947
|
+
if (closest) break;
|
948
|
+
}
|
949
|
+
}
|
950
|
+
}
|
951
|
+
return $(uniq(r))
|
952
|
+
},
|
953
|
+
|
954
|
+
closest: function (selector) {
|
955
|
+
return this.parents(selector, true)
|
956
|
+
},
|
957
|
+
|
958
|
+
first: function () {
|
959
|
+
return $(this.length ? this[0] : this)
|
960
|
+
},
|
961
|
+
|
962
|
+
last: function () {
|
963
|
+
return $(this.length ? this[this.length - 1] : [])
|
964
|
+
},
|
965
|
+
|
966
|
+
next: function () {
|
967
|
+
return $(b(this).next())
|
968
|
+
},
|
969
|
+
|
970
|
+
previous: function () {
|
971
|
+
return $(b(this).previous())
|
972
|
+
},
|
973
|
+
|
974
|
+
appendTo: function (t) {
|
975
|
+
return b(this.selector).appendTo(t, this)
|
976
|
+
},
|
977
|
+
|
978
|
+
prependTo: function (t) {
|
979
|
+
return b(this.selector).prependTo(t, this)
|
980
|
+
},
|
981
|
+
|
982
|
+
insertAfter: function (t) {
|
983
|
+
return b(this.selector).insertAfter(t, this)
|
984
|
+
},
|
985
|
+
|
986
|
+
insertBefore: function (t) {
|
987
|
+
return b(this.selector).insertBefore(t, this)
|
988
|
+
},
|
989
|
+
|
990
|
+
siblings: function () {
|
991
|
+
var i, l, p, r = []
|
992
|
+
for (i = 0, l = this.length; i < l; i++) {
|
993
|
+
p = this[i]
|
994
|
+
while (p = p.previousSibling) p.nodeType == 1 && r.push(p)
|
995
|
+
p = this[i]
|
996
|
+
while (p = p.nextSibling) p.nodeType == 1 && r.push(p)
|
997
|
+
}
|
998
|
+
return $(r)
|
999
|
+
},
|
1000
|
+
|
1001
|
+
children: function () {
|
1002
|
+
var i, el, r = []
|
1003
|
+
for (i = 0, l = this.length; i < l; i++) {
|
1004
|
+
if (!(el = b.firstChild(this[i]))) continue;
|
1005
|
+
r.push(el)
|
1006
|
+
while (el = el.nextSibling) el.nodeType == 1 && r.push(el)
|
1007
|
+
}
|
1008
|
+
return $(uniq(r))
|
1009
|
+
},
|
1010
|
+
|
1011
|
+
height: function (v) {
|
1012
|
+
return dimension(v, this, 'height')
|
1013
|
+
},
|
1014
|
+
|
1015
|
+
width: function (v) {
|
1016
|
+
return dimension(v, this, 'width')
|
1017
|
+
}
|
1018
|
+
}, true)
|
1019
|
+
|
1020
|
+
function dimension(v, self, which) {
|
1021
|
+
return v ?
|
1022
|
+
self.css(which, v) :
|
1023
|
+
function (r) {
|
1024
|
+
if (!self[0]) return 0
|
1025
|
+
r = parseInt(self.css(which), 10);
|
1026
|
+
return isNaN(r) ? self[0]['offset' + which.replace(/^\w/, function (m) {return m.toUpperCase()})] : r
|
1027
|
+
}()
|
1028
|
+
}
|
1029
|
+
|
1030
|
+
}(ender);
|
1031
|
+
|
1032
|
+
|
1033
|
+
}();
|