sproutcore 1.5.0.rc.1 → 1.5.0.rc.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. data/CHANGELOG +4 -0
  2. data/VERSION.yml +1 -1
  3. data/lib/frameworks/sproutcore/Buildfile +9 -4
  4. data/lib/frameworks/sproutcore/README.md +1 -0
  5. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/QuickLook/Preview.pdf +0 -0
  6. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/QuickLook/Thumbnail.tiff +0 -0
  7. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/data.plist +0 -0
  8. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image10.png +0 -0
  9. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image11.png +0 -0
  10. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image13.png +0 -0
  11. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image15.png +0 -0
  12. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image16.png +0 -0
  13. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image17.png +0 -0
  14. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image18.png +0 -0
  15. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image19.png +0 -0
  16. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image22.tiff +0 -0
  17. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image23.png +0 -0
  18. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image24.png +0 -0
  19. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image25.png +0 -0
  20. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image30.png +0 -0
  21. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image31.png +0 -0
  22. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image8.png +0 -0
  23. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image9.png +0 -0
  24. data/lib/frameworks/sproutcore/frameworks/animation/core.js +23 -25
  25. data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +160 -0
  26. data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +73 -82
  27. data/lib/frameworks/sproutcore/frameworks/core_foundation/core.js +1 -3
  28. data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/bind.js +110 -7
  29. data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/collection.js +10 -7
  30. data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/localization.js +1 -1
  31. data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/view.js +4 -2
  32. data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions.js → core_foundation/ext/handlebars.js} +0 -57
  33. data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/object.js +1 -3
  34. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +11 -0
  35. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/main.js +1 -3
  36. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +2 -4
  37. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/application.js +14 -16
  38. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/builder.js +29 -37
  39. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/datetime.js +0 -0
  40. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +71 -19
  41. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +3 -7
  42. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/page.js +5 -7
  43. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/selection_set.js +1 -3
  44. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +4 -0
  45. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/timer.js +21 -27
  46. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +3 -5
  47. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +3 -3
  48. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/object/single_enumerable_case.js +1 -1
  49. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/sparse_array.js +1 -1
  50. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +93 -1
  51. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +1 -1
  52. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/convertLayouts.js +13 -11
  53. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layer.js +2 -6
  54. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +4 -4
  55. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/theme.js +2 -0
  56. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js +4 -4
  57. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template.js +6 -2
  58. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +87 -32
  59. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +21 -25
  60. data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/cascade.js +15 -19
  61. data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +114 -167
  62. data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +4 -4
  63. data/lib/frameworks/sproutcore/frameworks/datastore/models/child_attribute.js +4 -6
  64. data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +2 -4
  65. data/lib/frameworks/sproutcore/frameworks/datastore/models/fetched_attribute.js +7 -7
  66. data/lib/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +18 -20
  67. data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +74 -72
  68. data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +36 -29
  69. data/lib/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +2 -2
  70. data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +97 -78
  71. data/lib/frameworks/sproutcore/frameworks/datastore/system/many_array.js +117 -97
  72. data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +13 -13
  73. data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +111 -108
  74. data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +231 -198
  75. data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +146 -145
  76. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/builders.js +21 -21
  77. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/flush.js +49 -50
  78. data/lib/frameworks/sproutcore/frameworks/datetime/{system → frameworks/core/system}/datetime.js +122 -171
  79. data/lib/frameworks/sproutcore/frameworks/datetime/{tests → frameworks/core/tests}/system/datetime.js +0 -0
  80. data/lib/frameworks/sproutcore/frameworks/datetime/{resources → frameworks/localized/resources}/strings.js +0 -0
  81. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +91 -0
  82. data/lib/frameworks/sproutcore/frameworks/desktop/core.js +18 -2
  83. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/border.js +23 -16
  84. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_fast_path.js +56 -45
  85. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_group.js +5 -2
  86. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +21 -19
  87. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +82 -77
  88. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/navigation_builder.js +18 -12
  89. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +29 -17
  90. data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +148 -107
  91. data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +31 -16
  92. data/lib/frameworks/sproutcore/frameworks/desktop/panes/modal.js +16 -13
  93. data/lib/frameworks/sproutcore/frameworks/desktop/panes/palette.js +38 -17
  94. data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +37 -25
  95. data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +247 -144
  96. data/lib/frameworks/sproutcore/frameworks/desktop/panes/select_button.js +155 -100
  97. data/lib/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +39 -17
  98. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source.js +9 -6
  99. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_source.js +18 -22
  100. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +27 -17
  101. data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +77 -44
  102. data/lib/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +68 -33
  103. data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +168 -110
  104. data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +37 -5
  105. data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +187 -123
  106. data/lib/frameworks/sproutcore/frameworks/desktop/views/date_field.js +73 -49
  107. data/lib/frameworks/sproutcore/frameworks/desktop/views/disclosure.js +34 -9
  108. data/lib/frameworks/sproutcore/frameworks/desktop/views/file.js +51 -14
  109. data/lib/frameworks/sproutcore/frameworks/desktop/views/grid.js +38 -8
  110. data/lib/frameworks/sproutcore/frameworks/desktop/views/image_button.js +15 -9
  111. data/lib/frameworks/sproutcore/frameworks/desktop/views/list.js +54 -34
  112. data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +113 -42
  113. data/lib/frameworks/sproutcore/frameworks/desktop/views/master_detail.js +84 -28
  114. data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +67 -51
  115. data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +122 -35
  116. data/lib/frameworks/sproutcore/frameworks/desktop/views/navigation.js +40 -16
  117. data/lib/frameworks/sproutcore/frameworks/desktop/views/navigation_bar.js +28 -18
  118. data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +27 -31
  119. data/lib/frameworks/sproutcore/frameworks/desktop/views/progress.js +118 -68
  120. data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +117 -61
  121. data/lib/frameworks/sproutcore/frameworks/desktop/views/scene.js +23 -16
  122. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +241 -77
  123. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroller.js +134 -69
  124. data/lib/frameworks/sproutcore/frameworks/desktop/views/segment.js +107 -25
  125. data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +125 -48
  126. data/lib/frameworks/sproutcore/frameworks/desktop/views/select.js +165 -69
  127. data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +73 -24
  128. data/lib/frameworks/sproutcore/frameworks/desktop/views/separator.js +19 -5
  129. data/lib/frameworks/sproutcore/frameworks/desktop/views/source_list.js +16 -4
  130. data/lib/frameworks/sproutcore/frameworks/desktop/views/source_list_group.js +14 -7
  131. data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +43 -37
  132. data/lib/frameworks/sproutcore/frameworks/desktop/views/split_divider.js +8 -1
  133. data/lib/frameworks/sproutcore/frameworks/desktop/views/stacked.js +14 -3
  134. data/lib/frameworks/sproutcore/frameworks/desktop/views/static_content.js +16 -2
  135. data/lib/frameworks/sproutcore/frameworks/desktop/views/tab.js +99 -0
  136. data/lib/frameworks/sproutcore/frameworks/desktop/views/thumb.js +13 -1
  137. data/lib/frameworks/sproutcore/frameworks/desktop/views/toolbar.js +58 -8
  138. data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +34 -18
  139. data/lib/frameworks/sproutcore/frameworks/desktop/views/well.js +25 -9
  140. data/lib/frameworks/sproutcore/frameworks/desktop/views/workspace.js +70 -36
  141. data/lib/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +10 -5
  142. data/lib/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +28 -17
  143. data/lib/frameworks/sproutcore/frameworks/foundation/delegates/inline_text_field.js +41 -43
  144. data/lib/frameworks/sproutcore/frameworks/foundation/gestures/pinch.js +42 -4
  145. data/lib/frameworks/sproutcore/frameworks/foundation/gestures/swipe.js +94 -4
  146. data/lib/frameworks/sproutcore/frameworks/foundation/gestures/tap.js +41 -1
  147. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_mixin.js +2 -0
  148. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +18 -9
  149. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/collection_content.js +7 -5
  150. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_display.js +7 -8
  151. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +34 -24
  152. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/control.js +48 -18
  153. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +1 -0
  154. data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/misc.js +1 -2
  155. data/lib/frameworks/sproutcore/frameworks/foundation/tasks/preload_bundle.js +1 -1
  156. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/beginEditing.js +0 -11
  157. data/lib/frameworks/sproutcore/frameworks/foundation/validators/date_time.js +1 -1
  158. data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +8 -0
  159. data/lib/frameworks/sproutcore/frameworks/qunit/README.md +24 -0
  160. data/lib/frameworks/sproutcore/frameworks/qunit/package.json +21 -0
  161. data/lib/frameworks/sproutcore/frameworks/qunit/qunit/qunit.css +215 -0
  162. data/lib/frameworks/sproutcore/frameworks/qunit/qunit/qunit.js +1442 -0
  163. data/lib/frameworks/sproutcore/frameworks/qunit/test/headless.html +24 -0
  164. data/lib/frameworks/sproutcore/frameworks/qunit/test/index.html +18 -0
  165. data/lib/frameworks/sproutcore/frameworks/qunit/test/logs.html +17 -0
  166. data/lib/frameworks/sproutcore/frameworks/qunit/test/logs.js +150 -0
  167. data/lib/frameworks/sproutcore/frameworks/qunit/test/same.js +1421 -0
  168. data/lib/frameworks/sproutcore/frameworks/qunit/test/test.js +314 -0
  169. data/lib/frameworks/sproutcore/frameworks/runtime/core.js +1 -1
  170. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +369 -60
  171. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +2 -405
  172. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +3 -9
  173. data/lib/frameworks/sproutcore/frameworks/runtime/private/property_chain.js +50 -45
  174. data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +20 -1
  175. data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +0 -9
  176. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/guidFor.js +1 -1
  177. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +36 -14
  178. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable/enumerable.js +0 -34
  179. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable/enumerable_observers.js +50 -61
  180. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +2 -2
  181. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/propertyChanges.js +1 -1
  182. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/registerDependentKeys.js +45 -1
  183. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/propertyChanges.js +1 -1
  184. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/bindings.js +5 -0
  185. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/enhance.js +1 -1
  186. data/lib/frameworks/sproutcore/frameworks/testing/core.js +3 -0
  187. data/lib/frameworks/sproutcore/frameworks/testing/system/plan.js +0 -1
  188. data/lib/frameworks/sproutcore/frameworks/testing/system/runner.js +0 -1
  189. data/lib/gen/html_app/templates/apps/@target_name@/@target_name@.js +1 -1
  190. data/vendor/chance/lib/chance/instance.rb +8 -6
  191. metadata +41 -31
  192. data/lib/frameworks/sproutcore/frameworks/testing/jquery.js +0 -3559
  193. data/lib/frameworks/sproutcore/frameworks/testing/qunit.js +0 -827
