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.
Files changed (112) hide show
  1. data/.bowerrc +3 -0
  2. data/lib/wpa_cli_web.rb +19 -31
  3. data/lib/wpa_cli_web/public/bower_components/house-style/.bower.json +14 -0
  4. data/lib/wpa_cli_web/public/bower_components/house-style/.bowerrc +3 -0
  5. data/lib/wpa_cli_web/public/bower_components/house-style/.gitignore +2 -0
  6. data/lib/wpa_cli_web/public/bower_components/house-style/Gemfile +6 -0
  7. data/lib/wpa_cli_web/public/bower_components/house-style/Gruntfile.js +99 -0
  8. data/lib/wpa_cli_web/public/bower_components/house-style/Guardfile +19 -0
  9. data/lib/wpa_cli_web/public/bower_components/house-style/bower.json +7 -0
  10. data/lib/wpa_cli_web/public/bower_components/house-style/bower_components/normalize-css/LICENSE.md +19 -0
  11. data/lib/wpa_cli_web/public/bower_components/house-style/bower_components/normalize-css/README.md +49 -0
  12. data/lib/wpa_cli_web/public/bower_components/house-style/bower_components/normalize-css/bower.json +23 -0
  13. data/lib/wpa_cli_web/public/bower_components/house-style/bower_components/normalize-css/normalize.css +396 -0
  14. data/lib/wpa_cli_web/public/bower_components/house-style/house-style.css +860 -0
  15. data/lib/wpa_cli_web/public/bower_components/house-style/house-style.min.css +1 -0
  16. data/lib/wpa_cli_web/public/bower_components/house-style/modules/base/base.css +37 -0
  17. data/lib/wpa_cli_web/public/bower_components/house-style/modules/button/button.css +26 -0
  18. data/lib/wpa_cli_web/public/bower_components/house-style/modules/grid/grid.css +151 -0
  19. data/lib/wpa_cli_web/public/bower_components/house-style/modules/grid/grid.png +0 -0
  20. data/lib/wpa_cli_web/public/bower_components/house-style/modules/grid/images.html +208 -0
  21. data/lib/wpa_cli_web/public/bower_components/house-style/modules/grid/index.html +141 -0
  22. data/lib/wpa_cli_web/public/bower_components/house-style/modules/loading/index.html +22 -0
  23. data/lib/wpa_cli_web/public/bower_components/house-style/modules/loading/loading.css +41 -0
  24. data/lib/wpa_cli_web/public/bower_components/house-style/modules/loading/spinner.svg +11 -0
  25. data/lib/wpa_cli_web/public/bower_components/house-style/modules/masthead/bbc-blocks-white.png +0 -0
  26. data/lib/wpa_cli_web/public/bower_components/house-style/modules/masthead/index.html +20 -0
  27. data/lib/wpa_cli_web/public/bower_components/house-style/modules/masthead/masthead.css +23 -0
  28. data/lib/wpa_cli_web/public/bower_components/house-style/modules/panel/panel.css +71 -0
  29. data/lib/wpa_cli_web/public/bower_components/house-style/modules/project-header/index.html +22 -0
  30. data/lib/wpa_cli_web/public/bower_components/house-style/modules/project-header/project-header.css +37 -0
  31. data/lib/wpa_cli_web/public/bower_components/house-style/modules/table/index.html +26 -0
  32. data/lib/wpa_cli_web/public/bower_components/house-style/modules/table/table.css +6 -0
  33. data/lib/wpa_cli_web/public/bower_components/house-style/modules/transitions/transitions.css +11 -0
  34. data/lib/wpa_cli_web/public/bower_components/house-style/package.json +21 -0
  35. data/lib/wpa_cli_web/public/bower_components/house-style/vendor/prefixfree.min.js +5 -0
  36. data/lib/wpa_cli_web/public/bower_components/normalize-css/.bower.json +21 -0
  37. data/lib/wpa_cli_web/public/bower_components/normalize-css/LICENSE.md +19 -0
  38. data/lib/wpa_cli_web/public/bower_components/normalize-css/README.md +49 -0
  39. data/lib/wpa_cli_web/public/bower_components/normalize-css/bower.json +12 -0
  40. data/lib/wpa_cli_web/public/bower_components/normalize-css/normalize.css +396 -0
  41. data/lib/wpa_cli_web/public/bower_components/qwery/.bower.json +14 -0
  42. data/lib/wpa_cli_web/public/bower_components/qwery/.gitignore +3 -0
  43. data/lib/wpa_cli_web/public/bower_components/qwery/.travis.yml +10 -0
  44. data/lib/wpa_cli_web/public/bower_components/qwery/LICENSE +7 -0
  45. data/lib/wpa_cli_web/public/bower_components/qwery/Makefile +6 -0
  46. data/lib/wpa_cli_web/public/bower_components/qwery/README.md +167 -0
  47. data/lib/wpa_cli_web/public/bower_components/qwery/config/smoosh.json +35 -0
  48. data/lib/wpa_cli_web/public/bower_components/qwery/integration/ender.js +1033 -0
  49. data/lib/wpa_cli_web/public/bower_components/qwery/integration/integration.html +26 -0
  50. data/lib/wpa_cli_web/public/bower_components/qwery/mobile/ender.js +62 -0
  51. data/lib/wpa_cli_web/public/bower_components/qwery/mobile/package.json +14 -0
  52. data/lib/wpa_cli_web/public/bower_components/qwery/mobile/qwery-mobile.js +79 -0
  53. data/lib/wpa_cli_web/public/bower_components/qwery/mobile/qwery-mobile.min.js +7 -0
  54. data/lib/wpa_cli_web/public/bower_components/qwery/mobile/src/mobile.js +72 -0
  55. data/lib/wpa_cli_web/public/bower_components/qwery/package.json +25 -0
  56. data/lib/wpa_cli_web/public/bower_components/qwery/pseudos/package.json +17 -0
  57. data/lib/wpa_cli_web/public/bower_components/qwery/pseudos/qwery-pseudos.js +106 -0
  58. data/lib/wpa_cli_web/public/bower_components/qwery/pseudos/qwery-pseudos.min.js +7 -0
  59. data/lib/wpa_cli_web/public/bower_components/qwery/pseudos/src/pseudos.js +99 -0
  60. data/lib/wpa_cli_web/public/bower_components/qwery/qwery.js +369 -0
  61. data/lib/wpa_cli_web/public/bower_components/qwery/qwery.min.js +7 -0
  62. data/lib/wpa_cli_web/public/bower_components/qwery/src/copyright.js +6 -0
  63. data/lib/wpa_cli_web/public/bower_components/qwery/src/ender.js +62 -0
  64. data/lib/wpa_cli_web/public/bower_components/qwery/src/qwery.js +362 -0
  65. data/lib/wpa_cli_web/public/bower_components/qwery/tests/W3C-Selector-tests.html +1372 -0
  66. data/lib/wpa_cli_web/public/bower_components/qwery/tests/benchmarks.html +220 -0
  67. data/lib/wpa_cli_web/public/bower_components/qwery/tests/index.html +132 -0
  68. data/lib/wpa_cli_web/public/bower_components/qwery/tests/mobile.html +58 -0
  69. data/lib/wpa_cli_web/public/bower_components/qwery/tests/phantom.js +43 -0
  70. data/lib/wpa_cli_web/public/bower_components/qwery/tests/test-env.js +25 -0
  71. data/lib/wpa_cli_web/public/bower_components/qwery/tests/tests.js +533 -0
  72. data/lib/wpa_cli_web/public/bower_components/qwery/vendor/nw.js +1680 -0
  73. data/lib/wpa_cli_web/public/bower_components/qwery/vendor/sink.css +79 -0
  74. data/lib/wpa_cli_web/public/bower_components/qwery/vendor/sink.js +181 -0
  75. data/lib/wpa_cli_web/public/bower_components/qwery/vendor/sizzle.js +1400 -0
  76. data/lib/wpa_cli_web/public/bower_components/reqwest/.bower.json +14 -0
  77. data/lib/wpa_cli_web/public/bower_components/reqwest/.gitignore +1 -0
  78. data/lib/wpa_cli_web/public/bower_components/reqwest/.jshintrc +61 -0
  79. data/lib/wpa_cli_web/public/bower_components/reqwest/Makefile +8 -0
  80. data/lib/wpa_cli_web/public/bower_components/reqwest/README.md +308 -0
  81. data/lib/wpa_cli_web/public/bower_components/reqwest/build.json +74 -0
  82. data/lib/wpa_cli_web/public/bower_components/reqwest/make/tests.js +89 -0
  83. data/lib/wpa_cli_web/public/bower_components/reqwest/package.json +27 -0
  84. data/lib/wpa_cli_web/public/bower_components/reqwest/reqwest.js +565 -0
  85. data/lib/wpa_cli_web/public/bower_components/reqwest/reqwest.min.js +7 -0
  86. data/lib/wpa_cli_web/public/bower_components/reqwest/src/copyright.js +6 -0
  87. data/lib/wpa_cli_web/public/bower_components/reqwest/src/ender.js +26 -0
  88. data/lib/wpa_cli_web/public/bower_components/reqwest/src/reqwest.js +559 -0
  89. data/lib/wpa_cli_web/public/bower_components/reqwest/tests/ender.js +117 -0
  90. data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/badfixtures.xml +1 -0
  91. data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/fixtures.html +1 -0
  92. data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/fixtures.js +1 -0
  93. data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/fixtures.json +1 -0
  94. data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/fixtures.xml +1 -0
  95. data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/fixtures_jsonp.jsonp +1 -0
  96. data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/fixtures_jsonp2.jsonp +1 -0
  97. data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/fixtures_jsonp3.jsonp +1 -0
  98. data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/fixtures_jsonp_multi.jsonp +1 -0
  99. data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/fixtures_jsonp_multi_b.jsonp +1 -0
  100. data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/fixtures_jsonp_multi_c.jsonp +1 -0
  101. data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/fixtures_with_prefix.json +1 -0
  102. data/lib/wpa_cli_web/public/bower_components/reqwest/tests/fixtures/invalidJSON.json +5 -0
  103. data/lib/wpa_cli_web/public/bower_components/reqwest/tests/tests.html +105 -0
  104. data/lib/wpa_cli_web/public/bower_components/reqwest/tests/tests.js +1723 -0
  105. data/lib/wpa_cli_web/views/access_points.erb +5 -0
  106. data/lib/wpa_cli_web/views/access_points_list.erb +19 -0
  107. data/lib/wpa_cli_web/views/layout.erb +141 -0
  108. data/lib/wpa_cli_web/views/networks_edit.erb +15 -0
  109. data/lib/wpa_cli_web/views/restart.erb +7 -0
  110. data/lib/wpa_cli_web/views/restarting.erb +14 -0
  111. data/wpa_cli_web.gemspec +1 -1
  112. metadata +111 -2