@@ -1,3559 +0,0 @@
1
- // NOTE: This version of jQuery has a line added at the end that remaps it to
2
- // Q$, for private use by Qunit only. This way the jQuery library used by
3
- // Qunit will not interfere with any other jQuery libs you might load.
4
- // You should be able to merge this file with new versions of jQuery with
5
- // minor effort.
6
-
7
- (function(){
8
- /*!
9
- *
10
- * jQuery 1.2.6 - New Wave Javascript
11
- *
12
- * Copyright (c) 2008 John Resig (jquery.com)
13
- * Dual licensed under the MIT (MIT-LICENSE.txt)
14
- * and GPL (GPL-LICENSE.txt) licenses.
15
- *
16
- * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
17
- * $Rev: 5685 $
18
- */
19
-
20
- // Map over jQuery in case of overwrite
21
- var _jQuery = window.jQuery,
22
- // Map over the $ in case of overwrite
23
- _$ = window.$;
24
-
25
- var jQuery = window.jQuery = window.$ = function( selector, context ) {
26
- // The jQuery object is actually just the init constructor 'enhanced'
27
- return new jQuery.fn.init( selector, context );
28
- };
29
-
30
- // A simple way to check for HTML strings or ID strings
31
- // (both of which we optimize for)
32
- var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,
33
-
34
- // Is it a simple selector
35
- isSimple = /^.[^:#\[\.]*$/,
36
-
37
- // Will speed up references to undefined, and allows munging its name.
38
- undefined;
39
-
40
- jQuery.fn = jQuery.prototype = {
41
- init: function( selector, context ) {
42
- // Make sure that a selection was provided
43
- selector = selector || document;
44
-
45
- // Handle $(DOMElement)
46
- if ( selector.nodeType ) {
47
- this[0] = selector;
48
- this.length = 1;
49
- return this;
50
- }
51
- // Handle HTML strings
52
- if ( typeof selector == "string" ) {
53
- // Are we dealing with HTML string or an ID?
54
- var match = quickExpr.exec( selector );
55
-
56
- // Verify a match, and that no context was specified for #id
57
- if ( match && (match[1] || !context) ) {
58
-
59
- // HANDLE: $(html) -> $(array)
60
- if ( match[1] )
61
- selector = jQuery.clean( [ match[1] ], context );
62
-
63
- // HANDLE: $("#id")
64
- else {
65
- var elem = document.getElementById( match[3] );
66
-
67
- // Make sure an element was located
68
- if ( elem ){
69
- // Handle the case where IE and Opera return items
70
- // by name instead of ID
71
- if ( elem.id != match[3] )
72
- return jQuery().find( selector );
73
-
74
- // Otherwise, we inject the element directly into the jQuery object
75
- return jQuery( elem );
76
- }
77
- selector = [];
78
- }
79
-
80
- // HANDLE: $(expr, [context])
81
- // (which is just equivalent to: $(content).find(expr)
82
- } else
83
- return jQuery( context ).find( selector );
84
-
85
- // HANDLE: $(function)
86
- // Shortcut for document ready
87
- } else if ( jQuery.isFunction( selector ) )
88
- return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );
89
-
90
- return this.setArray(jQuery.makeArray(selector));
91
- },
92
-
93
- // The current version of jQuery being used
94
- jquery: "1.2.6",
95
-
96
- // The number of elements contained in the matched element set
97
- size: function() {
98
- return this.length;
99
- },
100
-
101
- // The number of elements contained in the matched element set
102
- length: 0,
103
-
104
- // Get the Nth element in the matched element set OR
105
- // Get the whole matched element set as a clean array
106
- get: function( num ) {
107
- return num == undefined ?
108
-
109
- // Return a 'clean' array
110
- jQuery.makeArray( this ) :
111
-
112
- // Return just the object
113
- this[ num ];
114
- },
115
-
116
- // Take an array of elements and push it onto the stack
117
- // (returning the new matched element set)
118
- pushStack: function( elems ) {
119
- // Build a new jQuery matched element set
120
- var ret = jQuery( elems );
121
-
122
- // Add the old object onto the stack (as a reference)
123
- ret.prevObject = this;
124
-
125
- // Return the newly-formed element set
126
- return ret;
127
- },
128
-
129
- // Force the current matched set of elements to become
130
- // the specified array of elements (destroying the stack in the process)
131
- // You should use pushStack() in order to do this, but maintain the stack
132
- setArray: function( elems ) {
133
- // Resetting the length to 0, then using the native Array push
134
- // is a super-fast way to populate an object with array-like properties
135
- this.length = 0;
136
- Array.prototype.push.apply( this, elems );
137
-
138
- return this;
139
- },
140
-
141
- // Execute a callback for every element in the matched set.
142
- // (You can seed the arguments with an array of args, but this is
143
- // only used internally.)
144
- each: function( callback, args ) {
145
- return jQuery.each( this, callback, args );
146
- },
147
-
148
- // Determine the position of an element within
149
- // the matched set of elements
150
- index: function( elem ) {
151
- var ret = -1;
152
-
153
- // Locate the position of the desired element
154
- return jQuery.inArray(
155
- // If it receives a jQuery object, the first element is used
156
- elem && elem.jquery ? elem[0] : elem
157
- , this );
158
- },
159
-
160
- attr: function( name, value, type ) {
161
- var options = name;
162
-
163
- // Look for the case where we're accessing a style value
164
- if ( name.constructor == String )
165
- if ( value === undefined )
166
- return this[0] && jQuery[ type || "attr" ]( this[0], name );
167
-
168
- else {
169
- options = {};
170
- options[ name ] = value;
171
- }
172
-
173
- // Check to see if we're setting style values
174
- return this.each(function(i){
175
- // Set all the styles
176
- for ( name in options )
177
- jQuery.attr(
178
- type ?
179
- this.style :
180
- this,
181
- name, jQuery.prop( this, options[ name ], type, i, name )
182
- );
183
- });
184
- },
185
-
186
- css: function( key, value ) {
187
- // ignore negative width and height values
188
- if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
189
- value = undefined;
190
- return this.attr( key, value, "curCSS" );
191
- },
192
-
193
- text: function( text ) {
194
- if ( typeof text != "object" && text != null )
195
- return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
196
-
197
- var ret = "";
198
-
199
- jQuery.each( text || this, function(){
200
- jQuery.each( this.childNodes, function(){
201
- if ( this.nodeType != 8 )
202
- ret += this.nodeType != 1 ?
203
- this.nodeValue :
204
- jQuery.fn.text( [ this ] );
205
- });
206
- });
207
-
208
- return ret;
209
- },
210
-
211
- wrapAll: function( html ) {
212
- if ( this[0] )
213
- // The elements to wrap the target around
214
- jQuery( html, this[0].ownerDocument )
215
- .clone()
216
- .insertBefore( this[0] )
217
- .map(function(){
218
- var elem = this;
219
-
220
- while ( elem.firstChild )
221
- elem = elem.firstChild;
222
-
223
- return elem;
224
- })
225
- .append(this);
226
-
227
- return this;
228
- },
229
-
230
- wrapInner: function( html ) {
231
- return this.each(function(){
232
- jQuery( this ).contents().wrapAll( html );
233
- });
234
- },
235
-
236
- wrap: function( html ) {
237
- return this.each(function(){
238
- jQuery( this ).wrapAll( html );
239
- });
240
- },
241
-
242
- append: function() {
243
- return this.domManip(arguments, true, false, function(elem){
244
- if (this.nodeType == 1)
245
- this.appendChild( elem );
246
- });
247
- },
248
-
249
- prepend: function() {
250
- return this.domManip(arguments, true, true, function(elem){
251
- if (this.nodeType == 1)
252
- this.insertBefore( elem, this.firstChild );
253
- });
254
- },
255
-
256
- before: function() {
257
- return this.domManip(arguments, false, false, function(elem){
258
- this.parentNode.insertBefore( elem, this );
259
- });
260
- },
261
-
262
- after: function() {
263
- return this.domManip(arguments, false, true, function(elem){
264
- this.parentNode.insertBefore( elem, this.nextSibling );
265
- });
266
- },
267
-
268
- end: function() {
269
- return this.prevObject || jQuery( [] );
270
- },
271
-
272
- find: function( selector ) {
273
- var elems = jQuery.map(this, function(elem){
274
- return jQuery.find( selector, elem );
275
- });
276
-
277
- return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ?
278
- jQuery.unique( elems ) :
279
- elems );
280
- },
281
-
282
- clone: function( events ) {
283
- // Do the clone
284
- var ret = this.map(function(){
285
- if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) {
286
- // IE copies events bound via attachEvent when
287
- // using cloneNode. Calling detachEvent on the
288
- // clone will also remove the events from the orignal
289
- // In order to get around this, we use innerHTML.
290
- // Unfortunately, this means some modifications to
291
- // attributes in IE that are actually only stored
292
- // as properties will not be copied (such as the
293
- // the name attribute on an input).
294
- var clone = this.cloneNode(true),
295
- container = document.createElement("div");
296
- container.appendChild(clone);
297
- return jQuery.clean([container.innerHTML])[0];
298
- } else
299
- return this.cloneNode(true);
300
- });
301
-
302
- // Need to set the expando to null on the cloned set if it exists
303
- // removeData doesn't work here, IE removes it from the original as well
304
- // this is primarily for IE but the data expando shouldn't be copied over in any browser
305
- var clone = ret.find("*").andSelf().each(function(){
306
- if ( this[ expando ] != undefined )
307
- this[ expando ] = null;
308
- });
309
-
310
- // Copy the events from the original to the clone
311
- if ( events === true )
312
- this.find("*").andSelf().each(function(i){
313
- if (this.nodeType == 3)
314
- return;
315
- var events = jQuery.data( this, "events" );
316
-
317
- for ( var type in events )
318
- for ( var handler in events[ type ] )
319
- jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data );
320
- });
321
-
322
- // Return the cloned set
323
- return ret;
324
- },
325
-
326
- filter: function( selector ) {
327
- return this.pushStack(
328
- jQuery.isFunction( selector ) &&
329
- jQuery.grep(this, function(elem, i){
330
- return selector.call( elem, i );
331
- }) ||
332
-
333
- jQuery.multiFilter( selector, this ) );
334
- },
335
-
336
- not: function( selector ) {
337
- if ( selector.constructor == String )
338
- // test special case where just one selector is passed in
339
- if ( isSimple.test( selector ) )
340
- return this.pushStack( jQuery.multiFilter( selector, this, true ) );
341
- else
342
- selector = jQuery.multiFilter( selector, this );
343
-
344
- var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
345
- return this.filter(function() {
346
- return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
347
- });
348
- },
349
-
350
- add: function( selector ) {
351
- return this.pushStack( jQuery.unique( jQuery.merge(
352
- this.get(),
353
- typeof selector == 'string' ?
354
- jQuery( selector ) :
355
- jQuery.makeArray( selector )
356
- )));
357
- },
358
-
359
- is: function( selector ) {
360
- return !!selector && jQuery.multiFilter( selector, this ).length > 0;
361
- },
362
-
363
- hasClass: function( selector ) {
364
- return this.is( "." + selector );
365
- },
366
-
367
- val: function( value ) {
368
- if ( value == undefined ) {
369
-
370
- if ( this.length ) {
371
- var elem = this[0];
372
-
373
- // We need to handle select boxes special
374
- if ( jQuery.nodeName( elem, "select" ) ) {
375
- var index = elem.selectedIndex,
376
- values = [],
377
- options = elem.options,
378
- one = elem.type == "select-one";
379
-
380
- // Nothing was selected
381
- if ( index < 0 )
382
- return null;
383
-
384
- // Loop through all the selected options
385
- for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
386
- var option = options[ i ];
387
-
388
- if ( option.selected ) {
389
- // Get the specifc value for the option
390
- value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value;
391
-
392
- // We don't need an array for one selects
393
- if ( one )
394
- return value;
395
-
396
- // Multi-Selects return an array
397
- values.push( value );
398
- }
399
- }
400
-
401
- return values;
402
-
403
- // Everything else, we just grab the value
404
- } else
405
- return (this[0].value || "").replace(/\r/g, "");
406
-
407
- }
408
-
409
- return undefined;
410
- }
411
-
412
- if( value.constructor == Number )
413
- value += '';
414
-
415
- return this.each(function(){
416
- if ( this.nodeType != 1 )
417
- return;
418
-
419
- if ( value.constructor == Array && /radio|checkbox/.test( this.type ) )
420
- this.checked = (jQuery.inArray(this.value, value) >= 0 ||
421
- jQuery.inArray(this.name, value) >= 0);
422
-
423
- else if ( jQuery.nodeName( this, "select" ) ) {
424
- var values = jQuery.makeArray(value);
425
-
426
- jQuery( "option", this ).each(function(){
427
- this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
428
- jQuery.inArray( this.text, values ) >= 0);
429
- });
430
-
431
- if ( !values.length )
432
- this.selectedIndex = -1;
433
-
434
- } else
435
- this.value = value;
436
- });
437
- },
438
-
439
- html: function( value ) {
440
- return value == undefined ?
441
- (this[0] ?
442
- this[0].innerHTML :
443
- null) :
444
- this.empty().append( value );
445
- },
446
-
447
- replaceWith: function( value ) {
448
- return this.after( value ).remove();
449
- },
450
-
451
- eq: function( i ) {
452
- return this.slice( i, i + 1 );
453
- },
454
-
455
- slice: function() {
456
- return this.pushStack( Array.prototype.slice.apply( this, arguments ) );
457
- },
458
-
459
- map: function( callback ) {
460
- return this.pushStack( jQuery.map(this, function(elem, i){
461
- return callback.call( elem, i, elem );
462
- }));
463
- },
464
-
465
- andSelf: function() {
466
- return this.add( this.prevObject );
467
- },
468
-
469
- data: function( key, value ){
470
- var parts = key.split(".");
471
- parts[1] = parts[1] ? "." + parts[1] : "";
472
-
473
- if ( value === undefined ) {
474
- var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
475
-
476
- if ( data === undefined && this.length )
477
- data = jQuery.data( this[0], key );
478
-
479
- return data === undefined && parts[1] ?
480
- this.data( parts[0] ) :
481
- data;
482
- } else
483
- return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
484
- jQuery.data( this, key, value );
485
- });
486
- },
487
-
488
- removeData: function( key ){
489
- return this.each(function(){
490
- jQuery.removeData( this, key );
491
- });
492
- },
493
-
494
- domManip: function( args, table, reverse, callback ) {
495
- var clone = this.length > 1, elems;
496
-
497
- return this.each(function(){
498
- if ( !elems ) {
499
- elems = jQuery.clean( args, this.ownerDocument );
500
-
501
- if ( reverse )
502
- elems.reverse();
503
- }
504
-
505
- var obj = this;
506
-
507
- if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) )
508
- obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") );
509
-
510
- var scripts = jQuery( [] );
511
-
512
- jQuery.each(elems, function(){
513
- var elem = clone ?
514
- jQuery( this ).clone( true )[0] :
515
- this;
516
-
517
- // execute all scripts after the elements have been injected
518
- if ( jQuery.nodeName( elem, "script" ) )
519
- scripts = scripts.add( elem );
520
- else {
521
- // Remove any inner scripts for later evaluation
522
- if ( elem.nodeType == 1 )
523
- scripts = scripts.add( jQuery( "script", elem ).remove() );
524
-
525
- // Inject the elements into the document
526
- callback.call( obj, elem );
527
- }
528
- });
529
-
530
- scripts.each( evalScript );
531
- });
532
- }
533
- };
534
-
535
- // Give the init function the jQuery prototype for later instantiation
536
- jQuery.fn.init.prototype = jQuery.fn;
537
-
538
- function evalScript( i, elem ) {
539
- if ( elem.src )
540
- jQuery.ajax({
541
- url: elem.src,
542
- async: false,
543
- dataType: "script"
544
- });
545
-
546
- else
547
- jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
548
-
549
- if ( elem.parentNode )
550
- elem.parentNode.removeChild( elem );
551
- }
552
-
553
- function now(){
554
- return +new Date;
555
- }
556
-
557
- jQuery.extend = jQuery.fn.extend = function() {
558
- // copy reference to target object
559
- var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
560
-
561
- // Handle a deep copy situation
562
- if ( target.constructor == Boolean ) {
563
- deep = target;
564
- target = arguments[1] || {};
565
- // skip the boolean and the target
566
- i = 2;
567
- }
568
-
569
- // Handle case when target is a string or something (possible in deep copy)
570
- if ( typeof target != "object" && typeof target != "function" )
571
- target = {};
572
-
573
- // extend jQuery itself if only one argument is passed
574
- if ( length == i ) {
575
- target = this;
576
- --i;
577
- }
578
-
579
- for ( ; i < length; i++ )
580
- // Only deal with non-null/undefined values
581
- if ( (options = arguments[ i ]) != null )
582
- // Extend the base object
583
- for ( var name in options ) {
584
- var src = target[ name ], copy = options[ name ];
585
-
586
- // Prevent never-ending loop
587
- if ( target === copy )
588
- continue;
589
-
590
- // Recurse if we're merging object values
591
- if ( deep && copy && typeof copy == "object" && !copy.nodeType )
592
- target[ name ] = jQuery.extend( deep,
593
- // Never move original objects, clone them
594
- src || ( copy.length != null ? [ ] : { } )
595
- , copy );
596
-
597
- // Don't bring in undefined values
598
- else if ( copy !== undefined )
599
- target[ name ] = copy;
600
-
601
- }
602
-
603
- // Return the modified object
604
- return target;
605
- };
606
-
607
- var expando = "jQuery" + now(), uuid = 0, windowData = {},
608
- // exclude the following css properties to add px
609
- exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
610
- // cache defaultView
611
- defaultView = document.defaultView || {};
612
-
613
- jQuery.extend({
614
- noConflict: function( deep ) {
615
- window.$ = _$;
616
-
617
- if ( deep )
618
- window.jQuery = _jQuery;
619
-
620
- return jQuery;
621
- },
622
-
623
- // See test/unit/core.js for details concerning this function.
624
- isFunction: function( fn ) {
625
- return !!fn && typeof fn != "string" && !fn.nodeName &&
626
- fn.constructor != Array && /^[\s[]?function/.test( fn + "" );
627
- },
628
-
629
- // check if an element is in a (or is an) XML document
630
- isXMLDoc: function( elem ) {
631
- return elem.documentElement && !elem.body ||
632
- elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
633
- },
634
-
635
- // Evalulates a script in a global context
636
- globalEval: function( data ) {
637
- data = jQuery.trim( data );
638
-
639
- if ( data ) {
640
- // Inspired by code by Andrea Giammarchi
641
- // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
642
- var head = document.getElementsByTagName("head")[0] || document.documentElement,
643
- script = document.createElement("script");
644
-
645
- script.type = "text/javascript";
646
- if ( jQuery.browser.msie )
647
- script.text = data;
648
- else
649
- script.appendChild( document.createTextNode( data ) );
650
-
651
- // Use insertBefore instead of appendChild to circumvent an IE6 bug.
652
- // This arises when a base node is used (#2709).
653
- head.insertBefore( script, head.firstChild );
654
- head.removeChild( script );
655
- }
656
- },
657
-
658
- nodeName: function( elem, name ) {
659
- return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
660
- },
661
-
662
- cache: {},
663
-
664
- data: function( elem, name, data ) {
665
- elem = elem == window ?
666
- windowData :
667
- elem;
668
-
669
- var id = elem[ expando ];
670
-
671
- // Compute a unique ID for the element
672
- if ( !id )
673
- id = elem[ expando ] = ++uuid;
674
-
675
- // Only generate the data cache if we're
676
- // trying to access or manipulate it
677
- if ( name && !jQuery.cache[ id ] )
678
- jQuery.cache[ id ] = {};
679
-
680
- // Prevent overriding the named cache with undefined values
681
- if ( data !== undefined )
682
- jQuery.cache[ id ][ name ] = data;
683
-
684
- // Return the named cache data, or the ID for the element
685
- return name ?
686
- jQuery.cache[ id ][ name ] :
687
- id;
688
- },
689
-
690
- removeData: function( elem, name ) {
691
- elem = elem == window ?
692
- windowData :
693
- elem;
694
-
695
- var id = elem[ expando ];
696
-
697
- // If we want to remove a specific section of the element's data
698
- if ( name ) {
699
- if ( jQuery.cache[ id ] ) {
700
- // Remove the section of cache data
701
- delete jQuery.cache[ id ][ name ];
702
-
703
- // If we've removed all the data, remove the element's cache
704
- name = "";
705
-
706
- for ( name in jQuery.cache[ id ] )
707
- break;
708
-
709
- if ( !name )
710
- jQuery.removeData( elem );
711
- }
712
-
713
- // Otherwise, we want to remove all of the element's data
714
- } else {
715
- // Clean up the element expando
716
- try {
717
- delete elem[ expando ];
718
- } catch(e){
719
- // IE has trouble directly removing the expando
720
- // but it's ok with using removeAttribute
721
- if ( elem.removeAttribute )
722
- elem.removeAttribute( expando );
723
- }
724
-
725
- // Completely remove the data cache
726
- delete jQuery.cache[ id ];
727
- }
728
- },
729
-
730
- // args is for internal usage only
731
- each: function( object, callback, args ) {
732
- var name, i = 0, length = object.length;
733
-
734
- if ( args ) {
735
- if ( length == undefined ) {
736
- for ( name in object )
737
- if ( callback.apply( object[ name ], args ) === false )
738
- break;
739
- } else
740
- for ( ; i < length; )
741
- if ( callback.apply( object[ i++ ], args ) === false )
742
- break;
743
-
744
- // A special, fast, case for the most common use of each
745
- } else {
746
- if ( length == undefined ) {
747
- for ( name in object )
748
- if ( callback.call( object[ name ], name, object[ name ] ) === false )
749
- break;
750
- } else
751
- for ( var value = object[0];
752
- i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
753
- }
754
-
755
- return object;
756
- },
757
-
758
- prop: function( elem, value, type, i, name ) {
759
- // Handle executable functions
760
- if ( jQuery.isFunction( value ) )
761
- value = value.call( elem, i );
762
-
763
- // Handle passing in a number to a CSS property
764
- return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ?
765
- value + "px" :
766
- value;
767
- },
768
-
769
- className: {
770
- // internal only, use addClass("class")
771
- add: function( elem, classNames ) {
772
- jQuery.each((classNames || "").split(/\s+/), function(i, className){
773
- if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
774
- elem.className += (elem.className ? " " : "") + className;
775
- });
776
- },
777
-
778
- // internal only, use removeClass("class")
779
- remove: function( elem, classNames ) {
780
- if (elem.nodeType == 1)
781
- elem.className = classNames != undefined ?
782
- jQuery.grep(elem.className.split(/\s+/), function(className){
783
- return !jQuery.className.has( classNames, className );
784
- }).join(" ") :
785
- "";
786
- },
787
-
788
- // internal only, use hasClass("class")
789
- has: function( elem, className ) {
790
- return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
791
- }
792
- },
793
-
794
- // A method for quickly swapping in/out CSS properties to get correct calculations
795
- swap: function( elem, options, callback ) {
796
- var old = {};
797
- // Remember the old values, and insert the new ones
798
- for ( var name in options ) {
799
- old[ name ] = elem.style[ name ];
800
- elem.style[ name ] = options[ name ];
801
- }
802
-
803
- callback.call( elem );
804
-
805
- // Revert the old values
806
- for ( var name in options )
807
- elem.style[ name ] = old[ name ];
808
- },
809
-
810
- css: function( elem, name, force ) {
811
- if ( name == "width" || name == "height" ) {
812
- var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
813
-
814
- function getWH() {
815
- val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
816
- var padding = 0, border = 0;
817
- jQuery.each( which, function() {
818
- padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
819
- border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
820
- });
821
- val -= Math.round(padding + border);
822
- }
823
-
824
- if ( jQuery(elem).is(":visible") )
825
- getWH();
826
- else
827
- jQuery.swap( elem, props, getWH );
828
-
829
- return Math.max(0, val);
830
- }
831
-
832
- return jQuery.curCSS( elem, name, force );
833
- },
834
-
835
- curCSS: function( elem, name, force ) {
836
- var ret, style = elem.style;
837
-
838
- // A helper method for determining if an element's values are broken
839
- function color( elem ) {
840
- if ( !jQuery.browser.safari )
841
- return false;
842
-
843
- // defaultView is cached
844
- var ret = defaultView.getComputedStyle( elem, null );
845
- return !ret || ret.getPropertyValue("color") == "";
846
- }
847
-
848
- // We need to handle opacity special in IE
849
- if ( name == "opacity" && jQuery.browser.msie ) {
850
- ret = jQuery.attr( style, "opacity" );
851
-
852
- return ret == "" ?
853
- "1" :
854
- ret;
855
- }
856
- // Opera sometimes will give the wrong display answer, this fixes it, see #2037
857
- if ( jQuery.browser.opera && name == "display" ) {
858
- var save = style.outline;
859
- style.outline = "0 solid black";
860
- style.outline = save;
861
- }
862
-
863
- // Make sure we're using the right name for getting the float value
864
- if ( name.match( /float/i ) )
865
- name = styleFloat;
866
-
867
- if ( !force && style && style[ name ] )
868
- ret = style[ name ];
869
-
870
- else if ( defaultView.getComputedStyle ) {
871
-
872
- // Only "float" is needed here
873
- if ( name.match( /float/i ) )
874
- name = "float";
875
-
876
- name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
877
-
878
- var computedStyle = defaultView.getComputedStyle( elem, null );
879
-
880
- if ( computedStyle && !color( elem ) )
881
- ret = computedStyle.getPropertyValue( name );
882
-
883
- // If the element isn't reporting its values properly in Safari
884
- // then some display: none elements are involved
885
- else {
886
- var swap = [], stack = [], a = elem, i = 0;
887
-
888
- // Locate all of the parent display: none elements
889
- for ( ; a && color(a); a = a.parentNode )
890
- stack.unshift(a);
891
-
892
- // Go through and make them visible, but in reverse
893
- // (It would be better if we knew the exact display type that they had)
894
- for ( ; i < stack.length; i++ )
895
- if ( color( stack[ i ] ) ) {
896
- swap[ i ] = stack[ i ].style.display;
897
- stack[ i ].style.display = "block";
898
- }
899
-
900
- // Since we flip the display style, we have to handle that
901
- // one special, otherwise get the value
902
- ret = name == "display" && swap[ stack.length - 1 ] != null ?
903
- "none" :
904
- ( computedStyle && computedStyle.getPropertyValue( name ) ) || "";
905
-
906
- // Finally, revert the display styles back
907
- for ( i = 0; i < swap.length; i++ )
908
- if ( swap[ i ] != null )
909
- stack[ i ].style.display = swap[ i ];
910
- }
911
-
912
- // We should always get a number back from opacity
913
- if ( name == "opacity" && ret == "" )
914
- ret = "1";
915
-
916
- } else if ( elem.currentStyle ) {
917
- var camelCase = name.replace(/\-(\w)/g, function(all, letter){
918
- return letter.toUpperCase();
919
- });
920
-
921
- ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
922
-
923
- // From the awesome hack by Dean Edwards
924
- // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
925
-
926
- // If we're not dealing with a regular pixel number
927
- // but a number that has a weird ending, we need to convert it to pixels
928
- if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
929
- // Remember the original values
930
- var left = style.left, rsLeft = elem.runtimeStyle.left;
931
-
932
- // Put in the new values to get a computed value out
933
- elem.runtimeStyle.left = elem.currentStyle.left;
934
- style.left = ret || 0;
935
- ret = style.pixelLeft + "px";
936
-
937
- // Revert the changed values
938
- style.left = left;
939
- elem.runtimeStyle.left = rsLeft;
940
- }
941
- }
942
-
943
- return ret;
944
- },
945
-
946
- clean: function( elems, context ) {
947
- var ret = [];
948
- context = context || document;
949
- // !context.createElement fails in IE with an error but returns typeof 'object'
950
- if (typeof context.createElement == 'undefined')
951
- context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
952
-
953
- jQuery.each(elems, function(i, elem){
954
- if ( !elem )
955
- return;
956
-
957
- if ( elem.constructor == Number )
958
- elem += '';
959
-
960
- // Convert html string into DOM nodes
961
- if ( typeof elem == "string" ) {
962
- // Fix "XHTML"-style tags in all browsers
963
- elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
964
- return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
965
- all :
966
- front + "></" + tag + ">";
967
- });
968
-
969
- // Trim whitespace, otherwise indexOf won't work as expected
970
- var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div");
971
-
972
- var wrap =
973
- // option or optgroup
974
- !tags.indexOf("<opt") &&
975
- [ 1, "<select multiple='multiple'>", "</select>" ] ||
976
-
977
- !tags.indexOf("<leg") &&
978
- [ 1, "<fieldset>", "</fieldset>" ] ||
979
-
980
- tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
981
- [ 1, "<table>", "</table>" ] ||
982
-
983
- !tags.indexOf("<tr") &&
984
- [ 2, "<table><tbody>", "</tbody></table>" ] ||
985
-
986
- // <thead> matched above
987
- (!tags.indexOf("<td") || !tags.indexOf("<th")) &&
988
- [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
989
-
990
- !tags.indexOf("<col") &&
991
- [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
992
-
993
- // IE can't serialize <link> and <script> tags normally
994
- jQuery.browser.msie &&
995
- [ 1, "div<div>", "</div>" ] ||
996
-
997
- [ 0, "", "" ];
998
-
999
- // Go to html and back, then peel off extra wrappers
1000
- div.innerHTML = wrap[1] + elem + wrap[2];
1001
-
1002
- // Move to the right depth
1003
- while ( wrap[0]-- )
1004
- div = div.lastChild;
1005
-
1006
- // Remove IE's autoinserted <tbody> from table fragments
1007
- if ( jQuery.browser.msie ) {
1008
-
1009
- // String was a <table>, *may* have spurious <tbody>
1010
- var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ?
1011
- div.firstChild && div.firstChild.childNodes :
1012
-
1013
- // String was a bare <thead> or <tfoot>
1014
- wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ?
1015
- div.childNodes :
1016
- [];
1017
-
1018
- for ( var j = tbody.length - 1; j >= 0 ; --j )
1019
- if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
1020
- tbody[ j ].parentNode.removeChild( tbody[ j ] );
1021
-
1022
- // IE completely kills leading whitespace when innerHTML is used
1023
- if ( /^\s/.test( elem ) )
1024
- div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
1025
-
1026
- }
1027
-
1028
- elem = jQuery.makeArray( div.childNodes );
1029
- }
1030
-
1031
- if ( elem.length === 0 && (!jQuery.nodeName( elem, "form" ) && !jQuery.nodeName( elem, "select" )) )
1032
- return;
1033
-
1034
- if ( elem[0] == undefined || jQuery.nodeName( elem, "form" ) || elem.options )
1035
- ret.push( elem );
1036
-
1037
- else
1038
- ret = jQuery.merge( ret, elem );
1039
-
1040
- });
1041
-
1042
- return ret;
1043
- },
1044
-
1045
- attr: function( elem, name, value ) {
1046
- // don't set attributes on text and comment nodes
1047
- if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
1048
- return undefined;
1049
-
1050
- var notxml = !jQuery.isXMLDoc( elem ),
1051
- // Whether we are setting (or getting)
1052
- set = value !== undefined,
1053
- msie = jQuery.browser.msie;
1054
-
1055
- // Try to normalize/fix the name
1056
- name = notxml && jQuery.props[ name ] || name;
1057
-
1058
- // Only do all the following if this is a node (faster for style)
1059
- // IE elem.getAttribute passes even for style
1060
- if ( elem.tagName ) {
1061
-
1062
- // These attributes require special treatment
1063
- var special = /href|src|style/.test( name );
1064
-
1065
- // Safari mis-reports the default selected property of a hidden option
1066
- // Accessing the parent's selectedIndex property fixes it
1067
- if ( name == "selected" && jQuery.browser.safari )
1068
- elem.parentNode.selectedIndex;
1069
-
1070
- // If applicable, access the attribute via the DOM 0 way
1071
- if ( name in elem && notxml && !special ) {
1072
- if ( set ){
1073
- // We can't allow the type property to be changed (since it causes problems in IE)
1074
- if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
1075
- throw "type property can't be changed";
1076
-
1077
- elem[ name ] = value;
1078
- }
1079
-
1080
- // browsers index elements by id/name on forms, give priority to attributes.
1081
- if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
1082
- return elem.getAttributeNode( name ).nodeValue;
1083
-
1084
- return elem[ name ];
1085
- }
1086
-
1087
- if ( msie && notxml && name == "style" )
1088
- return jQuery.attr( elem.style, "cssText", value );
1089
-
1090
- if ( set )
1091
- // convert the value to a string (all browsers do this but IE) see #1070
1092
- elem.setAttribute( name, "" + value );
1093
-
1094
- var attr = msie && notxml && special
1095
- // Some attributes require a special call on IE
1096
- ? elem.getAttribute( name, 2 )
1097
- : elem.getAttribute( name );
1098
-
1099
- // Non-existent attributes return null, we normalize to undefined
1100
- return attr === null ? undefined : attr;
1101
- }
1102
-
1103
- // elem is actually elem.style ... set the style
1104
-
1105
- // IE uses filters for opacity
1106
- if ( msie && name == "opacity" ) {
1107
- if ( set ) {
1108
- // IE has trouble with opacity if it does not have layout
1109
- // Force it by setting the zoom level
1110
- elem.zoom = 1;
1111
-
1112
- // Set the alpha filter to set the opacity
1113
- elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
1114
- (parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
1115
- }
1116
-
1117
- return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
1118
- (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
1119
- "";
1120
- }
1121
-
1122
- name = name.replace(/-([a-z])/ig, function(all, letter){
1123
- return letter.toUpperCase();
1124
- });
1125
-
1126
- if ( set )
1127
- elem[ name ] = value;
1128
-
1129
- return elem[ name ];
1130
- },
1131
-
1132
- trim: function( text ) {
1133
- return (text || "").replace( /^\s+|\s+$/g, "" );
1134
- },
1135
-
1136
- makeArray: function( array ) {
1137
- var ret = [];
1138
-
1139
- if( array != null ){
1140
- var i = array.length;
1141
- //the window, strings and functions also have 'length'
1142
- if( i == null || array.split || array.setInterval || array.call )
1143
- ret[0] = array;
1144
- else
1145
- while( i )
1146
- ret[--i] = array[i];
1147
- }
1148
-
1149
- return ret;
1150
- },
1151
-
1152
- inArray: function( elem, array ) {
1153
- for ( var i = 0, length = array.length; i < length; i++ )
1154
- // Use === because on IE, window == document
1155
- if ( array[ i ] === elem )
1156
- return i;
1157
-
1158
- return -1;
1159
- },
1160
-
1161
- merge: function( first, second ) {
1162
- // We have to loop this way because IE & Opera overwrite the length
1163
- // expando of getElementsByTagName
1164
- var i = 0, elem, pos = first.length;
1165
- // Also, we need to make sure that the correct elements are being returned
1166
- // (IE returns comment nodes in a '*' query)
1167
- if ( jQuery.browser.msie ) {
1168
- while ( elem = second[ i++ ] )
1169
- if ( elem.nodeType != 8 )
1170
- first[ pos++ ] = elem;
1171
-
1172
- } else
1173
- while ( elem = second[ i++ ] )
1174
- first[ pos++ ] = elem;
1175
-
1176
- return first;
1177
- },
1178
-
1179
- unique: function( array ) {
1180
- var ret = [], done = {};
1181
-
1182
- try {
1183
-
1184
- for ( var i = 0, length = array.length; i < length; i++ ) {
1185
- var id = jQuery.data( array[ i ] );
1186
-
1187
- if ( !done[ id ] ) {
1188
- done[ id ] = true;
1189
- ret.push( array[ i ] );
1190
- }
1191
- }
1192
-
1193
- } catch( e ) {
1194
- ret = array;
1195
- }
1196
-
1197
- return ret;
1198
- },
1199
-
1200
- grep: function( elems, callback, inv ) {
1201
- var ret = [];
1202
-
1203
- // Go through the array, only saving the items
1204
- // that pass the validator function
1205
- for ( var i = 0, length = elems.length; i < length; i++ )
1206
- if ( !inv != !callback( elems[ i ], i ) )
1207
- ret.push( elems[ i ] );
1208
-
1209
- return ret;
1210
- },
1211
-
1212
- map: function( elems, callback ) {
1213
- var ret = [];
1214
-
1215
- // Go through the array, translating each of the items to their
1216
- // new value (or values).
1217
- for ( var i = 0, length = elems.length; i < length; i++ ) {
1218
- var value = callback( elems[ i ], i );
1219
-
1220
- if ( value != null )
1221
- ret[ ret.length ] = value;
1222
- }
1223
-
1224
- return ret.concat.apply( [], ret );
1225
- }
1226
- });
1227
-
1228
- var userAgent = navigator.userAgent.toLowerCase();
1229
-
1230
- // Figure out what browser is being used
1231
- jQuery.browser = {
1232
- version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],
1233
- safari: /webkit/.test( userAgent ),
1234
- opera: /opera/.test( userAgent ),
1235
- msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
1236
- mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
1237
- };
1238
-
1239
- var styleFloat = jQuery.browser.msie ?
1240
- "styleFloat" :
1241
- "cssFloat";
1242
-
1243
- jQuery.extend({
1244
- // Check to see if the W3C box model is being used
1245
- boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",
1246
-
1247
- props: {
1248
- "for": "htmlFor",
1249
- "class": "className",
1250
- "float": styleFloat,
1251
- cssFloat: styleFloat,
1252
- styleFloat: styleFloat,
1253
- readonly: "readOnly",
1254
- maxlength: "maxLength",
1255
- cellspacing: "cellSpacing"
1256
- }
1257
- });
1258
-
1259
- jQuery.each({
1260
- parent: function(elem){return elem.parentNode;},
1261
- parents: function(elem){return jQuery.dir(elem,"parentNode");},
1262
- next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
1263
- prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
1264
- nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
1265
- prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
1266
- siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},
1267
- children: function(elem){return jQuery.sibling(elem.firstChild);},
1268
- contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
1269
- }, function(name, fn){
1270
- jQuery.fn[ name ] = function( selector ) {
1271
- var ret = jQuery.map( this, fn );
1272
-
1273
- if ( selector && typeof selector == "string" )
1274
- ret = jQuery.multiFilter( selector, ret );
1275
-
1276
- return this.pushStack( jQuery.unique( ret ) );
1277
- };
1278
- });
1279
-
1280
- jQuery.each({
1281
- appendTo: "append",
1282
- prependTo: "prepend",
1283
- insertBefore: "before",
1284
- insertAfter: "after",
1285
- replaceAll: "replaceWith"
1286
- }, function(name, original){
1287
- jQuery.fn[ name ] = function() {
1288
- var args = arguments;
1289
-
1290
- return this.each(function(){
1291
- for ( var i = 0, length = args.length; i < length; i++ )
1292
- jQuery( args[ i ] )[ original ]( this );
1293
- });
1294
- };
1295
- });
1296
-
1297
- jQuery.each({
1298
- removeAttr: function( name ) {
1299
- jQuery.attr( this, name, "" );
1300
- if (this.nodeType == 1)
1301
- this.removeAttribute( name );
1302
- },
1303
-
1304
- addClass: function( classNames ) {
1305
- jQuery.className.add( this, classNames );
1306
- },
1307
-
1308
- removeClass: function( classNames ) {
1309
- jQuery.className.remove( this, classNames );
1310
- },
1311
-
1312
- toggleClass: function( classNames ) {
1313
- jQuery.className[ jQuery.className.has( this, classNames ) ? "remove" : "add" ]( this, classNames );
1314
- },
1315
-
1316
- remove: function( selector ) {
1317
- if ( !selector || jQuery.filter( selector, [ this ] ).r.length ) {
1318
- // Prevent memory leaks
1319
- jQuery( "*", this ).add(this).each(function(){
1320
- jQuery.event.remove(this);
1321
- jQuery.removeData(this);
1322
- });
1323
- if (this.parentNode)
1324
- this.parentNode.removeChild( this );
1325
- }
1326
- },
1327
-
1328
- empty: function() {
1329
- // Remove element nodes and prevent memory leaks
1330
- jQuery( ">*", this ).remove();
1331
-
1332
- // Remove any remaining nodes
1333
- while ( this.firstChild )
1334
- this.removeChild( this.firstChild );
1335
- }
1336
- }, function(name, fn){
1337
- jQuery.fn[ name ] = function(){
1338
- return this.each( fn, arguments );
1339
- };
1340
- });
1341
-
1342
- jQuery.each([ "Height", "Width" ], function(i, name){
1343
- var type = name.toLowerCase();
1344
-
1345
- jQuery.fn[ type ] = function( size ) {
1346
- // Get window width or height
1347
- return this[0] == window ?
1348
- // Opera reports document.body.client[Width/Height] properly in both quirks and standards
1349
- jQuery.browser.opera && document.body[ "client" + name ] ||
1350
-
1351
- // Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths)
1352
- jQuery.browser.safari && window[ "inner" + name ] ||
1353
-
1354
- // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
1355
- document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] :
1356
-
1357
- // Get document width or height
1358
- this[0] == document ?
1359
- // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
1360
- Math.max(
1361
- Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]),
1362
- Math.max(document.body["offset" + name], document.documentElement["offset" + name])
1363
- ) :
1364
-
1365
- // Get or set width or height on the element
1366
- size == undefined ?
1367
- // Get width or height on the element
1368
- (this.length ? jQuery.css( this[0], type ) : null) :
1369
-
1370
- // Set the width or height on the element (default to pixels if value is unitless)
1371
- this.css( type, size.constructor == String ? size : size + "px" );
1372
- };
1373
- });
1374
-
1375
- // Helper function used by the dimensions and offset modules
1376
- function num(elem, prop) {
1377
- return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
1378
- }var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ?
1379
- "(?:[\\w*_-]|\\\\.)" :
1380
- "(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",
1381
- quickChild = new RegExp("^>\\s*(" + chars + "+)"),
1382
- quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"),
1383
- quickClass = new RegExp("^([#.]?)(" + chars + "*)");
1384
-
1385
- jQuery.extend({
1386
- expr: {
1387
- "": function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},
1388
- "#": function(a,i,m){return a.getAttribute("id")==m[2];},
1389
- ":": {
1390
- // Position Checks
1391
- lt: function(a,i,m){return i<m[3]-0;},
1392
- gt: function(a,i,m){return i>m[3]-0;},
1393
- nth: function(a,i,m){return m[3]-0==i;},
1394
- eq: function(a,i,m){return m[3]-0==i;},
1395
- first: function(a,i){return i==0;},
1396
- last: function(a,i,m,r){return i==r.length-1;},
1397
- even: function(a,i){return i%2==0;},
1398
- odd: function(a,i){return i%2;},
1399
-
1400
- // Child Checks
1401
- "first-child": function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},
1402
- "last-child": function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},
1403
- "only-child": function(a){return !jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},
1404
-
1405
- // Parent Checks
1406
- parent: function(a){return a.firstChild;},
1407
- empty: function(a){return !a.firstChild;},
1408
-
1409
- // Text Check
1410
- contains: function(a,i,m){return (a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},
1411
-
1412
- // Visibility
1413
- visible: function(a){return "hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},
1414
- hidden: function(a){return "hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},
1415
-
1416
- // Form attributes
1417
- enabled: function(a){return !a.disabled;},
1418
- disabled: function(a){return a.disabled;},
1419
- checked: function(a){return a.checked;},
1420
- selected: function(a){return a.selected||jQuery.attr(a,"selected");},
1421
-
1422
- // Form elements
1423
- text: function(a){return "text"==a.type;},
1424
- radio: function(a){return "radio"==a.type;},
1425
- checkbox: function(a){return "checkbox"==a.type;},
1426
- file: function(a){return "file"==a.type;},
1427
- password: function(a){return "password"==a.type;},
1428
- submit: function(a){return "submit"==a.type;},
1429
- image: function(a){return "image"==a.type;},
1430
- reset: function(a){return "reset"==a.type;},
1431
- button: function(a){return "button"==a.type||jQuery.nodeName(a,"button");},
1432
- input: function(a){return /input|select|textarea|button/i.test(a.nodeName);},
1433
-
1434
- // :has()
1435
- has: function(a,i,m){return jQuery.find(m[3],a).length;},
1436
-
1437
- // :header
1438
- header: function(a){return /h\d/i.test(a.nodeName);},
1439
-
1440
- // :animated
1441
- animated: function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}
1442
- }
1443
- },
1444
-
1445
- // The regular expressions that power the parsing engine
1446
- parse: [
1447
- // Match: [@value='test'], [@foo]
1448
- /^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,
1449
-
1450
- // Match: :contains('foo')
1451
- /^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,
1452
-
1453
- // Match: :even, :last-child, #id, .class
1454
- new RegExp("^([:.#]*)(" + chars + "+)")
1455
- ],
1456
-
1457
- multiFilter: function( expr, elems, not ) {
1458
- var old, cur = [];
1459
-
1460
- while ( expr && expr != old ) {
1461
- old = expr;
1462
- var f = jQuery.filter( expr, elems, not );
1463
- expr = f.t.replace(/^\s*,\s*/, "" );
1464
- cur = not ? elems = f.r : jQuery.merge( cur, f.r );
1465
- }
1466
-
1467
- return cur;
1468
- },
1469
-
1470
- find: function( t, context ) {
1471
- // Quickly handle non-string expressions
1472
- if ( typeof t != "string" )
1473
- return [ t ];
1474
-
1475
- // check to make sure context is a DOM element or a document
1476
- if ( context && context.nodeType != 1 && context.nodeType != 9)
1477
- return [ ];
1478
-
1479
- // Set the correct context (if none is provided)
1480
- context = context || document;
1481
-
1482
- // Initialize the search
1483
- var ret = [context], done = [], last, nodeName;
1484
-
1485
- // Continue while a selector expression exists, and while
1486
- // we're no longer looping upon ourselves
1487
- while ( t && last != t ) {
1488
- var r = [];
1489
- last = t;
1490
-
1491
- t = jQuery.trim(t);
1492
-
1493
- var foundToken = false,
1494
-
1495
- // An attempt at speeding up child selectors that
1496
- // point to a specific element tag
1497
- re = quickChild,
1498
-
1499
- m = re.exec(t);
1500
-
1501
- if ( m ) {
1502
- nodeName = m[1].toUpperCase();
1503
-
1504
- // Perform our own iteration and filter
1505
- for ( var i = 0; ret[i]; i++ )
1506
- for ( var c = ret[i].firstChild; c; c = c.nextSibling )
1507
- if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName) )
1508
- r.push( c );
1509
-
1510
- ret = r;
1511
- t = t.replace( re, "" );
1512
- if ( t.indexOf(" ") == 0 ) continue;
1513
- foundToken = true;
1514
- } else {
1515
- re = /^([>+~])\s*(\w*)/i;
1516
-
1517
- if ( (m = re.exec(t)) != null ) {
1518
- r = [];
1519
-
1520
- var merge = {};
1521
- nodeName = m[2].toUpperCase();
1522
- m = m[1];
1523
-
1524
- for ( var j = 0, rl = ret.length; j < rl; j++ ) {
1525
- var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild;
1526
- for ( ; n; n = n.nextSibling )
1527
- if ( n.nodeType == 1 ) {
1528
- var id = jQuery.data(n);
1529
-
1530
- if ( m == "~" && merge[id] ) break;
1531
-
1532
- if (!nodeName || n.nodeName.toUpperCase() == nodeName ) {
1533
- if ( m == "~" ) merge[id] = true;
1534
- r.push( n );
1535
- }
1536
-
1537
- if ( m == "+" ) break;
1538
- }
1539
- }
1540
-
1541
- ret = r;
1542
-
1543
- // And remove the token
1544
- t = jQuery.trim( t.replace( re, "" ) );
1545
- foundToken = true;
1546
- }
1547
- }
1548
-
1549
- // See if there's still an expression, and that we haven't already
1550
- // matched a token
1551
- if ( t && !foundToken ) {
1552
- // Handle multiple expressions
1553
- if ( !t.indexOf(",") ) {
1554
- // Clean the result set
1555
- if ( context == ret[0] ) ret.shift();
1556
-
1557
- // Merge the result sets
1558
- done = jQuery.merge( done, ret );
1559
-
1560
- // Reset the context
1561
- r = ret = [context];
1562
-
1563
- // Touch up the selector string
1564
- t = " " + t.substr(1,t.length);
1565
-
1566
- } else {
1567
- // Optimize for the case nodeName#idName
1568
- var re2 = quickID;
1569
- var m = re2.exec(t);
1570
-
1571
- // Re-organize the results, so that they're consistent
1572
- if ( m ) {
1573
- m = [ 0, m[2], m[3], m[1] ];
1574
-
1575
- } else {
1576
- // Otherwise, do a traditional filter check for
1577
- // ID, class, and element selectors
1578
- re2 = quickClass;
1579
- m = re2.exec(t);
1580
- }
1581
-
1582
- m[2] = m[2].replace(/\\/g, "");
1583
-
1584
- var elem = ret[ret.length-1];
1585
-
1586
- // Try to do a global search by ID, where we can
1587
- if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) {
1588
- // Optimization for HTML document case
1589
- var oid = elem.getElementById(m[2]);
1590
-
1591
- // Do a quick check for the existence of the actual ID attribute
1592
- // to avoid selecting by the name attribute in IE
1593
- // also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form
1594
- if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2] )
1595
- oid = jQuery('[@id="'+m[2]+'"]', elem)[0];
1596
-
1597
- // Do a quick check for node name (where applicable) so
1598
- // that div#foo searches will be really fast
1599
- ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
1600
- } else {
1601
- // We need to find all descendant elements
1602
- for ( var i = 0; ret[i]; i++ ) {
1603
- // Grab the tag name being searched for
1604
- var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2];
1605
-
1606
- // Handle IE7 being really dumb about <object>s
1607
- if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" )
1608
- tag = "param";
1609
-
1610
- r = jQuery.merge( r, ret[i].getElementsByTagName( tag ));
1611
- }
1612
-
1613
- // It's faster to filter by class and be done with it
1614
- if ( m[1] == "." )
1615
- r = jQuery.classFilter( r, m[2] );
1616
-
1617
- // Same with ID filtering
1618
- if ( m[1] == "#" ) {
1619
- var tmp = [];
1620
-
1621
- // Try to find the element with the ID
1622
- for ( var i = 0; r[i]; i++ )
1623
- if ( r[i].getAttribute("id") == m[2] ) {
1624
- tmp = [ r[i] ];
1625
- break;
1626
- }
1627
-
1628
- r = tmp;
1629
- }
1630
-
1631
- ret = r;
1632
- }
1633
-
1634
- t = t.replace( re2, "" );
1635
- }
1636
-
1637
- }
1638
-
1639
- // If a selector string still exists
1640
- if ( t ) {
1641
- // Attempt to filter it
1642
- var val = jQuery.filter(t,r);
1643
- ret = r = val.r;
1644
- t = jQuery.trim(val.t);
1645
- }
1646
- }
1647
-
1648
- // An error occurred with the selector;
1649
- // just return an empty set instead
1650
- if ( t )
1651
- ret = [];
1652
-
1653
- // Remove the root context
1654
- if ( ret && context == ret[0] )
1655
- ret.shift();
1656
-
1657
- // And combine the results
1658
- done = jQuery.merge( done, ret );
1659
-
1660
- return done;
1661
- },
1662
-
1663
- classFilter: function(r,m,not){
1664
- m = " " + m + " ";
1665
- var tmp = [];
1666
- for ( var i = 0; r[i]; i++ ) {
1667
- var pass = (" " + r[i].className + " ").indexOf( m ) >= 0;
1668
- if ( !not && pass || not && !pass )
1669
- tmp.push( r[i] );
1670
- }
1671
- return tmp;
1672
- },
1673
-
1674
- filter: function(t,r,not) {
1675
- var last;
1676
-
1677
- // Look for common filter expressions
1678
- while ( t && t != last ) {
1679
- last = t;
1680
-
1681
- var p = jQuery.parse, m;
1682
-
1683
- for ( var i = 0; p[i]; i++ ) {
1684
- m = p[i].exec( t );
1685
-
1686
- if ( m ) {
1687
- // Remove what we just matched
1688
- t = t.substring( m[0].length );
1689
-
1690
- m[2] = m[2].replace(/\\/g, "");
1691
- break;
1692
- }
1693
- }
1694
-
1695
- if ( !m )
1696
- break;
1697
-
1698
- // :not() is a special case that can be optimized by
1699
- // keeping it out of the expression list
1700
- if ( m[1] == ":" && m[2] == "not" )
1701
- // optimize if only one selector found (most common case)
1702
- r = isSimple.test( m[3] ) ?
1703
- jQuery.filter(m[3], r, true).r :
1704
- jQuery( r ).not( m[3] );
1705
-
1706
- // We can get a big speed boost by filtering by class here
1707
- else if ( m[1] == "." )
1708
- r = jQuery.classFilter(r, m[2], not);
1709
-
1710
- else if ( m[1] == "[" ) {
1711
- var tmp = [], type = m[3];
1712
-
1713
- for ( var i = 0, rl = r.length; i < rl; i++ ) {
1714
- var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ];
1715
-
1716
- if ( z == null || /href|src|selected/.test(m[2]) )
1717
- z = jQuery.attr(a,m[2]) || '';
1718
-
1719
- if ( (type == "" && !!z ||
1720
- type == "=" && z == m[5] ||
1721
- type == "!=" && z != m[5] ||
1722
- type == "^=" && z && !z.indexOf(m[5]) ||
1723
- type == "$=" && z.substr(z.length - m[5].length) == m[5] ||
1724
- (type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not )
1725
- tmp.push( a );
1726
- }
1727
-
1728
- r = tmp;
1729
-
1730
- // We can get a speed boost by handling nth-child here
1731
- } else if ( m[1] == ":" && m[2] == "nth-child" ) {
1732
- var merge = {}, tmp = [],
1733
- // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
1734
- test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
1735
- m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" ||
1736
- !/\D/.test(m[3]) && "0n+" + m[3] || m[3]),
1737
- // calculate the numbers (first)n+(last) including if they are negative
1738
- first = (test[1] + (test[2] || 1)) - 0, last = test[3] - 0;
1739
-
1740
- // loop through all the elements left in the jQuery object
1741
- for ( var i = 0, rl = r.length; i < rl; i++ ) {
1742
- var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode);
1743
-
1744
- if ( !merge[id] ) {
1745
- var c = 1;
1746
-
1747
- for ( var n = parentNode.firstChild; n; n = n.nextSibling )
1748
- if ( n.nodeType == 1 )
1749
- n.nodeIndex = c++;
1750
-
1751
- merge[id] = true;
1752
- }
1753
-
1754
- var add = false;
1755
-
1756
- if ( first == 0 ) {
1757
- if ( node.nodeIndex == last )
1758
- add = true;
1759
- } else if ( (node.nodeIndex - last) % first == 0 && (node.nodeIndex - last) / first >= 0 )
1760
- add = true;
1761
-
1762
- if ( add ^ not )
1763
- tmp.push( node );
1764
- }
1765
-
1766
- r = tmp;
1767
-
1768
- // Otherwise, find the expression to execute
1769
- } else {
1770
- var fn = jQuery.expr[ m[1] ];
1771
- if ( typeof fn == "object" )
1772
- fn = fn[ m[2] ];
1773
-
1774
- if ( typeof fn == "string" )
1775
- fn = eval("false||function(a,i){return " + fn + ";}");
1776
-
1777
- // Execute it against the current filter
1778
- r = jQuery.grep( r, function(elem, i){
1779
- return fn(elem, i, m, r);
1780
- }, not );
1781
- }
1782
- }
1783
-
1784
- // Return an array of filtered elements (r)
1785
- // and the modified expression string (t)
1786
- return { r: r, t: t };
1787
- },
1788
-
1789
- dir: function( elem, dir ){
1790
- var matched = [],
1791
- cur = elem[dir];
1792
- while ( cur && cur != document ) {
1793
- if ( cur.nodeType == 1 )
1794
- matched.push( cur );
1795
- cur = cur[dir];
1796
- }
1797
- return matched;
1798
- },
1799
-
1800
- nth: function(cur,result,dir,elem){
1801
- result = result || 1;
1802
- var num = 0;
1803
-
1804
- for ( ; cur; cur = cur[dir] )
1805
- if ( cur.nodeType == 1 && ++num == result )
1806
- break;
1807
-
1808
- return cur;
1809
- },
1810
-
1811
- sibling: function( n, elem ) {
1812
- var r = [];
1813
-
1814
- for ( ; n; n = n.nextSibling ) {
1815
- if ( n.nodeType == 1 && n != elem )
1816
- r.push( n );
1817
- }
1818
-
1819
- return r;
1820
- }
1821
- });
1822
- /*
1823
- * A number of helper functions used for managing events.
1824
- * Many of the ideas behind this code orignated from
1825
- * Dean Edwards' addEvent library.
1826
- */
1827
- jQuery.event = {
1828
-
1829
- // Bind an event to an element
1830
- // Original by Dean Edwards
1831
- add: function(elem, types, handler, data) {
1832
- if ( elem.nodeType == 3 || elem.nodeType == 8 )
1833
- return;
1834
-
1835
- // For whatever reason, IE has trouble passing the window object
1836
- // around, causing it to be cloned in the process
1837
- if ( jQuery.browser.msie && elem.setInterval )
1838
- elem = window;
1839
-
1840
- // Make sure that the function being executed has a unique ID
1841
- if ( !handler.guid )
1842
- handler.guid = this.guid++;
1843
-
1844
- // if data is passed, bind to handler
1845
- if( data != undefined ) {
1846
- // Create temporary function pointer to original handler
1847
- var fn = handler;
1848
-
1849
- // Create unique handler function, wrapped around original handler
1850
- handler = this.proxy( fn, function() {
1851
- // Pass arguments and context to original handler
1852
- return fn.apply(this, arguments);
1853
- });
1854
-
1855
- // Store data in unique handler
1856
- handler.data = data;
1857
- }
1858
-
1859
- // Init the element's event structure
1860
- var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),
1861
- handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){
1862
- // Handle the second event of a trigger and when
1863
- // an event is called after a page has unloaded
1864
- if ( typeof jQuery != "undefined" && !jQuery.event.triggered )
1865
- return jQuery.event.handle.apply(arguments.callee.elem, arguments);
1866
- });
1867
- // Add elem as a property of the handle function
1868
- // This is to prevent a memory leak with non-native
1869
- // event in IE.
1870
- handle.elem = elem;
1871
-
1872
- // Handle multiple events separated by a space
1873
- // jQuery(...).bind("mouseover mouseout", fn);
1874
- jQuery.each(types.split(/\s+/), function(index, type) {
1875
- // Namespaced event handlers
1876
- var parts = type.split(".");
1877
- type = parts[0];
1878
- handler.type = parts[1];
1879
-
1880
- // Get the current list of functions bound to this event
1881
- var handlers = events[type];
1882
-
1883
- // Init the event handler queue
1884
- if (!handlers) {
1885
- handlers = events[type] = {};
1886
-
1887
- // Check for a special event handler
1888
- // Only use addEventListener/attachEvent if the special
1889
- // events handler returns false
1890
- if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) {
1891
- // Bind the global event handler to the element
1892
- if (elem.addEventListener)
1893
- elem.addEventListener(type, handle, false);
1894
- else if (elem.attachEvent)
1895
- elem.attachEvent("on" + type, handle);
1896
- }
1897
- }
1898
-
1899
- // Add the function to the element's handler list
1900
- handlers[handler.guid] = handler;
1901
-
1902
- // Keep track of which events have been used, for global triggering
1903
- jQuery.event.global[type] = true;
1904
- });
1905
-
1906
- // Nullify elem to prevent memory leaks in IE
1907
- elem = null;
1908
- },
1909
-
1910
- guid: 1,
1911
- global: {},
1912
-
1913
- // Detach an event or set of events from an element
1914
- remove: function(elem, types, handler) {
1915
- // don't do events on text and comment nodes
1916
- if ( elem.nodeType == 3 || elem.nodeType == 8 )
1917
- return;
1918
-
1919
- var events = jQuery.data(elem, "events"), ret, index;
1920
-
1921
- if ( events ) {
1922
- // Unbind all events for the element
1923
- if ( types == undefined || (typeof types == "string" && types.charAt(0) == ".") )
1924
- for ( var type in events )
1925
- this.remove( elem, type + (types || "") );
1926
- else {
1927
- // types is actually an event object here
1928
- if ( types.type ) {
1929
- handler = types.handler;
1930
- types = types.type;
1931
- }
1932
-
1933
- // Handle multiple events seperated by a space
1934
- // jQuery(...).unbind("mouseover mouseout", fn);
1935
- jQuery.each(types.split(/\s+/), function(index, type){
1936
- // Namespaced event handlers
1937
- var parts = type.split(".");
1938
- type = parts[0];
1939
-
1940
- if ( events[type] ) {
1941
- // remove the given handler for the given type
1942
- if ( handler )
1943
- delete events[type][handler.guid];
1944
-
1945
- // remove all handlers for the given type
1946
- else
1947
- for ( handler in events[type] )
1948
- // Handle the removal of namespaced events
1949
- if ( !parts[1] || events[type][handler].type == parts[1] )
1950
- delete events[type][handler];
1951
-
1952
- // remove generic event handler if no more handlers exist
1953
- for ( ret in events[type] ) break;
1954
- if ( !ret ) {
1955
- if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem) === false ) {
1956
- if (elem.removeEventListener)
1957
- elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
1958
- else if (elem.detachEvent)
1959
- elem.detachEvent("on" + type, jQuery.data(elem, "handle"));
1960
- }
1961
- ret = null;
1962
- delete events[type];
1963
- }
1964
- }
1965
- });
1966
- }
1967
-
1968
- // Remove the expando if it's no longer used
1969
- for ( ret in events ) break;
1970
- if ( !ret ) {
1971
- var handle = jQuery.data( elem, "handle" );
1972
- if ( handle ) handle.elem = null;
1973
- jQuery.removeData( elem, "events" );
1974
- jQuery.removeData( elem, "handle" );
1975
- }
1976
- }
1977
- },
1978
-
1979
- trigger: function(type, data, elem, donative, extra) {
1980
- // Clone the incoming data, if any
1981
- data = jQuery.makeArray(data);
1982
-
1983
- if ( type.indexOf("!") >= 0 ) {
1984
- type = type.slice(0, -1);
1985
- var exclusive = true;
1986
- }
1987
-
1988
- // Handle a global trigger
1989
- if ( !elem ) {
1990
- // Only trigger if we've ever bound an event for it
1991
- if ( this.global[type] )
1992
- jQuery("*").add([window, document]).trigger(type, data);
1993
-
1994
- // Handle triggering a single element
1995
- } else {
1996
- // don't do events on text and comment nodes
1997
- if ( elem.nodeType == 3 || elem.nodeType == 8 )
1998
- return undefined;
1999
-
2000
- var val, ret, fn = jQuery.isFunction( elem[ type ] || null ),
2001
- // Check to see if we need to provide a fake event, or not
2002
- event = !data[0] || !data[0].preventDefault;
2003
-
2004
- // Pass along a fake event
2005
- if ( event ) {
2006
- data.unshift({
2007
- type: type,
2008
- target: elem,
2009
- preventDefault: function(){},
2010
- stopPropagation: function(){},
2011
- timeStamp: now()
2012
- });
2013
- data[0][expando] = true; // no need to fix fake event
2014
- }
2015
-
2016
- // Enforce the right trigger type
2017
- data[0].type = type;
2018
- if ( exclusive )
2019
- data[0].exclusive = true;
2020
-
2021
- // Trigger the event, it is assumed that "handle" is a function
2022
- var handle = jQuery.data(elem, "handle");
2023
- if ( handle )
2024
- val = handle.apply( elem, data );
2025
-
2026
- // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)
2027
- if ( (!fn || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
2028
- val = false;
2029
-
2030
- // Extra functions don't get the custom event object
2031
- if ( event )
2032
- data.shift();
2033
-
2034
- // Handle triggering of extra function
2035
- if ( extra && jQuery.isFunction( extra ) ) {
2036
- // call the extra function and tack the current return value on the end for possible inspection
2037
- ret = extra.apply( elem, val == null ? data : data.concat( val ) );
2038
- // if anything is returned, give it precedence and have it overwrite the previous value
2039
- if (ret !== undefined)
2040
- val = ret;
2041
- }
2042
-
2043
- // Trigger the native events (except for clicks on links)
2044
- if ( fn && donative !== false && val !== false && !(jQuery.nodeName(elem, 'a') && type == "click") ) {
2045
- this.triggered = true;
2046
- try {
2047
- elem[ type ]();
2048
- // prevent IE from throwing an error for some hidden elements
2049
- } catch (e) {}
2050
- }
2051
-
2052
- this.triggered = false;
2053
- }
2054
-
2055
- return val;
2056
- },
2057
-
2058
- handle: function(event) {
2059
- // returned undefined or false
2060
- var val, ret, namespace, all, handlers;
2061
-
2062
- event = arguments[0] = jQuery.event.fix( event || window.event );
2063
-
2064
- // Namespaced event handlers
2065
- namespace = event.type.split(".");
2066
- event.type = namespace[0];
2067
- namespace = namespace[1];
2068
- // Cache this now, all = true means, any handler
2069
- all = !namespace && !event.exclusive;
2070
-
2071
- handlers = ( jQuery.data(this, "events") || {} )[event.type];
2072
-
2073
- for ( var j in handlers ) {
2074
- var handler = handlers[j];
2075
-
2076
- // Filter the functions by class
2077
- if ( all || handler.type == namespace ) {
2078
- // Pass in a reference to the handler function itself
2079
- // So that we can later remove it
2080
- event.handler = handler;
2081
- event.data = handler.data;
2082
-
2083
- ret = handler.apply( this, arguments );
2084
-
2085
- if ( val !== false )
2086
- val = ret;
2087
-
2088
- if ( ret === false ) {
2089
- event.preventDefault();
2090
- event.stopPropagation();
2091
- }
2092
- }
2093
- }
2094
-
2095
- return val;
2096
- },
2097
-
2098
- fix: function(event) {
2099
- if ( event[expando] == true )
2100
- return event;
2101
-
2102
- // store a copy of the original event object
2103
- // and "clone" to set read-only properties
2104
- var originalEvent = event;
2105
- event = { originalEvent: originalEvent };
2106
- var props = "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");
2107
- for ( var i=props.length; i; i-- )
2108
- event[ props[i] ] = originalEvent[ props[i] ];
2109
-
2110
- // Mark it as fixed
2111
- event[expando] = true;
2112
-
2113
- // add preventDefault and stopPropagation since
2114
- // they will not work on the clone
2115
- event.preventDefault = function() {
2116
- // if preventDefault exists run it on the original event
2117
- if (originalEvent.preventDefault)
2118
- originalEvent.preventDefault();
2119
- // otherwise set the returnValue property of the original event to false (IE)
2120
- originalEvent.returnValue = false;
2121
- };
2122
- event.stopPropagation = function() {
2123
- // if stopPropagation exists run it on the original event
2124
- if (originalEvent.stopPropagation)
2125
- originalEvent.stopPropagation();
2126
- // otherwise set the cancelBubble property of the original event to true (IE)
2127
- originalEvent.cancelBubble = true;
2128
- };
2129
-
2130
- // Fix timeStamp
2131
- event.timeStamp = event.timeStamp || now();
2132
-
2133
- // Fix target property, if necessary
2134
- if ( !event.target )
2135
- event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
2136
-
2137
- // check if target is a textnode (safari)
2138
- if ( event.target.nodeType == 3 )
2139
- event.target = event.target.parentNode;
2140
-
2141
- // Add relatedTarget, if necessary
2142
- if ( !event.relatedTarget && event.fromElement )
2143
- event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;
2144
-
2145
- // Calculate pageX/Y if missing and clientX/Y available
2146
- if ( event.pageX == null && event.clientX != null ) {
2147
- var doc = document.documentElement, body = document.body;
2148
- event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
2149
- event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
2150
- }
2151
-
2152
- // Add which for key events
2153
- if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) )
2154
- event.which = event.charCode || event.keyCode;
2155
-
2156
- // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
2157
- if ( !event.metaKey && event.ctrlKey )
2158
- event.metaKey = event.ctrlKey;
2159
-
2160
- // Add which for click: 1 == left; 2 == middle; 3 == right
2161
- // Note: button is not normalized, so don't use it
2162
- if ( !event.which && event.button )
2163
- event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
2164
-
2165
- return event;
2166
- },
2167
-
2168
- proxy: function( fn, proxy ){
2169
- // Set the guid of unique handler to the same of original handler, so it can be removed
2170
- proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;
2171
- // So proxy can be declared as an argument
2172
- return proxy;
2173
- },
2174
-
2175
- special: {
2176
- ready: {
2177
- setup: function() {
2178
- // Make sure the ready event is setup
2179
- bindReady();
2180
- return;
2181
- },
2182
-
2183
- teardown: function() { return; }
2184
- },
2185
-
2186
- mouseenter: {
2187
- setup: function() {
2188
- if ( jQuery.browser.msie ) return false;
2189
- jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler);
2190
- return true;
2191
- },
2192
-
2193
- teardown: function() {
2194
- if ( jQuery.browser.msie ) return false;
2195
- jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler);
2196
- return true;
2197
- },
2198
-
2199
- handler: function(event) {
2200
- // If we actually just moused on to a sub-element, ignore it
2201
- if ( withinElement(event, this) ) return true;
2202
- // Execute the right handlers by setting the event type to mouseenter
2203
- event.type = "mouseenter";
2204
- return jQuery.event.handle.apply(this, arguments);
2205
- }
2206
- },
2207
-
2208
- mouseleave: {
2209
- setup: function() {
2210
- if ( jQuery.browser.msie ) return false;
2211
- jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler);
2212
- return true;
2213
- },
2214
-
2215
- teardown: function() {
2216
- if ( jQuery.browser.msie ) return false;
2217
- jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler);
2218
- return true;
2219
- },
2220
-
2221
- handler: function(event) {
2222
- // If we actually just moused on to a sub-element, ignore it
2223
- if ( withinElement(event, this) ) return true;
2224
- // Execute the right handlers by setting the event type to mouseleave
2225
- event.type = "mouseleave";
2226
- return jQuery.event.handle.apply(this, arguments);
2227
- }
2228
- }
2229
- }
2230
- };
2231
-
2232
- jQuery.fn.extend({
2233
- bind: function( type, data, fn ) {
2234
- return type == "unload" ? this.one(type, data, fn) : this.each(function(){
2235
- jQuery.event.add( this, type, fn || data, fn && data );
2236
- });
2237
- },
2238
-
2239
- one: function( type, data, fn ) {
2240
- var one = jQuery.event.proxy( fn || data, function(event) {
2241
- jQuery(this).unbind(event, one);
2242
- return (fn || data).apply( this, arguments );
2243
- });
2244
- return this.each(function(){
2245
- jQuery.event.add( this, type, one, fn && data);
2246
- });
2247
- },
2248
-
2249
- unbind: function( type, fn ) {
2250
- return this.each(function(){
2251
- jQuery.event.remove( this, type, fn );
2252
- });
2253
- },
2254
-
2255
- trigger: function( type, data, fn ) {
2256
- return this.each(function(){
2257
- jQuery.event.trigger( type, data, this, true, fn );
2258
- });
2259
- },
2260
-
2261
- triggerHandler: function( type, data, fn ) {
2262
- return this[0] && jQuery.event.trigger( type, data, this[0], false, fn );
2263
- },
2264
-
2265
- toggle: function( fn ) {
2266
- // Save reference to arguments for access in closure
2267
- var args = arguments, i = 1;
2268
-
2269
- // link all the functions, so any of them can unbind this click handler
2270
- while( i < args.length )
2271
- jQuery.event.proxy( fn, args[i++] );
2272
-
2273
- return this.click( jQuery.event.proxy( fn, function(event) {
2274
- // Figure out which function to execute
2275
- this.lastToggle = ( this.lastToggle || 0 ) % i;
2276
-
2277
- // Make sure that clicks stop
2278
- event.preventDefault();
2279
-
2280
- // and execute the function
2281
- return args[ this.lastToggle++ ].apply( this, arguments ) || false;
2282
- }));
2283
- },
2284
-
2285
- hover: function(fnOver, fnOut) {
2286
- return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut);
2287
- },
2288
-
2289
- ready: function(fn) {
2290
- // Attach the listeners
2291
- bindReady();
2292
-
2293
- // If the DOM is already ready
2294
- if ( jQuery.isReady )
2295
- // Execute the function immediately
2296
- fn.call( document, jQuery );
2297
-
2298
- // Otherwise, remember the function for later
2299
- else
2300
- // Add the function to the wait list
2301
- jQuery.readyList.push( function() { return fn.call(this, jQuery); } );
2302
-
2303
- return this;
2304
- }
2305
- });
2306
-
2307
- jQuery.extend({
2308
- isReady: false,
2309
- readyList: [],
2310
- // Handle when the DOM is ready
2311
- ready: function() {
2312
- // Make sure that the DOM is not already loaded
2313
- if ( !jQuery.isReady ) {
2314
- // Remember that the DOM is ready
2315
- jQuery.isReady = true;
2316
-
2317
- // If there are functions bound, to execute
2318
- if ( jQuery.readyList ) {
2319
- // Execute all of them
2320
- jQuery.each( jQuery.readyList, function(){
2321
- this.call( document );
2322
- });
2323
-
2324
- // Reset the list of functions
2325
- jQuery.readyList = null;
2326
- }
2327
-
2328
- // Trigger any bound ready events
2329
- jQuery(document).triggerHandler("ready");
2330
- }
2331
- }
2332
- });
2333
-
2334
- var readyBound = false;
2335
-
2336
- function bindReady(){
2337
- if ( readyBound ) return;
2338
- readyBound = true;
2339
-
2340
- // Mozilla, Opera (see further below for it) and webkit nightlies currently support this event
2341
- if ( document.addEventListener && !jQuery.browser.opera)
2342
- // Use the handy event callback
2343
- document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
2344
-
2345
- // If IE is used and is not in a frame
2346
- // Continually check to see if the document is ready
2347
- if ( jQuery.browser.msie && window == top ) (function(){
2348
- if (jQuery.isReady) return;
2349
- try {
2350
- // If IE is used, use the trick by Diego Perini
2351
- // http://javascript.nwbox.com/IEContentLoaded/
2352
- document.documentElement.doScroll("left");
2353
- } catch( error ) {
2354
- setTimeout( arguments.callee, 0 );
2355
- return;
2356
- }
2357
- // and execute any waiting functions
2358
- jQuery.ready();
2359
- })();
2360
-
2361
- if ( jQuery.browser.opera )
2362
- document.addEventListener( "DOMContentLoaded", function () {
2363
- if (jQuery.isReady) return;
2364
- for (var i = 0; i < document.styleSheets.length; i++)
2365
- if (document.styleSheets[i].disabled) {
2366
- setTimeout( arguments.callee, 0 );
2367
- return;
2368
- }
2369
- // and execute any waiting functions
2370
- jQuery.ready();
2371
- }, false);
2372
-
2373
- if ( jQuery.browser.safari ) {
2374
- var numStyles;
2375
- (function(){
2376
- if (jQuery.isReady) return;
2377
- if ( document.readyState != "loaded" && document.readyState != "complete" ) {
2378
- setTimeout( arguments.callee, 0 );
2379
- return;
2380
- }
2381
- if ( numStyles === undefined )
2382
- numStyles = jQuery("style, link[rel=stylesheet]").length;
2383
- if ( document.styleSheets.length != numStyles ) {
2384
- setTimeout( arguments.callee, 0 );
2385
- return;
2386
- }
2387
- // and execute any waiting functions
2388
- jQuery.ready();
2389
- })();
2390
- }
2391
-
2392
- // A fallback to window.onload, that will always work
2393
- jQuery.event.add( window, "load", jQuery.ready );
2394
- }
2395
-
2396
- jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
2397
- "mousedown,mouseup,mousemove,mouseover,mouseout,change,select," +
2398
- "submit,keydown,keypress,keyup,error").split(","), function(i, name){
2399
-
2400
- // Handle event binding
2401
- jQuery.fn[name] = function(fn){
2402
- return fn ? this.bind(name, fn) : this.trigger(name);
2403
- };
2404
- });
2405
-
2406
- // Checks if an event happened on an element within another element
2407
- // Used in jQuery.event.special.mouseenter and mouseleave handlers
2408
- var withinElement = function(event, elem) {
2409
- // Check if mouse(over|out) are still within the same parent element
2410
- var parent = event.relatedTarget;
2411
- // Traverse up the tree
2412
- while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { parent = elem; }
2413
- // Return true if we actually just moused on to a sub-element
2414
- return parent == elem;
2415
- };
2416
-
2417
- // Prevent memory leaks in IE
2418
- // And prevent errors on refresh with events like mouseover in other browsers
2419
- // Window isn't included so as not to unbind existing unload events
2420
- jQuery(window).bind("unload", function() {
2421
- jQuery("*").add(document).unbind();
2422
- });
2423
- jQuery.fn.extend({
2424
- // Keep a copy of the old load
2425
- _load: jQuery.fn.load,
2426
-
2427
- load: function( url, params, callback ) {
2428
- if ( typeof url != 'string' )
2429
- return this._load( url );
2430
-
2431
- var off = url.indexOf(" ");
2432
- if ( off >= 0 ) {
2433
- var selector = url.slice(off, url.length);
2434
- url = url.slice(0, off);
2435
- }
2436
-
2437
- callback = callback || function(){};
2438
-
2439
- // Default to a GET request
2440
- var type = "GET";
2441
-
2442
- // If the second parameter was provided
2443
- if ( params )
2444
- // If it's a function
2445
- if ( jQuery.isFunction( params ) ) {
2446
- // We assume that it's the callback
2447
- callback = params;
2448
- params = null;
2449
-
2450
- // Otherwise, build a param string
2451
- } else {
2452
- params = jQuery.param( params );
2453
- type = "POST";
2454
- }
2455
-
2456
- var self = this;
2457
-
2458
- // Request the remote document
2459
- jQuery.ajax({
2460
- url: url,
2461
- type: type,
2462
- dataType: "html",
2463
- data: params,
2464
- complete: function(res, status){
2465
- // If successful, inject the HTML into all the matched elements
2466
- if ( status == "success" || status == "notmodified" )
2467
- // See if a selector was specified
2468
- self.html( selector ?
2469
- // Create a dummy div to hold the results
2470
- jQuery("<div/>")
2471
- // inject the contents of the document in, removing the scripts
2472
- // to avoid any 'Permission Denied' errors in IE
2473
- .append(res.responseText.replace(/<script(.|\s)*?\/script>/g, ""))
2474
-
2475
- // Locate the specified elements
2476
- .find(selector) :
2477
-
2478
- // If not, just inject the full result
2479
- res.responseText );
2480
-
2481
- self.each( callback, [res.responseText, status, res] );
2482
- }
2483
- });
2484
- return this;
2485
- },
2486
-
2487
- serialize: function() {
2488
- return jQuery.param(this.serializeArray());
2489
- },
2490
- serializeArray: function() {
2491
- return this.map(function(){
2492
- return jQuery.nodeName(this, "form") ?
2493
- jQuery.makeArray(this.elements) : this;
2494
- })
2495
- .filter(function(){
2496
- return this.name && !this.disabled &&
2497
- (this.checked || /select|textarea/i.test(this.nodeName) ||
2498
- /text|hidden|password/i.test(this.type));
2499
- })
2500
- .map(function(i, elem){
2501
- var val = jQuery(this).val();
2502
- return val == null ? null :
2503
- val.constructor == Array ?
2504
- jQuery.map( val, function(val, i){
2505
- return {name: elem.name, value: val};
2506
- }) :
2507
- {name: elem.name, value: val};
2508
- }).get();
2509
- }
2510
- });
2511
-
2512
- // Attach a bunch of functions for handling common AJAX events
2513
- jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){
2514
- jQuery.fn[o] = function(f){
2515
- return this.bind(o, f);
2516
- };
2517
- });
2518
-
2519
- var jsc = now();
2520
-
2521
- jQuery.extend({
2522
- get: function( url, data, callback, type ) {
2523
- // shift arguments if data argument was ommited
2524
- if ( jQuery.isFunction( data ) ) {
2525
- callback = data;
2526
- data = null;
2527
- }
2528
-
2529
- return jQuery.ajax({
2530
- type: "GET",
2531
- url: url,
2532
- data: data,
2533
- success: callback,
2534
- dataType: type
2535
- });
2536
- },
2537
-
2538
- getScript: function( url, callback ) {
2539
- return jQuery.get(url, null, callback, "script");
2540
- },
2541
-
2542
- getJSON: function( url, data, callback ) {
2543
- return jQuery.get(url, data, callback, "json");
2544
- },
2545
-
2546
- post: function( url, data, callback, type ) {
2547
- if ( jQuery.isFunction( data ) ) {
2548
- callback = data;
2549
- data = {};
2550
- }
2551
-
2552
- return jQuery.ajax({
2553
- type: "POST",
2554
- url: url,
2555
- data: data,
2556
- success: callback,
2557
- dataType: type
2558
- });
2559
- },
2560
-
2561
- ajaxSetup: function( settings ) {
2562
- jQuery.extend( jQuery.ajaxSettings, settings );
2563
- },
2564
-
2565
- ajaxSettings: {
2566
- url: location.href,
2567
- global: true,
2568
- type: "GET",
2569
- timeout: 0,
2570
- contentType: "application/x-www-form-urlencoded",
2571
- processData: true,
2572
- async: true,
2573
- data: null,
2574
- username: null,
2575
- password: null,
2576
- accepts: {
2577
- xml: "application/xml, text/xml",
2578
- html: "text/html",
2579
- script: "text/javascript, application/javascript",
2580
- json: "application/json, text/javascript",
2581
- text: "text/plain",
2582
- _default: "*/*"
2583
- }
2584
- },
2585
-
2586
- // Last-Modified header cache for next request
2587
- lastModified: {},
2588
-
2589
- ajax: function( s ) {
2590
- // Extend the settings, but re-extend 's' so that it can be
2591
- // checked again later (in the test suite, specifically)
2592
- s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));
2593
-
2594
- var jsonp, jsre = /=\?(&|$)/g, status, data,
2595
- type = s.type.toUpperCase();
2596
-
2597
- // convert data if not already a string
2598
- if ( s.data && s.processData && typeof s.data != "string" )
2599
- s.data = jQuery.param(s.data);
2600
-
2601
- // Handle JSONP Parameter Callbacks
2602
- if ( s.dataType == "jsonp" ) {
2603
- if ( type == "GET" ) {
2604
- if ( !s.url.match(jsre) )
2605
- s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";
2606
- } else if ( !s.data || !s.data.match(jsre) )
2607
- s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
2608
- s.dataType = "json";
2609
- }
2610
-
2611
- // Build temporary JSONP function
2612
- if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) {
2613
- jsonp = "jsonp" + jsc++;
2614
-
2615
- // Replace the =? sequence both in the query string and the data
2616
- if ( s.data )
2617
- s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
2618
- s.url = s.url.replace(jsre, "=" + jsonp + "$1");
2619
-
2620
- // We need to make sure
2621
- // that a JSONP style response is executed properly
2622
- s.dataType = "script";
2623
-
2624
- // Handle JSONP-style loading
2625
- window[ jsonp ] = function(tmp){
2626
- data = tmp;
2627
- success();
2628
- complete();
2629
- // Garbage collect
2630
- window[ jsonp ] = undefined;
2631
- try{ delete window[ jsonp ]; } catch(e){}
2632
- if ( head )
2633
- head.removeChild( script );
2634
- };
2635
- }
2636
-
2637
- if ( s.dataType == "script" && s.cache == null )
2638
- s.cache = false;
2639
-
2640
- if ( s.cache === false && type == "GET" ) {
2641
- var ts = now();
2642
- // try replacing _= if it is there
2643
- var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
2644
- // if nothing was replaced, add timestamp to the end
2645
- s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "");
2646
- }
2647
-
2648
- // If data is available, append data to url for get requests
2649
- if ( s.data && type == "GET" ) {
2650
- s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;
2651
-
2652
- // IE likes to send both get and post data, prevent this
2653
- s.data = null;
2654
- }
2655
-
2656
- // Watch for a new set of requests
2657
- if ( s.global && ! jQuery.active++ )
2658
- jQuery.event.trigger( "ajaxStart" );
2659
-
2660
- // Matches an absolute URL, and saves the domain
2661
- var remote = /^(?:\w+:)?\/\/([^\/?#]+)/;
2662
-
2663
- // If we're requesting a remote document
2664
- // and trying to load JSON or Script with a GET
2665
- if ( s.dataType == "script" && type == "GET"
2666
- && remote.test(s.url) && remote.exec(s.url)[1] != location.host ){
2667
- var head = document.getElementsByTagName("head")[0];
2668
- var script = document.createElement("script");
2669
- script.src = s.url;
2670
- if (s.scriptCharset)
2671
- script.charset = s.scriptCharset;
2672
-
2673
- // Handle Script loading
2674
- if ( !jsonp ) {
2675
- var done = false;
2676
-
2677
- // Attach handlers for all browsers
2678
- script.onload = script.onreadystatechange = function(){
2679
- if ( !done && (!this.readyState ||
2680
- this.readyState == "loaded" || this.readyState == "complete") ) {
2681
- done = true;
2682
- success();
2683
- complete();
2684
- head.removeChild( script );
2685
- }
2686
- };
2687
- }
2688
-
2689
- head.appendChild(script);
2690
-
2691
- // We handle everything using the script element injection
2692
- return undefined;
2693
- }
2694
-
2695
- var requestDone = false;
2696
-
2697
- // Create the request object; Microsoft failed to properly
2698
- // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
2699
- var xhr = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
2700
-
2701
- // Open the socket
2702
- // Passing null username, generates a login popup on Opera (#2865)
2703
- if( s.username )
2704
- xhr.open(type, s.url, s.async, s.username, s.password);
2705
- else
2706
- xhr.open(type, s.url, s.async);
2707
-
2708
- // Need an extra try/catch for cross domain requests in Firefox 3
2709
- try {
2710
- // Set the correct header, if data is being sent
2711
- if ( s.data )
2712
- xhr.setRequestHeader("Content-Type", s.contentType);
2713
-
2714
- // Set the If-Modified-Since header, if ifModified mode.
2715
- if ( s.ifModified )
2716
- xhr.setRequestHeader("If-Modified-Since",
2717
- jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );
2718
-
2719
- // Set header so the called script knows that it's an XMLHttpRequest
2720
- xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
2721
-
2722
- // Set the Accepts header for the server, depending on the dataType
2723
- xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
2724
- s.accepts[ s.dataType ] + ", */*" :
2725
- s.accepts._default );
2726
- } catch(e){}
2727
-
2728
- // Allow custom headers/mimetypes
2729
- if ( s.beforeSend && s.beforeSend(xhr, s) === false ) {
2730
- // cleanup active request counter
2731
- s.global && jQuery.active--;
2732
- // close opended socket
2733
- xhr.abort();
2734
- return false;
2735
- }
2736
-
2737
- if ( s.global )
2738
- jQuery.event.trigger("ajaxSend", [xhr, s]);
2739
-
2740
- // Wait for a response to come back
2741
- var onreadystatechange = function(isTimeout){
2742
- // The transfer is complete and the data is available, or the request timed out
2743
- if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) {
2744
- requestDone = true;
2745
-
2746
- // clear poll interval
2747
- if (ival) {
2748
- clearInterval(ival);
2749
- ival = null;
2750
- }
2751
-
2752
- status = isTimeout == "timeout" && "timeout" ||
2753
- !jQuery.httpSuccess( xhr ) && "error" ||
2754
- s.ifModified && jQuery.httpNotModified( xhr, s.url ) && "notmodified" ||
2755
- "success";
2756
-
2757
- if ( status == "success" ) {
2758
- // Watch for, and catch, XML document parse errors
2759
- try {
2760
- // process the data (runs the xml through httpData regardless of callback)
2761
- data = jQuery.httpData( xhr, s.dataType, s.dataFilter );
2762
- } catch(e) {
2763
- status = "parsererror";
2764
- }
2765
- }
2766
-
2767
- // Make sure that the request was successful or notmodified
2768
- if ( status == "success" ) {
2769
- // Cache Last-Modified header, if ifModified mode.
2770
- var modRes;
2771
- try {
2772
- modRes = xhr.getResponseHeader("Last-Modified");
2773
- } catch(e) {} // swallow exception thrown by FF if header is not available
2774
-
2775
- if ( s.ifModified && modRes )
2776
- jQuery.lastModified[s.url] = modRes;
2777
-
2778
- // JSONP handles its own success callback
2779
- if ( !jsonp )
2780
- success();
2781
- } else
2782
- jQuery.handleError(s, xhr, status);
2783
-
2784
- // Fire the complete handlers
2785
- complete();
2786
-
2787
- // Stop memory leaks
2788
- if ( s.async )
2789
- xhr = null;
2790
- }
2791
- };
2792
-
2793
- if ( s.async ) {
2794
- // don't attach the handler to the request, just poll it instead
2795
- var ival = setInterval(onreadystatechange, 13);
2796
-
2797
- // Timeout checker
2798
- if ( s.timeout > 0 )
2799
- setTimeout(function(){
2800
- // Check to see if the request is still happening
2801
- if ( xhr ) {
2802
- // Cancel the request
2803
- xhr.abort();
2804
-
2805
- if( !requestDone )
2806
- onreadystatechange( "timeout" );
2807
- }
2808
- }, s.timeout);
2809
- }
2810
-
2811
- // Send the data
2812
- try {
2813
- xhr.send(s.data);
2814
- } catch(e) {
2815
- jQuery.handleError(s, xhr, null, e);
2816
- }
2817
-
2818
- // firefox 1.5 doesn't fire statechange for sync requests
2819
- if ( !s.async )
2820
- onreadystatechange();
2821
-
2822
- function success(){
2823
- // If a local callback was specified, fire it and pass it the data
2824
- if ( s.success )
2825
- s.success( data, status );
2826
-
2827
- // Fire the global callback
2828
- if ( s.global )
2829
- jQuery.event.trigger( "ajaxSuccess", [xhr, s] );
2830
- }
2831
-
2832
- function complete(){
2833
- // Process result
2834
- if ( s.complete )
2835
- s.complete(xhr, status);
2836
-
2837
- // The request was completed
2838
- if ( s.global )
2839
- jQuery.event.trigger( "ajaxComplete", [xhr, s] );
2840
-
2841
- // Handle the global AJAX counter
2842
- if ( s.global && ! --jQuery.active )
2843
- jQuery.event.trigger( "ajaxStop" );
2844
- }
2845
-
2846
- // return XMLHttpRequest to allow aborting the request etc.
2847
- return xhr;
2848
- },
2849
-
2850
- handleError: function( s, xhr, status, e ) {
2851
- // If a local callback was specified, fire it
2852
- if ( s.error ) s.error( xhr, status, e );
2853
-
2854
- // Fire the global callback
2855
- if ( s.global )
2856
- jQuery.event.trigger( "ajaxError", [xhr, s, e] );
2857
- },
2858
-
2859
- // Counter for holding the number of active queries
2860
- active: 0,
2861
-
2862
- // Determines if an XMLHttpRequest was successful or not
2863
- httpSuccess: function( xhr ) {
2864
- try {
2865
- // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
2866
- return !xhr.status && location.protocol == "file:" ||
2867
- ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223 ||
2868
- jQuery.browser.safari && xhr.status == undefined;
2869
- } catch(e){}
2870
- return false;
2871
- },
2872
-
2873
- // Determines if an XMLHttpRequest returns NotModified
2874
- httpNotModified: function( xhr, url ) {
2875
- try {
2876
- var xhrRes = xhr.getResponseHeader("Last-Modified");
2877
-
2878
- // Firefox always returns 200. check Last-Modified date
2879
- return xhr.status == 304 || xhrRes == jQuery.lastModified[url] ||
2880
- jQuery.browser.safari && xhr.status == undefined;
2881
- } catch(e){}
2882
- return false;
2883
- },
2884
-
2885
- httpData: function( xhr, type, filter ) {
2886
- var ct = xhr.getResponseHeader("content-type"),
2887
- xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
2888
- data = xml ? xhr.responseXML : xhr.responseText;
2889
-
2890
- if ( xml && data.documentElement.tagName == "parsererror" )
2891
- throw "parsererror";
2892
-
2893
- // Allow a pre-filtering function to sanitize the response
2894
- if( filter )
2895
- data = filter( data, type );
2896
-
2897
- // If the type is "script", eval it in global context
2898
- if ( type == "script" )
2899
- jQuery.globalEval( data );
2900
-
2901
- // Get the JavaScript object, if JSON is used.
2902
- if ( type == "json" )
2903
- data = eval("(" + data + ")");
2904
-
2905
- return data;
2906
- },
2907
-
2908
- // Serialize an array of form elements or a set of
2909
- // key/values into a query string
2910
- param: function( a ) {
2911
- var s = [];
2912
-
2913
- // If an array was passed in, assume that it is an array
2914
- // of form elements
2915
- if ( a.constructor == Array || a.jquery )
2916
- // Serialize the form elements
2917
- jQuery.each( a, function(){
2918
- s.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( this.value ) );
2919
- });
2920
-
2921
- // Otherwise, assume that it's an object of key/value pairs
2922
- else
2923
- // Serialize the key/values
2924
- for ( var j in a )
2925
- // If the value is an array then the key names need to be repeated
2926
- if ( a[j] && a[j].constructor == Array )
2927
- jQuery.each( a[j], function(){
2928
- s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) );
2929
- });
2930
- else
2931
- s.push( encodeURIComponent(j) + "=" + encodeURIComponent( jQuery.isFunction(a[j]) ? a[j]() : a[j] ) );
2932
-
2933
- // Return the resulting serialization
2934
- return s.join("&").replace(/%20/g, "+");
2935
- }
2936
-
2937
- });
2938
- jQuery.fn.extend({
2939
- show: function(speed,callback){
2940
- return speed ?
2941
- this.animate({
2942
- height: "show", width: "show", opacity: "show"
2943
- }, speed, callback) :
2944
-
2945
- this.filter(":hidden").each(function(){
2946
- this.style.display = this.oldblock || "";
2947
- if ( jQuery.css(this,"display") == "none" ) {
2948
- var elem = jQuery("<" + this.tagName + " />").appendTo("body");
2949
- this.style.display = elem.css("display");
2950
- // handle an edge condition where css is - div { display:none; } or similar
2951
- if (this.style.display == "none")
2952
- this.style.display = "block";
2953
- elem.remove();
2954
- }
2955
- }).end();
2956
- },
2957
-
2958
- hide: function(speed,callback){
2959
- return speed ?
2960
- this.animate({
2961
- height: "hide", width: "hide", opacity: "hide"
2962
- }, speed, callback) :
2963
-
2964
- this.filter(":visible").each(function(){
2965
- this.oldblock = this.oldblock || jQuery.css(this,"display");
2966
- this.style.display = "none";
2967
- }).end();
2968
- },
2969
-
2970
- // Save the old toggle function
2971
- _toggle: jQuery.fn.toggle,
2972
-
2973
- toggle: function( fn, fn2 ){
2974
- return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
2975
- this._toggle.apply( this, arguments ) :
2976
- fn ?
2977
- this.animate({
2978
- height: "toggle", width: "toggle", opacity: "toggle"
2979
- }, fn, fn2) :
2980
- this.each(function(){
2981
- jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
2982
- });
2983
- },
2984
-
2985
- slideDown: function(speed,callback){
2986
- return this.animate({height: "show"}, speed, callback);
2987
- },
2988
-
2989
- slideUp: function(speed,callback){
2990
- return this.animate({height: "hide"}, speed, callback);
2991
- },
2992
-
2993
- slideToggle: function(speed, callback){
2994
- return this.animate({height: "toggle"}, speed, callback);
2995
- },
2996
-
2997
- fadeIn: function(speed, callback){
2998
- return this.animate({opacity: "show"}, speed, callback);
2999
- },
3000
-
3001
- fadeOut: function(speed, callback){
3002
- return this.animate({opacity: "hide"}, speed, callback);
3003
- },
3004
-
3005
- fadeTo: function(speed,to,callback){
3006
- return this.animate({opacity: to}, speed, callback);
3007
- },
3008
-
3009
- animate: function( prop, speed, easing, callback ) {
3010
- var optall = jQuery.speed(speed, easing, callback);
3011
-
3012
- return this[ optall.queue === false ? "each" : "queue" ](function(){
3013
- if ( this.nodeType != 1)
3014
- return false;
3015
-
3016
- var opt = jQuery.extend({}, optall), p,
3017
- hidden = jQuery(this).is(":hidden"), self = this;
3018
-
3019
- for ( p in prop ) {
3020
- if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
3021
- return opt.complete.call(this);
3022
-
3023
- if ( p == "height" || p == "width" ) {
3024
- // Store display property
3025
- opt.display = jQuery.css(this, "display");
3026
-
3027
- // Make sure that nothing sneaks out
3028
- opt.overflow = this.style.overflow;
3029
- }
3030
- }
3031
-
3032
- if ( opt.overflow != null )
3033
- this.style.overflow = "hidden";
3034
-
3035
- opt.curAnim = jQuery.extend({}, prop);
3036
-
3037
- jQuery.each( prop, function(name, val){
3038
- var e = new jQuery.fx( self, opt, name );
3039
-
3040
- if ( /toggle|show|hide/.test(val) )
3041
- e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop );
3042
- else {
3043
- var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
3044
- start = e.cur(true) || 0;
3045
-
3046
- if ( parts ) {
3047
- var end = parseFloat(parts[2]),
3048
- unit = parts[3] || "px";
3049
-
3050
- // We need to compute starting value
3051
- if ( unit != "px" ) {
3052
- self.style[ name ] = (end || 1) + unit;
3053
- start = ((end || 1) / e.cur(true)) * start;
3054
- self.style[ name ] = start + unit;
3055
- }
3056
-
3057
- // If a +=/-= token was provided, we're doing a relative animation
3058
- if ( parts[1] )
3059
- end = ((parts[1] == "-=" ? -1 : 1) * end) + start;
3060
-
3061
- e.custom( start, end, unit );
3062
- } else
3063
- e.custom( start, val, "" );
3064
- }
3065
- });
3066
-
3067
- // For JS strict compliance
3068
- return true;
3069
- });
3070
- },
3071
-
3072
- queue: function(type, fn){
3073
- if ( jQuery.isFunction(type) || ( type && type.constructor == Array )) {
3074
- fn = type;
3075
- type = "fx";
3076
- }
3077
-
3078
- if ( !type || (typeof type == "string" && !fn) )
3079
- return queue( this[0], type );
3080
-
3081
- return this.each(function(){
3082
- if ( fn.constructor == Array )
3083
- queue(this, type, fn);
3084
- else {
3085
- queue(this, type).push( fn );
3086
-
3087
- if ( queue(this, type).length == 1 )
3088
- fn.call(this);
3089
- }
3090
- });
3091
- },
3092
-
3093
- stop: function(clearQueue, gotoEnd){
3094
- var timers = jQuery.timers;
3095
-
3096
- if (clearQueue)
3097
- this.queue([]);
3098
-
3099
- this.each(function(){
3100
- // go in reverse order so anything added to the queue during the loop is ignored
3101
- for ( var i = timers.length - 1; i >= 0; i-- )
3102
- if ( timers[i].elem == this ) {
3103
- if (gotoEnd)
3104
- // force the next step to be the last
3105
- timers[i](true);
3106
- timers.splice(i, 1);
3107
- }
3108
- });
3109
-
3110
- // start the next in the queue if the last step wasn't forced
3111
- if (!gotoEnd)
3112
- this.dequeue();
3113
-
3114
- return this;
3115
- }
3116
-
3117
- });
3118
-
3119
- var queue = function( elem, type, array ) {
3120
- if ( elem ){
3121
-
3122
- type = type || "fx";
3123
-
3124
- var q = jQuery.data( elem, type + "queue" );
3125
-
3126
- if ( !q || array )
3127
- q = jQuery.data( elem, type + "queue", jQuery.makeArray(array) );
3128
-
3129
- }
3130
- return q;
3131
- };
3132
-
3133
- jQuery.fn.dequeue = function(type){
3134
- type = type || "fx";
3135
-
3136
- return this.each(function(){
3137
- var q = queue(this, type);
3138
-
3139
- q.shift();
3140
-
3141
- if ( q.length )
3142
- q[0].call( this );
3143
- });
3144
- };
3145
-
3146
- jQuery.extend({
3147
-
3148
- speed: function(speed, easing, fn) {
3149
- var opt = speed && speed.constructor == Object ? speed : {
3150
- complete: fn || !fn && easing ||
3151
- jQuery.isFunction( speed ) && speed,
3152
- duration: speed,
3153
- easing: fn && easing || easing && easing.constructor != Function && easing
3154
- };
3155
-
3156
- opt.duration = (opt.duration && opt.duration.constructor == Number ?
3157
- opt.duration :
3158
- jQuery.fx.speeds[opt.duration]) || jQuery.fx.speeds.def;
3159
-
3160
- // Queueing
3161
- opt.old = opt.complete;
3162
- opt.complete = function(){
3163
- if ( opt.queue !== false )
3164
- jQuery(this).dequeue();
3165
- if ( jQuery.isFunction( opt.old ) )
3166
- opt.old.call( this );
3167
- };
3168
-
3169
- return opt;
3170
- },
3171
-
3172
- easing: {
3173
- linear: function( p, n, firstNum, diff ) {
3174
- return firstNum + diff * p;
3175
- },
3176
- swing: function( p, n, firstNum, diff ) {
3177
- return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
3178
- }
3179
- },
3180
-
3181
- timers: [],
3182
- timerId: null,
3183
-
3184
- fx: function( elem, options, prop ){
3185
- this.options = options;
3186
- this.elem = elem;
3187
- this.prop = prop;
3188
-
3189
- if ( !options.orig )
3190
- options.orig = {};
3191
- }
3192
-
3193
- });
3194
-
3195
- jQuery.fx.prototype = {
3196
-
3197
- // Simple function for setting a style value
3198
- update: function(){
3199
- if ( this.options.step )
3200
- this.options.step.call( this.elem, this.now, this );
3201
-
3202
- (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
3203
-
3204
- // Set display property to block for height/width animations
3205
- if ( this.prop == "height" || this.prop == "width" )
3206
- this.elem.style.display = "block";
3207
- },
3208
-
3209
- // Get the current size
3210
- cur: function(force){
3211
- if ( this.elem[this.prop] != null && this.elem.style[this.prop] == null )
3212
- return this.elem[ this.prop ];
3213
-
3214
- var r = parseFloat(jQuery.css(this.elem, this.prop, force));
3215
- return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
3216
- },
3217
-
3218
- // Start an animation from one number to another
3219
- custom: function(from, to, unit){
3220
- this.startTime = now();
3221
- this.start = from;
3222
- this.end = to;
3223
- this.unit = unit || this.unit || "px";
3224
- this.now = this.start;
3225
- this.pos = this.state = 0;
3226
- this.update();
3227
-
3228
- var self = this;
3229
- function t(gotoEnd){
3230
- return self.step(gotoEnd);
3231
- }
3232
-
3233
- t.elem = this.elem;
3234
-
3235
- jQuery.timers.push(t);
3236
-
3237
- if ( jQuery.timerId == null ) {
3238
- jQuery.timerId = setInterval(function(){
3239
- var timers = jQuery.timers;
3240
-
3241
- for ( var i = 0; i < timers.length; i++ )
3242
- if ( !timers[i]() )
3243
- timers.splice(i--, 1);
3244
-
3245
- if ( !timers.length ) {
3246
- clearInterval( jQuery.timerId );
3247
- jQuery.timerId = null;
3248
- }
3249
- }, 13);
3250
- }
3251
- },
3252
-
3253
- // Simple 'show' function
3254
- show: function(){
3255
- // Remember where we started, so that we can go back to it later
3256
- this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
3257
- this.options.show = true;
3258
-
3259
- // Begin the animation
3260
- this.custom(0, this.cur());
3261
-
3262
- // Make sure that we start at a small width/height to avoid any
3263
- // flash of content
3264
- if ( this.prop == "width" || this.prop == "height" )
3265
- this.elem.style[this.prop] = "1px";
3266
-
3267
- // Start by showing the element
3268
- jQuery(this.elem).show();
3269
- },
3270
-
3271
- // Simple 'hide' function
3272
- hide: function(){
3273
- // Remember where we started, so that we can go back to it later
3274
- this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
3275
- this.options.hide = true;
3276
-
3277
- // Begin the animation
3278
- this.custom(this.cur(), 0);
3279
- },
3280
-
3281
- // Each step of an animation
3282
- step: function(gotoEnd){
3283
- var t = now();
3284
-
3285
- if ( gotoEnd || t > this.options.duration + this.startTime ) {
3286
- this.now = this.end;
3287
- this.pos = this.state = 1;
3288
- this.update();
3289
-
3290
- this.options.curAnim[ this.prop ] = true;
3291
-
3292
- var done = true;
3293
- for ( var i in this.options.curAnim )
3294
- if ( this.options.curAnim[i] !== true )
3295
- done = false;
3296
-
3297
- if ( done ) {
3298
- if ( this.options.display != null ) {
3299
- // Reset the overflow
3300
- this.elem.style.overflow = this.options.overflow;
3301
-
3302
- // Reset the display
3303
- this.elem.style.display = this.options.display;
3304
- if ( jQuery.css(this.elem, "display") == "none" )
3305
- this.elem.style.display = "block";
3306
- }
3307
-
3308
- // Hide the element if the "hide" operation was done
3309
- if ( this.options.hide )
3310
- this.elem.style.display = "none";
3311
-
3312
- // Reset the properties, if the item has been hidden or shown
3313
- if ( this.options.hide || this.options.show )
3314
- for ( var p in this.options.curAnim )
3315
- jQuery.attr(this.elem.style, p, this.options.orig[p]);
3316
- }
3317
-
3318
- if ( done )
3319
- // Execute the complete function
3320
- this.options.complete.call( this.elem );
3321
-
3322
- return false;
3323
- } else {
3324
- var n = t - this.startTime;
3325
- this.state = n / this.options.duration;
3326
-
3327
- // Perform the easing function, defaults to swing
3328
- this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
3329
- this.now = this.start + ((this.end - this.start) * this.pos);
3330
-
3331
- // Perform the next step of the animation
3332
- this.update();
3333
- }
3334
-
3335
- return true;
3336
- }
3337
-
3338
- };
3339
-
3340
- jQuery.extend( jQuery.fx, {
3341
- speeds:{
3342
- slow: 600,
3343
- fast: 200,
3344
- // Default speed
3345
- def: 400
3346
- },
3347
- step: {
3348
- scrollLeft: function(fx){
3349
- fx.elem.scrollLeft = fx.now;
3350
- },
3351
-
3352
- scrollTop: function(fx){
3353
- fx.elem.scrollTop = fx.now;
3354
- },
3355
-
3356
- opacity: function(fx){
3357
- jQuery.attr(fx.elem.style, "opacity", fx.now);
3358
- },
3359
-
3360
- _default: function(fx){
3361
- fx.elem.style[ fx.prop ] = fx.now + fx.unit;
3362
- }
3363
- }
3364
- });
3365
- // The Offset Method
3366
- // Originally By Brandon Aaron, part of the Dimension Plugin
3367
- // http://jquery.com/plugins/project/dimensions
3368
- jQuery.fn.offset = function() {
3369
- var left = 0, top = 0, elem = this[0], results;
3370
-
3371
- if ( elem ) with ( jQuery.browser ) {
3372
- var parent = elem.parentNode,
3373
- offsetChild = elem,
3374
- offsetParent = elem.offsetParent,
3375
- doc = elem.ownerDocument,
3376
- safari2 = safari && parseInt(version) < 522 && !/adobeair/i.test(userAgent),
3377
- css = jQuery.curCSS,
3378
- fixed = css(elem, "position") == "fixed";
3379
-
3380
- // Use getBoundingClientRect if available
3381
- if ( elem.getBoundingClientRect ) {
3382
- var box = elem.getBoundingClientRect();
3383
-
3384
- // Add the document scroll offsets
3385
- add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
3386
- box.top + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));
3387
-
3388
- // IE adds the HTML element's border, by default it is medium which is 2px
3389
- // IE 6 and 7 quirks mode the border width is overwritable by the following css html { border: 0; }
3390
- // IE 7 standards mode, the border is always 2px
3391
- // This border/offset is typically represented by the clientLeft and clientTop properties
3392
- // However, in IE6 and 7 quirks mode the clientLeft and clientTop properties are not updated when overwriting it via CSS
3393
- // Therefore this method will be off by 2px in IE while in quirksmode
3394
- add( -doc.documentElement.clientLeft, -doc.documentElement.clientTop );
3395
-
3396
- // Otherwise loop through the offsetParents and parentNodes
3397
- } else {
3398
-
3399
- // Initial element offsets
3400
- add( elem.offsetLeft, elem.offsetTop );
3401
-
3402
- // Get parent offsets
3403
- while ( offsetParent ) {
3404
- // Add offsetParent offsets
3405
- add( offsetParent.offsetLeft, offsetParent.offsetTop );
3406
-
3407
- // Mozilla and Safari > 2 does not include the border on offset parents
3408
- // However Mozilla adds the border for table or table cells
3409
- if ( mozilla && !/^t(able|d|h)$/i.test(offsetParent.tagName) || safari && !safari2 )
3410
- border( offsetParent );
3411
-
3412
- // Add the document scroll offsets if position is fixed on any offsetParent
3413
- if ( !fixed && css(offsetParent, "position") == "fixed" )
3414
- fixed = true;
3415
-
3416
- // Set offsetChild to previous offsetParent unless it is the body element
3417
- offsetChild = /^body$/i.test(offsetParent.tagName) ? offsetChild : offsetParent;
3418
- // Get next offsetParent
3419
- offsetParent = offsetParent.offsetParent;
3420
- }
3421
-
3422
- // Get parent scroll offsets
3423
- while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) {
3424
- // Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug
3425
- if ( !/^inline|table.*$/i.test(css(parent, "display")) )
3426
- // Subtract parent scroll offsets
3427
- add( -parent.scrollLeft, -parent.scrollTop );
3428
-
3429
- // Mozilla does not add the border for a parent that has overflow != visible
3430
- if ( mozilla && css(parent, "overflow") != "visible" )
3431
- border( parent );
3432
-
3433
- // Get next parent
3434
- parent = parent.parentNode;
3435
- }
3436
-
3437
- // Safari <= 2 doubles body offsets with a fixed position element/offsetParent or absolutely positioned offsetChild
3438
- // Mozilla doubles body offsets with a non-absolutely positioned offsetChild
3439
- if ( (safari2 && (fixed || css(offsetChild, "position") == "absolute")) ||
3440
- (mozilla && css(offsetChild, "position") != "absolute") )
3441
- add( -doc.body.offsetLeft, -doc.body.offsetTop );
3442
-
3443
- // Add the document scroll offsets if position is fixed
3444
- if ( fixed )
3445
- add(Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
3446
- Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));
3447
- }
3448
-
3449
- // Return an object with top and left properties
3450
- results = { top: top, left: left };
3451
- }
3452
-
3453
- function border(elem) {
3454
- add( jQuery.curCSS(elem, "borderLeftWidth", true), jQuery.curCSS(elem, "borderTopWidth", true) );
3455
- }
3456
-
3457
- function add(l, t) {
3458
- left += parseInt(l, 10) || 0;
3459
- top += parseInt(t, 10) || 0;
3460
- }
3461
-
3462
- return results;
3463
- };
3464
-
3465
-
3466
- jQuery.fn.extend({
3467
- position: function() {
3468
- var left = 0, top = 0, results;
3469
-
3470
- if ( this[0] ) {
3471
- // Get *real* offsetParent
3472
- var offsetParent = this.offsetParent(),
3473
-
3474
- // Get correct offsets
3475
- offset = this.offset(),
3476
- parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();
3477
-
3478
- // Subtract element margins
3479
- // note: when an element has margin: auto the offsetLeft and marginLeft
3480
- // are the same in Safari causing offset.left to incorrectly be 0
3481
- offset.top -= num( this, 'marginTop' );
3482
- offset.left -= num( this, 'marginLeft' );
3483
-
3484
- // Add offsetParent borders
3485
- parentOffset.top += num( offsetParent, 'borderTopWidth' );
3486
- parentOffset.left += num( offsetParent, 'borderLeftWidth' );
3487
-
3488
- // Subtract the two offsets
3489
- results = {
3490
- top: offset.top - parentOffset.top,
3491
- left: offset.left - parentOffset.left
3492
- };
3493
- }
3494
-
3495
- return results;
3496
- },
3497
-
3498
- offsetParent: function() {
3499
- var offsetParent = this[0].offsetParent;
3500
- while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') )
3501
- offsetParent = offsetParent.offsetParent;
3502
- return jQuery(offsetParent);
3503
- }
3504
- });
3505
-
3506
-
3507
- // Create scrollLeft and scrollTop methods
3508
- jQuery.each( ['Left', 'Top'], function(i, name) {
3509
- var method = 'scroll' + name;
3510
-
3511
- jQuery.fn[ method ] = function(val) {
3512
- if (!this[0]) return;
3513
-
3514
- return val != undefined ?
3515
-
3516
- // Set the scroll offset
3517
- this.each(function() {
3518
- this == window || this == document ?
3519
- window.scrollTo(
3520
- !i ? val : jQuery(window).scrollLeft(),
3521
- i ? val : jQuery(window).scrollTop()
3522
- ) :
3523
- this[ method ] = val;
3524
- }) :
3525
-
3526
- // Return the scroll offset
3527
- this[0] == window || this[0] == document ?
3528
- self[ i ? 'pageYOffset' : 'pageXOffset' ] ||
3529
- jQuery.boxModel && document.documentElement[ method ] ||
3530
- document.body[ method ] :
3531
- this[0][ method ];
3532
- };
3533
- });
3534
- // Create innerHeight, innerWidth, outerHeight and outerWidth methods
3535
- jQuery.each([ "Height", "Width" ], function(i, name){
3536
-
3537
- var tl = i ? "Left" : "Top", // top or left
3538
- br = i ? "Right" : "Bottom"; // bottom or right
3539
-
3540
- // innerHeight and innerWidth
3541
- jQuery.fn["inner" + name] = function(){
3542
- return this[ name.toLowerCase() ]() +
3543
- num(this, "padding" + tl) +
3544
- num(this, "padding" + br);
3545
- };
3546
-
3547
- // outerHeight and outerWidth
3548
- jQuery.fn["outer" + name] = function(margin) {
3549
- return this["inner" + name]() +
3550
- num(this, "border" + tl + "Width") +
3551
- num(this, "border" + br + "Width") +
3552
- (margin ?
3553
- num(this, "margin" + tl) + num(this, "margin" + br) : 0);
3554
- };
3555
-
3556
- });})();
3557
-
3558
- // Map this version of jQuery to Q$ for use by QUnit
3559
- var Q$ = jQuery.noConflict(true);