@@ -0,0 +1,79 @@
1
+ body {
2
+ width: 650px;
3
+ margin: 20px auto;
4
+ font: 300 16px 'helvetica neue', helvetica, arial;
5
+ text-shadow: 0 2px 2px #ccc;
6
+ }
7
+ h1 {
8
+ font-size: 30px;
9
+ font-weight: 300;
10
+ }
11
+ ol,li {
12
+ list-style: none;
13
+ }
14
+ ol {
15
+ -moz-box-shadow: 0 0 5px #ccc;
16
+ -moz-border-radius: 5px;
17
+ -webkit-box-shadow: 0 0 5px #ccc;
18
+ -webkit-border-radius: 5px;
19
+ box-shadow: 0 0 5px #ccc;
20
+ border-radius: 5px;
21
+ padding: 10px;
22
+ }
23
+ li {
24
+ margin: 3px 5px;
25
+ padding: 5px;
26
+ -webkit-border-radius: 5px;
27
+ -moz-border-radius: 5px;
28
+ overflow: hidden;
29
+ }
30
+ ol > li {
31
+ opacity: 0;
32
+ cursor: pointer;
33
+ }
34
+ li span {
35
+ color: #aaa;
36
+ text-align: right;
37
+ display: inline-block;
38
+ float: right;
39
+ }
40
+ li.fail span {
41
+ color: red;
42
+ }
43
+ li.pass span {
44
+ color: green;
45
+ }
46
+ li.fail {
47
+ background-color: #eed5d2;
48
+ }
49
+ li.pass {
50
+ background-color: #bdfcc9;
51
+ }
52
+ li.pass, li.fail {
53
+ -webkit-transition: opacity .5s linear;
54
+ opacity: 1;
55
+ }
56
+ li ul {
57
+ height: 0;
58
+ overflow: hidden;
59
+ margin: 0;
60
+ padding: 0;
61
+ list-style: none;
62
+ }
63
+ li.pass ul.show {
64
+ -webkit-box-shadow: 0 0 5px green;
65
+ }
66
+ li.fail ul.show {
67
+ -webkit-box-shadow: 0 0 5px red;
68
+ }
69
+ li ul.show {
70
+ height: auto;
71
+ padding: 5px;
72
+ -webkit-border-radius: 5px;
73
+ margin: 5px;
74
+ }
75
+ li ul li {
76
+ padding: 0;
77
+ margin: 2px 0;
78
+ list-style: none;
79
+ }
@@ -0,0 +1,181 @@
1
+ /*!
2
+ * Sink - Browser & Headless JavaScript Unit Tester
3
+ * copyright Dustin Diaz & Jacob Thornton
4
+ *
5
+ */
6
+ !function(context) {
7
+ var total = 0,
8
+ fail = false,
9
+ tests = [],
10
+ item,
11
+ setPasses = true,
12
+ beforeMethods = [],
13
+ afterMethods = [],
14
+ currentSetName,
15
+ isHeadless = false;
16
+
17
+ function reset() {
18
+ total = 0;
19
+ fail = false;
20
+ init();
21
+ }
22
+
23
+ function each(items, fn) {
24
+ for (var i = 0; i < items.length; i++) {
25
+ fn(items[i]);
26
+ }
27
+ }
28
+
29
+ function failure(li, check) {
30
+ setPasses = false;
31
+ if (!isHeadless) {
32
+ check.innerHTML = '✗';
33
+ li.className = 'fail';
34
+ }
35
+ reset();
36
+ }
37
+
38
+ function pass(li, check) {
39
+ if (!isHeadless) {
40
+ check.innerHTML = '✓';
41
+ li.className = 'pass';
42
+ }
43
+ reset();
44
+ }
45
+
46
+ function before(fn) {
47
+ fn ? beforeMethods.push(fn) : each(beforeMethods, function (f) {
48
+ f();
49
+ });
50
+ }
51
+
52
+ function after(fn) {
53
+ fn ? afterMethods.push(fn) : each(afterMethods, function (f) {
54
+ f();
55
+ });
56
+ }
57
+
58
+ function bind(li) {
59
+ li.onclick = function() {
60
+ this.getElementsByTagName('ul')[0].className = 'show';
61
+ };
62
+ }
63
+
64
+ function _test(name, expect, fn) {
65
+ before();
66
+ total = expect;
67
+ var li, check;
68
+ if (!isHeadless) {
69
+ li = document.createElement('li');
70
+ li.innerHTML = name + ' ... <span>o</span><ul></ul>';
71
+ item = li.getElementsByTagName('ul')[0];
72
+ bind(li);
73
+ check = li.getElementsByTagName('span')[0];
74
+ document.getElementById('tests').appendChild(li);
75
+ } else {
76
+ console.log((name + '...').yellow);
77
+ }
78
+
79
+ var start = +new Date;
80
+ fn();
81
+ setTimeout(function() {
82
+ if (+new Date - start > 10000) {
83
+ failure(li, check);
84
+ after();
85
+ } else {
86
+ if (fail) {
87
+ failure(li, check);
88
+ after();
89
+ } else if (!total) {
90
+ after();
91
+ pass(li, check);
92
+ } else {
93
+ setTimeout(arguments.callee, 10);
94
+ }
95
+ }
96
+ }, 10);
97
+ }
98
+
99
+ function test(name, expect, fn) {
100
+ tests.push({
101
+ name: name,
102
+ expect: expect,
103
+ fn: fn
104
+ });
105
+ }
106
+
107
+ function init() {
108
+ if (tests.length) {
109
+ var o = tests.shift();
110
+ _test(o.name, o.expect, o.fn);
111
+ } else {
112
+ setPasses = true;
113
+ start();
114
+ }
115
+ }
116
+
117
+ function ok(b, message) {
118
+ if (isHeadless) {
119
+ if (b) {
120
+ console.log((message + ' ✓').green);
121
+ } else {
122
+ console.log((message + ' ✗').red);
123
+ }
124
+ } else {
125
+ var li = document.createElement('li');
126
+ li.innerHTML = message + ' ' + (b ? '✓' : '✗');
127
+ item.appendChild(li);
128
+ }
129
+
130
+ if (b) {
131
+ total--;
132
+ } else {
133
+ fail = true;
134
+ }
135
+ }
136
+
137
+ var modules = [];
138
+
139
+ function sink(name, fn) {
140
+ modules.push({
141
+ name: name,
142
+ fn: fn
143
+ });
144
+ }
145
+
146
+ function nextGroup(name, fn) {
147
+ beforeMethods = [];
148
+ afterMethods = [];
149
+ console.log('MODULE: ' + name);
150
+ fn(test, ok, before, after);
151
+ currentSetName = name;
152
+ init();
153
+ }
154
+
155
+ function start() {
156
+ var current = modules.shift();
157
+ current ? nextGroup(current.name, current.fn) : !function () {
158
+ var message = [
159
+ 'Congratulations! All tests have passed!',
160
+ 'There were some errors! The suite has failed.'
161
+ ];
162
+ if (isHeadless) {
163
+ message = message[setPasses ? 0 : 1].toUpperCase();
164
+ if (setPasses) {
165
+ console.log(message.rainbow);
166
+ } else {
167
+ console.log(message.red);
168
+ }
169
+ }
170
+ }();
171
+ }
172
+
173
+ if (isHeadless) {
174
+ exports.sink = sink;
175
+ exports.start = start;
176
+ } else {
177
+ context.sink = sink;
178
+ context.start = start;
179
+ }
180
+
181
+ }(this);
@@ -0,0 +1,1400 @@
1
+ /*!
2
+ * Sizzle CSS Selector Engine
3
+ * Copyright 2011, The Dojo Foundation
4
+ * Released under the MIT, BSD, and GPL Licenses.
5
+ * More information: http://sizzlejs.com/
6
+ */
7
+ (function(){
8
+
9
+ var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
10
+ done = 0,
11
+ toString = Object.prototype.toString,
12
+ hasDuplicate = false,
13
+ baseHasDuplicate = true,
14
+ rBackslash = /\\/g,
15
+ rNonWord = /\W/;
16
+
17
+ // Here we check if the JavaScript engine is using some sort of
18
+ // optimization where it does not always call our comparision
19
+ // function. If that is the case, discard the hasDuplicate value.
20
+ // Thus far that includes Google Chrome.
21
+ [0, 0].sort(function() {
22
+ baseHasDuplicate = false;
23
+ return 0;
24
+ });
25
+
26
+ var Sizzle = function( selector, context, results, seed ) {
27
+ results = results || [];
28
+ context = context || document;
29
+
30
+ var origContext = context;
31
+
32
+ if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
33
+ return [];
34
+ }
35
+
36
+ if ( !selector || typeof selector !== "string" ) {
37
+ return results;
38
+ }
39
+
40
+ var m, set, checkSet, extra, ret, cur, pop, i,
41
+ prune = true,
42
+ contextXML = Sizzle.isXML( context ),
43
+ parts = [],
44
+ soFar = selector;
45
+
46
+ // Reset the position of the chunker regexp (start from head)
47
+ do {
48
+ chunker.exec( "" );
49
+ m = chunker.exec( soFar );
50
+
51
+ if ( m ) {
52
+ soFar = m[3];
53
+
54
+ parts.push( m[1] );
55
+
56
+ if ( m[2] ) {
57
+ extra = m[3];
58
+ break;
59
+ }
60
+ }
61
+ } while ( m );
62
+
63
+ if ( parts.length > 1 && origPOS.exec( selector ) ) {
64
+
65
+ if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
66
+ set = posProcess( parts[0] + parts[1], context );
67
+
68
+ } else {
69
+ set = Expr.relative[ parts[0] ] ?
70
+ [ context ] :
71
+ Sizzle( parts.shift(), context );
72
+
73
+ while ( parts.length ) {
74
+ selector = parts.shift();
75
+
76
+ if ( Expr.relative[ selector ] ) {
77
+ selector += parts.shift();
78
+ }
79
+
80
+ set = posProcess( selector, set );
81
+ }
82
+ }
83
+
84
+ } else {
85
+ // Take a shortcut and set the context if the root selector is an ID
86
+ // (but not if it'll be faster if the inner selector is an ID)
87
+ if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
88
+ Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
89
+
90
+ ret = Sizzle.find( parts.shift(), context, contextXML );
91
+ context = ret.expr ?
92
+ Sizzle.filter( ret.expr, ret.set )[0] :
93
+ ret.set[0];
94
+ }
95
+
96
+ if ( context ) {
97
+ ret = seed ?
98
+ { expr: parts.pop(), set: makeArray(seed) } :
99
+ Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
100
+
101
+ set = ret.expr ?
102
+ Sizzle.filter( ret.expr, ret.set ) :
103
+ ret.set;
104
+
105
+ if ( parts.length > 0 ) {
106
+ checkSet = makeArray( set );
107
+
108
+ } else {
109
+ prune = false;
110
+ }
111
+
112
+ while ( parts.length ) {
113
+ cur = parts.pop();
114
+ pop = cur;
115
+
116
+ if ( !Expr.relative[ cur ] ) {
117
+ cur = "";
118
+ } else {
119
+ pop = parts.pop();
120
+ }
121
+
122
+ if ( pop == null ) {
123
+ pop = context;
124
+ }
125
+
126
+ Expr.relative[ cur ]( checkSet, pop, contextXML );
127
+ }
128
+
129
+ } else {
130
+ checkSet = parts = [];
131
+ }
132
+ }
133
+
134
+ if ( !checkSet ) {
135
+ checkSet = set;
136
+ }
137
+
138
+ if ( !checkSet ) {
139
+ Sizzle.error( cur || selector );
140
+ }
141
+
142
+ if ( toString.call(checkSet) === "[object Array]" ) {
143
+ if ( !prune ) {
144
+ results.push.apply( results, checkSet );
145
+
146
+ } else if ( context && context.nodeType === 1 ) {
147
+ for ( i = 0; checkSet[i] != null; i++ ) {
148
+ if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
149
+ results.push( set[i] );
150
+ }
151
+ }
152
+
153
+ } else {
154
+ for ( i = 0; checkSet[i] != null; i++ ) {
155
+ if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
156
+ results.push( set[i] );
157
+ }
158
+ }
159
+ }
160
+
161
+ } else {
162
+ makeArray( checkSet, results );
163
+ }
164
+
165
+ if ( extra ) {
166
+ Sizzle( extra, origContext, results, seed );
167
+ Sizzle.uniqueSort( results );
168
+ }
169
+
170
+ return results;
171
+ };
172
+
173
+ Sizzle.uniqueSort = function( results ) {
174
+ if ( sortOrder ) {
175
+ hasDuplicate = baseHasDuplicate;
176
+ results.sort( sortOrder );
177
+
178
+ if ( hasDuplicate ) {
179
+ for ( var i = 1; i < results.length; i++ ) {
180
+ if ( results[i] === results[ i - 1 ] ) {
181
+ results.splice( i--, 1 );
182
+ }
183
+ }
184
+ }
185
+ }
186
+
187
+ return results;
188
+ };
189
+
190
+ Sizzle.matches = function( expr, set ) {
191
+ return Sizzle( expr, null, null, set );
192
+ };
193
+
194
+ Sizzle.matchesSelector = function( node, expr ) {
195
+ return Sizzle( expr, null, null, [node] ).length > 0;
196
+ };
197
+
198
+ Sizzle.find = function( expr, context, isXML ) {
199
+ var set;
200
+
201
+ if ( !expr ) {
202
+ return [];
203
+ }
204
+
205
+ for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
206
+ var match,
207
+ type = Expr.order[i];
208
+
209
+ if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
210
+ var left = match[1];
211
+ match.splice( 1, 1 );
212
+
213
+ if ( left.substr( left.length - 1 ) !== "\\" ) {
214
+ match[1] = (match[1] || "").replace( rBackslash, "" );
215
+ set = Expr.find[ type ]( match, context, isXML );
216
+
217
+ if ( set != null ) {
218
+ expr = expr.replace( Expr.match[ type ], "" );
219
+ break;
220
+ }
221
+ }
222
+ }
223
+ }
224
+
225
+ if ( !set ) {
226
+ set = typeof context.getElementsByTagName !== "undefined" ?
227
+ context.getElementsByTagName( "*" ) :
228
+ [];
229
+ }
230
+
231
+ return { set: set, expr: expr };
232
+ };
233
+
234
+ Sizzle.filter = function( expr, set, inplace, not ) {
235
+ var match, anyFound,
236
+ old = expr,
237
+ result = [],
238
+ curLoop = set,
239
+ isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
240
+
241
+ while ( expr && set.length ) {
242
+ for ( var type in Expr.filter ) {
243
+ if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
244
+ var found, item,
245
+ filter = Expr.filter[ type ],
246
+ left = match[1];
247
+
248
+ anyFound = false;
249
+
250
+ match.splice(1,1);
251
+
252
+ if ( left.substr( left.length - 1 ) === "\\" ) {
253
+ continue;
254
+ }
255
+
256
+ if ( curLoop === result ) {
257
+ result = [];
258
+ }
259
+
260
+ if ( Expr.preFilter[ type ] ) {
261
+ match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
262
+
263
+ if ( !match ) {
264
+ anyFound = found = true;
265
+
266
+ } else if ( match === true ) {
267
+ continue;
268
+ }
269
+ }
270
+
271
+ if ( match ) {
272
+ for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
273
+ if ( item ) {
274
+ found = filter( item, match, i, curLoop );
275
+ var pass = not ^ !!found;
276
+
277
+ if ( inplace && found != null ) {
278
+ if ( pass ) {
279
+ anyFound = true;
280
+
281
+ } else {
282
+ curLoop[i] = false;
283
+ }
284
+
285
+ } else if ( pass ) {
286
+ result.push( item );
287
+ anyFound = true;
288
+ }
289
+ }
290
+ }
291
+ }
292
+
293
+ if ( found !== undefined ) {
294
+ if ( !inplace ) {
295
+ curLoop = result;
296
+ }
297
+
298
+ expr = expr.replace( Expr.match[ type ], "" );
299
+
300
+ if ( !anyFound ) {
301
+ return [];
302
+ }
303
+
304
+ break;
305
+ }
306
+ }
307
+ }
308
+
309
+ // Improper expression
310
+ if ( expr === old ) {
311
+ if ( anyFound == null ) {
312
+ Sizzle.error( expr );
313
+
314
+ } else {
315
+ break;
316
+ }
317
+ }
318
+
319
+ old = expr;
320
+ }
321
+
322
+ return curLoop;
323
+ };
324
+
325
+ Sizzle.error = function( msg ) {
326
+ throw "Syntax error, unrecognized expression: " + msg;
327
+ };
328
+
329
+ var Expr = Sizzle.selectors = {
330
+ order: [ "ID", "NAME", "TAG" ],
331
+
332
+ match: {
333
+ ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
334
+ CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
335
+ NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
336
+ ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
337
+ TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
338
+ CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
339
+ POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
340
+ PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
341
+ },
342
+
343
+ leftMatch: {},
344
+
345
+ attrMap: {
346
+ "class": "className",
347
+ "for": "htmlFor"
348
+ },
349
+
350
+ attrHandle: {
351
+ href: function( elem ) {
352
+ return elem.getAttribute( "href" );
353
+ },
354
+ type: function( elem ) {
355
+ return elem.getAttribute( "type" );
356
+ }
357
+ },
358
+
359
+ relative: {
360
+ "+": function(checkSet, part){
361
+ var isPartStr = typeof part === "string",
362
+ isTag = isPartStr && !rNonWord.test( part ),
363
+ isPartStrNotTag = isPartStr && !isTag;
364
+
365
+ if ( isTag ) {
366
+ part = part.toLowerCase();
367
+ }
368
+
369
+ for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
370
+ if ( (elem = checkSet[i]) ) {
371
+ while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
372
+
373
+ checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
374
+ elem || false :
375
+ elem === part;
376
+ }
377
+ }
378
+
379
+ if ( isPartStrNotTag ) {
380
+ Sizzle.filter( part, checkSet, true );
381
+ }
382
+ },
383
+
384
+ ">": function( checkSet, part ) {
385
+ var elem,
386
+ isPartStr = typeof part === "string",
387
+ i = 0,
388
+ l = checkSet.length;
389
+
390
+ if ( isPartStr && !rNonWord.test( part ) ) {
391
+ part = part.toLowerCase();
392
+
393
+ for ( ; i < l; i++ ) {
394
+ elem = checkSet[i];
395
+
396
+ if ( elem ) {
397
+ var parent = elem.parentNode;
398
+ checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
399
+ }
400
+ }
401
+
402
+ } else {
403
+ for ( ; i < l; i++ ) {
404
+ elem = checkSet[i];
405
+
406
+ if ( elem ) {
407
+ checkSet[i] = isPartStr ?
408
+ elem.parentNode :
409
+ elem.parentNode === part;
410
+ }
411
+ }
412
+
413
+ if ( isPartStr ) {
414
+ Sizzle.filter( part, checkSet, true );
415
+ }
416
+ }
417
+ },
418
+
419
+ "": function(checkSet, part, isXML){
420
+ var nodeCheck,
421
+ doneName = done++,
422
+ checkFn = dirCheck;
423
+
424
+ if ( typeof part === "string" && !rNonWord.test( part ) ) {
425
+ part = part.toLowerCase();
426
+ nodeCheck = part;
427
+ checkFn = dirNodeCheck;
428
+ }
429
+
430
+ checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
431
+ },
432
+
433
+ "~": function( checkSet, part, isXML ) {
434
+ var nodeCheck,
435
+ doneName = done++,
436
+ checkFn = dirCheck;
437
+
438
+ if ( typeof part === "string" && !rNonWord.test( part ) ) {
439
+ part = part.toLowerCase();
440
+ nodeCheck = part;
441
+ checkFn = dirNodeCheck;
442
+ }
443
+
444
+ checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
445
+ }
446
+ },
447
+
448
+ find: {
449
+ ID: function( match, context, isXML ) {
450
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
451
+ var m = context.getElementById(match[1]);
452
+ // Check parentNode to catch when Blackberry 4.6 returns
453
+ // nodes that are no longer in the document #6963
454
+ return m && m.parentNode ? [m] : [];
455
+ }
456
+ },
457
+
458
+ NAME: function( match, context ) {
459
+ if ( typeof context.getElementsByName !== "undefined" ) {
460
+ var ret = [],
461
+ results = context.getElementsByName( match[1] );
462
+
463
+ for ( var i = 0, l = results.length; i < l; i++ ) {
464
+ if ( results[i].getAttribute("name") === match[1] ) {
465
+ ret.push( results[i] );
466
+ }
467
+ }
468
+
469
+ return ret.length === 0 ? null : ret;
470
+ }
471
+ },
472
+
473
+ TAG: function( match, context ) {
474
+ if ( typeof context.getElementsByTagName !== "undefined" ) {
475
+ return context.getElementsByTagName( match[1] );
476
+ }
477
+ }
478
+ },
479
+ preFilter: {
480
+ CLASS: function( match, curLoop, inplace, result, not, isXML ) {
481
+ match = " " + match[1].replace( rBackslash, "" ) + " ";
482
+
483
+ if ( isXML ) {
484
+ return match;
485
+ }
486
+
487
+ for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
488
+ if ( elem ) {
489
+ if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
490
+ if ( !inplace ) {
491
+ result.push( elem );
492
+ }
493
+
494
+ } else if ( inplace ) {
495
+ curLoop[i] = false;
496
+ }
497
+ }
498
+ }
499
+
500
+ return false;
501
+ },
502
+
503
+ ID: function( match ) {
504
+ return match[1].replace( rBackslash, "" );
505
+ },
506
+
507
+ TAG: function( match, curLoop ) {
508
+ return match[1].replace( rBackslash, "" ).toLowerCase();
509
+ },
510
+
511
+ CHILD: function( match ) {
512
+ if ( match[1] === "nth" ) {
513
+ if ( !match[2] ) {
514
+ Sizzle.error( match[0] );
515
+ }
516
+
517
+ match[2] = match[2].replace(/^\+|\s*/g, '');
518
+
519
+ // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
520
+ var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
521
+ match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
522
+ !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
523
+
524
+ // calculate the numbers (first)n+(last) including if they are negative
525
+ match[2] = (test[1] + (test[2] || 1)) - 0;
526
+ match[3] = test[3] - 0;
527
+ }
528
+ else if ( match[2] ) {
529
+ Sizzle.error( match[0] );
530
+ }
531
+
532
+ // TODO: Move to normal caching system
533
+ match[0] = done++;
534
+
535
+ return match;
536
+ },
537
+
538
+ ATTR: function( match, curLoop, inplace, result, not, isXML ) {
539
+ var name = match[1] = match[1].replace( rBackslash, "" );
540
+
541
+ if ( !isXML && Expr.attrMap[name] ) {
542
+ match[1] = Expr.attrMap[name];
543
+ }
544
+
545
+ // Handle if an un-quoted value was used
546
+ match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
547
+
548
+ if ( match[2] === "~=" ) {
549
+ match[4] = " " + match[4] + " ";
550
+ }
551
+
552
+ return match;
553
+ },
554
+
555
+ PSEUDO: function( match, curLoop, inplace, result, not ) {
556
+ if ( match[1] === "not" ) {
557
+ // If we're dealing with a complex expression, or a simple one
558
+ if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
559
+ match[3] = Sizzle(match[3], null, null, curLoop);
560
+
561
+ } else {
562
+ var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
563
+
564
+ if ( !inplace ) {
565
+ result.push.apply( result, ret );
566
+ }
567
+
568
+ return false;
569
+ }
570
+
571
+ } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
572
+ return true;
573
+ }
574
+
575
+ return match;
576
+ },
577
+
578
+ POS: function( match ) {
579
+ match.unshift( true );
580
+
581
+ return match;
582
+ }
583
+ },
584
+
585
+ filters: {
586
+ enabled: function( elem ) {
587
+ return elem.disabled === false && elem.type !== "hidden";
588
+ },
589
+
590
+ disabled: function( elem ) {
591
+ return elem.disabled === true;
592
+ },
593
+
594
+ checked: function( elem ) {
595
+ return elem.checked === true;
596
+ },
597
+
598
+ selected: function( elem ) {
599
+ // Accessing this property makes selected-by-default
600
+ // options in Safari work properly
601
+ if ( elem.parentNode ) {
602
+ elem.parentNode.selectedIndex;
603
+ }
604
+
605
+ return elem.selected === true;
606
+ },
607
+
608
+ parent: function( elem ) {
609
+ return !!elem.firstChild;
610
+ },
611
+
612
+ empty: function( elem ) {
613
+ return !elem.firstChild;
614
+ },
615
+
616
+ has: function( elem, i, match ) {
617
+ return !!Sizzle( match[3], elem ).length;
618
+ },
619
+
620
+ header: function( elem ) {
621
+ return (/h\d/i).test( elem.nodeName );
622
+ },
623
+
624
+ text: function( elem ) {
625
+ var attr = elem.getAttribute( "type" ), type = elem.type;
626
+ // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
627
+ // use getAttribute instead to test this case
628
+ return "text" === type && ( attr === type || attr === null );
629
+ },
630
+
631
+ radio: function( elem ) {
632
+ return "radio" === elem.type;
633
+ },
634
+
635
+ checkbox: function( elem ) {
636
+ return "checkbox" === elem.type;
637
+ },
638
+
639
+ file: function( elem ) {
640
+ return "file" === elem.type;
641
+ },
642
+ password: function( elem ) {
643
+ return "password" === elem.type;
644
+ },
645
+
646
+ submit: function( elem ) {
647
+ return "submit" === elem.type;
648
+ },
649
+
650
+ image: function( elem ) {
651
+ return "image" === elem.type;
652
+ },
653
+
654
+ reset: function( elem ) {
655
+ return "reset" === elem.type;
656
+ },
657
+
658
+ button: function( elem ) {
659
+ return "button" === elem.type || elem.nodeName.toLowerCase() === "button";
660
+ },
661
+
662
+ input: function( elem ) {
663
+ return (/input|select|textarea|button/i).test( elem.nodeName );
664
+ }
665
+ },
666
+ setFilters: {
667
+ first: function( elem, i ) {
668
+ return i === 0;
669
+ },
670
+
671
+ last: function( elem, i, match, array ) {
672
+ return i === array.length - 1;
673
+ },
674
+
675
+ even: function( elem, i ) {
676
+ return i % 2 === 0;
677
+ },
678
+
679
+ odd: function( elem, i ) {
680
+ return i % 2 === 1;
681
+ },
682
+
683
+ lt: function( elem, i, match ) {
684
+ return i < match[3] - 0;
685
+ },
686
+
687
+ gt: function( elem, i, match ) {
688
+ return i > match[3] - 0;
689
+ },
690
+
691
+ nth: function( elem, i, match ) {
692
+ return match[3] - 0 === i;
693
+ },
694
+
695
+ eq: function( elem, i, match ) {
696
+ return match[3] - 0 === i;
697
+ }
698
+ },
699
+ filter: {
700
+ PSEUDO: function( elem, match, i, array ) {
701
+ var name = match[1],
702
+ filter = Expr.filters[ name ];
703
+
704
+ if ( filter ) {
705
+ return filter( elem, i, match, array );
706
+
707
+ } else if ( name === "contains" ) {
708
+ return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
709
+
710
+ } else if ( name === "not" ) {
711
+ var not = match[3];
712
+
713
+ for ( var j = 0, l = not.length; j < l; j++ ) {
714
+ if ( not[j] === elem ) {
715
+ return false;
716
+ }
717
+ }
718
+
719
+ return true;
720
+
721
+ } else {
722
+ Sizzle.error( name );
723
+ }
724
+ },
725
+
726
+ CHILD: function( elem, match ) {
727
+ var type = match[1],
728
+ node = elem;
729
+
730
+ switch ( type ) {
731
+ case "only":
732
+ case "first":
733
+ while ( (node = node.previousSibling) ) {
734
+ if ( node.nodeType === 1 ) {
735
+ return false;
736
+ }
737
+ }
738
+
739
+ if ( type === "first" ) {
740
+ return true;
741
+ }
742
+
743
+ node = elem;
744
+
745
+ case "last":
746
+ while ( (node = node.nextSibling) ) {
747
+ if ( node.nodeType === 1 ) {
748
+ return false;
749
+ }
750
+ }
751
+
752
+ return true;
753
+
754
+ case "nth":
755
+ var first = match[2],
756
+ last = match[3];
757
+
758
+ if ( first === 1 && last === 0 ) {
759
+ return true;
760
+ }
761
+
762
+ var doneName = match[0],
763
+ parent = elem.parentNode;
764
+
765
+ if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
766
+ var count = 0;
767
+
768
+ for ( node = parent.firstChild; node; node = node.nextSibling ) {
769
+ if ( node.nodeType === 1 ) {
770
+ node.nodeIndex = ++count;
771
+ }
772
+ }
773
+
774
+ parent.sizcache = doneName;
775
+ }
776
+
777
+ var diff = elem.nodeIndex - last;
778
+
779
+ if ( first === 0 ) {
780
+ return diff === 0;
781
+
782
+ } else {
783
+ return ( diff % first === 0 && diff / first >= 0 );
784
+ }
785
+ }
786
+ },
787
+
788
+ ID: function( elem, match ) {
789
+ return elem.nodeType === 1 && elem.getAttribute("id") === match;
790
+ },
791
+
792
+ TAG: function( elem, match ) {
793
+ return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
794
+ },
795
+
796
+ CLASS: function( elem, match ) {
797
+ return (" " + (elem.className || elem.getAttribute("class")) + " ")
798
+ .indexOf( match ) > -1;
799
+ },
800
+
801
+ ATTR: function( elem, match ) {
802
+ var name = match[1],
803
+ result = Expr.attrHandle[ name ] ?
804
+ Expr.attrHandle[ name ]( elem ) :
805
+ elem[ name ] != null ?
806
+ elem[ name ] :
807
+ elem.getAttribute( name ),
808
+ value = result + "",
809
+ type = match[2],
810
+ check = match[4];
811
+
812
+ return result == null ?
813
+ type === "!=" :
814
+ type === "=" ?
815
+ value === check :
816
+ type === "*=" ?
817
+ value.indexOf(check) >= 0 :
818
+ type === "~=" ?
819
+ (" " + value + " ").indexOf(check) >= 0 :
820
+ !check ?
821
+ value && result !== false :
822
+ type === "!=" ?
823
+ value !== check :
824
+ type === "^=" ?
825
+ value.indexOf(check) === 0 :
826
+ type === "$=" ?
827
+ value.substr(value.length - check.length) === check :
828
+ type === "|=" ?
829
+ value === check || value.substr(0, check.length + 1) === check + "-" :
830
+ false;
831
+ },
832
+
833
+ POS: function( elem, match, i, array ) {
834
+ var name = match[2],
835
+ filter = Expr.setFilters[ name ];
836
+
837
+ if ( filter ) {
838
+ return filter( elem, i, match, array );
839
+ }
840
+ }
841
+ }
842
+ };
843
+
844
+ var origPOS = Expr.match.POS,
845
+ fescape = function(all, num){
846
+ return "\\" + (num - 0 + 1);
847
+ };
848
+
849
+ for ( var type in Expr.match ) {
850
+ Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
851
+ Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
852
+ }
853
+
854
+ var makeArray = function( array, results ) {
855
+ array = Array.prototype.slice.call( array, 0 );
856
+
857
+ if ( results ) {
858
+ results.push.apply( results, array );
859
+ return results;
860
+ }
861
+
862
+ return array;
863
+ };
864
+
865
+ // Perform a simple check to determine if the browser is capable of
866
+ // converting a NodeList to an array using builtin methods.
867
+ // Also verifies that the returned array holds DOM nodes
868
+ // (which is not the case in the Blackberry browser)
869
+ try {
870
+ Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
871
+
872
+ // Provide a fallback method if it does not work
873
+ } catch( e ) {
874
+ makeArray = function( array, results ) {
875
+ var i = 0,
876
+ ret = results || [];
877
+
878
+ if ( toString.call(array) === "[object Array]" ) {
879
+ Array.prototype.push.apply( ret, array );
880
+
881
+ } else {
882
+ if ( typeof array.length === "number" ) {
883
+ for ( var l = array.length; i < l; i++ ) {
884
+ ret.push( array[i] );
885
+ }
886
+
887
+ } else {
888
+ for ( ; array[i]; i++ ) {
889
+ ret.push( array[i] );
890
+ }
891
+ }
892
+ }
893
+
894
+ return ret;
895
+ };
896
+ }
897
+
898
+ var sortOrder, siblingCheck;
899
+
900
+ if ( document.documentElement.compareDocumentPosition ) {
901
+ sortOrder = function( a, b ) {
902
+ if ( a === b ) {
903
+ hasDuplicate = true;
904
+ return 0;
905
+ }
906
+
907
+ if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
908
+ return a.compareDocumentPosition ? -1 : 1;
909
+ }
910
+
911
+ return a.compareDocumentPosition(b) & 4 ? -1 : 1;
912
+ };
913
+
914
+ } else {
915
+ sortOrder = function( a, b ) {
916
+ var al, bl,
917
+ ap = [],
918
+ bp = [],
919
+ aup = a.parentNode,
920
+ bup = b.parentNode,
921
+ cur = aup;
922
+
923
+ // The nodes are identical, we can exit early
924
+ if ( a === b ) {
925
+ hasDuplicate = true;
926
+ return 0;
927
+
928
+ // If the nodes are siblings (or identical) we can do a quick check
929
+ } else if ( aup === bup ) {
930
+ return siblingCheck( a, b );
931
+
932
+ // If no parents were found then the nodes are disconnected
933
+ } else if ( !aup ) {
934
+ return -1;
935
+
936
+ } else if ( !bup ) {
937
+ return 1;
938
+ }
939
+
940
+ // Otherwise they're somewhere else in the tree so we need
941
+ // to build up a full list of the parentNodes for comparison
942
+ while ( cur ) {
943
+ ap.unshift( cur );
944
+ cur = cur.parentNode;
945
+ }
946
+
947
+ cur = bup;
948
+
949
+ while ( cur ) {
950
+ bp.unshift( cur );
951
+ cur = cur.parentNode;
952
+ }
953
+
954
+ al = ap.length;
955
+ bl = bp.length;
956
+
957
+ // Start walking down the tree looking for a discrepancy
958
+ for ( var i = 0; i < al && i < bl; i++ ) {
959
+ if ( ap[i] !== bp[i] ) {
960
+ return siblingCheck( ap[i], bp[i] );
961
+ }
962
+ }
963
+
964
+ // We ended someplace up the tree so do a sibling check
965
+ return i === al ?
966
+ siblingCheck( a, bp[i], -1 ) :
967
+ siblingCheck( ap[i], b, 1 );
968
+ };
969
+
970
+ siblingCheck = function( a, b, ret ) {
971
+ if ( a === b ) {
972
+ return ret;
973
+ }
974
+
975
+ var cur = a.nextSibling;
976
+
977
+ while ( cur ) {
978
+ if ( cur === b ) {
979
+ return -1;
980
+ }
981
+
982
+ cur = cur.nextSibling;
983
+ }
984
+
985
+ return 1;
986
+ };
987
+ }
988
+
989
+ // Utility function for retreiving the text value of an array of DOM nodes
990
+ Sizzle.getText = function( elems ) {
991
+ var ret = "", elem;
992
+
993
+ for ( var i = 0; elems[i]; i++ ) {
994
+ elem = elems[i];
995
+
996
+ // Get the text from text nodes and CDATA nodes
997
+ if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
998
+ ret += elem.nodeValue;
999
+
1000
+ // Traverse everything else, except comment nodes
1001
+ } else if ( elem.nodeType !== 8 ) {
1002
+ ret += Sizzle.getText( elem.childNodes );
1003
+ }
1004
+ }
1005
+
1006
+ return ret;
1007
+ };
1008
+
1009
+ // Check to see if the browser returns elements by name when
1010
+ // querying by getElementById (and provide a workaround)
1011
+ (function(){
1012
+ // We're going to inject a fake input element with a specified name
1013
+ var form = document.createElement("div"),
1014
+ id = "script" + (new Date()).getTime(),
1015
+ root = document.documentElement;
1016
+
1017
+ form.innerHTML = "<a name='" + id + "'/>";
1018
+
1019
+ // Inject it into the root element, check its status, and remove it quickly
1020
+ root.insertBefore( form, root.firstChild );
1021
+
1022
+ // The workaround has to do additional checks after a getElementById
1023
+ // Which slows things down for other browsers (hence the branching)
1024
+ if ( document.getElementById( id ) ) {
1025
+ Expr.find.ID = function( match, context, isXML ) {
1026
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
1027
+ var m = context.getElementById(match[1]);
1028
+
1029
+ return m ?
1030
+ m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
1031
+ [m] :
1032
+ undefined :
1033
+ [];
1034
+ }
1035
+ };
1036
+
1037
+ Expr.filter.ID = function( elem, match ) {
1038
+ var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
1039
+
1040
+ return elem.nodeType === 1 && node && node.nodeValue === match;
1041
+ };
1042
+ }
1043
+
1044
+ root.removeChild( form );
1045
+
1046
+ // release memory in IE
1047
+ root = form = null;
1048
+ })();
1049
+
1050
+ (function(){
1051
+ // Check to see if the browser returns only elements
1052
+ // when doing getElementsByTagName("*")
1053
+
1054
+ // Create a fake element
1055
+ var div = document.createElement("div");
1056
+ div.appendChild( document.createComment("") );
1057
+
1058
+ // Make sure no comments are found
1059
+ if ( div.getElementsByTagName("*").length > 0 ) {
1060
+ Expr.find.TAG = function( match, context ) {
1061
+ var results = context.getElementsByTagName( match[1] );
1062
+
1063
+ // Filter out possible comments
1064
+ if ( match[1] === "*" ) {
1065
+ var tmp = [];
1066
+
1067
+ for ( var i = 0; results[i]; i++ ) {
1068
+ if ( results[i].nodeType === 1 ) {
1069
+ tmp.push( results[i] );
1070
+ }
1071
+ }
1072
+
1073
+ results = tmp;
1074
+ }
1075
+
1076
+ return results;
1077
+ };
1078
+ }
1079
+
1080
+ // Check to see if an attribute returns normalized href attributes
1081
+ div.innerHTML = "<a href='#'></a>";
1082
+
1083
+ if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
1084
+ div.firstChild.getAttribute("href") !== "#" ) {
1085
+
1086
+ Expr.attrHandle.href = function( elem ) {
1087
+ return elem.getAttribute( "href", 2 );
1088
+ };
1089
+ }
1090
+
1091
+ // release memory in IE
1092
+ div = null;
1093
+ })();
1094
+
1095
+ if ( document.querySelectorAll ) {
1096
+ (function(){
1097
+ var oldSizzle = Sizzle,
1098
+ div = document.createElement("div"),
1099
+ id = "__sizzle__";
1100
+
1101
+ div.innerHTML = "<p class='TEST'></p>";
1102
+
1103
+ // Safari can't handle uppercase or unicode characters when
1104
+ // in quirks mode.
1105
+ if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
1106
+ return;
1107
+ }
1108
+
1109
+ Sizzle = function( query, context, extra, seed ) {
1110
+ context = context || document;
1111
+
1112
+ // Only use querySelectorAll on non-XML documents
1113
+ // (ID selectors don't work in non-HTML documents)
1114
+ if ( !seed && !Sizzle.isXML(context) ) {
1115
+ // See if we find a selector to speed up
1116
+ var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
1117
+
1118
+ if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
1119
+ // Speed-up: Sizzle("TAG")
1120
+ if ( match[1] ) {
1121
+ return makeArray( context.getElementsByTagName( query ), extra );
1122
+
1123
+ // Speed-up: Sizzle(".CLASS")
1124
+ } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
1125
+ return makeArray( context.getElementsByClassName( match[2] ), extra );
1126
+ }
1127
+ }
1128
+
1129
+ if ( context.nodeType === 9 ) {
1130
+ // Speed-up: Sizzle("body")
1131
+ // The body element only exists once, optimize finding it
1132
+ if ( query === "body" && context.body ) {
1133
+ return makeArray( [ context.body ], extra );
1134
+
1135
+ // Speed-up: Sizzle("#ID")
1136
+ } else if ( match && match[3] ) {
1137
+ var elem = context.getElementById( match[3] );
1138
+
1139
+ // Check parentNode to catch when Blackberry 4.6 returns
1140
+ // nodes that are no longer in the document #6963
1141
+ if ( elem && elem.parentNode ) {
1142
+ // Handle the case where IE and Opera return items
1143
+ // by name instead of ID
1144
+ if ( elem.id === match[3] ) {
1145
+ return makeArray( [ elem ], extra );
1146
+ }
1147
+
1148
+ } else {
1149
+ return makeArray( [], extra );
1150
+ }
1151
+ }
1152
+
1153
+ try {
1154
+ return makeArray( context.querySelectorAll(query), extra );
1155
+ } catch(qsaError) {}
1156
+
1157
+ // qSA works strangely on Element-rooted queries
1158
+ // We can work around this by specifying an extra ID on the root
1159
+ // and working up from there (Thanks to Andrew Dupont for the technique)
1160
+ // IE 8 doesn't work on object elements
1161
+ } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
1162
+ var oldContext = context,
1163
+ old = context.getAttribute( "id" ),
1164
+ nid = old || id,
1165
+ hasParent = context.parentNode,
1166
+ relativeHierarchySelector = /^\s*[+~]/.test( query );
1167
+
1168
+ if ( !old ) {
1169
+ context.setAttribute( "id", nid );
1170
+ } else {
1171
+ nid = nid.replace( /'/g, "\\$&" );
1172
+ }
1173
+ if ( relativeHierarchySelector && hasParent ) {
1174
+ context = context.parentNode;
1175
+ }
1176
+
1177
+ try {
1178
+ if ( !relativeHierarchySelector || hasParent ) {
1179
+ return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
1180
+ }
1181
+
1182
+ } catch(pseudoError) {
1183
+ } finally {
1184
+ if ( !old ) {
1185
+ oldContext.removeAttribute( "id" );
1186
+ }
1187
+ }
1188
+ }
1189
+ }
1190
+
1191
+ return oldSizzle(query, context, extra, seed);
1192
+ };
1193
+
1194
+ for ( var prop in oldSizzle ) {
1195
+ Sizzle[ prop ] = oldSizzle[ prop ];
1196
+ }
1197
+
1198
+ // release memory in IE
1199
+ div = null;
1200
+ })();
1201
+ }
1202
+
1203
+ (function(){
1204
+ var html = document.documentElement,
1205
+ matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
1206
+
1207
+ if ( matches ) {
1208
+ // Check to see if it's possible to do matchesSelector
1209
+ // on a disconnected node (IE 9 fails this)
1210
+ var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
1211
+ pseudoWorks = false;
1212
+
1213
+ try {
1214
+ // This should fail with an exception
1215
+ // Gecko does not error, returns false instead
1216
+ matches.call( document.documentElement, "[test!='']:sizzle" );
1217
+
1218
+ } catch( pseudoError ) {
1219
+ pseudoWorks = true;
1220
+ }
1221
+
1222
+ Sizzle.matchesSelector = function( node, expr ) {
1223
+ // Make sure that attribute selectors are quoted
1224
+ expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
1225
+
1226
+ if ( !Sizzle.isXML( node ) ) {
1227
+ try {
1228
+ if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
1229
+ var ret = matches.call( node, expr );
1230
+
1231
+ // IE 9's matchesSelector returns false on disconnected nodes
1232
+ if ( ret || !disconnectedMatch ||
1233
+ // As well, disconnected nodes are said to be in a document
1234
+ // fragment in IE 9, so check for that
1235
+ node.document && node.document.nodeType !== 11 ) {
1236
+ return ret;
1237
+ }
1238
+ }
1239
+ } catch(e) {}
1240
+ }
1241
+
1242
+ return Sizzle(expr, null, null, [node]).length > 0;
1243
+ };
1244
+ }
1245
+ })();
1246
+
1247
+ (function(){
1248
+ var div = document.createElement("div");
1249
+
1250
+ div.innerHTML = "<div class='test e'></div><div class='test'></div>";
1251
+
1252
+ // Opera can't find a second classname (in 9.6)
1253
+ // Also, make sure that getElementsByClassName actually exists
1254
+ if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
1255
+ return;
1256
+ }
1257
+
1258
+ // Safari caches class attributes, doesn't catch changes (in 3.2)
1259
+ div.lastChild.className = "e";
1260
+
1261
+ if ( div.getElementsByClassName("e").length === 1 ) {
1262
+ return;
1263
+ }
1264
+
1265
+ Expr.order.splice(1, 0, "CLASS");
1266
+ Expr.find.CLASS = function( match, context, isXML ) {
1267
+ if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
1268
+ return context.getElementsByClassName(match[1]);
1269
+ }
1270
+ };
1271
+
1272
+ // release memory in IE
1273
+ div = null;
1274
+ })();
1275
+
1276
+ function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
1277
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
1278
+ var elem = checkSet[i];
1279
+
1280
+ if ( elem ) {
1281
+ var match = false;
1282
+
1283
+ elem = elem[dir];
1284
+
1285
+ while ( elem ) {
1286
+ if ( elem.sizcache === doneName ) {
1287
+ match = checkSet[elem.sizset];
1288
+ break;
1289
+ }
1290
+
1291
+ if ( elem.nodeType === 1 && !isXML ){
1292
+ elem.sizcache = doneName;
1293
+ elem.sizset = i;
1294
+ }
1295
+
1296
+ if ( elem.nodeName.toLowerCase() === cur ) {
1297
+ match = elem;
1298
+ break;
1299
+ }
1300
+
1301
+ elem = elem[dir];
1302
+ }
1303
+
1304
+ checkSet[i] = match;
1305
+ }
1306
+ }
1307
+ }
1308
+
1309
+ function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
1310
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
1311
+ var elem = checkSet[i];
1312
+
1313
+ if ( elem ) {
1314
+ var match = false;
1315
+
1316
+ elem = elem[dir];
1317
+
1318
+ while ( elem ) {
1319
+ if ( elem.sizcache === doneName ) {
1320
+ match = checkSet[elem.sizset];
1321
+ break;
1322
+ }
1323
+
1324
+ if ( elem.nodeType === 1 ) {
1325
+ if ( !isXML ) {
1326
+ elem.sizcache = doneName;
1327
+ elem.sizset = i;
1328
+ }
1329
+
1330
+ if ( typeof cur !== "string" ) {
1331
+ if ( elem === cur ) {
1332
+ match = true;
1333
+ break;
1334
+ }
1335
+
1336
+ } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
1337
+ match = elem;
1338
+ break;
1339
+ }
1340
+ }
1341
+
1342
+ elem = elem[dir];
1343
+ }
1344
+
1345
+ checkSet[i] = match;
1346
+ }
1347
+ }
1348
+ }
1349
+
1350
+ if ( document.documentElement.contains ) {
1351
+ Sizzle.contains = function( a, b ) {
1352
+ return a !== b && (a.contains ? a.contains(b) : true);
1353
+ };
1354
+
1355
+ } else if ( document.documentElement.compareDocumentPosition ) {
1356
+ Sizzle.contains = function( a, b ) {
1357
+ return !!(a.compareDocumentPosition(b) & 16);
1358
+ };
1359
+
1360
+ } else {
1361
+ Sizzle.contains = function() {
1362
+ return false;
1363
+ };
1364
+ }
1365
+
1366
+ Sizzle.isXML = function( elem ) {
1367
+ // documentElement is verified for cases where it doesn't yet exist
1368
+ // (such as loading iframes in IE - #4833)
1369
+ var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
1370
+
1371
+ return documentElement ? documentElement.nodeName !== "HTML" : false;
1372
+ };
1373
+
1374
+ var posProcess = function( selector, context ) {
1375
+ var match,
1376
+ tmpSet = [],
1377
+ later = "",
1378
+ root = context.nodeType ? [context] : context;
1379
+
1380
+ // Position selectors must be done after the filter
1381
+ // And so must :not(positional) so we move all PSEUDOs to the end
1382
+ while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
1383
+ later += match[0];
1384
+ selector = selector.replace( Expr.match.PSEUDO, "" );
1385
+ }
1386
+
1387
+ selector = Expr.relative[selector] ? selector + "*" : selector;
1388
+
1389
+ for ( var i = 0, l = root.length; i < l; i++ ) {
1390
+ Sizzle( selector, root[i], tmpSet );
1391
+ }
1392
+
1393
+ return Sizzle.filter( later, tmpSet );
1394
+ };
1395
+
1396
+ // EXPOSE
1397
+
1398
+ window.Sizzle = Sizzle;
1399
+
1400
+ })();