All In One Schema Rich Snippets - Version 1.1.1

Version Description

  • Added - Article type

  • Added compatibility with WooThemes Plugins and themes

  • Added - New Media Manager for uploading images in metabox

Download this release

Release Info

Developer brainstormforce
Plugin Icon 128x128 All In One Schema Rich Snippets
Version 1.1.1
Comparing to
See all releases

Code changes from version 1.1.0 to 1.1.1

admin/css/admin.css CHANGED
@@ -1,9 +1,10 @@
1
- .etabs { margin: 0; padding: 0; }
2
- .tab { display: inline-block; zoom:1; *display:inline; background: #fff; border: solid 1px #999; border-bottom: none; -moz-border-radius: 4px 4px 0 0; -webkit-border-radius: 4px 4px 0 0; font-weight:bold; }
3
- .tab a { font-size: 14px; line-height: 2em; display: block; padding: 0 10px; outline: none; text-decoration:none; color:rgb(175, 175, 175); }
4
- .tab a:hover { text-decoration: none; color:#C00; }
5
- .tab.active { background: #fff; padding-top: 6px; position: relative; top: 1px; border-color: #666; }
6
- .tab a.active { font-weight: bold; text-decoration:none; color:#333; }
7
- .tab.active a:hover { text-decoration: none; color:#C00; }
8
- .tab-container { background: #fff; padding: 10px; -moz-border-radius: 0 4px 4px 4px; -webkit-border-radius: 0 4px 4px 4px; }
 
9
  .panel-container { margin-bottom: 10px; border-top:1px solid #999; padding: 10px; margin-top: -6px;}
1
+ html{ display:block !important;}
2
+ .etabs { margin: 0; padding: 0; }
3
+ .tab { display: inline-block; zoom:1; *display:inline; background: #fff; border: solid 1px #999; border-bottom: none; -moz-border-radius: 4px 4px 0 0; -webkit-border-radius: 4px 4px 0 0; font-weight:bold; }
4
+ .tab a { font-size: 14px; line-height: 2em; display: block; padding: 0 10px; outline: none; text-decoration:none; color:rgb(175, 175, 175); }
5
+ .tab a:hover { text-decoration: none; color:#C00; }
6
+ .tab.active { background: #fff; padding-top: 6px; position: relative; top: 1px; border-color: #666; }
7
+ .tab a.active { font-weight: bold; text-decoration:none; color:#333; }
8
+ .tab.active a:hover { text-decoration: none; color:#C00; }
9
+ .tab-container { background: #fff; padding: 10px; -moz-border-radius: 0 4px 4px 4px; -webkit-border-radius: 0 4px 4px 4px; }
10
  .panel-container { margin-bottom: 10px; border-top:1px solid #999; padding: 10px; margin-top: -6px;}
admin/css/style.css CHANGED
@@ -1,683 +1,202 @@
1
- /**
2
-
3
- * Metabox Styling
4
-
5
- */
6
-
7
- table.bsf_metabox td, table.bsf_metabox th { border-bottom: 0px solid #E9E9E9; padding-top:5px; padding-right: 12px;}
8
-
9
- table.bsf_metabox th { text-align: right; font-weight:bold;}
10
-
11
- table.bsf_metabox th label { margin-top:5px; display:block;}
12
-
13
- p.bsf_metabox_description { color: #AAA; font-style: italic; margin: 2px 0 !important;}
14
-
15
- span.bsf_metabox_description { color: #AAA; font-style: italic;}
16
-
17
- table.bsf_metabox input, table.bsf_metabox textarea { font-size:12px; padding: 5px; }
18
-
19
- table.bsf_metabox input[type=text], table.bsf_metabox textarea { width: 97%; }
20
-
21
- table.bsf_metabox textarea.bsf_textarea_code { font-family: Consolas,Monaco,monospace; line-height: 16px; }
22
-
23
- table.bsf_metabox input.bsf_text_small { width: 100px; margin-right: 15px;}
24
-
25
- table.bsf_metabox input.bsf_timepicker { width: 100px; margin-right: 15px;}
26
-
27
- table.bsf_metabox input.bsf_text_money { width: 90px; margin-right: 15px;}
28
-
29
- table.bsf_metabox input.bsf_text_medium { width: 230px; margin-right: 15px;}
30
-
31
- table.bsf_metabox input.bsf_upload_file { width: 65%; }
32
-
33
- table.bsf_metabox li { font-size:12px; margin: 1px 0 5px 0; line-height: 16px; }
34
-
35
- table.bsf_metabox ul { padding-top:5px; margin: 0; }
36
-
37
- table.bsf_metabox select { font-size:12px; margin-top: 3px;}
38
-
39
- table.bsf_metabox input:focus, table.bsf_metabox textarea:focus { background: #fffff8;}
40
-
41
- .bsf_metabox_title { margin: 0 0 5px 0; padding: 5px 0 0 0; font: italic 24px/35px Georgia,"Times New Roman","Bitstream Charter",Times,serif;}
42
-
43
- .bsf_radio_inline { padding: 4px 0 0 0;}
44
-
45
- .bsf_radio_inline_option {display: inline; padding-right: 18px;}
46
-
47
- table.bsf_metabox input[type="radio"] { margin: 0 5px 0 0; padding: 0;}
48
-
49
- table.bsf_metabox input[type="checkbox"] { margin: 0 5px 0 0; padding: 0;}
50
-
51
- table.bsf_metabox .mceLayout {border:1px solid #DFDFDF !important;}
52
-
53
- table.bsf_metabox .mceIframeContainer {background:#FFF;}
54
-
55
- table.bsf_metabox .meta_mce {width:97%;}
56
-
57
- table.bsf_metabox .meta_mce textarea {width:100%;}
58
-
59
- table.bsf_metabox .bsf_media_status { margin: 10px 0 0 0;}
60
-
61
- table.bsf_metabox .bsf_media_status .img_status, table.bsf_metabox .bsf_media_status .embed_status { position: relative; }
62
-
63
- table.bsf_metabox .bsf_media_status .img_status img, table.bsf_metabox .bsf_media_status .embed_status { border:1px solid #DFDFDF; background: #FAFAFA; max-width:350px; padding: 5px; -moz-border-radius: 2px; border-radius: 2px;}
64
-
65
- table.bsf_metabox .bsf_media_status .embed_status { float: left; max-width:800px;}
66
-
67
- table.bsf_metabox .bsf_media_status .img_status .bsf_remove_file_button, table.bsf_metabox .bsf_media_status .embed_status .bsf_remove_file_button { text-indent: -9999px; background: url(images/ico-delete.png); width: 16px; height: 16px; position: absolute; top: -5px; left: -5px;}
68
-
69
- /* Sidebar placement adjustments */
70
-
71
- .inner-sidebar table.bsf_metabox input[type=text], table.bsf_metabox textarea { width: 95%; }
72
-
73
- .inner-sidebar table.bsf_metabox .bsf_media_status .img_status img, .inner-sidebar table.bsf_metabox .bsf_media_status .embed_status img { width: 90%; }
74
-
75
- .postbox table.bsf_metabox .cmb-spinner { float: left; }
76
-
77
- /**
78
-
79
- * Color picker
80
-
81
- */
82
-
83
- table.bsf_metabox .wp-color-result, table.bsf_metabox .wp-picker-input-wrap { vertical-align: middle; }
84
-
85
- table.bsf_metabox .wp-color-result, table.bsf_metabox .wp-picker-container { margin: 0 10px 0 0; width: 80px; height: 25px; display: block; box-shadow: 0px 0px 1px 1px;}
86
-
87
-
88
-
89
- /**
90
-
91
- * Timepicker
92
-
93
- */
94
-
95
- div.time-picker { position: absolute; height: 191px; width:6em; /* needed for IE */overflow: auto; background: #fff; border: 1px solid #aaa; z-index: 99; margin: 0;}
96
-
97
- div.time-picker-12hours { width:8em; /* needed for IE */}
98
-
99
- div.time-picker ul { list-style-type: none; margin: 0; padding: 0; }
100
-
101
- div.time-picker li { cursor: pointer; height: 10px; font: 12px/1 Helvetica, Arial, sans-serif; padding: 4px 3px; }
102
-
103
- div.time-picker li.selected { background: #0063CE; color: #fff; }
104
-
105
-
106
-
107
- /**
108
-
109
- * jQuery UI CSS Framework 1.8.16
110
-
111
- *
112
-
113
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
114
-
115
- * Dual licensed under the MIT or GPL Version 2 licenses.
116
-
117
- * http://jquery.org/license
118
-
119
- *
120
-
121
- * http://docs.jquery.com/UI/Theming/API
122
-
123
- */
124
-
125
- .bsf_element .ui-helper-hidden { display: none; }
126
-
127
- .bsf_element .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
128
-
129
- .bsf_element .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
130
-
131
- .bsf_element .ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
132
-
133
- .bsf_element .ui-helper-clearfix { display: inline-block; }
134
-
135
- * html .ui-helper-clearfix { height:1%; }
136
-
137
- .bsf_element .ui-helper-clearfix { display:block; }
138
-
139
- .bsf_element .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
140
-
141
- .bsf_element .ui-state-disabled { cursor: default !important; }
142
-
143
- .bsf_element .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
144
-
145
- .bsf_element .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
146
-
147
- .bsf_element .ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
148
-
149
- .bsf_element .ui-widget .ui-widget { font-size: 1em; }
150
-
151
- .bsf_element .ui-widget input, .bsf_element .ui-widget select, .bsf_element .ui-widget textarea, .bsf_element .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
152
-
153
- .bsf_element .ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
154
-
155
- .bsf_element .ui-widget-content a { color: #222222; }
156
-
157
- .bsf_element .ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
158
-
159
- .bsf_element .ui-widget-header a { color: #222222; }
160
-
161
- .bsf_element .ui-state-default, .bsf_element .ui-widget-content .ui-state-default, .bsf_element .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
162
-
163
- .bsf_element .ui-state-default a, .bsf_element .ui-state-default a:link, .bsf_element .ui-state-default a:visited { color: #555555; text-decoration: none; }
164
-
165
- .bsf_element .ui-state-hover, .bsf_element .ui-widget-content .ui-state-hover, .bsf_element .ui-widget-header .ui-state-hover, .bsf_element .ui-state-focus, .bsf_element .ui-widget-content .ui-state-focus, .bsf_element .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
166
-
167
- .bsf_element .ui-state-hover a, .bsf_element .ui-state-hover a:hover { color: #212121; text-decoration: none; }
168
-
169
- .bsf_element .ui-state-active, .bsf_element .ui-widget-content .ui-state-active, .bsf_element .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
170
-
171
- .bsf_element .ui-state-active a, .bsf_element .ui-state-active a:link, .bsf_element .ui-state-active a:visited { color: #212121; text-decoration: none; }
172
-
173
- .bsf_element .ui-widget :active { outline: none; }
174
-
175
- .bsf_element .ui-state-highlight, .bsf_element .ui-widget-content .ui-state-highlight, .bsf_element .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
176
-
177
- .bsf_element .ui-state-highlight a, .bsf_element .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
178
-
179
- .bsf_element .ui-state-error, .bsf_element .ui-widget-content .ui-state-error, .bsf_element .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
180
-
181
- .bsf_element .ui-state-error a, .bsf_element .ui-widget-content .ui-state-error a, .bsf_element .ui-widget-header .ui-state-error a { color: #cd0a0a; }
182
-
183
- .bsf_element .ui-state-error-text, .bsf_element .ui-widget-content .ui-state-error-text, .bsf_element .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
184
-
185
- .bsf_element .ui-priority-primary, .bsf_element .ui-widget-content .ui-priority-primary, .bsf_element .ui-widget-header .ui-priority-primary { font-weight: bold; }
186
-
187
- .bsf_element .ui-priority-secondary, .bsf_element .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
188
-
189
- .bsf_element .ui-state-disabled, .bsf_element .ui-widget-content .ui-state-disabled, .bsf_element .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
190
-
191
- .bsf_element .ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
192
-
193
- .bsf_element .ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
194
-
195
- .bsf_element .ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
196
-
197
- .bsf_element .ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }
198
-
199
- .bsf_element .ui-state-hover .ui-icon, .bsf_element .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
200
-
201
- .bsf_element .ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
202
-
203
- .bsf_element .ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
204
-
205
- .bsf_element .ui-state-error .ui-icon, .bsf_element .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
206
-
207
- .bsf_element .ui-icon-carat-1-n { background-position: 0 0; }
208
-
209
- .bsf_element .ui-icon-carat-1-ne { background-position: -16px 0; }
210
-
211
- .bsf_element .ui-icon-carat-1-e { background-position: -32px 0; }
212
-
213
- .bsf_element .ui-icon-carat-1-se { background-position: -48px 0; }
214
-
215
- .bsf_element .ui-icon-carat-1-s { background-position: -64px 0; }
216
-
217
- .bsf_element .ui-icon-carat-1-sw { background-position: -80px 0; }
218
-
219
- .bsf_element .ui-icon-carat-1-w { background-position: -96px 0; }
220
-
221
- .bsf_element .ui-icon-carat-1-nw { background-position: -112px 0; }
222
-
223
- .bsf_element .ui-icon-carat-2-n-s { background-position: -128px 0; }
224
-
225
- .bsf_element .ui-icon-carat-2-e-w { background-position: -144px 0; }
226
-
227
- .bsf_element .ui-icon-triangle-1-n { background-position: 0 -16px; }
228
-
229
- .bsf_element .ui-icon-triangle-1-ne { background-position: -16px -16px; }
230
-
231
- .bsf_element .ui-icon-triangle-1-e { background-position: -32px -16px; }
232
-
233
- .bsf_element .ui-icon-triangle-1-se { background-position: -48px -16px; }
234
-
235
- .bsf_element .ui-icon-triangle-1-s { background-position: -64px -16px; }
236
-
237
- .bsf_element .ui-icon-triangle-1-sw { background-position: -80px -16px; }
238
-
239
- .bsf_element .ui-icon-triangle-1-w { background-position: -96px -16px; }
240
-
241
- .bsf_element .ui-icon-triangle-1-nw { background-position: -112px -16px; }
242
-
243
- .bsf_element .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
244
-
245
- .bsf_element .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
246
-
247
- .bsf_element .ui-icon-arrow-1-n { background-position: 0 -32px; }
248
-
249
- .bsf_element .ui-icon-arrow-1-ne { background-position: -16px -32px; }
250
-
251
- .bsf_element .ui-icon-arrow-1-e { background-position: -32px -32px; }
252
-
253
- .bsf_element .ui-icon-arrow-1-se { background-position: -48px -32px; }
254
-
255
- .bsf_element .ui-icon-arrow-1-s { background-position: -64px -32px; }
256
-
257
- .bsf_element .ui-icon-arrow-1-sw { background-position: -80px -32px; }
258
-
259
- .bsf_element .ui-icon-arrow-1-w { background-position: -96px -32px; }
260
-
261
- .bsf_element .ui-icon-arrow-1-nw { background-position: -112px -32px; }
262
-
263
- .bsf_element .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
264
-
265
- .bsf_element .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
266
-
267
- .bsf_element .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
268
-
269
- .bsf_element .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
270
-
271
- .bsf_element .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
272
-
273
- .bsf_element .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
274
-
275
- .bsf_element .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
276
-
277
- .bsf_element .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
278
-
279
- .bsf_element .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
280
-
281
- .bsf_element .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
282
-
283
- .bsf_element .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
284
-
285
- .bsf_element .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
286
-
287
- .bsf_element .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
288
-
289
- .bsf_element .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
290
-
291
- .bsf_element .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
292
-
293
- .bsf_element .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
294
-
295
- .bsf_element .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
296
-
297
- .bsf_element .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
298
-
299
- .bsf_element .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
300
-
301
- .bsf_element .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
302
-
303
- .bsf_element .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
304
-
305
- .bsf_element .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
306
-
307
- .bsf_element .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
308
-
309
- .bsf_element .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
310
-
311
- .bsf_element .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
312
-
313
- .bsf_element .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
314
-
315
- .bsf_element .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
316
-
317
- .bsf_element .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
318
-
319
- .bsf_element .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
320
-
321
- .bsf_element .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
322
-
323
- .bsf_element .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
324
-
325
- .bsf_element .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
326
-
327
- .bsf_element .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
328
-
329
- .bsf_element .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
330
-
331
- .bsf_element .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
332
-
333
- .bsf_element .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
334
-
335
- .bsf_element .ui-icon-arrow-4 { background-position: 0 -80px; }
336
-
337
- .bsf_element .ui-icon-arrow-4-diag { background-position: -16px -80px; }
338
-
339
- .bsf_element .ui-icon-extlink { background-position: -32px -80px; }
340
-
341
- .bsf_element .ui-icon-newwin { background-position: -48px -80px; }
342
-
343
- .bsf_element .ui-icon-refresh { background-position: -64px -80px; }
344
-
345
- .bsf_element .ui-icon-shuffle { background-position: -80px -80px; }
346
-
347
- .bsf_element .ui-icon-transfer-e-w { background-position: -96px -80px; }
348
-
349
- .bsf_element .ui-icon-transferthick-e-w { background-position: -112px -80px; }
350
-
351
- .bsf_element .ui-icon-folder-collapsed { background-position: 0 -96px; }
352
-
353
- .bsf_element .ui-icon-folder-open { background-position: -16px -96px; }
354
-
355
- .bsf_element .ui-icon-document { background-position: -32px -96px; }
356
-
357
- .bsf_element .ui-icon-document-b { background-position: -48px -96px; }
358
-
359
- .bsf_element .ui-icon-note { background-position: -64px -96px; }
360
-
361
- .bsf_element .ui-icon-mail-closed { background-position: -80px -96px; }
362
-
363
- .bsf_element .ui-icon-mail-open { background-position: -96px -96px; }
364
-
365
- .bsf_element .ui-icon-suitcase { background-position: -112px -96px; }
366
-
367
- .bsf_element .ui-icon-comment { background-position: -128px -96px; }
368
-
369
- .bsf_element .ui-icon-person { background-position: -144px -96px; }
370
-
371
- .bsf_element .ui-icon-print { background-position: -160px -96px; }
372
-
373
- .bsf_element .ui-icon-trash { background-position: -176px -96px; }
374
-
375
- .bsf_element .ui-icon-locked { background-position: -192px -96px; }
376
-
377
- .bsf_element .ui-icon-unlocked { background-position: -208px -96px; }
378
-
379
- .bsf_element .ui-icon-bookmark { background-position: -224px -96px; }
380
-
381
- .bsf_element .ui-icon-tag { background-position: -240px -96px; }
382
-
383
- .bsf_element .ui-icon-home { background-position: 0 -112px; }
384
-
385
- .bsf_element .ui-icon-flag { background-position: -16px -112px; }
386
-
387
- .bsf_element .ui-icon-calendar { background-position: -32px -112px; }
388
-
389
- .bsf_element .ui-icon-cart { background-position: -48px -112px; }
390
-
391
- .bsf_element .ui-icon-pencil { background-position: -64px -112px; }
392
-
393
- .bsf_element .ui-icon-clock { background-position: -80px -112px; }
394
-
395
- .bsf_element .ui-icon-disk { background-position: -96px -112px; }
396
-
397
- .bsf_element .ui-icon-calculator { background-position: -112px -112px; }
398
-
399
- .bsf_element .ui-icon-zoomin { background-position: -128px -112px; }
400
-
401
- .bsf_element .ui-icon-zoomout { background-position: -144px -112px; }
402
-
403
- .bsf_element .ui-icon-search { background-position: -160px -112px; }
404
-
405
- .bsf_element .ui-icon-wrench { background-position: -176px -112px; }
406
-
407
- .bsf_element .ui-icon-gear { background-position: -192px -112px; }
408
-
409
- .bsf_element .ui-icon-heart { background-position: -208px -112px; }
410
-
411
- .bsf_element .ui-icon-star { background-position: -224px -112px; }
412
-
413
- .bsf_element .ui-icon-link { background-position: -240px -112px; }
414
-
415
- .bsf_element .ui-icon-cancel { background-position: 0 -128px; }
416
-
417
- .bsf_element .ui-icon-plus { background-position: -16px -128px; }
418
-
419
- .bsf_element .ui-icon-plusthick { background-position: -32px -128px; }
420
-
421
- .bsf_element .ui-icon-minus { background-position: -48px -128px; }
422
-
423
- .bsf_element .ui-icon-minusthick { background-position: -64px -128px; }
424
-
425
- .bsf_element .ui-icon-close { background-position: -80px -128px; }
426
-
427
- .bsf_element .ui-icon-closethick { background-position: -96px -128px; }
428
-
429
- .bsf_element .ui-icon-key { background-position: -112px -128px; }
430
-
431
- .bsf_element .ui-icon-lightbulb { background-position: -128px -128px; }
432
-
433
- .bsf_element .ui-icon-scissors { background-position: -144px -128px; }
434
-
435
- .bsf_element .ui-icon-clipboard { background-position: -160px -128px; }
436
-
437
- .bsf_element .ui-icon-copy { background-position: -176px -128px; }
438
-
439
- .bsf_element .ui-icon-contact { background-position: -192px -128px; }
440
-
441
- .bsf_element .ui-icon-image { background-position: -208px -128px; }
442
-
443
- .bsf_element .ui-icon-video { background-position: -224px -128px; }
444
-
445
- .bsf_element .ui-icon-script { background-position: -240px -128px; }
446
-
447
- .bsf_element .ui-icon-alert { background-position: 0 -144px; }
448
-
449
- .bsf_element .ui-icon-info { background-position: -16px -144px; }
450
-
451
- .bsf_element .ui-icon-notice { background-position: -32px -144px; }
452
-
453
- .bsf_element .ui-icon-help { background-position: -48px -144px; }
454
-
455
- .bsf_element .ui-icon-check { background-position: -64px -144px; }
456
-
457
- .bsf_element .ui-icon-bullet { background-position: -80px -144px; }
458
-
459
- .bsf_element .ui-icon-radio-off { background-position: -96px -144px; }
460
-
461
- .bsf_element .ui-icon-radio-on { background-position: -112px -144px; }
462
-
463
- .bsf_element .ui-icon-pin-w { background-position: -128px -144px; }
464
-
465
- .bsf_element .ui-icon-pin-s { background-position: -144px -144px; }
466
-
467
- .bsf_element .ui-icon-play { background-position: 0 -160px; }
468
-
469
- .bsf_element .ui-icon-pause { background-position: -16px -160px; }
470
-
471
- .bsf_element .ui-icon-seek-next { background-position: -32px -160px; }
472
-
473
- .bsf_element .ui-icon-seek-prev { background-position: -48px -160px; }
474
-
475
- .bsf_element .ui-icon-seek-end { background-position: -64px -160px; }
476
-
477
- .bsf_element .ui-icon-seek-start { background-position: -80px -160px; }
478
-
479
- .bsf_element .ui-icon-seek-first { background-position: -80px -160px; }
480
-
481
- .bsf_element .ui-icon-stop { background-position: -96px -160px; }
482
-
483
- .bsf_element .ui-icon-eject { background-position: -112px -160px; }
484
-
485
- .bsf_element .ui-icon-volume-off { background-position: -128px -160px; }
486
-
487
- .bsf_element .ui-icon-volume-on { background-position: -144px -160px; }
488
-
489
- .bsf_element .ui-icon-power { background-position: 0 -176px; }
490
-
491
- .bsf_element .ui-icon-signal-diag { background-position: -16px -176px; }
492
-
493
- .bsf_element .ui-icon-signal { background-position: -32px -176px; }
494
-
495
- .bsf_element .ui-icon-battery-0 { background-position: -48px -176px; }
496
-
497
- .bsf_element .ui-icon-battery-1 { background-position: -64px -176px; }
498
-
499
- .bsf_element .ui-icon-battery-2 { background-position: -80px -176px; }
500
-
501
- .bsf_element .ui-icon-battery-3 { background-position: -96px -176px; }
502
-
503
- .bsf_element .ui-icon-circle-plus { background-position: 0 -192px; }
504
-
505
- .bsf_element .ui-icon-circle-minus { background-position: -16px -192px; }
506
-
507
- .bsf_element .ui-icon-circle-close { background-position: -32px -192px; }
508
-
509
- .bsf_element .ui-icon-circle-triangle-e { background-position: -48px -192px; }
510
-
511
- .bsf_element .ui-icon-circle-triangle-s { background-position: -64px -192px; }
512
-
513
- .bsf_element .ui-icon-circle-triangle-w { background-position: -80px -192px; }
514
-
515
- .bsf_element .ui-icon-circle-triangle-n { background-position: -96px -192px; }
516
-
517
- .bsf_element .ui-icon-circle-arrow-e { background-position: -112px -192px; }
518
-
519
- .bsf_element .ui-icon-circle-arrow-s { background-position: -128px -192px; }
520
-
521
- .bsf_element .ui-icon-circle-arrow-w { background-position: -144px -192px; }
522
-
523
- .bsf_element .ui-icon-circle-arrow-n { background-position: -160px -192px; }
524
-
525
- .bsf_element .ui-icon-circle-zoomin { background-position: -176px -192px; }
526
-
527
- .bsf_element .ui-icon-circle-zoomout { background-position: -192px -192px; }
528
-
529
- .bsf_element .ui-icon-circle-check { background-position: -208px -192px; }
530
-
531
- .bsf_element .ui-icon-circlesmall-plus { background-position: 0 -208px; }
532
-
533
- .bsf_element .ui-icon-circlesmall-minus { background-position: -16px -208px; }
534
-
535
- .bsf_element .ui-icon-circlesmall-close { background-position: -32px -208px; }
536
-
537
- .bsf_element .ui-icon-squaresmall-plus { background-position: -48px -208px; }
538
-
539
- .bsf_element .ui-icon-squaresmall-minus { background-position: -64px -208px; }
540
-
541
- .bsf_element .ui-icon-squaresmall-close { background-position: -80px -208px; }
542
-
543
- .bsf_element .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
544
-
545
- .bsf_element .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
546
-
547
- .bsf_element .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
548
-
549
- .bsf_element .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
550
-
551
- .bsf_element .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
552
-
553
- .bsf_element .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
554
-
555
- .bsf_element .ui-corner-all, .bsf_element .ui-corner-top, .bsf_element .ui-corner-left, .bsf_element .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; }
556
-
557
- .bsf_element .ui-corner-all, .bsf_element .ui-corner-top, .bsf_element .ui-corner-right, .bsf_element .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; }
558
-
559
- .bsf_element .ui-corner-all, .bsf_element .ui-corner-bottom, .bsf_element .ui-corner-left, .bsf_element .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
560
-
561
- .bsf_element .ui-corner-all, .bsf_element .ui-corner-bottom, .bsf_element .ui-corner-right, .bsf_element .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
562
-
563
- .bsf_element .ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
564
-
565
- .bsf_element .ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }
566
-
567
- .bsf_element .ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
568
-
569
- .bsf_element .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
570
-
571
- .bsf_element .ui-datepicker .ui-datepicker-prev, .bsf_element .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
572
-
573
- .bsf_element .ui-datepicker .ui-datepicker-prev-hover, .bsf_element .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
574
-
575
- .bsf_element .ui-datepicker .ui-datepicker-prev { left:2px; }
576
-
577
- .bsf_element .ui-datepicker .ui-datepicker-next { right:2px; }
578
-
579
- .bsf_element .ui-datepicker .ui-datepicker-prev-hover { left:1px; }
580
-
581
- .bsf_element .ui-datepicker .ui-datepicker-next-hover { right:1px; }
582
-
583
- .bsf_element .ui-datepicker .ui-datepicker-prev span, .bsf_element .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
584
-
585
- .bsf_element .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
586
-
587
- .bsf_element .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
588
-
589
- .bsf_element .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
590
-
591
- .bsf_element .ui-datepicker select.ui-datepicker-month,
592
-
593
- .bsf_element .ui-datepicker select.ui-datepicker-year { width: 49%;}
594
-
595
- .bsf_element .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
596
-
597
- .bsf_element .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
598
-
599
- .bsf_element .ui-datepicker td { border: 0; padding: 1px; }
600
-
601
- .bsf_element .ui-datepicker td span, .bsf_element .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
602
-
603
- .bsf_element .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
604
-
605
- .bsf_element .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
606
-
607
- .bsf_element .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
608
-
609
- .bsf_element .ui-datepicker.ui-datepicker-multi { width:auto; }
610
-
611
- .bsf_element .ui-datepicker-multi .ui-datepicker-group { float:left; }
612
-
613
- .bsf_element .ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
614
-
615
- .bsf_element .ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
616
-
617
- .bsf_element .ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
618
-
619
- .bsf_element .ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
620
-
621
- .bsf_element .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
622
-
623
- .bsf_element .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
624
-
625
- .bsf_element .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
626
-
627
- .bsf_element .ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
628
-
629
- .bsf_element .ui-datepicker-rtl { direction: rtl; }
630
-
631
- .bsf_element .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
632
-
633
- .bsf_element .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
634
-
635
- .bsf_element .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
636
-
637
- .bsf_element .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
638
-
639
- .bsf_element .ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
640
-
641
- .bsf_element .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
642
-
643
- .bsf_element .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
644
-
645
- .bsf_element .ui-datepicker-rtl .ui-datepicker-group { float:right; }
646
-
647
- .bsf_element .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
648
-
649
- .bsf_element .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
650
-
651
- .bsf_element .ui-datepicker-cover {
652
-
653
- display: none; /*sorry for IE5*/
654
-
655
- display/**/: block; /*sorry for IE5*/
656
-
657
- position: absolute; /*must have*/
658
-
659
- z-index: -1; /*must have*/
660
-
661
- filter: mask(); /*must have*/
662
-
663
- top: -4px; /*must have*/
664
-
665
- left: -4px; /*must have*/
666
-
667
- width: 200px; /*must have*/
668
-
669
- height: 200px; /*must have*/
670
-
671
- }
672
- .required {
673
- color: #F00;
674
- font-size: 11px;
675
- margin-left: -12px;
676
- }
677
- .select_full {
678
- width: 94%;
679
- }
680
- .bsf_textarea_small {
681
- width: 94%;
682
- height: 110px;
683
  }
1
+ /**
2
+ * Metabox Styling
3
+ */
4
+ table.bsf_metabox td, table.bsf_metabox th { border-bottom: 0px solid #E9E9E9; padding-top:5px; padding-right: 12px;}
5
+ table.bsf_metabox th { text-align: right; font-weight:bold;}
6
+ table.bsf_metabox th label { margin-top:5px; display:block;}
7
+ p.bsf_metabox_description { color: #AAA; font-style: italic; margin: 2px 0 !important;}
8
+ span.bsf_metabox_description { color: #AAA; font-style: italic;}
9
+ table.bsf_metabox input, table.bsf_metabox textarea { font-size:12px; padding: 5px; }
10
+ table.bsf_metabox input[type=text], table.bsf_metabox textarea { width: 97%; }
11
+ table.bsf_metabox textarea.bsf_textarea_code { font-family: Consolas,Monaco,monospace; line-height: 16px; }
12
+ table.bsf_metabox input.bsf_text_small { width: 100px; margin-right: 15px;}
13
+ table.bsf_metabox input.bsf_timepicker { width: 100px; margin-right: 15px;}
14
+ table.bsf_metabox input.bsf_text_money { width: 90px; margin-right: 15px;}
15
+ table.bsf_metabox input.bsf_text_medium { width: 230px; margin-right: 15px;}
16
+ table.bsf_metabox input.bsf_upload_file { width: 65%; }
17
+ table.bsf_metabox li { font-size:12px; margin: 1px 0 5px 0; line-height: 16px; }
18
+ table.bsf_metabox ul { padding-top:5px; margin: 0; }
19
+ table.bsf_metabox select { font-size:12px; margin-top: 3px;}
20
+ table.bsf_metabox input:focus, table.bsf_metabox textarea:focus { background: #fffff8;}
21
+ .bsf_metabox_title { margin: 0 0 5px 0; padding: 5px 0 0 0; font: italic 24px/35px Georgia,"Times New Roman","Bitstream Charter",Times,serif;}
22
+ .bsf_radio_inline { padding: 4px 0 0 0;}
23
+ .bsf_radio_inline_option {display: inline; padding-right: 18px;}
24
+ table.bsf_metabox input[type="radio"] { margin: 0 5px 0 0; padding: 0;}
25
+ table.bsf_metabox input[type="checkbox"] { margin: 0 5px 0 0; padding: 0;}
26
+ table.bsf_metabox .mceLayout {border:1px solid #DFDFDF !important;}
27
+ table.bsf_metabox .mceIframeContainer {background:#FFF;}
28
+ table.bsf_metabox .meta_mce {width:97%;}
29
+ table.bsf_metabox .meta_mce textarea {width:100%;}
30
+ table.bsf_metabox .bsf_media_status { margin: 10px 0 0 0;}
31
+ table.bsf_metabox .bsf_media_status .img_status, table.bsf_metabox .bsf_media_status .embed_status { position: relative; }
32
+ table.bsf_metabox .bsf_media_status .img_status img, table.bsf_metabox .bsf_media_status .embed_status { border:1px solid #DFDFDF; background: #FAFAFA; max-width:350px; padding: 5px; -moz-border-radius: 2px; border-radius: 2px;}
33
+ table.bsf_metabox .bsf_media_status .embed_status { float: left; max-width:800px;}
34
+ table.bsf_metabox .bsf_media_status .img_status .bsf_remove_file_button, table.bsf_metabox .bsf_media_status .embed_status .bsf_remove_file_button { text-indent: -9999px; width: 16px; height: 16px; position: absolute; top: -5px; left: -5px;}
35
+ /* Sidebar placement adjustments */
36
+ .inner-sidebar table.bsf_metabox input[type=text], table.bsf_metabox textarea { width: 95%; }
37
+ .inner-sidebar table.bsf_metabox .bsf_media_status .img_status img, .inner-sidebar table.bsf_metabox .bsf_media_status .embed_status img { width: 90%; }
38
+ .postbox table.bsf_metabox .cmb-spinner { float: left; }
39
+ /**
40
+ * Color picker
41
+ */
42
+ table.bsf_metabox .wp-color-result, table.bsf_metabox .wp-picker-input-wrap { vertical-align: middle; }
43
+ table.bsf_metabox .wp-color-result, table.bsf_metabox .wp-picker-container { margin: 0 10px 0 0; width: 80px; height: 22px; display: block; box-shadow: none;}
44
+ /**
45
+ * Timepicker
46
+ */
47
+ div.time-picker { position: absolute; height: 191px; width:6em; /* needed for IE */overflow: auto; background: #fff; border: 1px solid #aaa; z-index: 99; margin: 0;}
48
+ div.time-picker-12hours { width:8em; /* needed for IE */}
49
+ div.time-picker ul { list-style-type: none; margin: 0; padding: 0; }
50
+ div.time-picker li { cursor: pointer; height: 10px; font: 12px/1 Helvetica, Arial, sans-serif; padding: 4px 3px; }
51
+ div.time-picker li.selected { background: #0063CE; color: #fff; }
52
+ /**
53
+ * jQuery UI CSS Framework 1.8.16
54
+ *
55
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
56
+ * Dual licensed under the MIT or GPL Version 2 licenses.
57
+ * http://jquery.org/license
58
+ *
59
+ * http://docs.jquery.com/UI/Theming/API
60
+ */
61
+ .bsf_element .ui-helper-hidden { display: none; }
62
+ .bsf_element .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
63
+ .bsf_element .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
64
+ .bsf_element .ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
65
+ .bsf_element .ui-helper-clearfix { display: inline-block; }
66
+ * html .ui-helper-clearfix { height:1%; }
67
+ .bsf_element .ui-helper-clearfix { display:block; }
68
+ .bsf_element .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
69
+ .bsf_element .ui-state-disabled { cursor: default !important; }
70
+ .bsf_element .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
71
+ .bsf_element .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
72
+ .bsf_element .ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
73
+ .bsf_element .ui-widget .ui-widget { font-size: 1em; }
74
+ .bsf_element .ui-widget input, .bsf_element .ui-widget select, .bsf_element .ui-widget textarea, .bsf_element .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
75
+ .bsf_element .ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff 50% 50% repeat-x; color: #222222; }
76
+ .bsf_element .ui-widget-content a { color: #222222; }
77
+ .bsf_element .ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc; color: #222222; font-weight: bold; }
78
+ .bsf_element .ui-widget-header a { color: #222222; }
79
+ .bsf_element .ui-state-default, .bsf_element .ui-widget-content .ui-state-default, .bsf_element .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6; font-weight: normal; color: #555555; }
80
+ .bsf_element .ui-state-default a, .bsf_element .ui-state-default a:link, .bsf_element .ui-state-default a:visited { color: #555555; text-decoration: none; }
81
+ .bsf_element .ui-state-hover, .bsf_element .ui-widget-content .ui-state-hover, .bsf_element .ui-widget-header .ui-state-hover, .bsf_element .ui-state-focus, .bsf_element .ui-widget-content .ui-state-focus, .bsf_element .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada; font-weight: normal; color: #212121; }
82
+ .bsf_element .ui-state-hover a, .bsf_element .ui-state-hover a:hover { color: #212121; text-decoration: none; }
83
+ .bsf_element .ui-state-active, .bsf_element .ui-widget-content .ui-state-active, .bsf_element .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff; font-weight: normal; color: #212121; }
84
+ .bsf_element .ui-state-active a, .bsf_element .ui-state-active a:link, .bsf_element .ui-state-active a:visited { color: #212121; text-decoration: none; }
85
+ .bsf_element .ui-widget :active { outline: none; }
86
+ .bsf_element .ui-state-highlight, .bsf_element .ui-widget-content .ui-state-highlight, .bsf_element .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee; color: #363636; }
87
+ .bsf_element .ui-state-highlight a, .bsf_element .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
88
+ .bsf_element .ui-state-error, .bsf_element .ui-widget-content .ui-state-error, .bsf_element .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec; color: #cd0a0a; }
89
+ .bsf_element .ui-state-error a, .bsf_element .ui-widget-content .ui-state-error a, .bsf_element .ui-widget-header .ui-state-error a { color: #cd0a0a; }
90
+ .bsf_element .ui-state-error-text, .bsf_element .ui-widget-content .ui-state-error-text, .bsf_element .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
91
+ .bsf_element .ui-priority-primary, .bsf_element .ui-widget-content .ui-priority-primary, .bsf_element .ui-widget-header .ui-priority-primary { font-weight: bold; }
92
+ .bsf_element .ui-priority-secondary, .bsf_element .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
93
+ .bsf_element .ui-state-disabled, .bsf_element .ui-widget-content .ui-state-disabled, .bsf_element .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
94
+ .bsf_element .ui-corner-all, .bsf_element .ui-corner-top, .bsf_element .ui-corner-left, .bsf_element .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; }
95
+ .bsf_element .ui-corner-all, .bsf_element .ui-corner-top, .bsf_element .ui-corner-right, .bsf_element .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; }
96
+ .bsf_element .ui-corner-all, .bsf_element .ui-corner-bottom, .bsf_element .ui-corner-left, .bsf_element .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
97
+ .bsf_element .ui-corner-all, .bsf_element .ui-corner-bottom, .bsf_element .ui-corner-right, .bsf_element .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
98
+ .bsf_element .ui-widget-overlay { background: #aaaaaa; opacity: .30;filter:Alpha(Opacity=30); }
99
+ .bsf_element .ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }
100
+ .bsf_element .ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
101
+ .bsf_element .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
102
+ .bsf_element .ui-datepicker .ui-datepicker-prev, .bsf_element .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
103
+ .bsf_element .ui-datepicker .ui-datepicker-prev-hover, .bsf_element .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
104
+ .bsf_element .ui-datepicker .ui-datepicker-prev { left:2px; }
105
+ .bsf_element .ui-datepicker .ui-datepicker-next { right:2px; }
106
+ .bsf_element .ui-datepicker .ui-datepicker-prev-hover { left:1px; }
107
+ .bsf_element .ui-datepicker .ui-datepicker-next-hover { right:1px; }
108
+ .bsf_element .ui-datepicker .ui-datepicker-prev span, .bsf_element .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
109
+ .bsf_element .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
110
+ .bsf_element .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
111
+ .bsf_element .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
112
+ .bsf_element .ui-datepicker select.ui-datepicker-month,
113
+ .bsf_element .ui-datepicker select.ui-datepicker-year { width: 49%;}
114
+ .bsf_element .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
115
+ .bsf_element .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
116
+ .bsf_element .ui-datepicker td { border: 0; padding: 1px; }
117
+ .bsf_element .ui-datepicker td span, .bsf_element .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
118
+ .bsf_element .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
119
+ .bsf_element .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
120
+ .bsf_element .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
121
+ .bsf_element .ui-datepicker.ui-datepicker-multi { width:auto; }
122
+ .bsf_element .ui-datepicker-multi .ui-datepicker-group { float:left; }
123
+ .bsf_element .ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
124
+ .bsf_element .ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
125
+ .bsf_element .ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
126
+ .bsf_element .ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
127
+ .bsf_element .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
128
+ .bsf_element .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
129
+ .bsf_element .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
130
+ .bsf_element .ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
131
+ .bsf_element .ui-datepicker-rtl { direction: rtl; }
132
+ .bsf_element .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
133
+ .bsf_element .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
134
+ .bsf_element .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
135
+ .bsf_element .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
136
+ .bsf_element .ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
137
+ .bsf_element .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
138
+ .bsf_element .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
139
+ .bsf_element .ui-datepicker-rtl .ui-datepicker-group { float:right; }
140
+ .bsf_element .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
141
+ .bsf_element .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
142
+ .bsf_element .ui-datepicker-cover {
143
+ display: none; /*sorry for IE5*/
144
+ display/**/: block; /*sorry for IE5*/
145
+ position: absolute; /*must have*/
146
+ z-index: -1; /*must have*/
147
+ filter: mask(); /*must have*/
148
+ top: -4px; /*must have*/
149
+ left: -4px; /*must have*/
150
+ width: 200px; /*must have*/
151
+ height: 200px; /*must have*/
152
+ }
153
+ .required {
154
+ color: #F00;
155
+ font-size: 11px;
156
+ margin-left: -12px;
157
+ }
158
+ .select_full {
159
+ width: 94%;
160
+ }
161
+ .bsf_textarea_small {
162
+ width: 94%;
163
+ height: 110px;
164
+ }
165
+ .img_status>img {
166
+ max-width: 180px !important;
167
+ }
168
+ /**/
169
+ .iris-picker.iris-border {
170
+ z-index: 9999;
171
+ }
172
+ .button.button-small.wp-picker-clear {
173
+ z-index: 9999;
174
+ float: left;
175
+ line-height: 1.5em;
176
+ padding: 2px 10px !important;
177
+ height: 27px;
178
+ }
179
+ .wp-color-picker {
180
+ z-index: 9999;
181
+ float: left;
182
+ width: 80px !important;
183
+ }
184
+ .wp-picker-input-wrap {
185
+ z-index: 9999;
186
+ width: 160px;
187
+ }
188
+ .wp-picker-input-wrap {
189
+ z-index: 99999;
190
+ position: relative;
191
+ top: -27px;
192
+ left: 120px;
193
+ }
194
+ .wp-picker-holder {
195
+ position: relative;
196
+ z-index: 9999;
197
+ top: -29px;
198
+ right: 0;
199
+ }
200
+ .bsf_media_status>img {
201
+ width: 180px !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  }
admin/images/sidebar.jpg DELETED
Binary file
admin/index.php CHANGED
@@ -6,36 +6,23 @@ if ( is_admin() )
6
  add_action( 'admin_footer', 'add_footer_script' );
7
  }
8
  //enqueues the scripts and styles in admin dashboard
9
-
10
  function bsf_admin_styles() {
11
-
12
  // wp_enqueue_style( 'ui_style' );
13
-
14
  wp_enqueue_style( 'star_style' );
15
-
16
  wp_enqueue_style( 'meta_style' );
17
-
18
  wp_enqueue_script( 'bsf_jquery' );
19
-
20
  wp_enqueue_script( 'bsf_jquery_ui' );
21
-
22
  wp_enqueue_script( 'bsf_jquery_star' );
23
-
24
  /// wp_enqueue_script( 'postbox' );
25
-
26
  }
27
  function add_the_script() {
28
  wp_enqueue_script('postbox');
29
  wp_enqueue_style( 'admin_style' );
30
  }
31
  add_action('admin_print_scripts', 'add_the_script');
32
-
33
  //The Main Admin Dashboard for Rich Snippets Plugin
34
-
35
  function rich_snippet_dashboard() {
36
-
37
  $plugins_url = plugins_url();
38
-
39
  $args_review = get_option('bsf_review');
40
  $args_event = get_option('bsf_event');
41
  $args_person = get_option('bsf_person');
@@ -43,26 +30,18 @@ function rich_snippet_dashboard() {
43
  $args_recipe = get_option('bsf_recipe');
44
  $args_soft = get_option('bsf_software');
45
  $args_video = get_option('bsf_video');
 
46
  $args_color = get_option('bsf_custom');
47
-
48
  echo '<div class="wrap">';
49
-
50
  echo '<div id="star-icons-32" class="icon32"></div><h2>'.__("All in One Schema.org Rich Snippets - Dashboard","rich-snippets").'</h2>';
51
-
52
  echo '<div class="clear"></div><div id="tab-container" class="tab-container">';
53
-
54
  echo '<ul class="etabs">
55
-
56
  <li class="tab"><a href="#tab-1">'.__("Configuration","rich-snippets").'</a></li>
57
-
58
  <li class="tab"><a href="#tab-4">'.__("Customization","rich-snippets").'</a></li>
59
-
60
  <li class="tab"><a href="#tab-2">'.__(" How to Use?","rich-snippets").'</a></li>
61
-
62
  <li class="tab"><a href="#tab-3">'.__("FAQs","rich-snippets").'</a></li>
63
 
64
  </ul>
65
-
66
  <div class="clear"></div>
67
  <div class="panel-container">
68
  <div id="tab-1">
@@ -103,7 +82,6 @@ function rich_snippet_dashboard() {
103
  <td></td>
104
  <td><input type="submit" class="button-primary" name="item_submit" value="'.__("Update ").'"/>&nbsp;&nbsp;&nbsp;<a class="button-primary" href="?page=rich_snippet_dashboard&amp;action=reset&options=review">'.__('Reset ','rich-snippets').'</a></td>
105
  </tr>
106
-
107
  </tbody>
108
  </table>
109
  </form>
@@ -215,10 +193,6 @@ function rich_snippet_dashboard() {
215
  <td align="right"><strong><label>'.__("Author Rating :","rich-snippets").'</label></strong></td>
216
  <td><input class="bsf_text_medium" type="text" name="product_rating" value="'.$args_product["product_rating"].'"/></td>
217
  </tr>
218
- <tr>
219
- <td align="right"><strong><label>'.__("Your Rating :","rich-snippets").'</label></strong></td>
220
- <td><input class="bsf_text_medium" type="text" name="product_rating" value="'.$args_product["product_rating"].'"/></td>
221
- </tr>
222
  <tr>
223
  <td align="right"><strong><label>'.__("Brand Name :","rich-snippets").'</label></strong></td>
224
  <td><input class="bsf_text_medium" type="text" name="product_brand" value="'.$args_product["product_brand"].'"/></td>
@@ -286,7 +260,7 @@ function rich_snippet_dashboard() {
286
  <tr>
287
  <td align="right"><strong><label>'.__("Average Rating:","rich-snippets").'</label></strong></td>
288
  <td><input class="bsf_text_medium" type="text" name="recipe_rating" value="'.$args_recipe["recipe_rating"].'"/></td>
289
- </tr>
290
  <tr><td colspan="2"></td></tr>
291
  <tr>
292
  <td></td>
@@ -342,6 +316,8 @@ function rich_snippet_dashboard() {
342
  </div>
343
  </div>
344
  </div>
 
 
345
  <div class="postbox closed">
346
  <div class="handlediv" title="Click to toggle"><br></div>
347
  <h3 class="hndle"><span>'.__("Video","rich-snippets").'</span></h3>
@@ -382,6 +358,47 @@ function rich_snippet_dashboard() {
382
  </div>
383
  </div>
384
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
385
 
386
  </div>
387
  </div>
@@ -433,10 +450,8 @@ function rich_snippet_dashboard() {
433
  <p>'.__("We understand you don't like the content that gets displayed on your page / post. However as per the strong recommendation of Google, the MicroData should be clearly visible to the user.","rich-snippets").'</p>
434
  <p>'.__("Here is a reference link of what Google says. <a href='https://sites.google.com/site/webmasterhelpforum/en/faq-rich-snippets#display'> https://sites.google.com/site/webmasterhelpforum/en/faq-rich-snippets#display</a>","rich-snippets").'</p>
435
  <p> '.__("If you don't like the default design the content box created by plugin, you can always <a href='?page=rich_snippet_dashboard#tab-4'> customise it </a> or edit CSS located <a target='_blank' title='Click here to edit the css' href='plugin-editor.php?file=all-in-one-schemaorg-rich-snippets/css/style.css&plugin=all-in-one-schemaorg-rich-snippets/index.php'> here </a>or request professional service at $25", "rich-snippets").' </p>
436
-
437
  <li><strong>'.__(" How does this plugin work with other plugins like WordPress SEO, wooCommerce, etc?","rich-snippets").'</strong></li>
438
  <p>'.__('Well, the plugin works perfectly with most of the other plugins as the only thing "All in One Schema.org Rich Snippets" does is - it give you power to add Rich Snippets MicroData in your pages and posts easily. <br><br>If you find any it conflicting with any other plugin, please do not hesitate to report an issue.','rich-snippets').'</p>
439
-
440
  <li><strong>'.__("How much time does it take to show up rich snippets for my search results? My search results are still not coming up with rich snippets.","rich-snippets").'</strong></li>
441
  <p>'.__("Most probably rich snippets are displayed in for you search results as soon as search engines crawl the MicroData the plugin has created. However it's totally upto search engines to display rich snippets for your search result (which mostly depends on your website authority)","rich-snippets").'</p>
442
  <p>'.__("If rich snippets are not appearing in your search results yet, most probably they will start appearing soon as Google / other search engines finds your website more authoritative.","rich-snippets").'</p>
@@ -448,10 +463,8 @@ function rich_snippet_dashboard() {
448
  <li> '.__('Code the new feature if you are a developer and submit your code. If we include this feature in our releases, credits will be given to you.', 'rich-snippets').' </li>
449
  <li> '.__(' Offer a sponsorship to get this feature done for all plugin users OR request a professional customisation service.', 'rich-snippets').' </li>
450
  </ol>
451
-
452
  <li><strong>'.__("Is Google Authorship part of your plugin as well?","rich-snippets").'</strong></li>
453
  <p>'.__("Unfortunately, not at the moment. Though this is definitely in our roadmap and the development will complete soon. Stay tuned!","rich-snippets").'</p>
454
-
455
  </ol>
456
  </div>
457
  </div>
@@ -477,23 +490,23 @@ function rich_snippet_dashboard() {
477
  <table class="bsf_metabox">
478
  <tr>
479
  <th> <label for="snippet_box_bg"> '.__('Box Background ', 'rich-snippets').' </label> </th>
480
- <td> <input type="text" name="snippet_box_bg" id="snippet_box_bg" value="'.$args_color["snippet_box_bg"].'" class="bsf_colorpicker" /> </td>
481
  </tr>
482
  <tr>
483
  <th> <label for="snippet_title_bg"> '.__('Title Background', 'rich-snippets').' </label> </th>
484
- <td> <input type="text" name="snippet_title_bg" id="snippet_title_bg" value="'.$args_color["snippet_title_bg"].'" class="bsf_colorpicker" /> </td>
485
  </tr>
486
  <tr>
487
  <th> <label for="snippet_border"> '.__('Border Color', 'rich-snippets').' </label> </th>
488
- <td> <input type="text" name="snippet_border" id="snippet_border" value="'.$args_color["snippet_border"].'" class="bsf_colorpicker" /> </td>
489
  </tr>
490
  <tr>
491
  <th> <label for="snippet_title_color"> '.__('Title Color', 'rich-snippets').' </label> </th>
492
- <td> <input type="text" name="snippet_title_color" id="snippet_title_color" value="'.$args_color["snippet_title_color"].'" class="bsf_colorpicker" /> </td>
493
  </tr>
494
  <tr>
495
  <th> <label for="snippet_box_color"> '.__('Snippet Text Color', 'rich-snippets').' </label> </th>
496
- <td> <input type="text" name="snippet_box_color" id="snippet_box_color" value="'.$args_color["snippet_box_color"].'" class="bsf_colorpicker" /> </td>
497
  </tr>
498
  <tr>
499
  <td></td>
@@ -516,9 +529,7 @@ function rich_snippet_dashboard() {
516
 
517
  </div>
518
  </div> ';
519
-
520
  echo '
521
-
522
  <script src="'.plugins_url('/all-in-one-schemaorg-rich-snippets/admin/js/jquery.easytabs.min.js').'"></script>
523
  <script src="'.plugins_url('/all-in-one-schemaorg-rich-snippets/admin/js/jquery.hashchange.min.js').'"></script>
524
  <script language="javascript">
@@ -534,16 +545,13 @@ function rich_snippet_dashboard() {
534
  jQuery("#postbox-container-9").css("width","35%");
535
  jQuery("#postbox-container-10").css("width","35%");
536
  jQuery("#postbox-container-11").css({"width":"63%","padding-right":"2%"});
537
-
538
  jQuery(".postbox h3").click( function() {
539
  jQuery(jQuery(this).parent().get(0)).toggleClass("closed");
540
  });
541
-
542
  jQuery(".handlediv").click( function() {
543
  jQuery(jQuery(this).parent().get(0)).toggleClass("closed");
544
  });
545
  </script>';
546
-
547
  }
548
  // Update options
549
  if(isset($_POST['item_submit']))
@@ -558,7 +566,6 @@ if(isset($_POST['item_submit']))
558
  $status = update_option('bsf_review',$args);
559
  displayStatus($status);
560
  }
561
-
562
  if(isset($_POST['event_submit']))
563
  {
564
  foreach(array('snippet_title','event_title','event_location','start_time','end_time') as $option)
@@ -571,7 +578,6 @@ if(isset($_POST['event_submit']))
571
  $status = update_option('bsf_event',$args);
572
  displayStatus($status);
573
  }
574
-
575
  if(isset($_POST['person_submit']))
576
  {
577
  foreach(array('snippet_title','person_name','person_nickname','person_job_title','person_website','person_company','person_address') as $option)
@@ -584,7 +590,6 @@ if(isset($_POST['person_submit']))
584
  $status = update_option('bsf_person',$args);
585
  displayStatus($status);
586
  }
587
-
588
  if(isset($_POST['product_submit']))
589
  {
590
  foreach(array('snippet_title','product_rating','product_brand','product_name','product_agr','product_price','product_avail') as $option)
@@ -597,7 +602,6 @@ if(isset($_POST['product_submit']))
597
  $status = update_option('bsf_product',$args);
598
  displayStatus($status);
599
  }
600
-
601
  if(isset($_POST['recipe_submit']))
602
  {
603
  foreach(array('snippet_title','recipe_name','recipe_pub','recipe_prep','recipe_cook','recipe_time','recipe_rating') as $option)
@@ -610,7 +614,6 @@ if(isset($_POST['recipe_submit']))
610
  $status = update_option('bsf_recipe',$args);
611
  displayStatus($status);
612
  }
613
-
614
  if(isset($_POST['software_submit']))
615
  {
616
  foreach(array('snippet_title','software_rating','software_price','software_name','software_os','software_website') as $option)
@@ -623,7 +626,6 @@ if(isset($_POST['software_submit']))
623
  $status = update_option('bsf_software',$args);
624
  displayStatus($status);
625
  }
626
-
627
  if(isset($_POST['video_submit']))
628
  {
629
  foreach(array('snippet_title','video_title','video_desc','video_time','video_date') as $option)
@@ -636,9 +638,19 @@ if(isset($_POST['video_submit']))
636
  $status = update_option('bsf_video',$args);
637
  displayStatus($status);
638
  }
639
-
 
 
 
 
 
 
 
 
 
 
 
640
  function displayStatus($status) {
641
-
642
  if($status)
643
  {
644
  echo '<div class="updated"><p>' . __('Success! Your changes were successfully saved!', 'rich-snippets') . '</p></div>';
@@ -648,72 +660,60 @@ function displayStatus($status) {
648
  echo '<div class="error"><p>' . __('Sorry, Your changes are not saved!', 'rich-snippets') . '</p></div>';
649
  }
650
  }
651
-
652
  if(isset($_GET['action']))
653
  {
654
  if($_GET['action'] == 'reset')
655
  {
656
  $option_to_reset = $_GET['options'];
657
-
658
  if($option_to_reset == 'review')
659
  delete_option('bsf_review');
660
-
661
  if($option_to_reset == 'event')
662
  delete_option('bsf_event');
663
-
664
  if($option_to_reset == 'person')
665
  delete_option('bsf_person');
666
 
667
  if($option_to_reset == 'product')
668
  delete_option('bsf_product');
669
-
670
  if($option_to_reset == 'recipe')
671
  delete_option('bsf_recipe');
672
-
673
  if($option_to_reset == 'software')
674
  delete_option('bsf_software');
675
-
676
  if($option_to_reset == 'video')
677
  delete_option('bsf_video');
678
-
 
 
 
679
  if($option_to_reset == 'color')
680
  delete_option('bsf_custom');
681
 
682
  bsf_reset_options($option_to_reset);
683
  }
684
  }
685
-
686
  function bsf_reset_options($option_to_reset)
687
  {
688
  require_once(dirname(__FILE__) .'/../settings.php');
689
-
690
  if($option_to_reset == 'review')
691
  add_review_option();
692
-
693
  if($option_to_reset == 'event')
694
  add_event_option();
695
-
696
  if($option_to_reset == 'person')
697
  add_person_option();
698
-
699
  if($option_to_reset == 'product')
700
  add_product_option();
701
-
702
  if($option_to_reset == 'recipe')
703
  add_recipe_option();
704
-
705
  if($option_to_reset == 'software')
706
  add_software_option();
707
-
708
  if($option_to_reset == 'video')
709
  add_video_option();
710
-
 
711
  if($option_to_reset == 'color')
712
  add_color_option();
713
 
714
  header("location:?page=rich_snippet_dashboard");
715
  }
716
-
717
  function add_footer_script()
718
  {?>
719
  <script type="text/javascript">
@@ -728,7 +728,6 @@ function add_footer_script()
728
  }
729
  );
730
  });
731
-
732
  jQuery("#submit_request_1").click(function()
733
  {
734
  var data = jQuery("#support_form_1").serialize();
@@ -775,7 +774,6 @@ function add_footer_script()
775
  });
776
  </script>
777
  <?php }
778
-
779
  function get_support($n)
780
  {
781
  $html = '
6
  add_action( 'admin_footer', 'add_footer_script' );
7
  }
8
  //enqueues the scripts and styles in admin dashboard
 
9
  function bsf_admin_styles() {
 
10
  // wp_enqueue_style( 'ui_style' );
 
11
  wp_enqueue_style( 'star_style' );
 
12
  wp_enqueue_style( 'meta_style' );
 
13
  wp_enqueue_script( 'bsf_jquery' );
 
14
  wp_enqueue_script( 'bsf_jquery_ui' );
 
15
  wp_enqueue_script( 'bsf_jquery_star' );
 
16
  /// wp_enqueue_script( 'postbox' );
 
17
  }
18
  function add_the_script() {
19
  wp_enqueue_script('postbox');
20
  wp_enqueue_style( 'admin_style' );
21
  }
22
  add_action('admin_print_scripts', 'add_the_script');
 
23
  //The Main Admin Dashboard for Rich Snippets Plugin
 
24
  function rich_snippet_dashboard() {
 
25
  $plugins_url = plugins_url();
 
26
  $args_review = get_option('bsf_review');
27
  $args_event = get_option('bsf_event');
28
  $args_person = get_option('bsf_person');
30
  $args_recipe = get_option('bsf_recipe');
31
  $args_soft = get_option('bsf_software');
32
  $args_video = get_option('bsf_video');
33
+ $args_article = get_option('bsf_article');
34
  $args_color = get_option('bsf_custom');
 
35
  echo '<div class="wrap">';
 
36
  echo '<div id="star-icons-32" class="icon32"></div><h2>'.__("All in One Schema.org Rich Snippets - Dashboard","rich-snippets").'</h2>';
 
37
  echo '<div class="clear"></div><div id="tab-container" class="tab-container">';
 
38
  echo '<ul class="etabs">
 
39
  <li class="tab"><a href="#tab-1">'.__("Configuration","rich-snippets").'</a></li>
 
40
  <li class="tab"><a href="#tab-4">'.__("Customization","rich-snippets").'</a></li>
 
41
  <li class="tab"><a href="#tab-2">'.__(" How to Use?","rich-snippets").'</a></li>
 
42
  <li class="tab"><a href="#tab-3">'.__("FAQs","rich-snippets").'</a></li>
43
 
44
  </ul>
 
45
  <div class="clear"></div>
46
  <div class="panel-container">
47
  <div id="tab-1">
82
  <td></td>
83
  <td><input type="submit" class="button-primary" name="item_submit" value="'.__("Update ").'"/>&nbsp;&nbsp;&nbsp;<a class="button-primary" href="?page=rich_snippet_dashboard&amp;action=reset&options=review">'.__('Reset ','rich-snippets').'</a></td>
84
  </tr>
 
85
  </tbody>
86
  </table>
87
  </form>
193
  <td align="right"><strong><label>'.__("Author Rating :","rich-snippets").'</label></strong></td>
194
  <td><input class="bsf_text_medium" type="text" name="product_rating" value="'.$args_product["product_rating"].'"/></td>
195
  </tr>
 
 
 
 
196
  <tr>
197
  <td align="right"><strong><label>'.__("Brand Name :","rich-snippets").'</label></strong></td>
198
  <td><input class="bsf_text_medium" type="text" name="product_brand" value="'.$args_product["product_brand"].'"/></td>
260
  <tr>
261
  <td align="right"><strong><label>'.__("Average Rating:","rich-snippets").'</label></strong></td>
262
  <td><input class="bsf_text_medium" type="text" name="recipe_rating" value="'.$args_recipe["recipe_rating"].'"/></td>
263
+ </tr>
264
  <tr><td colspan="2"></td></tr>
265
  <tr>
266
  <td></td>
316
  </div>
317
  </div>
318
  </div>
319
+
320
+
321
  <div class="postbox closed">
322
  <div class="handlediv" title="Click to toggle"><br></div>
323
  <h3 class="hndle"><span>'.__("Video","rich-snippets").'</span></h3>
358
  </div>
359
  </div>
360
  </div>
361
+ <div class="postbox closed">
362
+ <div class="handlediv" title="Click to toggle"><br></div>
363
+ <h3 class="hndle"><span>'.__("Article","rich-snippets").'</span></h3>
364
+ <div class="inside">
365
+ <div class="table">
366
+ <p>'.__("Strings to be displayed on frontend for <strong>Article Rich Snippets &mdash;</strong>","rich-snippets").'</p>
367
+ <form id="bsf_article_form" method="post">
368
+ <table class="bsf_metabox">
369
+ <tbody>
370
+ <tr>
371
+ <td align="right"><strong><label>'.__("Rich Snippet Title :","rich-snippets").'</label></strong></td>
372
+ <td><input class="bsf_text_medium" type="text" name="snippet_title" value="'.$args_article["snippet_title"].'"/></td>
373
+ </tr>
374
+ <tr>
375
+ <td align="right"><strong><label>'.__("Article Name :","rich-snippets").'</label></strong></td>
376
+ <td><input class="bsf_text_medium" type="text" name="article_name" value="'.$args_article["article_name"].'"/></td>
377
+ </tr>
378
+ <tr>
379
+ <td align="right"><strong><label>'.__("Author :","rich-snippets").'</label></strong></td>
380
+ <td><input class="bsf_text_medium" type="text" name="article_author" value="'.$args_article["article_author"].'"/></td>
381
+ </tr>
382
+ <tr>
383
+ <td align="right"><strong><label>'.__("Description :","rich-snippets").'</label></strong></td>
384
+ <td><input class="bsf_text_medium" type="text" name="article_desc" value="'.$args_article["article_desc"].'"/></td>
385
+ </tr>
386
+ <tr>
387
+ <td align="right"><strong><label>'.__("Image :","rich-snippets").'</label></strong></td>
388
+ <td><input class="bsf_text_medium" type="text" name="article_image" value="'.$args_article["article_image"].'"/></td>
389
+ </tr>
390
+ <tr><td colspan="2"></td></tr>
391
+ <tr>
392
+ <td></td>
393
+ <td><input type="submit" class="button-primary" name="article_submit" value="'.__("Update ").'"/>&nbsp;&nbsp;&nbsp;<a class="button-primary" href="?page=rich_snippet_dashboard&amp;action=reset&options=article">'.__('Reset ','rich-snippets').'</a></td>
394
+ </tr>
395
+ </tbody>
396
+ </table>
397
+ </form>
398
+ </div>
399
+ </div>
400
+ </div>
401
+ <!-- Post blox -->
402
 
403
  </div>
404
  </div>
450
  <p>'.__("We understand you don't like the content that gets displayed on your page / post. However as per the strong recommendation of Google, the MicroData should be clearly visible to the user.","rich-snippets").'</p>
451
  <p>'.__("Here is a reference link of what Google says. <a href='https://sites.google.com/site/webmasterhelpforum/en/faq-rich-snippets#display'> https://sites.google.com/site/webmasterhelpforum/en/faq-rich-snippets#display</a>","rich-snippets").'</p>
452
  <p> '.__("If you don't like the default design the content box created by plugin, you can always <a href='?page=rich_snippet_dashboard#tab-4'> customise it </a> or edit CSS located <a target='_blank' title='Click here to edit the css' href='plugin-editor.php?file=all-in-one-schemaorg-rich-snippets/css/style.css&plugin=all-in-one-schemaorg-rich-snippets/index.php'> here </a>or request professional service at $25", "rich-snippets").' </p>
 
453
  <li><strong>'.__(" How does this plugin work with other plugins like WordPress SEO, wooCommerce, etc?","rich-snippets").'</strong></li>
454
  <p>'.__('Well, the plugin works perfectly with most of the other plugins as the only thing "All in One Schema.org Rich Snippets" does is - it give you power to add Rich Snippets MicroData in your pages and posts easily. <br><br>If you find any it conflicting with any other plugin, please do not hesitate to report an issue.','rich-snippets').'</p>
 
455
  <li><strong>'.__("How much time does it take to show up rich snippets for my search results? My search results are still not coming up with rich snippets.","rich-snippets").'</strong></li>
456
  <p>'.__("Most probably rich snippets are displayed in for you search results as soon as search engines crawl the MicroData the plugin has created. However it's totally upto search engines to display rich snippets for your search result (which mostly depends on your website authority)","rich-snippets").'</p>
457
  <p>'.__("If rich snippets are not appearing in your search results yet, most probably they will start appearing soon as Google / other search engines finds your website more authoritative.","rich-snippets").'</p>
463
  <li> '.__('Code the new feature if you are a developer and submit your code. If we include this feature in our releases, credits will be given to you.', 'rich-snippets').' </li>
464
  <li> '.__(' Offer a sponsorship to get this feature done for all plugin users OR request a professional customisation service.', 'rich-snippets').' </li>
465
  </ol>
 
466
  <li><strong>'.__("Is Google Authorship part of your plugin as well?","rich-snippets").'</strong></li>
467
  <p>'.__("Unfortunately, not at the moment. Though this is definitely in our roadmap and the development will complete soon. Stay tuned!","rich-snippets").'</p>
 
468
  </ol>
469
  </div>
470
  </div>
490
  <table class="bsf_metabox">
491
  <tr>
492
  <th> <label for="snippet_box_bg"> '.__('Box Background ', 'rich-snippets').' </label> </th>
493
+ <td> <input type="text" name="snippet_box_bg" id="snippet_box_bg" value="'.$args_color["snippet_box_bg"].'" class="snippet_box_bg" /> </td>
494
  </tr>
495
  <tr>
496
  <th> <label for="snippet_title_bg"> '.__('Title Background', 'rich-snippets').' </label> </th>
497
+ <td> <input type="text" name="snippet_title_bg" id="snippet_title_bg" value="'.$args_color["snippet_title_bg"].'" class="snippet_title_bg" /> </td>
498
  </tr>
499
  <tr>
500
  <th> <label for="snippet_border"> '.__('Border Color', 'rich-snippets').' </label> </th>
501
+ <td> <input type="text" name="snippet_border" id="snippet_border" value="'.$args_color["snippet_border"].'" class="snippet_border" /> </td>
502
  </tr>
503
  <tr>
504
  <th> <label for="snippet_title_color"> '.__('Title Color', 'rich-snippets').' </label> </th>
505
+ <td> <input type="text" name="snippet_title_color" id="snippet_title_color" value="'.$args_color["snippet_title_color"].'" class="snippet_title_color" /> </td>
506
  </tr>
507
  <tr>
508
  <th> <label for="snippet_box_color"> '.__('Snippet Text Color', 'rich-snippets').' </label> </th>
509
+ <td> <input type="text" name="snippet_box_color" id="snippet_box_color" value="'.$args_color["snippet_box_color"].'" class="snippet_box_color" /> </td>
510
  </tr>
511
  <tr>
512
  <td></td>
529
 
530
  </div>
531
  </div> ';
 
532
  echo '
 
533
  <script src="'.plugins_url('/all-in-one-schemaorg-rich-snippets/admin/js/jquery.easytabs.min.js').'"></script>
534
  <script src="'.plugins_url('/all-in-one-schemaorg-rich-snippets/admin/js/jquery.hashchange.min.js').'"></script>
535
  <script language="javascript">
545
  jQuery("#postbox-container-9").css("width","35%");
546
  jQuery("#postbox-container-10").css("width","35%");
547
  jQuery("#postbox-container-11").css({"width":"63%","padding-right":"2%"});
 
548
  jQuery(".postbox h3").click( function() {
549
  jQuery(jQuery(this).parent().get(0)).toggleClass("closed");
550
  });
 
551
  jQuery(".handlediv").click( function() {
552
  jQuery(jQuery(this).parent().get(0)).toggleClass("closed");
553
  });
554
  </script>';
 
555
  }
556
  // Update options
557
  if(isset($_POST['item_submit']))
566
  $status = update_option('bsf_review',$args);
567
  displayStatus($status);
568
  }
 
569
  if(isset($_POST['event_submit']))
570
  {
571
  foreach(array('snippet_title','event_title','event_location','start_time','end_time') as $option)
578
  $status = update_option('bsf_event',$args);
579
  displayStatus($status);
580
  }
 
581
  if(isset($_POST['person_submit']))
582
  {
583
  foreach(array('snippet_title','person_name','person_nickname','person_job_title','person_website','person_company','person_address') as $option)
590
  $status = update_option('bsf_person',$args);
591
  displayStatus($status);
592
  }
 
593
  if(isset($_POST['product_submit']))
594
  {
595
  foreach(array('snippet_title','product_rating','product_brand','product_name','product_agr','product_price','product_avail') as $option)
602
  $status = update_option('bsf_product',$args);
603
  displayStatus($status);
604
  }
 
605
  if(isset($_POST['recipe_submit']))
606
  {
607
  foreach(array('snippet_title','recipe_name','recipe_pub','recipe_prep','recipe_cook','recipe_time','recipe_rating') as $option)
614
  $status = update_option('bsf_recipe',$args);
615
  displayStatus($status);
616
  }
 
617
  if(isset($_POST['software_submit']))
618
  {
619
  foreach(array('snippet_title','software_rating','software_price','software_name','software_os','software_website') as $option)
626
  $status = update_option('bsf_software',$args);
627
  displayStatus($status);
628
  }
 
629
  if(isset($_POST['video_submit']))
630
  {
631
  foreach(array('snippet_title','video_title','video_desc','video_time','video_date') as $option)
638
  $status = update_option('bsf_video',$args);
639
  displayStatus($status);
640
  }
641
+ if(isset($_POST['article_submit']))
642
+ {
643
+ foreach(array('snippet_title','article_name','article_author','article_desc','article_image') as $option)
644
+ {
645
+ if(isset($_POST[$option]))
646
+ {
647
+ $args[$option] = $_POST[$option];
648
+ }
649
+ }
650
+ $status = update_option('bsf_article',$args);
651
+ displayStatus($status);
652
+ }
653
  function displayStatus($status) {
 
654
  if($status)
655
  {
656
  echo '<div class="updated"><p>' . __('Success! Your changes were successfully saved!', 'rich-snippets') . '</p></div>';
660
  echo '<div class="error"><p>' . __('Sorry, Your changes are not saved!', 'rich-snippets') . '</p></div>';
661
  }
662
  }
 
663
  if(isset($_GET['action']))
664
  {
665
  if($_GET['action'] == 'reset')
666
  {
667
  $option_to_reset = $_GET['options'];
 
668
  if($option_to_reset == 'review')
669
  delete_option('bsf_review');
 
670
  if($option_to_reset == 'event')
671
  delete_option('bsf_event');
 
672
  if($option_to_reset == 'person')
673
  delete_option('bsf_person');
674
 
675
  if($option_to_reset == 'product')
676
  delete_option('bsf_product');
 
677
  if($option_to_reset == 'recipe')
678
  delete_option('bsf_recipe');
 
679
  if($option_to_reset == 'software')
680
  delete_option('bsf_software');
 
681
  if($option_to_reset == 'video')
682
  delete_option('bsf_video');
683
+
684
+ if($option_to_reset == 'article')
685
+ delete_option('bsf_article');
686
+
687
  if($option_to_reset == 'color')
688
  delete_option('bsf_custom');
689
 
690
  bsf_reset_options($option_to_reset);
691
  }
692
  }
 
693
  function bsf_reset_options($option_to_reset)
694
  {
695
  require_once(dirname(__FILE__) .'/../settings.php');
 
696
  if($option_to_reset == 'review')
697
  add_review_option();
 
698
  if($option_to_reset == 'event')
699
  add_event_option();
 
700
  if($option_to_reset == 'person')
701
  add_person_option();
 
702
  if($option_to_reset == 'product')
703
  add_product_option();
 
704
  if($option_to_reset == 'recipe')
705
  add_recipe_option();
 
706
  if($option_to_reset == 'software')
707
  add_software_option();
 
708
  if($option_to_reset == 'video')
709
  add_video_option();
710
+ if($option_to_reset == 'article')
711
+ add_article_option();
712
  if($option_to_reset == 'color')
713
  add_color_option();
714
 
715
  header("location:?page=rich_snippet_dashboard");
716
  }
 
717
  function add_footer_script()
718
  {?>
719
  <script type="text/javascript">
728
  }
729
  );
730
  });
 
731
  jQuery("#submit_request_1").click(function()
732
  {
733
  var data = jQuery("#support_form_1").serialize();
774
  });
775
  </script>
776
  <?php }
 
777
  function get_support($n)
778
  {
779
  $html = '
admin/js/jquery.easytabs.min.js CHANGED
@@ -1,12 +1,14 @@
1
- /*
2
- * jQuery EasyTabs plugin 3.1.1
3
- *
4
- * Copyright (c) 2010-2011 Steve Schwartz (JangoSteve)
5
- *
6
- * Dual licensed under the MIT and GPL licenses:
7
- * http://www.opensource.org/licenses/mit-license.php
8
- * http://www.gnu.org/licenses/gpl.html
9
- *
10
- * Date: Tue Jan 26 16:30:00 2012 -0500
11
- */
12
- (function(a){a.easytabs=function(j,e){var f=this,q=a(j),i={animate:true,panelActiveClass:"active",tabActiveClass:"active",defaultTab:"li:first-child",animationSpeed:"normal",tabs:"> ul > li",updateHash:true,cycle:false,collapsible:false,collapsedClass:"collapsed",collapsedByDefault:true,uiTabs:false,transitionIn:"fadeIn",transitionOut:"fadeOut",transitionInEasing:"swing",transitionOutEasing:"swing",transitionCollapse:"slideUp",transitionUncollapse:"slideDown",transitionCollapseEasing:"swing",transitionUncollapseEasing:"swing",containerClass:"",tabsClass:"",tabClass:"",panelClass:"",cache:true,panelContext:q},h,l,v,m,d,t={fast:200,normal:400,slow:600},r;f.init=function(){f.settings=r=a.extend({},i,e);if(r.uiTabs){r.tabActiveClass="ui-tabs-selected";r.containerClass="ui-tabs ui-widget ui-widget-content ui-corner-all";r.tabsClass="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all";r.tabClass="ui-state-default ui-corner-top";r.panelClass="ui-tabs-panel ui-widget-content ui-corner-bottom"}if(r.collapsible&&e.defaultTab!==undefined&&e.collpasedByDefault===undefined){r.collapsedByDefault=false}if(typeof(r.animationSpeed)==="string"){r.animationSpeed=t[r.animationSpeed]}a("a.anchor").remove().prependTo("body");q.data("easytabs",{});f.setTransitions();f.getTabs();b();g();w();n();c();q.attr("data-easytabs",true)};f.setTransitions=function(){v=(r.animate)?{show:r.transitionIn,hide:r.transitionOut,speed:r.animationSpeed,collapse:r.transitionCollapse,uncollapse:r.transitionUncollapse,halfSpeed:r.animationSpeed/2}:{show:"show",hide:"hide",speed:0,collapse:"hide",uncollapse:"show",halfSpeed:0}};f.getTabs=function(){var x;f.tabs=q.find(r.tabs),f.panels=a(),f.tabs.each(function(){var A=a(this),z=A.children("a"),y=A.children("a").data("target");A.data("easytabs",{});if(y!==undefined&&y!==null){A.data("easytabs").ajax=z.attr("href")}else{y=z.attr("href")}y=y.match(/#([^\?]+)/)[0].substr(1);x=r.panelContext.find("#"+y);if(x.length){x.data("easytabs",{position:x.css("position"),visibility:x.css("visibility")});x.not(r.panelActiveClass).hide();f.panels=f.panels.add(x);A.data("easytabs").panel=x}else{f.tabs=f.tabs.not(A)}})};f.selectTab=function(x,C){var y=window.location,B=y.hash.match(/^[^\?]*/)[0],z=x.parent().data("easytabs").panel,A=x.parent().data("easytabs").ajax;if(r.collapsible&&!d&&(x.hasClass(r.tabActiveClass)||x.hasClass(r.collapsedClass))){f.toggleTabCollapse(x,z,A,C)}else{if(!x.hasClass(r.tabActiveClass)||!z.hasClass(r.panelActiveClass)){o(x,z,A,C)}else{if(!r.cache){o(x,z,A,C)}}}};f.toggleTabCollapse=function(x,y,z,A){f.panels.stop(true,true);if(u(q,"easytabs:before",[x,y,r])){f.tabs.filter("."+r.tabActiveClass).removeClass(r.tabActiveClass).children().removeClass(r.tabActiveClass);if(x.hasClass(r.collapsedClass)){if(z&&(!r.cache||!x.parent().data("easytabs").cached)){q.trigger("easytabs:ajax:beforeSend",[x,y]);y.load(z,function(C,B,D){x.parent().data("easytabs").cached=true;q.trigger("easytabs:ajax:complete",[x,y,C,B,D])})}x.parent().removeClass(r.collapsedClass).addClass(r.tabActiveClass).children().removeClass(r.collapsedClass).addClass(r.tabActiveClass);y.addClass(r.panelActiveClass)[v.uncollapse](v.speed,r.transitionUncollapseEasing,function(){q.trigger("easytabs:midTransition",[x,y,r]);if(typeof A=="function"){A()}})}else{x.addClass(r.collapsedClass).parent().addClass(r.collapsedClass);y.removeClass(r.panelActiveClass)[v.collapse](v.speed,r.transitionCollapseEasing,function(){q.trigger("easytabs:midTransition",[x,y,r]);if(typeof A=="function"){A()}})}}};f.matchTab=function(x){return f.tabs.find("[href='"+x+"'],[data-target='"+x+"']").first()};f.matchInPanel=function(x){return(x?f.panels.filter(":has("+x+")").first():[])};f.selectTabFromHashChange=function(){var y=window.location.hash.match(/^[^\?]*/)[0],x=f.matchTab(y),z;if(r.updateHash){if(x.length){d=true;f.selectTab(x)}else{z=f.matchInPanel(y);if(z.length){y="#"+z.attr("id");x=f.matchTab(y);d=true;f.selectTab(x)}else{if(!h.hasClass(r.tabActiveClass)&&!r.cycle){if(y===""||f.matchTab(m).length||q.closest(y).length){d=true;f.selectTab(l)}}}}}};f.cycleTabs=function(x){if(r.cycle){x=x%f.tabs.length;$tab=a(f.tabs[x]).children("a").first();d=true;f.selectTab($tab,function(){setTimeout(function(){f.cycleTabs(x+1)},r.cycle)})}};f.publicMethods={select:function(x){var y;if((y=f.tabs.filter(x)).length===0){if((y=f.tabs.find("a[href='"+x+"']")).length===0){if((y=f.tabs.find("a"+x)).length===0){if((y=f.tabs.find("[data-target='"+x+"']")).length===0){if((y=f.tabs.find("a[href$='"+x+"']")).length===0){a.error("Tab '"+x+"' does not exist in tab set")}}}}}else{y=y.children("a").first()}f.selectTab(y)}};var u=function(A,x,z){var y=a.Event(x);A.trigger(y,z);return y.result!==false};var b=function(){q.addClass(r.containerClass);f.tabs.parent().addClass(r.tabsClass);f.tabs.addClass(r.tabClass);f.panels.addClass(r.panelClass)};var g=function(){var y=window.location.hash.match(/^[^\?]*/)[0],x=f.matchTab(y).parent(),z;if(x.length===1){h=x;r.cycle=false}else{z=f.matchInPanel(y);if(z.length){y="#"+z.attr("id");h=f.matchTab(y).parent()}else{h=f.tabs.parent().find(r.defaultTab);if(h.length===0){a.error("The specified default tab ('"+r.defaultTab+"') could not be found in the tab set.")}}}l=h.children("a").first();p(x)};var p=function(z){var y,x;if(r.collapsible&&z.length===0&&r.collapsedByDefault){h.addClass(r.collapsedClass).children().addClass(r.collapsedClass)}else{y=a(h.data("easytabs").panel);x=h.data("easytabs").ajax;if(x&&(!r.cache||!h.data("easytabs").cached)){q.trigger("easytabs:ajax:beforeSend",[l,y]);y.load(x,function(B,A,C){h.data("easytabs").cached=true;q.trigger("easytabs:ajax:complete",[l,y,B,A,C])})}h.data("easytabs").panel.show().addClass(r.panelActiveClass);h.addClass(r.tabActiveClass).children().addClass(r.tabActiveClass)}};var w=function(){f.tabs.children("a").bind("click.easytabs",function(x){r.cycle=false;d=false;f.selectTab(a(this));x.preventDefault()})};var o=function(z,D,E,H){f.panels.stop(true,true);if(u(q,"easytabs:before",[z,D,r])){var A=f.panels.filter(":visible"),y=D.parent(),F,x,C,G,B=window.location.hash.match(/^[^\?]*/)[0];if(r.animate){F=s(D);x=A.length?k(A):0;C=F-x}m=B;G=function(){q.trigger("easytabs:midTransition",[z,D,r]);if(r.animate&&r.transitionIn=="fadeIn"){if(C<0){y.animate({height:y.height()+C},v.halfSpeed).css({"min-height":""})}}if(r.updateHash&&!d){window.location.hash="#"+D.attr("id")}else{d=false}D[v.show](v.speed,r.transitionInEasing,function(){y.css({height:"","min-height":""});q.trigger("easytabs:after",[z,D,r]);if(typeof H=="function"){H()}})};if(E&&(!r.cache||!z.parent().data("easytabs").cached)){q.trigger("easytabs:ajax:beforeSend",[z,D]);D.load(E,function(J,I,K){z.parent().data("easytabs").cached=true;q.trigger("easytabs:ajax:complete",[z,D,J,I,K])})}if(r.animate&&r.transitionOut=="fadeOut"){if(C>0){y.animate({height:(y.height()+C)},v.halfSpeed)}else{y.css({"min-height":y.height()})}}f.tabs.filter("."+r.tabActiveClass).removeClass(r.tabActiveClass).children().removeClass(r.tabActiveClass);f.tabs.filter("."+r.collapsedClass).removeClass(r.collapsedClass).children().removeClass(r.collapsedClass);z.parent().addClass(r.tabActiveClass).children().addClass(r.tabActiveClass);f.panels.filter("."+r.panelActiveClass).removeClass(r.panelActiveClass);D.addClass(r.panelActiveClass);if(A.length){A[v.hide](v.speed,r.transitionOutEasing,G)}else{D[v.uncollapse](v.speed,r.transitionUncollapseEasing,G)}}};var s=function(y){if(y.data("easytabs")&&y.data("easytabs").lastHeight){return y.data("easytabs").lastHeight}var z=y.css("display"),x=y.wrap(a("<div>",{position:"absolute",visibility:"hidden",overflow:"hidden"})).css({position:"relative",visibility:"hidden",display:"block"}).outerHeight();y.unwrap();y.css({position:y.data("easytabs").position,visibility:y.data("easytabs").visibility,display:z});y.data("easytabs").lastHeight=x;return x};var k=function(y){var x=y.outerHeight();if(y.data("easytabs")){y.data("easytabs").lastHeight=x}else{y.data("easytabs",{lastHeight:x})}return x};var n=function(){if(typeof a(window).hashchange==="function"){a(window).hashchange(function(){f.selectTabFromHashChange()})}else{if(a.address&&typeof a.address.change==="function"){a.address.change(function(){f.selectTabFromHashChange()})}}};var c=function(){var x;if(r.cycle){x=f.tabs.index(h);setTimeout(function(){f.cycleTabs(x+1)},r.cycle)}};f.init()};a.fn.easytabs=function(c){var b=arguments;return this.each(function(){var e=a(this),d=e.data("easytabs");if(undefined===d){d=new a.easytabs(this,c);e.data("easytabs",d)}if(d.publicMethods[c]){return d.publicMethods[c](Array.prototype.slice.call(b,1))}})}})(jQuery);
 
 
1
+ /*
2
+ * jQuery EasyTabs plugin 3.1.1
3
+ *
4
+ * Copyright (c) 2010-2011 Steve Schwartz (JangoSteve)
5
+ *
6
+ * Dual licensed under the MIT and GPL licenses:
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ * http://www.gnu.org/licenses/gpl.html
9
+ *
10
+ * Date: Tue Jan 26 16:30:00 2012 -0500
11
+ */
12
+ (function(a){a.easytabs=function(j,e){var f=this,q=a(j),i={animate:true,panelActiveClass:"active",tabActiveClass:"active",defaultTab:"li:first-child",animationSpeed:"normal",tabs:"> ul > li",updateHash:true,cycle:false,collapsible:false,collapsedClass:"collapsed",collapsedByDefault:true,uiTabs:false,transitionIn:"fadeIn",transitionOut:"fadeOut",transitionInEasing:"swing",transitionOutEasing:"swing",transitionCollapse:"slideUp",transitionUncollapse:"slideDown",transitionCollapseEasing:"swing",transitionUncollapseEasing:"swing",containerClass:"",tabsClass:"",tabClass:"",panelClass:"",cache:true,panelContext:q},h,l,v,m,d,t={fast:200,normal:400,slow:600},r;f.init=function(){f.settings=r=a.extend({},i,e);if(r.uiTabs){r.tabActiveClass="ui-tabs-selected";r.containerClass="ui-tabs ui-widget ui-widget-content ui-corner-all";r.tabsClass="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all";r.tabClass="ui-state-default ui-corner-top";r.panelClass="ui-tabs-panel ui-widget-content ui-corner-bottom"}if(r.collapsible&&e.defaultTab!==undefined&&e.collpasedByDefault===undefined){r.collapsedByDefault=false}if(typeof(r.animationSpeed)==="string"){r.animationSpeed=t[r.animationSpeed]}a("a.anchor").remove().prependTo("body");q.data("easytabs",{});f.setTransitions();f.getTabs();b();g();w();n();c();q.attr("data-easytabs",true)};f.setTransitions=function(){v=(r.animate)?{show:r.transitionIn,hide:r.transitionOut,speed:r.animationSpeed,collapse:r.transitionCollapse,uncollapse:r.transitionUncollapse,halfSpeed:r.animationSpeed/2}:{show:"show",hide:"hide",speed:0,collapse:"hide",uncollapse:"show",halfSpeed:0}};f.getTabs=function(){var x;f.tabs=q.find(r.tabs),f.panels=a(),f.tabs.each(function(){var A=a(this),z=A.children("a"),y=A.children("a").data("target");A.data("easytabs",{});if(y!==undefined&&y!==null){A.data("easytabs").ajax=z.attr("href")}else{y=z.attr("href")}y=y.match(/#([^\?]+)/)[0].substr(1);x=r.panelContext.find("#"+y);if(x.length){x.data("easytabs",{position:x.css("position"),visibility:x.css("visibility")});x.not(r.panelActiveClass).hide();f.panels=f.panels.add(x);A.data("easytabs").panel=x}else{f.tabs=f.tabs.not(A)}})};f.selectTab=function(x,C){var y=window.location,B=y.hash.match(/^[^\?]*/)[0],z=x.parent().data("easytabs").panel,A=x.parent().data("easytabs").ajax;if(r.collapsible&&!d&&(x.hasClass(r.tabActiveClass)||x.hasClass(r.collapsedClass))){f.toggleTabCollapse(x,z,A,C)}else{if(!x.hasClass(r.tabActiveClass)||!z.hasClass(r.panelActiveClass)){o(x,z,A,C)}else{if(!r.cache){o(x,z,A,C)}}}};f.toggleTabCollapse=function(x,y,z,A){f.panels.stop(true,true);if(u(q,"easytabs:before",[x,y,r])){f.tabs.filter("."+r.tabActiveClass).removeClass(r.tabActiveClass).children().removeClass(r.tabActiveClass);if(x.hasClass(r.collapsedClass)){if(z&&(!r.cache||!x.parent().data("easytabs").cached)){q.trigger("easytabs:ajax:beforeSend",[x,y]);y.load(z,function(C,B,D){x.parent().data("easytabs").cached=true;q.trigger("easytabs:ajax:complete",[x,y,C,B,D])})}x.parent().removeClass(r.collapsedClass).addClass(r.tabActiveClass).children().removeClass(r.collapsedClass).addClass(r.tabActiveClass);y.addClass(r.panelActiveClass)[v.uncollapse](v.speed,r.transitionUncollapseEasing,function(){q.trigger("easytabs:midTransition",[x,y,r]);if(typeof A=="function"){A()}})}else{x.addClass(r.collapsedClass).parent().addClass(r.collapsedClass);y.removeClass(r.panelActiveClass)[v.collapse](v.speed,r.transitionCollapseEasing,function(){q.trigger("easytabs:midTransition",[x,y,r]);if(typeof A=="function"){A()}})}}};f.matchTab=function(x){return f.tabs.find("[href='"+x+"'],[data-target='"+x+"']").first()};f.matchInPanel=function(x){return(x?f.panels.filter(":has("+x+")").first():[])};f.selectTabFromHashChange=function(){var y=window.location.hash.match(/^[^\?]*/)[0],x=f.matchTab(y),z;if(r.updateHash){if(x.length){d=true;f.selectTab(x)}else{z=f.matchInPanel(y);if(z.length){y="#"+z.attr("id");x=f.matchTab(y);d=true;f.selectTab(x)}else{if(!h.hasClass(r.tabActiveClass)&&!r.cycle){if(y===""||f.matchTab(m).length||q.closest(y).length){d=true;f.selectTab(l)}}}}}};f.cycleTabs=function(x){if(r.cycle){x=x%f.tabs.length;$tab=a(f.tabs[x]).children("a").first();d=true;f.selectTab($tab,function(){setTimeout(function(){f.cycleTabs(x+1)},r.cycle)})}};f.publicMethods={select:function(x){var y;if((y=f.tabs.filter(x)).length===0){if((y=f.tabs.find("a[href='"+x+"']")).length===0){if((y=f.tabs.find("a"+x)).length===0){if((y=f.tabs.find("[data-target='"+x+"']")).length===0){if((y=f.tabs.find("a[href$='"+x+"']")).length===0){a.error("Tab '"+x+"' does not exist in tab set")}}}}}else{y=y.children("a").first()}f.selectTab(y)}};var u=function(A,x,z){var y=a.Event(x);A.trigger(y,z);return y.result!==false};var b=function(){q.addClass(r.containerClass);f.tabs.parent().addClass(r.tabsClass);f.tabs.addClass(r.tabClass);f.panels.addClass(r.panelClass)};var g=function(){var y=window.location.hash.match(/^[^\?]*/)[0],x=f.matchTab(y).parent(),z;if(x.length===1){h=x;r.cycle=false}else{z=f.matchInPanel(y);if(z.length){y="#"+z.attr("id");h=f.matchTab(y).parent()}else{h=f.tabs.parent().find(r.defaultTab);if(h.length===0){a.error("The specified default tab ('"+r.defaultTab+"') could not be found in the tab set.")}}}l=h.children("a").first();p(x)};var p=function(z){var y,x;if(r.collapsible&&z.length===0&&r.collapsedByDefault){h.addClass(r.collapsedClass).children().addClass(r.collapsedClass)}else{y=a(h.data("easytabs").panel);x=h.data("easytabs").ajax;if(x&&(!r.cache||!h.data("easytabs").cached)){q.trigger("easytabs:ajax:beforeSend",[l,y]);y.load(x,function(B,A,C){h.data("easytabs").cached=true;q.trigger("easytabs:ajax:complete",[l,y,B,A,C])})}h.data("easytabs").panel.show().addClass(r.panelActiveClass);h.addClass(r.tabActiveClass).children().addClass(r.tabActiveClass)}};var w=function(){f.tabs.children("a").bind("click.easytabs",function(x){r.cycle=false;d=false;f.selectTab(a(this));x.preventDefault()})};var o=function(z,D,E,H){f.panels.stop(true,true);if(u(q,"easytabs:before",[z,D,r])){var A=f.panels.filter(":visible"),y=D.parent(),F,x,C,G,B=window.location.hash.match(/^[^\?]*/)[0];if(r.animate){F=s(D);x=A.length?k(A):0;C=F-x}m=B;G=function(){q.trigger("easytabs:midTransition",[z,D,r]);if(r.animate&&r.transitionIn=="fadeIn"){if(C<0){y.animate({height:y.height()+C},v.halfSpeed).css({"min-height":""})}}if(r.updateHash&&!d){window.location.hash="#"+D.attr("id")}else{d=false}D[v.show](v.speed,r.transitionInEasing,function(){y.css({height:"","min-height":""});q.trigger("easytabs:after",[z,D,r]);if(typeof H=="function"){H()}})};if(E&&(!r.cache||!z.parent().data("easytabs").cached)){q.trigger("easytabs:ajax:beforeSend",[z,D]);D.load(E,function(J,I,K){z.parent().data("easytabs").cached=true;q.trigger("easytabs:ajax:complete",[z,D,J,I,K])})}if(r.animate&&r.transitionOut=="fadeOut"){if(C>0){y.animate({height:(y.height()+C)},v.halfSpeed)}else{y.css({"min-height":y.height()})}}f.tabs.filter("."+r.tabActiveClass).removeClass(r.tabActiveClass).children().removeClass(r.tabActiveClass);f.tabs.filter("."+r.collapsedClass).removeClass(r.collapsedClass).children().removeClass(r.collapsedClass);z.parent().addClass(r.tabActiveClass).children().addClass(r.tabActiveClass);f.panels.filter("."+r.panelActiveClass).removeClass(r.panelActiveClass);D.addClass(r.panelActiveClass);if(A.length){A[v.hide](v.speed,r.transitionOutEasing,G)}else{D[v.uncollapse](v.speed,r.transitionUncollapseEasing,G)}}};var s=function(y){if(y.data("easytabs")&&y.data("easytabs").lastHeight){return y.data("easytabs").lastHeight}var z=y.css("display"),x=y.wrap(a("<div>",{position:"absolute",visibility:"hidden",overflow:"hidden"})).css({position:"relative",visibility:"hidden",display:"block"}).outerHeight();y.unwrap();y.css({position:y.data("easytabs").position,visibility:y.data("easytabs").visibility,display:z});y.data("easytabs").lastHeight=x;return x};var k=function(y){var x=y.outerHeight();if(y.data("easytabs")){y.data("easytabs").lastHeight=x}else{y.data("easytabs",{lastHeight:x})}return x};var n=function(){if(typeof a(window).hashchange==="function"){a(window).hashchange(function(){f.selectTabFromHashChange()})}else{if(a.address&&typeof a.address.change==="function"){a.address.change(function(){f.selectTabFromHashChange()})}}};var c=function(){var x;if(r.cycle){x=f.tabs.index(h);setTimeout(function(){f.cycleTabs(x+1)},r.cycle)}};f.init()};a.fn.easytabs=function(c){var b=arguments;return this.each(function(){var e=a(this),d=e.data("easytabs");if(undefined===d){d=new a.easytabs(this,c);e.data("easytabs",d)}if(d.publicMethods[c]){return d.publicMethods[c](Array.prototype.slice.call(b,1))}})}})(jQuery);
13
+
14
+
admin/js/jquery.hashchange.min.js CHANGED
@@ -1,9 +1,11 @@
1
- /*
2
- * jQuery hashchange event - v1.3 - 7/21/2010
3
- * http://benalman.com/projects/jquery-hashchange-plugin/
4
- *
5
- * Copyright (c) 2010 "Cowboy" Ben Alman
6
- * Dual licensed under the MIT and GPL licenses.
7
- * http://benalman.com/about/license/
8
- */
 
 
9
  (function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){r||l(a());n()}).attr("src",r||"javascript:0").insertAfter("body")[0].contentWindow;h.onpropertychange=function(){try{if(event.propertyName==="title"){q.document.title=h.title}}catch(s){}}}};j.stop=k;o=function(){return a(q.location.href)};l=function(v,s){var u=q.document,t=$.fn[c].domain;if(v!==s){u.title=h.title;u.open();t&&u.write('<script>document.domain="'+t+'"<\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this);
1
+ /*
2
+ * jQuery hashchange event - v1.3 - 7/21/2010
3
+ * http://benalman.com/projects/jquery-hashchange-plugin/
4
+ *
5
+ * Copyright (c) 2010 "Cowboy" Ben Alman
6
+ * Dual licensed under the MIT and GPL licenses.
7
+ * http://benalman.com/about/license/
8
+ */
9
+
10
+
11
  (function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){r||l(a());n()}).attr("src",r||"javascript:0").insertAfter("body")[0].contentWindow;h.onpropertychange=function(){try{if(event.propertyName==="title"){q.document.title=h.title}}catch(s){}}}};j.stop=k;o=function(){return a(q.location.href)};l=function(v,s){var u=q.document,t=$.fn[c].domain;if(v!==s){u.title=h.title;u.open();t&&u.write('<script>document.domain="'+t+'"<\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this);
css/jquery.rating.css CHANGED
@@ -1,37 +1,18 @@
1
  /* jQuery.Rating Plugin CSS - http://www.fyneworks.com/jquery/star-rating/ */
2
-
3
  div.rating-cancel,div.star-rating{float:left;width:17px;height:17px;text-indent:-999em;cursor:pointer;display:block;background:transparent;overflow:hidden}
4
-
5
  div.rating-cancel,div.rating-cancel a{background:url(delete.gif) no-repeat 0 -16px}
6
-
7
  div.star-rating,div.star-rating a{background:url(star.png) no-repeat 0 0px}
8
-
9
  div.rating-cancel a,div.star-rating a{display:block;width:16px;height:100%;background-position:0 -38px;border:0}
10
-
11
  div.star-rating-on a{background-position:0 0px!important}
12
-
13
  div.star-rating-hover a{background-position:0 -18px}
14
-
15
  div.rating-cancel a:hover{background-position:0 -16px}
16
  /* Read Only CSS */
17
-
18
  div.star-rating-readonly a{cursor:default !important}
19
-
20
  /* Partial Star CSS */
21
-
22
  div.star-rating{background:transparent!important;overflow:hidden!important}
23
-
24
  /* END jQuery.Rating Plugin CSS */
25
-
26
-
27
-
28
  #tabs {
29
-
30
  width:60%;
31
-
32
  float:left;
33
-
34
  margin-right:10px;
35
-
36
  }
37
-
1
  /* jQuery.Rating Plugin CSS - http://www.fyneworks.com/jquery/star-rating/ */
 
2
  div.rating-cancel,div.star-rating{float:left;width:17px;height:17px;text-indent:-999em;cursor:pointer;display:block;background:transparent;overflow:hidden}
 
3
  div.rating-cancel,div.rating-cancel a{background:url(delete.gif) no-repeat 0 -16px}
 
4
  div.star-rating,div.star-rating a{background:url(star.png) no-repeat 0 0px}
 
5
  div.rating-cancel a,div.star-rating a{display:block;width:16px;height:100%;background-position:0 -38px;border:0}
 
6
  div.star-rating-on a{background-position:0 0px!important}
 
7
  div.star-rating-hover a{background-position:0 -18px}
 
8
  div.rating-cancel a:hover{background-position:0 -16px}
9
  /* Read Only CSS */
 
10
  div.star-rating-readonly a{cursor:default !important}
 
11
  /* Partial Star CSS */
 
12
  div.star-rating{background:transparent!important;overflow:hidden!important}
 
13
  /* END jQuery.Rating Plugin CSS */
 
 
 
14
  #tabs {
 
15
  width:60%;
 
16
  float:left;
 
17
  margin-right:10px;
 
18
  }
 
css/rating.css CHANGED
@@ -1,27 +1,14 @@
1
  /* jQuery.Rating Plugin CSS - http://www.fyneworks.com/jquery/star-rating/ */
2
-
3
  div.rating-cancel,div.star-rating{float:left;width:17px;height:15px;text-indent:-999em;cursor:pointer;display:block;background:transparent;overflow:hidden}
4
-
5
  div.rating-cancel,div.rating-cancel a{background:url(delete.gif) no-repeat 0 -16px}
6
-
7
  div.star-rating,div.star-rating a{background:url(star.png) no-repeat 0 0px}
8
-
9
  div.rating-cancel a,div.star-rating a{display:block;width:16px;height:100%;background-position:0 0px;border:0}
10
-
11
  div.star-rating-on a{background-position:0 -16px!important}
12
-
13
  div.star-rating-hover a{background-position:0 -32px}
14
-
15
  /* Read Only CSS */
16
-
17
  div.star-rating-readonly a{cursor:default !important}
18
-
19
  /* Partial Star CSS */
20
-
21
  div.star-rating{background:transparent!important;overflow:hidden!important}
22
-
23
  div.star-block{float: left; width: 100%; margin-bottom: 15px}
24
-
25
  p#star-block{float: left; width: 100%; margin-bottom: 10px}
26
-
27
  /* END jQuery.Rating Plugin CSS */
1
  /* jQuery.Rating Plugin CSS - http://www.fyneworks.com/jquery/star-rating/ */
 
2
  div.rating-cancel,div.star-rating{float:left;width:17px;height:15px;text-indent:-999em;cursor:pointer;display:block;background:transparent;overflow:hidden}
 
3
  div.rating-cancel,div.rating-cancel a{background:url(delete.gif) no-repeat 0 -16px}
 
4
  div.star-rating,div.star-rating a{background:url(star.png) no-repeat 0 0px}
 
5
  div.rating-cancel a,div.star-rating a{display:block;width:16px;height:100%;background-position:0 0px;border:0}
 
6
  div.star-rating-on a{background-position:0 -16px!important}
 
7
  div.star-rating-hover a{background-position:0 -32px}
 
8
  /* Read Only CSS */
 
9
  div.star-rating-readonly a{cursor:default !important}
 
10
  /* Partial Star CSS */
 
11
  div.star-rating{background:transparent!important;overflow:hidden!important}
 
12
  div.star-block{float: left; width: 100%; margin-bottom: 15px}
 
13
  p#star-block{float: left; width: 100%; margin-bottom: 10px}
 
14
  /* END jQuery.Rating Plugin CSS */
css/star@2x.png DELETED
Binary file
css/style.css CHANGED
@@ -127,7 +127,9 @@ display: block;
127
  }
128
  .star-img img {
129
  box-shadow: none;
130
- margin: -2px 1px;
 
 
131
  }
132
  .snippet-label-img {
133
  width: 37%;
@@ -171,20 +173,16 @@ display: block;
171
  clear: both;
172
  }
173
  }
174
-
175
  @media (max-width: 650px)
176
  {
177
 
178
  }
179
  @media (max-width: 480px)
180
  {
181
-
182
  }
183
  @media (max-width: 450px)
184
  {
185
-
186
  }
187
  @media (max-width: 320px)
188
  {
189
-
190
  }
127
  }
128
  .star-img img {
129
  box-shadow: none;
130
+ margin: -2px 2px;
131
+ border: none !important;
132
+ padding: 0 !important;
133
  }
134
  .snippet-label-img {
135
  width: 37%;
173
  clear: both;
174
  }
175
  }
 
176
  @media (max-width: 650px)
177
  {
178
 
179
  }
180
  @media (max-width: 480px)
181
  {
 
182
  }
183
  @media (max-width: 450px)
184
  {
 
185
  }
186
  @media (max-width: 320px)
187
  {
 
188
  }
functions.php CHANGED
@@ -4,97 +4,66 @@
4
  *
5
  */
6
  //add_filter( 'bsf_meta_boxes', 'bsf_review_metaboxes' );
7
-
8
  /**
9
  * Define the metabox and field configurations.
10
  *
11
  * @param array $meta_boxes
12
  * @return array
13
  */
14
-
15
  add_action( 'init', 'bsf_initialize_bsf_meta_boxes', 9999 );
16
-
17
  // Register an action for submitting rating
18
-
19
  add_action( 'wp_ajax_nopriv_bsf_submit_rating', 'bsf_add_rating' );
20
  add_action( 'wp_ajax_bsf_submit_rating', 'bsf_add_rating' );
21
-
22
  // Register an action for updating rating
23
-
24
  add_action( 'wp_ajax_nopriv_bsf_update_rating', 'bsf_update_rating' );
25
  add_action( 'wp_ajax_bsf_update_rating', 'bsf_update_rating' );
26
-
27
  // Include the Ajax library on the front end
28
  add_action( 'wp_head', 'add_ajax_library' );
29
-
30
  /**
31
  * Initialize the metabox class.
32
  */
33
-
34
  function bsf_initialize_bsf_meta_boxes() {
35
  if ( ! class_exists( 'bsf_Meta_Box' ) )
36
  require_once 'init.php';
37
  }
38
-
39
  //Function to display the rich snippet output below the content
40
  function display_rich_snippet($content) {
41
-
42
  global $post;
43
 
44
  $args_color = get_option('bsf_custom');
45
-
46
  $id = $post->ID;
47
-
48
  $type = get_post_meta($id, '_bsf_post_type', true);
49
-
50
  if($type == '1')
51
-
52
  {
53
-
54
  global $post;
55
 
56
  $args_review = get_option('bsf_review');
57
-
58
- // echo $post->ID;
59
-
60
  $review = $content;
61
-
62
  $review .= '<div id="snippet-box" style="background:'.$args_color["snippet_box_bg"].'; color:'.$args_color["snippet_box_color"].'; border:1px solid '.$args_color["snippet_border"].';">';
63
 
64
  if($args_review['review_title'] != "")
65
  $review .= '<div class="snippet-title" style="background:'.$args_color["snippet_title_bg"].'; color:'.$args_color["snippet_title_color"].'; border-bottom:1px solid '.$args_color["snippet_border"].';">'.$args_review['review_title'].'</div>';
66
-
67
  $review .= '<div class="snippet-markup" itemscope itemtype="http://data-vocabulary.org/Review">';
68
-
69
  $item = get_post_meta( $post->ID, '_bsf_item_name', true );
70
-
71
  $rating = get_post_meta( $post->ID, '_bsf_rating', true );
72
-
73
- // $desc = get_post_meta( $post->ID, '_bsf_item_desc', true );
74
-
75
  $reviewer = get_post_meta( $post->ID, '_bsf_item_reviewer', true);
76
-
77
  $post_date = get_the_date('Y-m-d');
78
-
79
  if(trim($reviewer) != "")
80
  {
81
  if($args_review['item_reviewer'] != "")
82
  $review .= "<div class='snippet-label'>".$args_review['item_reviewer']."</div>";
83
-
84
  $review .= " <div class='snippet-data'><span itemprop='reviewer'>".$reviewer."</span></div>";
85
  }
86
  if(isset($args_review['review_date']))
87
  {
88
  if( $args_review['review_date'] != "")
89
  $review .= "<div class='snippet-label'>".$args_review['review_date'] ."</div>";
90
-
91
  $review .= "<div class='snippet-data'> <time itemprop='dtreviewed' datetime='".$post_date."'>".$post_date."</time></div>";
92
  }
93
  if(trim($item) != "")
94
  {
95
  if( $args_review['item_name'] != "")
96
  $review .= "<div class='snippet-label'>".$args_review['item_name']."</div>";
97
-
98
  $review .= "<div class='snippet-data'> <span itemprop='itemreviewed'>".$item."</span></div>";
99
  }
100
  if(trim($rating) != "")
@@ -113,28 +82,15 @@ function display_rich_snippet($content) {
113
  $review .= '<img src="'.plugin_dir_url(__FILE__) .'images/gray.png">';
114
  }
115
  $review .= '</span></div>';
116
-
117
  }
118
- /* if(trim($desc) != "")
119
- {
120
- if( $args_review['item_description'] != "")
121
- $review .= "<div class='snippet-label'>".$args_review['item_description']."</div>";
122
-
123
- $review .= "<div class='snippet-data'> <span itemprop='summary'>".$desc."</span></div>";
124
- }*/
125
  $review .= "</div>
126
  </div><div style='clear:both;'></div>";
127
 
128
  return ( is_single() || is_page() ) ? $review : $content;
129
-
130
  }
131
-
132
  else if($type == '2')
133
-
134
  {
135
-
136
  global $post;
137
-
138
  $args_event = get_option('bsf_event');
139
 
140
  $event = $content;
@@ -143,31 +99,17 @@ function display_rich_snippet($content) {
143
 
144
  if($args_event['snippet_title'] != "")
145
  $event .= '<div class="snippet-title" style="background:'.$args_color["snippet_title_bg"].'; color:'.$args_color["snippet_title_color"].'; border-bottom:1px solid '.$args_color["snippet_border"].';">'.$args_event['snippet_title'].'</div>';
146
-
147
  $event .= '<div itemscope itemtype="http://data-vocabulary.org/Event">';
148
-
149
  $event_title = get_post_meta( $post->ID, '_bsf_event_title', true );
150
-
151
  $event_org = get_post_meta( $post->ID, '_bsf_event_organization', true );
152
-
153
  $event_street = get_post_meta( $post->ID, '_bsf_event_street', true );
154
-
155
  $event_local = get_post_meta( $post->ID, '_bsf_event_local', true );
156
-
157
  $event_region = get_post_meta( $post->ID, '_bsf_event_region', true );
158
-
159
- // $event_desc = get_post_meta( $post->ID, '_bsf_event_desc', true );
160
-
161
  $event_start_date = get_post_meta( $post->ID, '_bsf_event_start_date', true );
162
-
163
  $event_end_date = get_post_meta( $post->ID, '_bsf_event_end_date', true );
164
-
165
  $event_geo_latitude = get_post_meta( $post->ID, '_bsf_event_geo_latitude', true );
166
-
167
  $event_geo_longitude = get_post_meta( $post->ID, '_bsf_event_geo_longitude', true );
168
-
169
  $event_photo = get_post_meta( $post->ID, '_bsf_event_photo', true );
170
-
171
  if(trim($event_photo) != "")
172
  {
173
  $event .= '<div class="snippet-image"><img width="180" itemprop="photo" src="'.$event_photo.'"></div>';
@@ -186,44 +128,30 @@ function display_rich_snippet($content) {
186
  {
187
  if( $args_event['event_title'])
188
  $event .= '<div class="snippet-label-img">'.$args_event['event_title'].'</div>';
189
-
190
  $event .=' <div class="snippet-data-img">​<span itemprop="summary">'.$event_title.'</span></div><div class="snippet-clear"></div>';
191
  }
192
  if(trim($event_org) != "")
193
  {
194
  if( $args_event['event_location'] != "")
195
  $event .= '<div class="snippet-label-img">'.$args_event['event_location'].'</div>';
196
-
197
  $event .=' <div class="snippet-data-img">
198
  ​<span itemprop="location" itemscope itemtype="http://data-vocabulary.org/Organization">
199
-
200
  <span itemprop="name">'.$event_org.'</span>,';
201
  }
202
  if(trim($event_street) != "")
203
-
204
  $event .= '<span itemprop="address" itemscope itemtype="http://data-vocabulary.org/Address">
205
-
206
  <span itemprop="street-address">'.$event_street.'</span>,';
207
-
208
  if(trim($event_local) != "")
209
-
210
  $event .= '<span itemprop="locality">'.$event_local.'</span>,';
211
-
212
  if(trim($event_region) != "")
213
-
214
  $event .= '<span itemprop="region">'.$event_region.'</span>';
215
-
216
  $event .= '</span>';
217
-
218
  $event .= ' <span itemprop="geo" itemscope itemtype="http://data-vocabulary.org/Geo">';
219
-
220
  if(trim($event_geo_latitude) != "")
221
  $event .= '<meta itemprop="latitude" content="'.$event_geo_latitude.'" />';
222
-
223
  if(trim($event_geo_longitude) != "")
224
 
225
  $event .= '<meta itemprop="longitude" content="'.$event_geo_longitude.'" />';
226
-
227
  $event .= '</span>
228
  </span>
229
  </div><div class="snippet-clear"></div>';
@@ -238,118 +166,63 @@ function display_rich_snippet($content) {
238
  {
239
  if( $args_event['end_time'] != "")
240
  $event .= '<div class="snippet-label-img">'.$args_event['end_time'].'</div>';
241
-
242
  $event .= ' <div class="snippet-data-img"> <span itemprop="endDate" datetime="'.$event_end_date.'T00:00-00:00">'.$event_end_date.'</span></div><div class="snippet-clear"></div>';
243
  }
244
  $event .= '</div>
245
  </div></div><div class="snippet-clear"></div>';
246
-
247
  return ( is_single() || is_page() ) ? $event : $content;
248
-
249
  }
250
-
251
  else if($type == '4')
252
-
253
  {
254
-
255
  global $post;
256
-
257
  $organization = $content;
258
-
259
  $organization .= '<div class="snippet-title">Organization Brief :</div>';
260
-
261
  $organization .= '<div xmlns:v="http://rdf.data-vocabulary.org/#" typeof="v:Organization">';
262
-
263
  $org_name = get_post_meta( $post->ID,'_bsf_organization_name', true );
264
-
265
  $org_url = get_post_meta( $post->ID,'_bsf_organization_url', true );
266
-
267
  $org_tel = get_post_meta( $post->ID,'_bsf_organization_tel', true );
268
-
269
  $org_street = get_post_meta( $post->ID,'_bsf_organization_street', true );
270
-
271
  $org_local = get_post_meta( $post->ID,'_bsf_organization_local', true );
272
-
273
  $org_region = get_post_meta( $post->ID,'_bsf_organization_region', true );
274
-
275
  $org_zip = get_post_meta( $post->ID,'_bsf_organization_zip', true );
276
-
277
  $org_country = get_post_meta( $post->ID,'_bsf_organization_country', true );
278
-
279
  $org_latitude = get_post_meta( $post->ID,'_bsf_organization_latitude', true );
280
-
281
  $org_longitude = get_post_meta( $post->ID,'_bsf_organization_longitude', true );
282
-
283
  if(trim($org_name) != "")
284
-
285
  $organization .= 'Organization Name : <span property="v:name">'.$org_name.'</span></div>';
286
-
287
  if(trim($org_url) != "")
288
-
289
  $organization .= 'Website : <a href="'.$org_url.'" rel="v:url">'.$org_url.'</a></div>';
290
-
291
  if(trim($org_tel) != "")
292
-
293
  $organization .= 'Telephone No. : <span property="v:tel">'.$org_tel.'</span></div>';
294
-
295
  if(trim($org_street) != "")
296
-
297
  $organization .= 'Address :
298
-
299
  <span rel="v:address">
300
-
301
  <span typeof="v:Address">
302
-
303
  <span property="v:street-address">'.$org_street.'</span>';
304
-
305
  if(trim($org_local) != "")
306
-
307
  $organization .= '<span property="v:locality">'.$org_local.'</span>';
308
-
309
  if(trim($org_region) != "")
310
-
311
  $organization .= '<span property="v:region">'.$org_region.'</span>';
312
-
313
  if(trim($org_zip) != "")
314
-
315
  $organization .= '<span property="v:postal-code">'.$org_zip.'</span>';
316
-
317
  if(trim($org_country) != "")
318
-
319
  $organization .= '<span property="v:country-name">'.$org_country.'</span>
320
-
321
  </span>
322
-
323
  </span>';
324
-
325
  if(trim($org_latitude) != "")
326
-
327
  $organization .= 'GEO Location :
328
-
329
  <span rel="v:geo">
330
-
331
  <span typeof="v:Geo">
332
-
333
  <span property="v:latitude" content="'.$org_latitude.'">'.$org_latitude.'</span> - ';
334
-
335
  if(trim($org_longitude) != "")
336
-
337
  $organization .= '<span property="v:longitude" content="'.$org_longitude.'">'.$org_longitude.'</span>
338
-
339
  </span>
340
-
341
  </span>';
342
-
343
  $organization .= '</div><div style="clear:both;"></div>';
344
-
345
  return ( is_single() || is_page() ) ? $organization : $content;
346
-
347
  }
348
-
349
  else if($type == '5')
350
-
351
  {
352
-
353
  global $post;
354
 
355
  $args_person = get_option('bsf_person');
@@ -360,25 +233,15 @@ function display_rich_snippet($content) {
360
 
361
  if($args_person['snippet_title'] != "")
362
  $people .= '<div class="snippet-title" style="background:'.$args_color["snippet_title_bg"].'; color:'.$args_color["snippet_title_color"].'; border-bottom:1px solid '.$args_color["snippet_border"].';">'.$args_person['snippet_title'].'</div>';
363
-
364
  $people .= '<div xmlns:v="http://rdf.data-vocabulary.org/#" typeof="v:Person">';
365
-
366
  $people_fn = get_post_meta( $post->ID, '_bsf_people_fn', true );
367
-
368
  $people_nickname = get_post_meta( $post->ID, '_bsf_people_nickname', true );
369
-
370
  $people_photo = get_post_meta( $post->ID, '_bsf_people_photo', true );
371
-
372
  $people_job_title = get_post_meta( $post->ID, '_bsf_people_job_title', true );
373
-
374
  $people_website = get_post_meta( $post->ID, '_bsf_people_website', true );
375
-
376
  $people_company = get_post_meta( $post->ID, '_bsf_people_company', true );
377
-
378
  $people_local = get_post_meta( $post->ID, '_bsf_people_local', true );
379
-
380
  $people_region = get_post_meta( $post->ID, '_bsf_people_region', true );
381
-
382
  if(trim($people_photo) != "")
383
  {
384
  $people .= '<div class="snippet-image"><img width="180" src="'.$people_photo.'" rel="v:photo" /></div>';
@@ -403,109 +266,70 @@ function display_rich_snippet($content) {
403
  {
404
  if($args_person['person_nickname'] != "")
405
  $people .= '<div class="snippet-label-img">'.$args_person['person_nickname'].'</div> ';
406
-
407
  $people .= '<div class="snippet-data-img"> (<span property="v:nickname">'.$people_nickname.'</span>)</div><div class="snippet-clear"></div>';
408
  }
409
  if(trim($people_website) != "")
410
  {
411
  if($args_person['person_website'] != "")
412
  $people .= '<div class="snippet-label-img">'.$args_person['person_website'].'</div> ';
413
-
414
  $people .= '<div class="snippet-data-img"> <a href="'.$people_website.'" rel="v:url">'.$people_website.'</a></div><div class="snippet-clear"></div>';
415
  }
416
  if(trim($people_job_title) != "")
417
  {
418
  if($args_person['person_job_title'] != "")
419
  $people .= '<div class="snippet-label-img">'.$args_person['person_job_title'].'</div> ';
420
-
421
  $people .= '<div class="snippet-data-img"> <span property="v:title">'.$people_job_title.'</span></div><div class="snippet-clear"></div>';
422
  }
423
  if(trim($people_company) != "")
424
  {
425
  if($args_person['person_company'] != "")
426
  $people .= '<div class="snippet-label-img">'.$args_person['person_company'].'</div> ';
427
-
428
  $people .= '<div class="snippet-data-img"> <span property="v:affiliation">'.$people_company.'</span></div><div class="snippet-clear"></div>';
429
  }
430
  if(trim($people_local) != "")
431
  {
432
  if($args_person['person_address'] != "")
433
  $people .= '<div class="snippet-label-img">'.$args_person['person_address'].'</div> ';
434
-
435
  $people .= '<div class="snippet-data-img"> <span rel="v:address">
436
-
437
  <span typeof="v:Address">
438
-
439
  <span property="v:locality">'.$people_local.'</span>,';
440
  }
441
  if(trim($people_region) != "")
442
-
443
  $people .= '<span property="v:region">'.$people_region.'</span>
444
-
445
  </span>
446
-
447
  </span></div><div class="snippet-clear"></div>';
448
-
449
  $people .= '</div>
450
  </div></div><div class="snippet-clear"></div>';
451
-
452
  return ( is_single() || is_page() ) ? $people : $content;
453
-
454
  }
455
-
456
  else if($type == '6')
457
-
458
  {
459
-
460
  global $post;
461
-
462
  $args_product = get_option('bsf_product');
463
-
464
  $product = $content;
465
-
466
  $product .= '<div id="snippet-box" style="background:'.$args_color["snippet_box_bg"].'; color:'.$args_color["snippet_box_color"].'; border:1px solid '.$args_color["snippet_border"].';">';
467
-
468
  if($args_product['snippet_title'] != "")
469
  $product .= '<div class="snippet-title" style="background:'.$args_color["snippet_title_bg"].'; color:'.$args_color["snippet_title_color"].'; border-bottom:1px solid '.$args_color["snippet_border"].';">'.$args_product['snippet_title'];
470
-
471
  $product .= bsf_do_rating();
472
 
473
  $product .= '</div>';
474
-
475
  $product .= '<div itemscope itemtype="http://data-vocabulary.org/Product">';
476
-
477
  $product_rating = get_post_meta( $post->ID, '_bsf_product_rating', true);
478
-
479
  $product_brand = get_post_meta( $post->ID, '_bsf_product_brand', true);
480
-
481
  $product_name = get_post_meta( $post->ID, '_bsf_product_name', true);
482
-
483
  $product_image = get_post_meta($post->ID, '_bsf_product_image', true);
484
-
485
  $product_cat = get_post_meta($post->ID, '_bsf_product_cat', true);
486
-
487
  $product_price = get_post_meta($post->ID, '_bsf_product_price', true);
488
-
489
  $product_cur = get_post_meta($post->ID, '_bsf_product_cur', true);
490
-
491
  $product_status = get_post_meta($post->ID, '_bsf_product_status', true);
492
-
493
  if(trim($product_status) == "out_of_stock")
494
-
495
  $availability = "Out of Stock";
496
-
497
  else if(trim($product_status) == "in_stock")
498
-
499
  $availability = "Available in Stock";
500
-
501
  else if(trim($product_status) == "instore_only")
502
-
503
  $availability = "Available in Store Only";
504
-
505
  else if(trim($product_status) == "preorder")
506
-
507
  $availability = "Pre-Order Only";
508
-
509
  if(trim($product_image) != "")
510
  {
511
  $product .= '<div class="snippet-image"><img width="180" src="'.$product_image.'" itemprop="image" /></div>';
@@ -523,7 +347,6 @@ function display_rich_snippet($content) {
523
  {
524
  if($args_product['product_brand'] != "")
525
  $product .= '<div class="snippet-label-img">'.$args_product['product_rating'].'</div>';
526
-
527
  $product .= '<div class="snippet-data-img"><span class="star-img">';
528
  for($i = 1; $i<=$product_rating; $i++)
529
  {
@@ -534,10 +357,8 @@ function display_rich_snippet($content) {
534
  if($j)
535
  $product .= '<img src="'.plugin_dir_url(__FILE__) .'images/gray.png">';
536
  }
537
-
538
  $product .= '</span></div><div class="snippet-clear"></div>';
539
  }
540
-
541
  $product .= '<span itemprop="review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
542
  if($args_product['product_agr'] != "")
543
  {
@@ -546,53 +367,40 @@ function display_rich_snippet($content) {
546
  $product .= '<div class="snippet-data-img">';
547
  $product .= '<span itemprop="rating">'.average_rating().'</span>';
548
  $product .= ' based on <span class="rating-count" itemprop="count">'.rating_count().'</span> reviews </span></div><div class="snippet-clear"></div>';
549
-
550
  if(trim($product_brand) != "")
551
  {
552
  if($args_product['product_brand'] != "")
553
  $product .= '<div class="snippet-label-img">'.$args_product['product_brand'].'</div>';
554
-
555
  $product .= ' <div class="snippet-data-img"> <span itemprop="brand">'.$product_brand.'</span></div><div class="snippet-clear"></div>';
556
  }
557
  if(trim($product_name) != "")
558
  {
559
  if($args_product['product_name'] != "")
560
  $product .= '<div class="snippet-label-img">'.$args_product['product_name'].'</div>';
561
-
562
  $product .= ' <div class="snippet-data-img"> <span itemprop="name">'.$product_name.'</span></div><div class="snippet-clear"></div>';
563
  }
564
  if(trim($product_price) != "")
565
  {
566
  if($args_product['product_price'] != "")
567
  $product .= '<div class="snippet-label-img">'.$args_product['product_price'].'</div>';
568
-
569
  $product .= '<div class="snippet-data-img"> <span itemprop="offerDetails" itemscope itemtype="http://data-vocabulary.org/Offer">
570
-
571
  <meta itemprop="currency" content="'.$product_cur.'" /><span itemprop="price">'.$product_cur.' '.$product_price.'</span></div><div class="snippet-clear"></div>';
572
  }
573
  if(trim($product_status) != "")
574
  {
575
  if($args_product['product_avail'] != "")
576
  $product .= '<div class="snippet-label-img">'.$args_product['product_avail'].'</div>';
577
-
578
  $product .= ' <div class="snippet-data-img"> <span itemprop="availability" content="'.$product_status.'">'.$availability.'</span></span></div><div class="snippet-clear"></div>';
579
  }
580
-
581
  $product .= '</div>
582
  </div></div><div class="snippet-clear"></div>';
583
 
584
  // $product .= getPostLikeLink($post->ID);
585
-
586
  return ( is_single() || is_page() ) ? $product : $content;
587
-
588
  }
589
-
590
  else if($type == '7')
591
-
592
  {
593
-
594
  global $post;
595
-
596
  $recipe = $content;
597
 
598
  $recipe .= '<div id="snippet-box" style="background:'.$args_color["snippet_box_bg"].'; color:'.$args_color["snippet_box_color"].'; border:1px solid '.$args_color["snippet_border"].';">';
@@ -605,27 +413,16 @@ function display_rich_snippet($content) {
605
  $recipe .= bsf_do_rating();
606
  }
607
  $recipe .= '</div>';
608
-
609
  $recipe .= '<div itemscope itemtype="http://data-vocabulary.org/Recipe">';
610
-
611
  $recipes_name = get_post_meta( $post->ID, '_bsf_recipes_name', true );
612
-
613
  $recipes_preptime = get_post_meta( $post->ID, '_bsf_recipes_preptime', true );
614
-
615
  $recipes_cooktime = get_post_meta( $post->ID, '_bsf_recipes_cooktime', true );
616
-
617
  $recipes_totaltime = get_post_meta( $post->ID, '_bsf_recipes_totaltime', true );
618
-
619
  $recipes_photo = get_post_meta( $post->ID, '_bsf_recipes_photo', true );
620
-
621
  $recipes_desc = get_post_meta( $post->ID, '_bsf_recipes_desc', true );
622
-
623
  $recipes_ingredient = get_post_meta( $post->ID, '_bsf_recipes_ingredient', true );
624
-
625
  $count = rating_count();
626
-
627
  $agregate = average_rating();
628
-
629
  if(trim($recipes_photo) != "")
630
  {
631
  $recipe .= '<div class="snippet-image"><img width="180" itemprop="photo" src="'.$recipes_photo.'"/></div>';
@@ -647,46 +444,26 @@ function display_rich_snippet($content) {
647
  $recipe .= '<div class="snippet-data-img"><span itemprop="name">'.$recipes_name.'</span></div><div class="snippet-clear"></div>';
648
  }
649
  $recipe .= '<div class="snippet-label-img">Published on : </div><div class="snippet-data-img"><time datetime="'.get_the_date('Y-m-d').'" itemprop="published">'.get_the_date('Y-m-d').'</time></div><div class="snippet-clear"></div>';
650
-
651
  if(trim($recipes_preptime) != "")
652
  {
653
  if($args_recipe['recipe_prep'] != "")
654
  $recipe .= '<div class="snippet-label-img">'.$args_recipe['recipe_prep'].'</div>';
655
-
656
  $recipe .= '<div class="snippet-data-img"> <time datetime="PT'.$recipes_preptime.'" itemprop="prepTime">'.$recipes_preptime.'</time></div><div class="snippet-clear"></div>';
657
  }
658
  if(trim($recipes_cooktime) != "")
659
  {
660
  if($args_recipe['recipe_cook'] != "")
661
  $recipe .= '<div class="snippet-label-img">'.$args_recipe['recipe_cook'].'</div>';
662
-
663
  $recipe .= '<div class="snippet-data-img"> <time datetime="PT'.$recipes_cooktime.'" itemprop="cookTime">'.$recipes_cooktime.'</span></div><div class="snippet-clear"></div> ';
664
  }
665
  if(trim($recipes_totaltime) != "")
666
  {
667
  if($args_recipe['recipe_time'] != "")
668
  $recipe .= '<div class="snippet-label-img">'.$args_recipe['recipe_time'].'</div>';
669
-
670
  $recipe .= '<div class="snippet-data-img"> <time datetime="PT'.$recipes_totaltime.'" itemprop="totalTime">'.$recipes_totaltime.'</span></div><div class="snippet-clear"></div>';
671
  }
672
- /* if(trim($recipes_ingredient) != "")
673
- {
674
- if($args_recipe['recipe_ingred'] != "")
675
- $recipe .= '<div class="snippet-label">'.$args_recipe['recipe_ingred'].'</div>';
676
-
677
- $recipe .= '<div class="snippet-data-img"> <pre>'.$recipes_ingredient.'</pre></div>';
678
- }
679
- if(trim($recipes_desc) != "")
680
- {
681
- if($args_recipe['recipe_summary'] != "")
682
- $recipe .= '<div class="snippet-label">'.$args_recipe['recipe_summary'].'</div>';
683
-
684
- $recipe .= '<div class="snippet-data-img"> <span itemprop="summary">'.$recipes_desc.'</span></div>';
685
- }
686
- */
687
  if($args_recipe['recipe_rating'] != "")
688
  $recipe .= '<div class="snippet-label-img">'.$args_recipe['recipe_rating'].'</div>';
689
-
690
  $recipe .= ' <div class="snippet-data-img"> <span itemprop="review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate"><span itemprop="rating" class="rating-value">'.$agregate.'</span><span class="star-img">';
691
  for($i = 1; $i<=$agregate; $i++)
692
  {
@@ -697,49 +474,29 @@ function display_rich_snippet($content) {
697
  if($j)
698
  $recipe .= '<img src="'.plugin_dir_url(__FILE__) .'images/gray.png">';
699
  }
700
-
701
  $recipe .= '</span> Based on <span itemprop="count"><strong>'.$count.'</strong> </span> Review(s)</span></div><div class="snippet-clear"></div>';
702
-
703
  $recipe .= '</div>
704
  </div></div><div class="snippet-clear"></div>';
705
-
706
  return ( is_single() || is_page() ) ? $recipe : $content;
707
-
708
  }
709
-
710
  else if($type == '8')
711
-
712
  {
713
-
714
  global $post;
715
-
716
  $args_soft = get_option('bsf_software');
717
-
718
  $software = $content;
719
 
720
  $software .= '<div id="snippet-box" style="background:'.$args_color["snippet_box_bg"].'; color:'.$args_color["snippet_box_color"].'; border:1px solid '.$args_color["snippet_border"].';">';
721
-
722
  if($args_soft['snippet_title'] != "" )
723
  $software .= '<div class="snippet-title" style="background:'.$args_color["snippet_title_bg"].'; color:'.$args_color["snippet_title_color"].'; border-bottom:1px solid '.$args_color["snippet_border"].';">'.$args_soft['snippet_title'].'</div>';
724
-
725
  $software .= '<div itemscope itemtype="http://schema.org/SoftwareApplication">';
726
-
727
  $software_rating = get_post_meta( $post->ID, '_bsf_software_rating', true);
728
-
729
  $software_name = get_post_meta( $post->ID, '_bsf_software_name', true );
730
-
731
  $software_desc = get_post_meta( $post->ID, '_bsf_software_desc', true );
732
-
733
  $software_landing = get_post_meta( $post->ID, '_bsf_software_landing', true );
734
-
735
  $software_image = get_post_meta( $post->ID, '_bsf_software_image', true );
736
-
737
  $software_price = get_post_meta( $post->ID, '_bsf_software_price', true );
738
-
739
  $software_cur = get_post_meta($post->ID, '_bsf_software_cur', true);
740
-
741
  $software_os = get_post_meta( $post->ID, '_bsf_software_os', true );
742
-
743
  if(trim($software_image) != "")
744
  {
745
  $software .= '<div class="snippet-image"><img width="180" src="'.$software_image.'" itemprop="image" /></div>';
@@ -757,7 +514,6 @@ function display_rich_snippet($content) {
757
  {
758
  if($args_soft['software_rating'] != "")
759
  $software .= '<div class="snippet-label-img">'.$args_soft['software_rating'].'</div>';
760
-
761
  $software .= '<div class="snippet-data-img"> <div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"><span itemprop="ratingValue" class="rating-value">'.$software_rating.'</span></div><span class="star-img">';
762
  for($i = 1; $i<=$software_rating; $i++)
763
  {
@@ -775,25 +531,19 @@ function display_rich_snippet($content) {
775
  {
776
  if($args_soft['software_name'] != "")
777
  $software .= '<div class="snippet-label-img">'.$args_soft['software_name'].'</div>';
778
-
779
  $software .= ' <div class="snippet-data-img"> <span itemprop="name">'.$software_name.'</span></div><div class="snippet-clear"></div>';
780
  }
781
  if(trim($software_os) != "")
782
  {
783
  if($args_soft['software_os'] != "")
784
  $software .= '<div class="snippet-label-img">'.$args_soft['software_os'].'</div>';
785
-
786
  $software .= ' <div class="snippet-data-img"> <span itemprop="operatingSystems">'.$software_os.'</span></div><div class="snippet-clear"></div>';
787
  }
788
  if(trim($software_price) != "")
789
  {
790
  if($args_soft['software_price'] != "")
791
  $software .= '<div class="snippet-label-img">'.$args_soft['software_price'].'</div>';
792
-
793
- // $software .= '<div class="snippet-data-img"> <div itemprop="offers" itemscope itemtype="http://schema.org/Offer"><span itemprop="price">'.$software_price.'</span></div></div>';
794
-
795
  $software .= '<div class="snippet-data-img"> <span itemprop="offers" itemscope itemtype="http://data-vocabulary.org/Offer">
796
-
797
  <meta itemprop="priceCurrency" content="'.$software_cur.'" />'.$software_cur.' <span itemprop="price"> '.$software_price.'</span></div><div class="snippet-clear"></div>';
798
 
799
  }
@@ -801,52 +551,35 @@ function display_rich_snippet($content) {
801
  {
802
  if($args_soft['software_desc'] != "")
803
  $software .= '<div class="snippet-label-img">'.$args_soft['software_desc'].'</div>';
804
-
805
  $software .= ' <div class="snippet-data-img"> <span itemprop="description">'.$software_desc.'</span></div><div class="snippet-clear"></div>';
806
  }
807
  if(trim($software_landing) != "")
808
  {
809
  if($args_soft['software_website'] != "")
810
  $software .= '<div class="snippet-label-img">'.$args_soft['software_website'].'</div>';
811
-
812
  $software .= '<div class="snippet-data-img"> <a itemprop="url" href="'.$software_landing.'">'.$software_landing.'</a></div><div class="snippet-clear"></div>';
813
  }
814
  $software .= '</div>
815
  </div></div><div class="snippet-clear"></div>';
816
-
817
  return ( is_single() || is_page() ) ? $software : $content;
818
-
819
  }
820
-
821
  else if($type == '9')
822
-
823
  {
824
-
825
  global $post;
826
-
827
  $args_video = get_option('bsf_video');
828
-
829
  $video = $content;
830
 
831
  $video .= '<div id="snippet-box" style="background:'.$args_color["snippet_box_bg"].'; color:'.$args_color["snippet_box_color"].'; border:1px solid '.$args_color["snippet_border"].';">';
832
 
833
  if($args_video['snippet_title'] != "" )
834
  $video .= '<div class="snippet-title" style="background:'.$args_color["snippet_title_bg"].'; color:'.$args_color["snippet_title_color"].'; border-bottom:1px solid '.$args_color["snippet_border"].';">'.$args_video['snippet_title'].'</div>';
835
-
836
  $video .= '<div itemprop="video" itemscope itemtype="http://schema.org/VideoObject">';
837
-
838
  $video_title = get_post_meta( $post->ID, '_bsf_video_title', true );
839
-
840
  $video_desc = get_post_meta( $post->ID, '_bsf_video_desc', true );
841
-
842
  $video_thumb = get_post_meta( $post->ID, '_bsf_video_thumb', true );
843
-
844
  $video_url = get_post_meta( $post->ID, '_bsf_video_url', true );
845
-
846
  $video_duration = get_post_meta( $post->ID, '_bsf_video_duration', true );
847
-
848
  $video_date = get_post_meta( $post->ID, '_bsf_video_date', true );
849
-
850
  if(trim($video_url) != "")
851
  {
852
  $video .= '<div class="snippet-image"><a itemprop="url" href="'.$video_url.'"><img width="180" src="'.$video_thumb.'"></a></div>';
@@ -871,53 +604,89 @@ function display_rich_snippet($content) {
871
  {
872
  if($args_video['video_desc'] != "" )
873
  $video .= '<div class="snippet-label-img">'.$args_video['video_desc'].'</div>';
874
-
875
  $video .= '<div class="snippet-data-img"> <p itemprop="description">'.$video_desc.'</p></div><div class="snippet-clear"></div>';
876
  }
877
  if(trim($video_thumb) != "")
878
-
879
  $video .= '<meta itemprop="thumbnail" content="'.$video_thumb.'">';
880
-
881
  if(trim($video_duration) != "")
882
-
883
  $video .= '<meta itemprop="duration" content="'.$video_duration.'">';
884
-
885
  if(trim($video_date) != "")
886
-
887
  $video .= '<meta itemprop="uploaddate" content="'.$video_date.'">';
888
-
889
  $video .= '</div>
890
  </div></div><div class="snippet-clear"></div>';
891
-
892
  return ( is_single() || is_page() ) ? $video : $content;
893
-
894
- } else {
895
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
896
  return $content;
897
-
898
  }
899
-
900
  }
901
-
902
  //Filter the content and return with rich snippet output
903
  add_filter('the_content','display_rich_snippet');
904
-
905
  require_once('meta-boxes.php');
906
-
907
  function enque() {
908
-
909
  wp_enqueue_style('rating_style', plugin_dir_url(__FILE__) . 'css/jquery.rating.css');
910
-
911
  wp_enqueue_script('jquery');
912
-
913
  wp_enqueue_script('jquery_rating', plugin_dir_url(__FILE__) . 'js/jquery.rating.min.js', array('jquery'));
914
 
915
  wp_enqueue_script('ratina_js', plugin_dir_url(__FILE__) . 'js/retina.js', array('jquery'));
916
-
917
  }
918
-
919
  add_action('wp_enqueue_scripts', 'enque');
920
-
921
  function get_the_ip() {
922
  if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
923
  return $_SERVER["HTTP_X_FORWARDED_FOR"];
@@ -929,39 +698,17 @@ function get_the_ip() {
929
  return $_SERVER["REMOTE_ADDR"];
930
  }
931
  }
932
-
933
  function average_rating() {
934
-
935
  // global $wpdb;
936
-
937
  global $post;
938
 
939
  $data = get_post_meta($post->ID, 'post-rating', false);
940
-
941
  $post_id = $post->ID;
942
-
943
- /* $ratings = $wpdb->get_results("
944
-
945
- SELECT $wpdb->commentmeta.meta_value
946
-
947
- FROM $wpdb->commentmeta
948
-
949
- INNER JOIN $wpdb->comments on $wpdb->comments.comment_id=$wpdb->commentmeta.comment_id
950
-
951
- WHERE $wpdb->commentmeta.meta_key='rating'
952
-
953
- AND $wpdb->comments.comment_post_id=$post_id
954
-
955
- AND $wpdb->comments.comment_approved =1
956
-
957
- ");
958
- */
959
  if( !empty($data) )
960
  {
961
  $counter = 0;
962
 
963
  $average_rating = 0;
964
-
965
  foreach($data as $d)
966
  {
967
  $rating = $d['user_rating'];
@@ -971,38 +718,29 @@ function average_rating() {
971
  $counter++;
972
 
973
  }
974
-
975
  //round the average to the nearast 1/2 point
976
-
977
  return (round(($average_rating/$counter)*2,0)/2);
978
 
979
  } else {
980
-
981
  //no ratings
982
-
983
  return 'no rating';
984
  }
985
  }
986
-
987
  function rating_count()
988
  {
989
  global $post;
990
 
991
  $data = get_post_meta($post->ID, 'post-rating', false);
992
-
993
  return count($data);
994
-
995
  }
996
  function bsf_do_rating()
997
  {
998
  global $post;
999
-
1000
  $ip = get_the_ip();
1001
 
1002
  $ip_array = array();
1003
 
1004
  $data = get_post_meta($post->ID, 'post-rating', false);
1005
-
1006
  if( !empty($data))
1007
  {
1008
  foreach($data as $d)
@@ -1018,18 +756,6 @@ function bsf_do_rating()
1018
  $rating = get_previous_rating($ip, $data);
1019
 
1020
  $stars = bsf_display_rating($rating);
1021
- /* $stars = '<span class="ratings">Your rating: <span class="star-img">';
1022
- for($i = 1; $i<=$rating; $i++)
1023
- {
1024
- $stars .= '<img src="'.plugin_dir_url(__FILE__) .'images/1star.png">';
1025
- }
1026
- for($j = 0; $j<=5-$rating; $j++)
1027
- {
1028
- if($j)
1029
- $stars .= '<img src="'.plugin_dir_url(__FILE__) .'images/gray.png">';
1030
- }
1031
- $stars .= '</span></span>';
1032
- */
1033
  return $stars;
1034
  }
1035
  }
@@ -1037,7 +763,6 @@ function bsf_do_rating()
1037
  {
1038
  return display_rating();
1039
  }
1040
-
1041
  }
1042
  function get_previous_rating($needle, $haystack, $strict = false) {
1043
  foreach ($haystack as $item) {
@@ -1045,7 +770,6 @@ function get_previous_rating($needle, $haystack, $strict = false) {
1045
  return $item['user_rating'];
1046
  }
1047
  }
1048
-
1049
  return false;
1050
  }
1051
  function add_ajax_library() {
@@ -1056,7 +780,6 @@ function add_ajax_library() {
1056
 
1057
  echo $html;
1058
  }
1059
-
1060
  function bsf_add_rating()
1061
  {
1062
  // ob_clean();
@@ -1073,7 +796,6 @@ function bsf_add_rating()
1073
  $user_rating = array('post_id' => $postid, 'user_ip' => $ip, 'user_rating' => $stars);
1074
 
1075
  echo false == add_post_meta($postid, 'post-rating', $user_rating) ? 'Error adding your rating' : 'Ratings added successfully !';
1076
-
1077
  die();
1078
  }
1079
  function bsf_update_rating()
@@ -1093,38 +815,22 @@ function bsf_update_rating()
1093
  $user_rating = array('post_id' => $postid, 'user_ip' => $ip, 'user_rating' => $stars);
1094
 
1095
  echo false == update_post_meta($postid, 'post-rating', $user_rating, $prev_data) ? 'Error updating your rating' : 'Ratings updated successfully !';
1096
-
1097
  die();
1098
  }
1099
-
1100
  function display_rating() {
1101
 
1102
  global $post;
1103
-
1104
  $rating = '<span class="ratings"><div class="star-blocks">';
1105
-
1106
  $rating .= '<form name="rating" method="post" action="'. get_permalink() .'" id="bsf-rating" onsubmit="return false;">';
1107
-
1108
  $rating .= '<input type="radio" name="star-review" class="star star-1" value="1"/>';
1109
-
1110
  $rating .= '<input type="radio" name="star-review" class="star star-2" value="2"/>';
1111
-
1112
  $rating .= '<input type="radio" name="star-review" class="star star-3" value="3"/>';
1113
-
1114
  $rating .= '<input type="radio" name="star-review" class="star star-4" value="4"/>';
1115
-
1116
  $rating .= '<input type="radio" name="star-review" class="star star-5" value="5"/>';
1117
-
1118
  $rating .= '<input type="hidden" name="ip" value="'.get_the_ip().'" />';
1119
-
1120
  $rating .= '<input type="hidden" name="post_id" value="'.$post->ID.'" />';
1121
-
1122
- // $rating .= '<input id="submit_rating" type="submit" name="submit" value="Submit" />';
1123
-
1124
  $rating .= '</form>';
1125
-
1126
  $rating .= '</div></span>';
1127
-
1128
  $script = '<script type="text/javascript">
1129
  jQuery("#bsf-rating").click(function()
1130
  {
@@ -1140,40 +846,23 @@ function display_rating() {
1140
  });
1141
  </script>
1142
  ';
1143
-
1144
  $rating .= $script;
1145
-
1146
  return $rating;
1147
-
1148
  }
1149
  function bsf_display_rating($n) {
1150
 
1151
  global $post;
1152
-
1153
  $rating = '<span class="ratings"><div class="star-blocks">';
1154
-
1155
  $rating .= '<form name="rating" method="post" action="'. get_permalink() .'" id="bsf-rating" onsubmit="return false;">';
1156
-
1157
  $rating .= '<input type="radio" name="star-review" class="star star-1" value="1" '; $n == 1 ? $rating .=' checked="checked"/>' : $rating .='/>';
1158
-
1159
  $rating .= '<input type="radio" name="star-review" class="star star-2" value="2" '; $n == 2 ? $rating .=' checked="checked"/>' : $rating .='/>';
1160
-
1161
  $rating .= '<input type="radio" name="star-review" class="star star-3" value="3" '; $n == 3 ? $rating .=' checked="checked"/>' : $rating .='/>';
1162
-
1163
  $rating .= '<input type="radio" name="star-review" class="star star-4" value="4" '; $n == 4 ? $rating .=' checked="checked"/>' : $rating .='/>';
1164
-
1165
  $rating .= '<input type="radio" name="star-review" class="star star-5" value="5" '; $n == 5 ? $rating .=' checked="checked"/>' : $rating .='/>';
1166
-
1167
  $rating .= '<input type="hidden" name="ip" value="'.get_the_ip().'" />';
1168
-
1169
  $rating .= '<input type="hidden" name="post_id" value="'.$post->ID.'" />';
1170
-
1171
- // $rating .= '<input id="submit_rating" type="submit" name="submit" value="Submit" />';
1172
-
1173
  $rating .= '</form>';
1174
-
1175
  $rating .= '</div></span>';
1176
-
1177
  $script = '<script type="text/javascript">
1178
  jQuery("#bsf-rating").click(function()
1179
  {
@@ -1189,9 +878,6 @@ function bsf_display_rating($n) {
1189
  });
1190
  </script>
1191
  ';
1192
-
1193
  $rating .= $script;
1194
-
1195
  return $rating;
1196
-
1197
  }
4
  *
5
  */
6
  //add_filter( 'bsf_meta_boxes', 'bsf_review_metaboxes' );
 
7
  /**
8
  * Define the metabox and field configurations.
9
  *
10
  * @param array $meta_boxes
11
  * @return array
12
  */
 
13
  add_action( 'init', 'bsf_initialize_bsf_meta_boxes', 9999 );
 
14
  // Register an action for submitting rating
 
15
  add_action( 'wp_ajax_nopriv_bsf_submit_rating', 'bsf_add_rating' );
16
  add_action( 'wp_ajax_bsf_submit_rating', 'bsf_add_rating' );
 
17
  // Register an action for updating rating
 
18
  add_action( 'wp_ajax_nopriv_bsf_update_rating', 'bsf_update_rating' );
19
  add_action( 'wp_ajax_bsf_update_rating', 'bsf_update_rating' );
 
20
  // Include the Ajax library on the front end
21
  add_action( 'wp_head', 'add_ajax_library' );
 
22
  /**
23
  * Initialize the metabox class.
24
  */
 
25
  function bsf_initialize_bsf_meta_boxes() {
26
  if ( ! class_exists( 'bsf_Meta_Box' ) )
27
  require_once 'init.php';
28
  }
 
29
  //Function to display the rich snippet output below the content
30
  function display_rich_snippet($content) {
 
31
  global $post;
32
 
33
  $args_color = get_option('bsf_custom');
 
34
  $id = $post->ID;
 
35
  $type = get_post_meta($id, '_bsf_post_type', true);
 
36
  if($type == '1')
 
37
  {
 
38
  global $post;
39
 
40
  $args_review = get_option('bsf_review');
 
 
 
41
  $review = $content;
 
42
  $review .= '<div id="snippet-box" style="background:'.$args_color["snippet_box_bg"].'; color:'.$args_color["snippet_box_color"].'; border:1px solid '.$args_color["snippet_border"].';">';
43
 
44
  if($args_review['review_title'] != "")
45
  $review .= '<div class="snippet-title" style="background:'.$args_color["snippet_title_bg"].'; color:'.$args_color["snippet_title_color"].'; border-bottom:1px solid '.$args_color["snippet_border"].';">'.$args_review['review_title'].'</div>';
 
46
  $review .= '<div class="snippet-markup" itemscope itemtype="http://data-vocabulary.org/Review">';
 
47
  $item = get_post_meta( $post->ID, '_bsf_item_name', true );
 
48
  $rating = get_post_meta( $post->ID, '_bsf_rating', true );
 
 
 
49
  $reviewer = get_post_meta( $post->ID, '_bsf_item_reviewer', true);
 
50
  $post_date = get_the_date('Y-m-d');
 
51
  if(trim($reviewer) != "")
52
  {
53
  if($args_review['item_reviewer'] != "")
54
  $review .= "<div class='snippet-label'>".$args_review['item_reviewer']."</div>";
 
55
  $review .= " <div class='snippet-data'><span itemprop='reviewer'>".$reviewer."</span></div>";
56
  }
57
  if(isset($args_review['review_date']))
58
  {
59
  if( $args_review['review_date'] != "")
60
  $review .= "<div class='snippet-label'>".$args_review['review_date'] ."</div>";
 
61
  $review .= "<div class='snippet-data'> <time itemprop='dtreviewed' datetime='".$post_date."'>".$post_date."</time></div>";
62
  }
63
  if(trim($item) != "")
64
  {
65
  if( $args_review['item_name'] != "")
66
  $review .= "<div class='snippet-label'>".$args_review['item_name']."</div>";
 
67
  $review .= "<div class='snippet-data'> <span itemprop='itemreviewed'>".$item."</span></div>";
68
  }
69
  if(trim($rating) != "")
82
  $review .= '<img src="'.plugin_dir_url(__FILE__) .'images/gray.png">';
83
  }
84
  $review .= '</span></div>';
 
85
  }
 
 
 
 
 
 
 
86
  $review .= "</div>
87
  </div><div style='clear:both;'></div>";
88
 
89
  return ( is_single() || is_page() ) ? $review : $content;
 
90
  }
 
91
  else if($type == '2')
 
92
  {
 
93
  global $post;
 
94
  $args_event = get_option('bsf_event');
95
 
96
  $event = $content;
99
 
100
  if($args_event['snippet_title'] != "")
101
  $event .= '<div class="snippet-title" style="background:'.$args_color["snippet_title_bg"].'; color:'.$args_color["snippet_title_color"].'; border-bottom:1px solid '.$args_color["snippet_border"].';">'.$args_event['snippet_title'].'</div>';
 
102
  $event .= '<div itemscope itemtype="http://data-vocabulary.org/Event">';
 
103
  $event_title = get_post_meta( $post->ID, '_bsf_event_title', true );
 
104
  $event_org = get_post_meta( $post->ID, '_bsf_event_organization', true );
 
105
  $event_street = get_post_meta( $post->ID, '_bsf_event_street', true );
 
106
  $event_local = get_post_meta( $post->ID, '_bsf_event_local', true );
 
107
  $event_region = get_post_meta( $post->ID, '_bsf_event_region', true );
 
 
 
108
  $event_start_date = get_post_meta( $post->ID, '_bsf_event_start_date', true );
 
109
  $event_end_date = get_post_meta( $post->ID, '_bsf_event_end_date', true );
 
110
  $event_geo_latitude = get_post_meta( $post->ID, '_bsf_event_geo_latitude', true );
 
111
  $event_geo_longitude = get_post_meta( $post->ID, '_bsf_event_geo_longitude', true );
 
112
  $event_photo = get_post_meta( $post->ID, '_bsf_event_photo', true );
 
113
  if(trim($event_photo) != "")
114
  {
115
  $event .= '<div class="snippet-image"><img width="180" itemprop="photo" src="'.$event_photo.'"></div>';
128
  {
129
  if( $args_event['event_title'])
130
  $event .= '<div class="snippet-label-img">'.$args_event['event_title'].'</div>';
 
131
  $event .=' <div class="snippet-data-img">​<span itemprop="summary">'.$event_title.'</span></div><div class="snippet-clear"></div>';
132
  }
133
  if(trim($event_org) != "")
134
  {
135
  if( $args_event['event_location'] != "")
136
  $event .= '<div class="snippet-label-img">'.$args_event['event_location'].'</div>';
 
137
  $event .=' <div class="snippet-data-img">
138
  ​<span itemprop="location" itemscope itemtype="http://data-vocabulary.org/Organization">
 
139
  <span itemprop="name">'.$event_org.'</span>,';
140
  }
141
  if(trim($event_street) != "")
 
142
  $event .= '<span itemprop="address" itemscope itemtype="http://data-vocabulary.org/Address">
 
143
  <span itemprop="street-address">'.$event_street.'</span>,';
 
144
  if(trim($event_local) != "")
 
145
  $event .= '<span itemprop="locality">'.$event_local.'</span>,';
 
146
  if(trim($event_region) != "")
 
147
  $event .= '<span itemprop="region">'.$event_region.'</span>';
 
148
  $event .= '</span>';
 
149
  $event .= ' <span itemprop="geo" itemscope itemtype="http://data-vocabulary.org/Geo">';
 
150
  if(trim($event_geo_latitude) != "")
151
  $event .= '<meta itemprop="latitude" content="'.$event_geo_latitude.'" />';
 
152
  if(trim($event_geo_longitude) != "")
153
 
154
  $event .= '<meta itemprop="longitude" content="'.$event_geo_longitude.'" />';
 
155
  $event .= '</span>
156
  </span>
157
  </div><div class="snippet-clear"></div>';
166
  {
167
  if( $args_event['end_time'] != "")
168
  $event .= '<div class="snippet-label-img">'.$args_event['end_time'].'</div>';
 
169
  $event .= ' <div class="snippet-data-img"> <span itemprop="endDate" datetime="'.$event_end_date.'T00:00-00:00">'.$event_end_date.'</span></div><div class="snippet-clear"></div>';
170
  }
171
  $event .= '</div>
172
  </div></div><div class="snippet-clear"></div>';
 
173
  return ( is_single() || is_page() ) ? $event : $content;
 
174
  }
 
175
  else if($type == '4')
 
176
  {
 
177
  global $post;
 
178
  $organization = $content;
 
179
  $organization .= '<div class="snippet-title">Organization Brief :</div>';
 
180
  $organization .= '<div xmlns:v="http://rdf.data-vocabulary.org/#" typeof="v:Organization">';
 
181
  $org_name = get_post_meta( $post->ID,'_bsf_organization_name', true );
 
182
  $org_url = get_post_meta( $post->ID,'_bsf_organization_url', true );
 
183
  $org_tel = get_post_meta( $post->ID,'_bsf_organization_tel', true );
 
184
  $org_street = get_post_meta( $post->ID,'_bsf_organization_street', true );
 
185
  $org_local = get_post_meta( $post->ID,'_bsf_organization_local', true );
 
186
  $org_region = get_post_meta( $post->ID,'_bsf_organization_region', true );
 
187
  $org_zip = get_post_meta( $post->ID,'_bsf_organization_zip', true );
 
188
  $org_country = get_post_meta( $post->ID,'_bsf_organization_country', true );
 
189
  $org_latitude = get_post_meta( $post->ID,'_bsf_organization_latitude', true );
 
190
  $org_longitude = get_post_meta( $post->ID,'_bsf_organization_longitude', true );
 
191
  if(trim($org_name) != "")
 
192
  $organization .= 'Organization Name : <span property="v:name">'.$org_name.'</span></div>';
 
193
  if(trim($org_url) != "")
 
194
  $organization .= 'Website : <a href="'.$org_url.'" rel="v:url">'.$org_url.'</a></div>';
 
195
  if(trim($org_tel) != "")
 
196
  $organization .= 'Telephone No. : <span property="v:tel">'.$org_tel.'</span></div>';
 
197
  if(trim($org_street) != "")
 
198
  $organization .= 'Address :
 
199
  <span rel="v:address">
 
200
  <span typeof="v:Address">
 
201
  <span property="v:street-address">'.$org_street.'</span>';
 
202
  if(trim($org_local) != "")
 
203
  $organization .= '<span property="v:locality">'.$org_local.'</span>';
 
204
  if(trim($org_region) != "")
 
205
  $organization .= '<span property="v:region">'.$org_region.'</span>';
 
206
  if(trim($org_zip) != "")
 
207
  $organization .= '<span property="v:postal-code">'.$org_zip.'</span>';
 
208
  if(trim($org_country) != "")
 
209
  $organization .= '<span property="v:country-name">'.$org_country.'</span>
 
210
  </span>
 
211
  </span>';
 
212
  if(trim($org_latitude) != "")
 
213
  $organization .= 'GEO Location :
 
214
  <span rel="v:geo">
 
215
  <span typeof="v:Geo">
 
216
  <span property="v:latitude" content="'.$org_latitude.'">'.$org_latitude.'</span> - ';
 
217
  if(trim($org_longitude) != "")
 
218
  $organization .= '<span property="v:longitude" content="'.$org_longitude.'">'.$org_longitude.'</span>
 
219
  </span>
 
220
  </span>';
 
221
  $organization .= '</div><div style="clear:both;"></div>';
 
222
  return ( is_single() || is_page() ) ? $organization : $content;
 
223
  }
 
224
  else if($type == '5')
 
225
  {
 
226
  global $post;
227
 
228
  $args_person = get_option('bsf_person');
233
 
234
  if($args_person['snippet_title'] != "")
235
  $people .= '<div class="snippet-title" style="background:'.$args_color["snippet_title_bg"].'; color:'.$args_color["snippet_title_color"].'; border-bottom:1px solid '.$args_color["snippet_border"].';">'.$args_person['snippet_title'].'</div>';
 
236
  $people .= '<div xmlns:v="http://rdf.data-vocabulary.org/#" typeof="v:Person">';
 
237
  $people_fn = get_post_meta( $post->ID, '_bsf_people_fn', true );
 
238
  $people_nickname = get_post_meta( $post->ID, '_bsf_people_nickname', true );
 
239
  $people_photo = get_post_meta( $post->ID, '_bsf_people_photo', true );
 
240
  $people_job_title = get_post_meta( $post->ID, '_bsf_people_job_title', true );
 
241
  $people_website = get_post_meta( $post->ID, '_bsf_people_website', true );
 
242
  $people_company = get_post_meta( $post->ID, '_bsf_people_company', true );
 
243
  $people_local = get_post_meta( $post->ID, '_bsf_people_local', true );
 
244
  $people_region = get_post_meta( $post->ID, '_bsf_people_region', true );
 
245
  if(trim($people_photo) != "")
246
  {
247
  $people .= '<div class="snippet-image"><img width="180" src="'.$people_photo.'" rel="v:photo" /></div>';
266
  {
267
  if($args_person['person_nickname'] != "")
268
  $people .= '<div class="snippet-label-img">'.$args_person['person_nickname'].'</div> ';
 
269
  $people .= '<div class="snippet-data-img"> (<span property="v:nickname">'.$people_nickname.'</span>)</div><div class="snippet-clear"></div>';
270
  }
271
  if(trim($people_website) != "")
272
  {
273
  if($args_person['person_website'] != "")
274
  $people .= '<div class="snippet-label-img">'.$args_person['person_website'].'</div> ';
 
275
  $people .= '<div class="snippet-data-img"> <a href="'.$people_website.'" rel="v:url">'.$people_website.'</a></div><div class="snippet-clear"></div>';
276
  }
277
  if(trim($people_job_title) != "")
278
  {
279
  if($args_person['person_job_title'] != "")
280
  $people .= '<div class="snippet-label-img">'.$args_person['person_job_title'].'</div> ';
 
281
  $people .= '<div class="snippet-data-img"> <span property="v:title">'.$people_job_title.'</span></div><div class="snippet-clear"></div>';
282
  }
283
  if(trim($people_company) != "")
284
  {
285
  if($args_person['person_company'] != "")
286
  $people .= '<div class="snippet-label-img">'.$args_person['person_company'].'</div> ';
 
287
  $people .= '<div class="snippet-data-img"> <span property="v:affiliation">'.$people_company.'</span></div><div class="snippet-clear"></div>';
288
  }
289
  if(trim($people_local) != "")
290
  {
291
  if($args_person['person_address'] != "")
292
  $people .= '<div class="snippet-label-img">'.$args_person['person_address'].'</div> ';
 
293
  $people .= '<div class="snippet-data-img"> <span rel="v:address">
 
294
  <span typeof="v:Address">
 
295
  <span property="v:locality">'.$people_local.'</span>,';
296
  }
297
  if(trim($people_region) != "")
 
298
  $people .= '<span property="v:region">'.$people_region.'</span>
 
299
  </span>
 
300
  </span></div><div class="snippet-clear"></div>';
 
301
  $people .= '</div>
302
  </div></div><div class="snippet-clear"></div>';
 
303
  return ( is_single() || is_page() ) ? $people : $content;
 
304
  }
 
305
  else if($type == '6')
 
306
  {
 
307
  global $post;
 
308
  $args_product = get_option('bsf_product');
 
309
  $product = $content;
 
310
  $product .= '<div id="snippet-box" style="background:'.$args_color["snippet_box_bg"].'; color:'.$args_color["snippet_box_color"].'; border:1px solid '.$args_color["snippet_border"].';">';
 
311
  if($args_product['snippet_title'] != "")
312
  $product .= '<div class="snippet-title" style="background:'.$args_color["snippet_title_bg"].'; color:'.$args_color["snippet_title_color"].'; border-bottom:1px solid '.$args_color["snippet_border"].';">'.$args_product['snippet_title'];
 
313
  $product .= bsf_do_rating();
314
 
315
  $product .= '</div>';
 
316
  $product .= '<div itemscope itemtype="http://data-vocabulary.org/Product">';
 
317
  $product_rating = get_post_meta( $post->ID, '_bsf_product_rating', true);
 
318
  $product_brand = get_post_meta( $post->ID, '_bsf_product_brand', true);
 
319
  $product_name = get_post_meta( $post->ID, '_bsf_product_name', true);
 
320
  $product_image = get_post_meta($post->ID, '_bsf_product_image', true);
 
321
  $product_cat = get_post_meta($post->ID, '_bsf_product_cat', true);
 
322
  $product_price = get_post_meta($post->ID, '_bsf_product_price', true);
 
323
  $product_cur = get_post_meta($post->ID, '_bsf_product_cur', true);
 
324
  $product_status = get_post_meta($post->ID, '_bsf_product_status', true);
 
325
  if(trim($product_status) == "out_of_stock")
 
326
  $availability = "Out of Stock";
 
327
  else if(trim($product_status) == "in_stock")
 
328
  $availability = "Available in Stock";
 
329
  else if(trim($product_status) == "instore_only")
 
330
  $availability = "Available in Store Only";
 
331
  else if(trim($product_status) == "preorder")
 
332
  $availability = "Pre-Order Only";
 
333
  if(trim($product_image) != "")
334
  {
335
  $product .= '<div class="snippet-image"><img width="180" src="'.$product_image.'" itemprop="image" /></div>';
347
  {
348
  if($args_product['product_brand'] != "")
349
  $product .= '<div class="snippet-label-img">'.$args_product['product_rating'].'</div>';
 
350
  $product .= '<div class="snippet-data-img"><span class="star-img">';
351
  for($i = 1; $i<=$product_rating; $i++)
352
  {
357
  if($j)
358
  $product .= '<img src="'.plugin_dir_url(__FILE__) .'images/gray.png">';
359
  }
 
360
  $product .= '</span></div><div class="snippet-clear"></div>';
361
  }
 
362
  $product .= '<span itemprop="review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
363
  if($args_product['product_agr'] != "")
364
  {
367
  $product .= '<div class="snippet-data-img">';
368
  $product .= '<span itemprop="rating">'.average_rating().'</span>';
369
  $product .= ' based on <span class="rating-count" itemprop="count">'.rating_count().'</span> reviews </span></div><div class="snippet-clear"></div>';
 
370
  if(trim($product_brand) != "")
371
  {
372
  if($args_product['product_brand'] != "")
373
  $product .= '<div class="snippet-label-img">'.$args_product['product_brand'].'</div>';
 
374
  $product .= ' <div class="snippet-data-img"> <span itemprop="brand">'.$product_brand.'</span></div><div class="snippet-clear"></div>';
375
  }
376
  if(trim($product_name) != "")
377
  {
378
  if($args_product['product_name'] != "")
379
  $product .= '<div class="snippet-label-img">'.$args_product['product_name'].'</div>';
 
380
  $product .= ' <div class="snippet-data-img"> <span itemprop="name">'.$product_name.'</span></div><div class="snippet-clear"></div>';
381
  }
382
  if(trim($product_price) != "")
383
  {
384
  if($args_product['product_price'] != "")
385
  $product .= '<div class="snippet-label-img">'.$args_product['product_price'].'</div>';
 
386
  $product .= '<div class="snippet-data-img"> <span itemprop="offerDetails" itemscope itemtype="http://data-vocabulary.org/Offer">
 
387
  <meta itemprop="currency" content="'.$product_cur.'" /><span itemprop="price">'.$product_cur.' '.$product_price.'</span></div><div class="snippet-clear"></div>';
388
  }
389
  if(trim($product_status) != "")
390
  {
391
  if($args_product['product_avail'] != "")
392
  $product .= '<div class="snippet-label-img">'.$args_product['product_avail'].'</div>';
 
393
  $product .= ' <div class="snippet-data-img"> <span itemprop="availability" content="'.$product_status.'">'.$availability.'</span></span></div><div class="snippet-clear"></div>';
394
  }
 
395
  $product .= '</div>
396
  </div></div><div class="snippet-clear"></div>';
397
 
398
  // $product .= getPostLikeLink($post->ID);
 
399
  return ( is_single() || is_page() ) ? $product : $content;
 
400
  }
 
401
  else if($type == '7')
 
402
  {
 
403
  global $post;
 
404
  $recipe = $content;
405
 
406
  $recipe .= '<div id="snippet-box" style="background:'.$args_color["snippet_box_bg"].'; color:'.$args_color["snippet_box_color"].'; border:1px solid '.$args_color["snippet_border"].';">';
413
  $recipe .= bsf_do_rating();
414
  }
415
  $recipe .= '</div>';
 
416
  $recipe .= '<div itemscope itemtype="http://data-vocabulary.org/Recipe">';
 
417
  $recipes_name = get_post_meta( $post->ID, '_bsf_recipes_name', true );
 
418
  $recipes_preptime = get_post_meta( $post->ID, '_bsf_recipes_preptime', true );
 
419
  $recipes_cooktime = get_post_meta( $post->ID, '_bsf_recipes_cooktime', true );
 
420
  $recipes_totaltime = get_post_meta( $post->ID, '_bsf_recipes_totaltime', true );
 
421
  $recipes_photo = get_post_meta( $post->ID, '_bsf_recipes_photo', true );
 
422
  $recipes_desc = get_post_meta( $post->ID, '_bsf_recipes_desc', true );
 
423
  $recipes_ingredient = get_post_meta( $post->ID, '_bsf_recipes_ingredient', true );
 
424
  $count = rating_count();
 
425
  $agregate = average_rating();
 
426
  if(trim($recipes_photo) != "")
427
  {
428
  $recipe .= '<div class="snippet-image"><img width="180" itemprop="photo" src="'.$recipes_photo.'"/></div>';
444
  $recipe .= '<div class="snippet-data-img"><span itemprop="name">'.$recipes_name.'</span></div><div class="snippet-clear"></div>';
445
  }
446
  $recipe .= '<div class="snippet-label-img">Published on : </div><div class="snippet-data-img"><time datetime="'.get_the_date('Y-m-d').'" itemprop="published">'.get_the_date('Y-m-d').'</time></div><div class="snippet-clear"></div>';
 
447
  if(trim($recipes_preptime) != "")
448
  {
449
  if($args_recipe['recipe_prep'] != "")
450
  $recipe .= '<div class="snippet-label-img">'.$args_recipe['recipe_prep'].'</div>';
 
451
  $recipe .= '<div class="snippet-data-img"> <time datetime="PT'.$recipes_preptime.'" itemprop="prepTime">'.$recipes_preptime.'</time></div><div class="snippet-clear"></div>';
452
  }
453
  if(trim($recipes_cooktime) != "")
454
  {
455
  if($args_recipe['recipe_cook'] != "")
456
  $recipe .= '<div class="snippet-label-img">'.$args_recipe['recipe_cook'].'</div>';
 
457
  $recipe .= '<div class="snippet-data-img"> <time datetime="PT'.$recipes_cooktime.'" itemprop="cookTime">'.$recipes_cooktime.'</span></div><div class="snippet-clear"></div> ';
458
  }
459
  if(trim($recipes_totaltime) != "")
460
  {
461
  if($args_recipe['recipe_time'] != "")
462
  $recipe .= '<div class="snippet-label-img">'.$args_recipe['recipe_time'].'</div>';
 
463
  $recipe .= '<div class="snippet-data-img"> <time datetime="PT'.$recipes_totaltime.'" itemprop="totalTime">'.$recipes_totaltime.'</span></div><div class="snippet-clear"></div>';
464
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
465
  if($args_recipe['recipe_rating'] != "")
466
  $recipe .= '<div class="snippet-label-img">'.$args_recipe['recipe_rating'].'</div>';
 
467
  $recipe .= ' <div class="snippet-data-img"> <span itemprop="review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate"><span itemprop="rating" class="rating-value">'.$agregate.'</span><span class="star-img">';
468
  for($i = 1; $i<=$agregate; $i++)
469
  {
474
  if($j)
475
  $recipe .= '<img src="'.plugin_dir_url(__FILE__) .'images/gray.png">';
476
  }
 
477
  $recipe .= '</span> Based on <span itemprop="count"><strong>'.$count.'</strong> </span> Review(s)</span></div><div class="snippet-clear"></div>';
 
478
  $recipe .= '</div>
479
  </div></div><div class="snippet-clear"></div>';
 
480
  return ( is_single() || is_page() ) ? $recipe : $content;
 
481
  }
 
482
  else if($type == '8')
 
483
  {
 
484
  global $post;
 
485
  $args_soft = get_option('bsf_software');
 
486
  $software = $content;
487
 
488
  $software .= '<div id="snippet-box" style="background:'.$args_color["snippet_box_bg"].'; color:'.$args_color["snippet_box_color"].'; border:1px solid '.$args_color["snippet_border"].';">';
 
489
  if($args_soft['snippet_title'] != "" )
490
  $software .= '<div class="snippet-title" style="background:'.$args_color["snippet_title_bg"].'; color:'.$args_color["snippet_title_color"].'; border-bottom:1px solid '.$args_color["snippet_border"].';">'.$args_soft['snippet_title'].'</div>';
 
491
  $software .= '<div itemscope itemtype="http://schema.org/SoftwareApplication">';
 
492
  $software_rating = get_post_meta( $post->ID, '_bsf_software_rating', true);
 
493
  $software_name = get_post_meta( $post->ID, '_bsf_software_name', true );
 
494
  $software_desc = get_post_meta( $post->ID, '_bsf_software_desc', true );
 
495
  $software_landing = get_post_meta( $post->ID, '_bsf_software_landing', true );
 
496
  $software_image = get_post_meta( $post->ID, '_bsf_software_image', true );
 
497
  $software_price = get_post_meta( $post->ID, '_bsf_software_price', true );
 
498
  $software_cur = get_post_meta($post->ID, '_bsf_software_cur', true);
 
499
  $software_os = get_post_meta( $post->ID, '_bsf_software_os', true );
 
500
  if(trim($software_image) != "")
501
  {
502
  $software .= '<div class="snippet-image"><img width="180" src="'.$software_image.'" itemprop="image" /></div>';
514
  {
515
  if($args_soft['software_rating'] != "")
516
  $software .= '<div class="snippet-label-img">'.$args_soft['software_rating'].'</div>';
 
517
  $software .= '<div class="snippet-data-img"> <div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"><span itemprop="ratingValue" class="rating-value">'.$software_rating.'</span></div><span class="star-img">';
518
  for($i = 1; $i<=$software_rating; $i++)
519
  {
531
  {
532
  if($args_soft['software_name'] != "")
533
  $software .= '<div class="snippet-label-img">'.$args_soft['software_name'].'</div>';
 
534
  $software .= ' <div class="snippet-data-img"> <span itemprop="name">'.$software_name.'</span></div><div class="snippet-clear"></div>';
535
  }
536
  if(trim($software_os) != "")
537
  {
538
  if($args_soft['software_os'] != "")
539
  $software .= '<div class="snippet-label-img">'.$args_soft['software_os'].'</div>';
 
540
  $software .= ' <div class="snippet-data-img"> <span itemprop="operatingSystems">'.$software_os.'</span></div><div class="snippet-clear"></div>';
541
  }
542
  if(trim($software_price) != "")
543
  {
544
  if($args_soft['software_price'] != "")
545
  $software .= '<div class="snippet-label-img">'.$args_soft['software_price'].'</div>';
 
 
 
546
  $software .= '<div class="snippet-data-img"> <span itemprop="offers" itemscope itemtype="http://data-vocabulary.org/Offer">
 
547
  <meta itemprop="priceCurrency" content="'.$software_cur.'" />'.$software_cur.' <span itemprop="price"> '.$software_price.'</span></div><div class="snippet-clear"></div>';
548
 
549
  }
551
  {
552
  if($args_soft['software_desc'] != "")
553
  $software .= '<div class="snippet-label-img">'.$args_soft['software_desc'].'</div>';
 
554
  $software .= ' <div class="snippet-data-img"> <span itemprop="description">'.$software_desc.'</span></div><div class="snippet-clear"></div>';
555
  }
556
  if(trim($software_landing) != "")
557
  {
558
  if($args_soft['software_website'] != "")
559
  $software .= '<div class="snippet-label-img">'.$args_soft['software_website'].'</div>';
 
560
  $software .= '<div class="snippet-data-img"> <a itemprop="url" href="'.$software_landing.'">'.$software_landing.'</a></div><div class="snippet-clear"></div>';
561
  }
562
  $software .= '</div>
563
  </div></div><div class="snippet-clear"></div>';
 
564
  return ( is_single() || is_page() ) ? $software : $content;
 
565
  }
 
566
  else if($type == '9')
 
567
  {
 
568
  global $post;
 
569
  $args_video = get_option('bsf_video');
 
570
  $video = $content;
571
 
572
  $video .= '<div id="snippet-box" style="background:'.$args_color["snippet_box_bg"].'; color:'.$args_color["snippet_box_color"].'; border:1px solid '.$args_color["snippet_border"].';">';
573
 
574
  if($args_video['snippet_title'] != "" )
575
  $video .= '<div class="snippet-title" style="background:'.$args_color["snippet_title_bg"].'; color:'.$args_color["snippet_title_color"].'; border-bottom:1px solid '.$args_color["snippet_border"].';">'.$args_video['snippet_title'].'</div>';
 
576
  $video .= '<div itemprop="video" itemscope itemtype="http://schema.org/VideoObject">';
 
577
  $video_title = get_post_meta( $post->ID, '_bsf_video_title', true );
 
578
  $video_desc = get_post_meta( $post->ID, '_bsf_video_desc', true );
 
579
  $video_thumb = get_post_meta( $post->ID, '_bsf_video_thumb', true );
 
580
  $video_url = get_post_meta( $post->ID, '_bsf_video_url', true );
 
581
  $video_duration = get_post_meta( $post->ID, '_bsf_video_duration', true );
 
582
  $video_date = get_post_meta( $post->ID, '_bsf_video_date', true );
 
583
  if(trim($video_url) != "")
584
  {
585
  $video .= '<div class="snippet-image"><a itemprop="url" href="'.$video_url.'"><img width="180" src="'.$video_thumb.'"></a></div>';
604
  {
605
  if($args_video['video_desc'] != "" )
606
  $video .= '<div class="snippet-label-img">'.$args_video['video_desc'].'</div>';
 
607
  $video .= '<div class="snippet-data-img"> <p itemprop="description">'.$video_desc.'</p></div><div class="snippet-clear"></div>';
608
  }
609
  if(trim($video_thumb) != "")
 
610
  $video .= '<meta itemprop="thumbnail" content="'.$video_thumb.'">';
 
611
  if(trim($video_duration) != "")
 
612
  $video .= '<meta itemprop="duration" content="'.$video_duration.'">';
 
613
  if(trim($video_date) != "")
 
614
  $video .= '<meta itemprop="uploaddate" content="'.$video_date.'">';
 
615
  $video .= '</div>
616
  </div></div><div class="snippet-clear"></div>';
 
617
  return ( is_single() || is_page() ) ? $video : $content;
618
+ }
619
+ else if($type == '10')
620
+ {
621
+ global $post;
622
+ $article = $content;
623
+ $args_article = get_option('bsf_article');
624
+ $article_title = get_post_meta( $post->ID, '_bsf_article_title', true );
625
+ $article_name = get_post_meta( $post->ID, '_bsf_article_name', true );
626
+ $article_desc = get_post_meta( $post->ID, '_bsf_article_desc', true );
627
+ $article_image = get_post_meta( $post->ID, '_bsf_article_image', true );
628
+ $article_author = get_post_meta( $post->ID, '_bsf_article_author', true );
629
+ $article .= '<div id="snippet-box" style="background:'.$args_color["snippet_box_bg"].'; color:'.$args_color["snippet_box_color"].'; border:1px solid '.$args_color["snippet_border"].';">';
630
+ if($args_article['snippet_title'] != "" )
631
+ {
632
+ $article .= '<div class="snippet-title" style="background:'.$args_color["snippet_title_bg"].'; color:'.$args_color["snippet_title_color"].'; border-bottom:1px solid '.$args_color["snippet_border"].';">'.$args_article['snippet_title'];
633
+ }
634
+ $article .= '</div>';
635
+ $article .= '<div itemscope itemtype="http://schema.org/Article">';
636
+ if(trim($article_image) != "")
637
+ {
638
+ $article .= '<div class="snippet-image"><img width="180" itemprop="image" src="'.$article_image.'"/></div>';
639
+ }
640
+ else
641
+ {
642
+ $article .= '<script type="text/javascript">
643
+ jQuery(document).ready(function() {
644
+ jQuery(".snippet-label-img").addClass("snippet-clear");
645
+ });
646
+ </script>';
647
+ }
648
+ $article .= '<div class="aio-info">';
649
+ if(trim($article_name) != "")
650
+ {
651
+ if($args_article['article_name'] != "")
652
+ $article .= '<div class="snippet-label-img">'.$args_article['article_name'].'</div>';
653
+
654
+ $article .= '<div class="snippet-data-img"><span itemprop="name">'.$article_name.'</span></div><div class="snippet-clear"></div>';
655
+ }
656
+ if(trim($article_author) != "")
657
+ {
658
+ if($args_article['article_author'] != "")
659
+ $article .= '<div class="snippet-label-img">'.$args_article['article_author'].'</div>';
660
+
661
+ $article .= '<div class="snippet-data-img"><span itemprop="author">'.$article_author.'</span></div><div class="snippet-clear"></div>';
662
+ }
663
+ if(trim($article_desc) != "")
664
+ {
665
+ if($args_article['article_desc'] != "")
666
+ $article .= '<div class="snippet-label-img">'.$args_article['article_desc'].'</div>';
667
+
668
+ $article .= '<div class="snippet-data-img"><span itemprop="description">'.$article_desc.'</span></div><div class="snippet-clear"></div>';
669
+ }
670
+
671
+ $article .= '</div>
672
+ </div></div><div class="snippet-clear"></div>';
673
+ return ( is_single() || is_page() ) ? $article : $content;
674
+ }
675
+ else {
676
  return $content;
 
677
  }
 
678
  }
 
679
  //Filter the content and return with rich snippet output
680
  add_filter('the_content','display_rich_snippet');
 
681
  require_once('meta-boxes.php');
 
682
  function enque() {
 
683
  wp_enqueue_style('rating_style', plugin_dir_url(__FILE__) . 'css/jquery.rating.css');
 
684
  wp_enqueue_script('jquery');
 
685
  wp_enqueue_script('jquery_rating', plugin_dir_url(__FILE__) . 'js/jquery.rating.min.js', array('jquery'));
686
 
687
  wp_enqueue_script('ratina_js', plugin_dir_url(__FILE__) . 'js/retina.js', array('jquery'));
 
688
  }
 
689
  add_action('wp_enqueue_scripts', 'enque');
 
690
  function get_the_ip() {
691
  if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
692
  return $_SERVER["HTTP_X_FORWARDED_FOR"];
698
  return $_SERVER["REMOTE_ADDR"];
699
  }
700
  }
 
701
  function average_rating() {
 
702
  // global $wpdb;
 
703
  global $post;
704
 
705
  $data = get_post_meta($post->ID, 'post-rating', false);
 
706
  $post_id = $post->ID;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
707
  if( !empty($data) )
708
  {
709
  $counter = 0;
710
 
711
  $average_rating = 0;
 
712
  foreach($data as $d)
713
  {
714
  $rating = $d['user_rating'];
718
  $counter++;
719
 
720
  }
 
721
  //round the average to the nearast 1/2 point
 
722
  return (round(($average_rating/$counter)*2,0)/2);
723
 
724
  } else {
 
725
  //no ratings
 
726
  return 'no rating';
727
  }
728
  }
 
729
  function rating_count()
730
  {
731
  global $post;
732
 
733
  $data = get_post_meta($post->ID, 'post-rating', false);
 
734
  return count($data);
 
735
  }
736
  function bsf_do_rating()
737
  {
738
  global $post;
 
739
  $ip = get_the_ip();
740
 
741
  $ip_array = array();
742
 
743
  $data = get_post_meta($post->ID, 'post-rating', false);
 
744
  if( !empty($data))
745
  {
746
  foreach($data as $d)
756
  $rating = get_previous_rating($ip, $data);
757
 
758
  $stars = bsf_display_rating($rating);
 
 
 
 
 
 
 
 
 
 
 
 
759
  return $stars;
760
  }
761
  }
763
  {
764
  return display_rating();
765
  }
 
766
  }
767
  function get_previous_rating($needle, $haystack, $strict = false) {
768
  foreach ($haystack as $item) {
770
  return $item['user_rating'];
771
  }
772
  }
 
773
  return false;
774
  }
775
  function add_ajax_library() {
780
 
781
  echo $html;
782
  }
 
783
  function bsf_add_rating()
784
  {
785
  // ob_clean();
796
  $user_rating = array('post_id' => $postid, 'user_ip' => $ip, 'user_rating' => $stars);
797
 
798
  echo false == add_post_meta($postid, 'post-rating', $user_rating) ? 'Error adding your rating' : 'Ratings added successfully !';
 
799
  die();
800
  }
801
  function bsf_update_rating()
815
  $user_rating = array('post_id' => $postid, 'user_ip' => $ip, 'user_rating' => $stars);
816
 
817
  echo false == update_post_meta($postid, 'post-rating', $user_rating, $prev_data) ? 'Error updating your rating' : 'Ratings updated successfully !';
 
818
  die();
819
  }
 
820
  function display_rating() {
821
 
822
  global $post;
 
823
  $rating = '<span class="ratings"><div class="star-blocks">';
 
824
  $rating .= '<form name="rating" method="post" action="'. get_permalink() .'" id="bsf-rating" onsubmit="return false;">';
 
825
  $rating .= '<input type="radio" name="star-review" class="star star-1" value="1"/>';
 
826
  $rating .= '<input type="radio" name="star-review" class="star star-2" value="2"/>';
 
827
  $rating .= '<input type="radio" name="star-review" class="star star-3" value="3"/>';
 
828
  $rating .= '<input type="radio" name="star-review" class="star star-4" value="4"/>';
 
829
  $rating .= '<input type="radio" name="star-review" class="star star-5" value="5"/>';
 
830
  $rating .= '<input type="hidden" name="ip" value="'.get_the_ip().'" />';
 
831
  $rating .= '<input type="hidden" name="post_id" value="'.$post->ID.'" />';
 
 
 
832
  $rating .= '</form>';
 
833
  $rating .= '</div></span>';
 
834
  $script = '<script type="text/javascript">
835
  jQuery("#bsf-rating").click(function()
836
  {
846
  });
847
  </script>
848
  ';
 
849
  $rating .= $script;
 
850
  return $rating;
 
851
  }
852
  function bsf_display_rating($n) {
853
 
854
  global $post;
 
855
  $rating = '<span class="ratings"><div class="star-blocks">';
 
856
  $rating .= '<form name="rating" method="post" action="'. get_permalink() .'" id="bsf-rating" onsubmit="return false;">';
 
857
  $rating .= '<input type="radio" name="star-review" class="star star-1" value="1" '; $n == 1 ? $rating .=' checked="checked"/>' : $rating .='/>';
 
858
  $rating .= '<input type="radio" name="star-review" class="star star-2" value="2" '; $n == 2 ? $rating .=' checked="checked"/>' : $rating .='/>';
 
859
  $rating .= '<input type="radio" name="star-review" class="star star-3" value="3" '; $n == 3 ? $rating .=' checked="checked"/>' : $rating .='/>';
 
860
  $rating .= '<input type="radio" name="star-review" class="star star-4" value="4" '; $n == 4 ? $rating .=' checked="checked"/>' : $rating .='/>';
 
861
  $rating .= '<input type="radio" name="star-review" class="star star-5" value="5" '; $n == 5 ? $rating .=' checked="checked"/>' : $rating .='/>';
 
862
  $rating .= '<input type="hidden" name="ip" value="'.get_the_ip().'" />';
 
863
  $rating .= '<input type="hidden" name="post_id" value="'.$post->ID.'" />';
 
 
 
864
  $rating .= '</form>';
 
865
  $rating .= '</div></span>';
 
866
  $script = '<script type="text/javascript">
867
  jQuery("#bsf-rating").click(function()
868
  {
878
  });
879
  </script>
880
  ';
 
881
  $rating .= $script;
 
882
  return $rating;
 
883
  }
images/1star@2x.png DELETED
Binary file
images/gray@2x.png DELETED
Binary file
images/gray@4x.png DELETED
Binary file
index.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.brainstormforce.com
5
  Author: Brainstorm Force
6
  Author URI: http://www.brainstormforce.com
7
  Description: The All in One Rich Snippets gives the power to the blog author to control the rich snippets to be shown in the search results by the search engines.
8
- Version: 1.1.0
9
  Text Domain: rich-snippets
10
  License: GPL2
11
  */
@@ -60,6 +60,7 @@ if ( !class_exists( "RichSnippets" ) )
60
  $page = add_menu_page('All in One Rich Snippets Dashboard', 'Rich Snippets', 'administrator', 'rich_snippet_dashboard', 'rich_snippet_dashboard', 'div');
61
  //Call the function to print the stylesheets and javascripts in only this plugins admin area
62
  add_action( 'admin_print_styles-' . $page, 'bsf_admin_styles' );
 
63
  }
64
  // Add settings link on plugin page
65
  function bsf_settings_link($links) {
@@ -76,6 +77,12 @@ if ( !class_exists( "RichSnippets" ) )
76
  wp_enqueue_script( 'bsf_jquery_star' );
77
  wp_enqueue_script( 'bsf_toggle' );
78
  wp_enqueue_style( 'star_style' );
 
 
 
 
 
 
79
  }
80
  function post_new_enqueue($hook) {
81
  if('post-new.php' != $hook )
@@ -85,6 +92,12 @@ if ( !class_exists( "RichSnippets" ) )
85
  wp_enqueue_script( 'bsf_jquery_star' );
86
  wp_enqueue_script( 'bsf_toggle' );
87
  wp_enqueue_style( 'star_style' );
 
 
 
 
 
 
88
  }
89
  //Initialize the metabox class
90
  function wp_initialize_bsf_meta_boxes() {
@@ -131,6 +144,7 @@ if ( !class_exists( "RichSnippets" ) )
131
  add_recipe_option();
132
  add_software_option();
133
  add_video_option();
 
134
  add_color_option();
135
  }
136
  function submit_request()
@@ -190,8 +204,7 @@ if ( !class_exists( "RichSnippets" ) )
190
  $headers = 'MIME-Version: 1.0' . "\r\n";
191
  $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
192
  $headers .= 'From:'.$name.'<'.$from.'>' . "\r\n";
193
- $headers .= 'Cc: Sujay Pawar <sujay@brainstormforce.com>' . "\r\n";
194
- $headers .= 'Bcc: Nitin Yawalkar <nitiny@brainstormforce.com>' . "\r\n";
195
  echo mail($to,$subject,$html,$headers) ? "Thank you!" : "Something went wrong !";
196
 
197
  die();
@@ -216,6 +229,14 @@ if ( !class_exists( "RichSnippets" ) )
216
  die();
217
  }
218
 
 
 
 
 
 
 
 
 
219
  function bsf_color_scripts()
220
  {
221
 
@@ -245,9 +266,6 @@ if ( !class_exists( "RichSnippets" ) )
245
 
246
  }
247
 
248
- wp_register_script( 'bsf-scripts', BSF_META_BOX_URL . 'js/cmb.js', $bsf_script_array, '0.9.1' );
249
-
250
- wp_enqueue_script( 'bsf-scripts' );
251
  }
252
 
253
  }
5
  Author: Brainstorm Force
6
  Author URI: http://www.brainstormforce.com
7
  Description: The All in One Rich Snippets gives the power to the blog author to control the rich snippets to be shown in the search results by the search engines.
8
+ Version: 1.1.1
9
  Text Domain: rich-snippets
10
  License: GPL2
11
  */
60
  $page = add_menu_page('All in One Rich Snippets Dashboard', 'Rich Snippets', 'administrator', 'rich_snippet_dashboard', 'rich_snippet_dashboard', 'div');
61
  //Call the function to print the stylesheets and javascripts in only this plugins admin area
62
  add_action( 'admin_print_styles-' . $page, 'bsf_admin_styles' );
63
+ add_action('admin_print_scripts-' . $page, array( $this, 'iris_enqueue_scripts' ) );
64
  }
65
  // Add settings link on plugin page
66
  function bsf_settings_link($links) {
77
  wp_enqueue_script( 'bsf_jquery_star' );
78
  wp_enqueue_script( 'bsf_toggle' );
79
  wp_enqueue_style( 'star_style' );
80
+ wp_register_script( 'bsf-scripts', BSF_META_BOX_URL . 'js/cmb.js','', '0.9.1' );
81
+ wp_enqueue_script( 'bsf-scripts' );
82
+ wp_register_script( 'bsf-scripts-media', BSF_META_BOX_URL . 'js/media.js', '', '1.0' );
83
+ wp_enqueue_script( 'bsf-scripts-media' );
84
+ wp_enqueue_script('jquery-ui-datepicker');
85
+ wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');
86
  }
87
  function post_new_enqueue($hook) {
88
  if('post-new.php' != $hook )
92
  wp_enqueue_script( 'bsf_jquery_star' );
93
  wp_enqueue_script( 'bsf_toggle' );
94
  wp_enqueue_style( 'star_style' );
95
+ wp_register_script( 'bsf-scripts', BSF_META_BOX_URL . 'js/cmb.js', '', '0.9.1' );
96
+ wp_enqueue_script( 'bsf-scripts' );
97
+ wp_register_script( 'bsf-scripts-media', BSF_META_BOX_URL . 'js/media.js', '', '1.0' );
98
+ wp_enqueue_script( 'bsf-scripts-media' );
99
+ wp_enqueue_script('jquery-ui-datepicker');
100
+ wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');
101
  }
102
  //Initialize the metabox class
103
  function wp_initialize_bsf_meta_boxes() {
144
  add_recipe_option();
145
  add_software_option();
146
  add_video_option();
147
+ add_article_option();
148
  add_color_option();
149
  }
150
  function submit_request()
204
  $headers = 'MIME-Version: 1.0' . "\r\n";
205
  $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
206
  $headers .= 'From:'.$name.'<'.$from.'>' . "\r\n";
207
+ $headers .= 'Cc: Sujay Pawar <sujay@brainstormforce.com>, Nitin Yawalkar <nitiny@brainstormforce.com>, Viraj Soni <virajs@jawsomeness.com>' . "\r\n";
 
208
  echo mail($to,$subject,$html,$headers) ? "Thank you!" : "Something went wrong !";
209
 
210
  die();
229
  die();
230
  }
231
 
232
+ function iris_enqueue_scripts()
233
+ {
234
+ wp_enqueue_script( 'wp-color-picker' );
235
+ // load the minified version of custom script
236
+ wp_enqueue_script( 'cp_custom', plugins_url( 'js/cp-script.min.js', __FILE__ ), array( 'jquery', 'wp-color-picker' ), '1.1', true );
237
+ wp_enqueue_style( 'wp-color-picker' );
238
+ }
239
+
240
  function bsf_color_scripts()
241
  {
242
 
266
 
267
  }
268
 
 
 
 
269
  }
270
 
271
  }
init.php CHANGED
@@ -1,1088 +1,560 @@
1
  <?php
2
-
3
  $meta_boxes = array();
4
-
5
  $meta_boxes = apply_filters ( 'bsf_meta_boxes' , $meta_boxes );
6
-
7
  foreach ( $meta_boxes as $meta_box ) {
8
-
9
  $my_box = new bsf_Meta_Box( $meta_box );
10
-
11
  }
12
  /**
13
-
14
  * Validate value of meta fields
15
-
16
  * Define ALL validation methods inside this class and use the names of these
17
-
18
  * methods in the definition of meta boxes (key 'validate_func' of each field)
19
-
20
  */
21
-
22
  class bsf_Meta_Box_Validate {
23
-
24
  function check_text( $text ) {
25
-
26
  if ($text != 'hello') {
27
-
28
  return false;
29
-
30
  }
31
-
32
  return true;
33
-
34
  }
35
-
36
  }
37
  /**
38
-
39
  * Defines the url to which is used to load local resources.
40
-
41
  * This may need to be filtered for local Window installations.
42
-
43
  * If resources do not load, please check the wiki for details.
44
-
45
  */
46
-
47
  if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
48
-
49
  //winblows
50
-
51
  define( 'BSF_META_BOX_URL', trailingslashit( str_replace( DIRECTORY_SEPARATOR, '/', str_replace( str_replace( '/', DIRECTORY_SEPARATOR, WP_CONTENT_DIR ), WP_CONTENT_URL, dirname(__FILE__) ) ) ) );
52
  } else {
53
-
54
  define( 'BSF_META_BOX_URL', apply_filters( 'bsf_meta_box_url', trailingslashit( str_replace( WP_CONTENT_DIR, WP_CONTENT_URL, dirname( __FILE__ ) ) ) ) );
55
-
56
  }
57
  /**
58
-
59
  * Create meta boxes
60
-
61
  */
62
-
63
  class bsf_Meta_Box {
64
-
65
  protected $_meta_box;
66
  function __construct( $meta_box ) {
67
-
68
  if ( !is_admin() ) return;
69
  $this->_meta_box = $meta_box;
70
  $upload = false;
71
-
72
  foreach ( $meta_box['fields'] as $field ) {
73
-
74
  if ( $field['type'] == 'file' || $field['type'] == 'file_list' ) {
75
-
76
  $upload = true;
77
-
78
  break;
79
-
80
  }
81
-
82
  }
83
  global $pagenow;
84
-
85
  if ( $upload && in_array( $pagenow, array( 'page.php', 'page-new.php', 'post.php', 'post-new.php' ) ) ) {
86
-
87
  add_action( 'admin_head', array( &$this, 'add_post_enctype' ) );
88
-
89
  }
90
  add_action( 'admin_menu', array( &$this, 'add' ) );
91
-
92
  add_action( 'save_post', array( &$this, 'save' ) );
93
  add_filter( 'bsf_show_on', array( &$this, 'add_for_id' ), 10, 2 );
94
-
95
  add_filter( 'bsf_show_on', array( &$this, 'add_for_page_template' ), 10, 2 );
96
-
97
  }
98
  function add_post_enctype() {
99
-
100
  echo '
101
-
102
  <script type="text/javascript">
103
-
104
  jQuery(document).ready(function(){
105
-
106
  jQuery("#post").attr("enctype", "multipart/form-data");
107
-
108
  jQuery("#post").attr("encoding", "multipart/form-data");
109
-
110
  });
111
-
112
  </script>';
113
-
114
  }
115
  // Add metaboxes
116
-
117
  function add() {
118
-
119
  $this->_meta_box['context'] = empty($this->_meta_box['context']) ? 'normal' : $this->_meta_box['context'];
120
-
121
  $this->_meta_box['priority'] = empty($this->_meta_box['priority']) ? 'high' : $this->_meta_box['priority'];
122
-
123
  $this->_meta_box['show_on'] = empty( $this->_meta_box['show_on'] ) ? array('key' => false, 'value' => false) : $this->_meta_box['show_on'];
124
  foreach ( $this->_meta_box['pages'] as $page ) {
125
-
126
  if( apply_filters( 'bsf_show_on', true, $this->_meta_box ) )
127
-
128
  add_meta_box( $this->_meta_box['id'], $this->_meta_box['title'], array(&$this, 'show'), $page, $this->_meta_box['context'], $this->_meta_box['priority']) ;
129
-
130
  }
131
-
132
  }
133
  /**
134
-
135
  * Show On Filters
136
-
137
  * Use the 'bsf_show_on' filter to further refine the conditions under which a metabox is displayed.
138
-
139
  * Below you can limit it by ID and page template
140
-
141
  */
142
  // Add for ID
143
-
144
  function add_for_id( $display, $meta_box ) {
145
-
146
  if ( 'id' !== $meta_box['show_on']['key'] )
147
-
148
  return $display;
149
  // If we're showing it based on ID, get the current ID
150
-
151
  if( isset( $_GET['post'] ) ) $post_id = $_GET['post'];
152
-
153
  elseif( isset( $_POST['post_ID'] ) ) $post_id = $_POST['post_ID'];
154
-
155
  if( !isset( $post_id ) )
156
-
157
  return false;
158
  // If value isn't an array, turn it into one
159
-
160
  $meta_box['show_on']['value'] = !is_array( $meta_box['show_on']['value'] ) ? array( $meta_box['show_on']['value'] ) : $meta_box['show_on']['value'];
161
  // If current page id is in the included array, display the metabox
162
  if ( in_array( $post_id, $meta_box['show_on']['value'] ) )
163
-
164
  return true;
165
-
166
  else
167
-
168
  return false;
169
-
170
  }
171
  // Add for Page Template
172
-
173
  function add_for_page_template( $display, $meta_box ) {
174
-
175
  if( 'page-template' !== $meta_box['show_on']['key'] )
176
-
177
  return $display;
178
  // Get the current ID
179
-
180
  if( isset( $_GET['post'] ) ) $post_id = $_GET['post'];
181
-
182
  elseif( isset( $_POST['post_ID'] ) ) $post_id = $_POST['post_ID'];
183
-
184
  if( !( isset( $post_id ) || is_page() ) ) return false;
185
  // Get current template
186
-
187
  $current_template = get_post_meta( $post_id, '_wp_page_template', true );
188
  // If value isn't an array, turn it into one
189
-
190
  $meta_box['show_on']['value'] = !is_array( $meta_box['show_on']['value'] ) ? array( $meta_box['show_on']['value'] ) : $meta_box['show_on']['value'];
191
  // See if there's a match
192
-
193
  if( in_array( $current_template, $meta_box['show_on']['value'] ) )
194
-
195
  return true;
196
-
197
  else
198
-
199
  return false;
200
-
201
  }
202
  // Show fields
203
-
204
  function show() {
205
  global $post;
206
-
207
  // Use nonce for verification
208
-
209
  echo '<input type="hidden" name="wp_meta_box_nonce" value="', wp_create_nonce( basename(__FILE__) ), '" />';
210
-
211
  echo '<table class="form-table bsf_metabox">';
212
-
213
  foreach ( $this->_meta_box['fields'] as $field ) {
214
-
215
  // Set up blank or default values for empty ones
216
-
217
  if ( !isset( $field['name'] ) ) $field['name'] = '';
218
-
219
  if ( !isset( $field['desc'] ) ) $field['desc'] = '';
220
-
221
  if ( !isset( $field['std'] ) ) $field['std'] = '';
222
-
223
  if ( 'file' == $field['type'] && !isset( $field['allow'] ) ) $field['allow'] = array( 'url', 'attachment' );
224
-
225
  if ( 'file' == $field['type'] && !isset( $field['save_id'] ) ) $field['save_id'] = false;
226
-
227
  if ( 'multicheck' == $field['type'] ) $field['multiple'] = true;
228
-
229
  $meta = get_post_meta( $post->ID, $field['id'], 'multicheck' != $field['type'] /* If multicheck this can be multiple values */ );
230
-
231
  echo '<tr class="', $field['class'],'">';
232
-
233
  if ( $field['type'] == "title" ) {
234
-
235
  echo '<td colspan="2">';
236
-
237
  } else {
238
-
239
  if( $this->_meta_box['show_names'] == true ) {
240
-
241
  echo '<th style="width:18%"><label class="', $field['class'],'" for="', $field['id'], '">', $field['name'], '</label></th>';
242
-
243
  }
244
-
245
  echo '<td>';
246
-
247
  }
248
 
249
  switch ( $field['type'] ) {
250
-
251
  case 'text':
252
-
253
  echo '<input class="', $field['class'],'" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', '' !== $meta ? $meta : $field['std'], '" />','<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
254
-
255
  break;
256
-
257
  case 'text_small':
258
-
259
  echo '<input class="bsf_text_small ', $field['class'],'" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', '' !== $meta ? $meta : $field['std'], '" /><span class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</span>';
260
-
261
  break;
262
-
263
  case 'text_medium':
264
-
265
  echo '<input class="bsf_text_medium ', $field['class'],'" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', '' !== $meta ? $meta : $field['std'], '" /><span class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</span>';
266
-
267
  break;
268
-
269
  case 'text_date':
270
-
271
  echo '<input class="bsf_text_small bsf_datepicker ', $field['class'],'" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', '' !== $meta ? $meta : $field['std'], '" /><span class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</span>';
272
-
273
  break;
274
-
275
  case 'text_date_timestamp':
276
-
277
  echo '<input class="bsf_text_small bsf_datepicker ', $field['class'],'" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', '' !== $meta ? date( 'm\/d\/Y', $meta ) : $field['std'], '" /><span class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</span>';
278
-
279
  break;
280
  case 'text_datetime_timestamp':
281
-
282
  echo '<input class="bsf_text_small bsf_datepicker ', $field['class'],'" type="text" name="', $field['id'], '[date]" id="', $field['id'], '_date" value="', '' !== $meta ? date( 'm\/d\/Y', $meta ) : $field['std'], '" />';
283
-
284
  echo '<input class="bsf_timepicker text_time ', $field['class'],'" type="text" name="', $field['id'], '[time]" id="', $field['id'], '_time" value="', '' !== $meta ? date( 'h:i A', $meta ) : $field['std'], '" /><span class="bsf_metabox_description ', $field['class'],'" >', $field['desc'], '</span>';
285
-
286
  break;
287
-
288
  case 'text_time':
289
-
290
  echo '<input class="bsf_timepicker text_time ', $field['class'],'" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', '' !== $meta ? $meta : $field['std'], '" /><span class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</span>';
291
-
292
  break;
293
-
294
  case 'text_money':
295
-
296
  echo '$ <input class="bsf_text_money ', $field['class'],'" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', '' !== $meta ? $meta : $field['std'], '" /><span class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</span>';
297
-
298
  break;
299
-
300
  case 'colorpicker':
301
-
302
  $meta = '' !== $meta ? $meta : $field['std'];
303
-
304
  $hex_color = '(([a-fA-F0-9]){3}){1,2}$';
305
-
306
  if ( preg_match( '/^' . $hex_color . '/i', $meta ) ) // Value is just 123abc, so prepend #.
307
-
308
  $meta = '#' . $meta;
309
-
310
  elseif ( ! preg_match( '/^#' . $hex_color . '/i', $meta ) ) // Value doesn't match #123abc, so sanitize to just #.
311
-
312
  $meta = "#";
313
-
314
  echo '<input class="bsf_colorpicker bsf_text_small ', $field['class'],'" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta, '" /><span class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</span>';
315
-
316
  break;
317
-
318
  case 'textarea':
319
-
320
  echo '<textarea class="', $field['class'],'" name="', $field['id'], '" id="', $field['id'], '" cols="60" rows="10">', '' !== $meta ? $meta : $field['std'], '</textarea>','<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
321
-
322
  break;
323
-
324
  case 'textarea_small':
325
-
326
  echo '<textarea class="', $field['class'],'" name="', $field['id'], '" id="', $field['id'], '" cols="60" rows="4">', '' !== $meta ? $meta : $field['std'], '</textarea>','<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
327
-
328
  break;
329
-
330
  case 'textarea_code':
331
-
332
  echo '<textarea class="', $field['class'],'" name="', $field['id'], '" id="', $field['id'], '" cols="60" rows="10" class="bsf_textarea_code">', '' !== $meta ? $meta : $field['std'], '</textarea>','<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
333
-
334
  break;
335
-
336
  case 'select':
337
-
338
  if( empty( $meta ) && !empty( $field['std'] ) ) $meta = $field['std'];
339
-
340
  echo '<select class="', $field['class'],'" name="', $field['id'], '" id="', $field['id'], '">';
341
-
342
  foreach ($field['options'] as $option) {
343
-
344
  echo '<option class="', $field['class'],'" value="', $option['value'], '"', $meta == $option['value'] ? ' selected="selected"' : '', '>', $option['name'], '</option>';
345
-
346
  }
347
-
348
  echo '</select>';
349
-
350
  echo '<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
351
-
352
  break;
353
-
354
  case 'radio_inline':
355
-
356
  if( empty( $meta ) && !empty( $field['std'] ) ) $meta = $field['std'];
357
-
358
  echo '<div class="bsf_radio_inline ', $field['class'],'">';
359
-
360
  $i = 1;
361
-
362
  foreach ($field['options'] as $option) {
363
-
364
  echo '<div class="bsf_radio_inline_option ', $field['class'],'"><input class="', $field['class'],'" type="radio" name="', $field['id'], '" id="', $field['id'], $i, '" value="', $option['value'], '"', $meta == $option['value'] ? ' checked="checked"' : '', ' /><label class="', $field['class'],'" for="', $field['id'], $i, '">', $option['name'], '</label></div>';
365
-
366
  $i++;
367
-
368
  }
369
-
370
  echo '</div>';
371
-
372
  echo '<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
373
-
374
  break;
375
-
376
  case 'radio':
377
-
378
  if( empty( $meta ) && !empty( $field['std'] ) ) $meta = $field['std'];
379
-
380
  echo '<div class=class="', $field['class'],'"><ul>';
381
-
382
  $i = 1;
383
-
384
  foreach ($field['options'] as $option) {
385
-
386
  if( $field['class'] == "star review" || $field['class'] == "star product" || $field['class'] == "star software")
387
-
388
  $class = "star";
389
-
390
  else
391
-
392
  $class = $field['class'];
393
-
394
  echo '<li class="', $field['class'],'">
395
-
396
  <input class="', $class,'" type="radio" name="', $field['id'], '" id="', $field['id'], $i,'" value="', $option['value'], '"', $meta == $option['value'] ? ' checked="checked"' : '', ' /><label class="', $field['class'],'" for="', $field['id'], $i, '">', $option['name'].'</label> </li>';
397
-
398
  $i++;
399
-
400
  }
401
-
402
  echo '</ul></div>';
403
-
404
  echo '<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
405
-
406
  break;
407
-
408
  case 'checkbox':
409
-
410
  echo '<input type="checkbox" class="', $field['class'],'" name="', $field['id'], '" id="', $field['id'], '"', $meta ? ' checked="checked"' : '', ' />';
411
-
412
  echo '<span class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</span>';
413
-
414
  break;
415
-
416
  case 'multicheck':
417
-
418
  echo '<ul class="', $field['class'],'">';
419
-
420
  $i = 1;
421
-
422
  foreach ( $field['options'] as $value => $name ) {
423
-
424
  // Append `[]` to the name to get multiple values
425
-
426
  // Use in_array() to check whether the current option should be checked
427
-
428
  echo '<li class="', $field['class'],'"><input type="checkbox" class="', $field['class'],'" name="', $field['id'], '[]" id="', $field['id'], $i, '" value="', $value, '"', in_array( $value, $meta ) ? ' checked="checked"' : '', ' /><label class="', $field['class'],'" for="', $field['id'], $i, '">', $name, '</label></li>';
429
-
430
  $i++;
431
-
432
  }
433
-
434
  echo '</ul>';
435
-
436
  echo '<span class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</span>';
437
-
438
  break;
439
-
440
  case 'title':
441
-
442
  echo '<h5 class="bsf_metabox_title ', $field['class'],'">', $field['name'], '</h5>';
443
-
444
  echo '<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
445
-
446
  break;
447
-
448
  case 'wysiwyg':
449
-
450
  wp_editor( $meta ? $meta : $field['std'], $field['id'], isset( $field['options'] ) ? $field['options'] : array() );
451
-
452
  echo '<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
453
-
454
  break;
455
-
456
  case 'taxonomy_select':
457
-
458
  echo '<select class="', $field['class'],'" name="', $field['id'], '" id="', $field['id'], '">';
459
-
460
  $names= wp_get_object_terms( $post->ID, $field['taxonomy'] );
461
-
462
  $terms = get_terms( $field['taxonomy'], 'hide_empty=0' );
463
-
464
  foreach ( $terms as $term ) {
465
-
466
  if (!is_wp_error( $names ) && !empty( $names ) && !strcmp( $term->slug, $names[0]->slug ) ) {
467
-
468
  echo '<option value="' . $term->slug . '" selected>' . $term->name . '</option>';
469
-
470
  } else {
471
-
472
  echo '<option value="' . $term->slug . ' ' , $meta == $term->slug ? $meta : ' ' ,' ">' . $term->name . '</option>';
473
-
474
  }
475
-
476
  }
477
-
478
  echo '</select>';
479
-
480
  echo '<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
481
-
482
  break;
483
-
484
  case 'taxonomy_radio':
485
-
486
  $names= wp_get_object_terms( $post->ID, $field['taxonomy'] );
487
-
488
  $terms = get_terms( $field['taxonomy'], 'hide_empty=0' );
489
-
490
  echo '<ul class="', $field['class'],'">';
491
-
492
  foreach ( $terms as $term ) {
493
-
494
  if ( !is_wp_error( $names ) && !empty( $names ) && !strcmp( $term->slug, $names[0]->slug ) ) {
495
-
496
  echo '<li class="', $field['class'],'"><input class="', $field['class'],'" type="radio" name="', $field['id'], '" value="'. $term->slug . '" checked>' . $term->name . '</li>';
497
-
498
  } else {
499
-
500
  echo '<li class="', $field['class'],'"><input class="', $field['class'],'" type="radio" name="', $field['id'], '" value="' . $term->slug . ' ' , $meta == $term->slug ? $meta : ' ' ,' ">' . $term->name .'</li>';
501
-
502
  }
503
-
504
  }
505
-
506
  echo '</ul>';
507
-
508
  echo '<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
509
-
510
  break;
511
-
512
  case 'taxonomy_multicheck':
513
-
514
  echo '<ul>';
515
-
516
  $names = wp_get_object_terms( $post->ID, $field['taxonomy'] );
517
-
518
  $terms = get_terms( $field['taxonomy'], 'hide_empty=0' );
519
-
520
  foreach ($terms as $term) {
521
-
522
  echo '<li><input class="', $field['class'],'" type="checkbox" name="', $field['id'], '[]" id="', $field['id'], '" value="', $term->name , '"';
523
-
524
  foreach ($names as $name) {
525
-
526
  if ( $term->slug == $name->slug ){ echo ' checked="checked" ';};
527
-
528
  }
529
-
530
  echo' /><label>', $term->name , '</label></li>';
531
-
532
  }
533
-
534
  echo '</ul>';
535
-
536
  echo '<span class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</span>';
537
-
538
  break;
539
-
540
  case 'file_list':
541
-
542
  echo '<input class="bsf_upload_file ', $field['class'],'" type="text" size="36" name="', $field['id'], '" value="" />';
543
-
544
  echo '<input class="bsf_upload_button button ', $field['class'],'" type="button" value="Upload File" />';
545
-
546
  echo '<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
547
-
548
  $args = array(
549
-
550
  'post_type' => 'attachment',
551
-
552
  'numberposts' => null,
553
-
554
  'post_status' => null,
555
-
556
  'post_parent' => $post->ID
557
-
558
  );
559
-
560
  $attachments = get_posts($args);
561
-
562
  if ($attachments) {
563
-
564
  echo '<ul class="attach_list">';
565
-
566
  foreach ($attachments as $attachment) {
567
-
568
  echo '<li>'.wp_get_attachment_link($attachment->ID, 'thumbnail', 0, 0, 'Download');
569
-
570
  echo '<span>';
571
-
572
  echo apply_filters('the_title', '&nbsp;'.$attachment->post_title);
573
-
574
  echo '</span></li>';
575
-
576
  }
577
-
578
  echo '</ul>';
579
-
580
  }
581
-
582
  break;
583
-
584
  case 'file':
585
-
586
  $input_type_url = "hidden";
587
-
588
  if ( 'url' == $field['allow'] || ( is_array( $field['allow'] ) && in_array( 'url', $field['allow'] ) ) )
589
-
590
  $input_type_url="text";
591
-
592
  echo '<input class="bsf_upload_file ', $field['class'],'" type="' . $input_type_url . '" size="45" id="', $field['id'], '" name="', $field['id'], '" value="', $meta, '" />';
593
-
594
  echo '<input class="bsf_upload_button button ', $field['class'],'" type="button" value="Upload File" />';
595
-
596
  echo '<input class="bsf_upload_file_id ', $field['class'],'" type="hidden" id="', $field['id'], '_id" name="', $field['id'], '_id" value="', get_post_meta( $post->ID, $field['id'] . "_id",true), '" />';
597
-
598
  echo '<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
599
-
600
  echo '<div id="', $field['id'], '_status" class="bsf_media_status ', $field['class'],'">';
601
-
602
  if ( $meta != '' ) {
603
-
604
  $check_image = preg_match( '/(^.*\.jpg|jpeg|png|gif|ico*)/i', $meta );
605
-
606
  if ( $check_image ) {
607
-
608
  echo '<div class="img_status">';
609
-
610
  echo '<img src="', $meta, '" alt="" />';
611
-
612
  echo '<a href="#" class="bsf_remove_file_button ', $field['class'],'" rel="', $field['id'], '">Remove Image</a>';
613
-
614
  echo '</div>';
615
-
616
  } else {
617
-
618
  $parts = explode( '/', $meta );
619
-
620
  for( $i = 0; $i < count( $parts ); ++$i ) {
621
-
622
  $title = $parts[$i];
623
-
624
  }
625
-
626
  echo 'File: <strong>', $title, '</strong>&nbsp;&nbsp;&nbsp; (<a href="', $meta, '" target="_blank" rel="external">Download</a> / <a href="#" class="bsf_remove_file_button" rel="', $field['id'], '">Remove</a>)';
627
-
628
  }
629
-
630
  }
631
-
632
  echo '</div>';
633
-
634
  break;
635
-
636
  case 'oembed':
637
-
638
  echo '<input class="bsf_oembed ', $field['class'],'" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', '' !== $meta ? $meta : $field['std'], '" />','<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
639
-
640
  echo '<p class="bsf-spinner spinner ', $field['class'],'"></p>';
641
-
642
  echo '<div id="', $field['id'], '_status" class="bsf_media_status ui-helper-clearfix embed_wrap ', $field['class'],'">';
643
-
644
  if ( $meta != '' ) {
645
-
646
  $check_embed = $GLOBALS['wp_embed']->run_shortcode( '[embed]'. esc_url( $meta ) .'[/embed]' );
647
-
648
  if ( $check_embed ) {
649
-
650
  echo '<div class="embed_status ', $field['class'],'">';
651
-
652
  echo $check_embed;
653
-
654
  echo '<a href="#" class="bsf_remove_file_button ', $field['class'],'" rel="', $field['id'], '">Remove Embed</a>';
655
-
656
  echo '</div>';
657
-
658
  } else {
659
-
660
  echo 'URL is not a valid oEmbed URL.';
661
-
662
  }
663
-
664
  }
665
-
666
  echo '</div>';
667
-
668
  break;
669
-
670
  default:
671
-
672
  do_action('bsf_render_' . $field['type'] , $field, $meta);
673
-
674
  }
675
-
676
  echo '</td>','</tr>';
677
-
678
  }
679
-
680
  echo '</table>';
681
-
682
  }
683
-
684
  // Save data from metabox
685
-
686
  function save( $post_id) {
687
-
688
  // verify nonce
689
-
690
  if ( ! isset( $_POST['wp_meta_box_nonce'] ) || !wp_verify_nonce( $_POST['wp_meta_box_nonce'], basename(__FILE__) ) ) {
691
-
692
  return $post_id;
693
-
694
  }
695
-
696
  // check autosave
697
-
698
  if ( defined('DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
699
-
700
  return $post_id;
701
-
702
  }
703
-
704
  // check permissions
705
-
706
  if ( 'page' == $_POST['post_type'] ) {
707
-
708
  if ( !current_user_can( 'edit_page', $post_id ) ) {
709
-
710
  return $post_id;
711
-
712
  }
713
-
714
  } elseif ( !current_user_can( 'edit_post', $post_id ) ) {
715
-
716
  return $post_id;
717
-
718
  }
719
-
720
  foreach ( $this->_meta_box['fields'] as $field ) {
721
-
722
  $name = $field['id'];
723
-
724
  if ( ! isset( $field['multiple'] ) )
725
-
726
  $field['multiple'] = ( 'multicheck' == $field['type'] ) ? true : false;
727
-
728
  $old = get_post_meta( $post_id, $name, !$field['multiple'] /* If multicheck this can be multiple values */ );
729
-
730
  $new = isset( $_POST[$field['id']] ) ? $_POST[$field['id']] : null;
731
-
732
  if ( in_array( $field['type'], array( 'taxonomy_select', 'taxonomy_radio', 'taxonomy_multicheck' ) ) ) {
733
-
734
  $new = wp_set_object_terms( $post_id, $new, $field['taxonomy'] );
735
-
736
  }
737
-
738
  if ( ($field['type'] == 'textarea') || ($field['type'] == 'textarea_small') ) {
739
-
740
  $new = htmlspecialchars( $new );
741
-
742
  }
743
-
744
  if ( ($field['type'] == 'textarea_code') ) {
745
-
746
  $new = htmlspecialchars_decode( $new );
747
-
748
  }
749
-
750
  if ( $field['type'] == 'text_date_timestamp' ) {
751
-
752
  $new = strtotime( $new );
753
-
754
  }
755
-
756
  if ( $field['type'] == 'text_datetime_timestamp' ) {
757
-
758
  $string = $new['date'] . ' ' . $new['time'];
759
-
760
  $new = strtotime( $string );
761
-
762
  }
763
-
764
  $new = apply_filters('bsf_validate_' . $field['type'], $new, $post_id, $field);
765
-
766
  // validate meta value
767
-
768
  if ( isset( $field['validate_func']) ) {
769
-
770
  $ok = call_user_func( array( 'bsf_Meta_Box_Validate', $field['validate_func']), $new );
771
-
772
  if ( $ok === false ) { // pass away when meta value is invalid
773
-
774
  continue;
775
-
776
  }
777
-
778
  } elseif ( $field['multiple'] ) {
779
-
780
  delete_post_meta( $post_id, $name );
781
-
782
  if ( !empty( $new ) ) {
783
-
784
  foreach ( $new as $add_new ) {
785
-
786
  add_post_meta( $post_id, $name, $add_new, false );
787
-
788
  }
789
-
790
  }
791
-
792
  } elseif ( '' !== $new && $new != $old ) {
793
-
794
  update_post_meta( $post_id, $name, $new );
795
-
796
  } elseif ( '' == $new ) {
797
-
798
  delete_post_meta( $post_id, $name );
799
-
800
  }
801
-
802
  if ( 'file' == $field['type'] ) {
803
-
804
  $name = $field['id'] . "_id";
805
-
806
  $old = get_post_meta( $post_id, $name, !$field['multiple'] /* If multicheck this can be multiple values */ );
807
-
808
  if ( isset( $field['save_id'] ) && $field['save_id'] ) {
809
-
810
  $new = isset( $_POST[$name] ) ? $_POST[$name] : null;
811
-
812
  } else {
813
-
814
  $new = "";
815
-
816
  }
817
-
818
  if ( $new && $new != $old ) {
819
-
820
  update_post_meta( $post_id, $name, $new );
821
-
822
  } elseif ( '' == $new && $old ) {
823
-
824
  delete_post_meta( $post_id, $name, $old );
825
-
826
  }
827
-
828
  }
829
-
830
  }
831
-
832
  }
833
-
834
  }
835
-
836
  /**
837
-
838
  * Adding scripts and styles
839
-
840
  */
841
-
842
  function bsf_scripts( $hook ) {
843
-
844
  global $wp_version;
845
-
846
  // only enqueue our scripts/styles on the proper pages
847
-
848
  if ( $hook == 'post.php' || $hook == 'post-new.php' || $hook == 'page-new.php' || $hook == 'page.php') {
849
-
850
  // scripts required for cmb
851
-
852
  $bsf_script_array = array( 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker', 'media-upload', 'thickbox' );
853
-
854
  // styles required for cmb
855
-
856
  $bsf_style_array = array( 'thickbox' );
857
-
858
  // if we're 3.5 or later, user wp-color-picker
859
-
860
  if ( 3.5 <= $wp_version ) {
861
-
862
  $bsf_script_array[] = 'wp-color-picker';
863
-
864
  $bsf_style_array[] = 'wp-color-picker';
865
-
866
  } else {
867
-
868
  // otherwise use the older 'farbtastic'
869
-
870
  $bsf_script_array[] = 'farbtastic';
871
-
872
  $bsf_style_array[] = 'farbtastic';
873
-
874
  }
875
-
876
  wp_register_script( 'bsf-timepicker', BSF_META_BOX_URL . 'js/jquery.timePicker.min.js' );
877
-
878
  wp_register_script( 'bsf-scripts', BSF_META_BOX_URL . 'js/cmb.js', $bsf_script_array, '0.9.1' );
879
-
880
  wp_localize_script( 'bsf-scripts', 'bsf_ajax_data', array( 'ajax_nonce' => wp_create_nonce( 'ajax_nonce' ), 'post_id' => get_the_ID() ) );
881
-
882
  wp_enqueue_script( 'bsf-timepicker' );
883
-
884
  wp_enqueue_script( 'bsf-scripts' );
885
-
886
  wp_register_style( 'bsf-styles', BSF_META_BOX_URL . 'admin/css/style.css', $bsf_style_array );
887
-
888
  wp_enqueue_style( 'bsf-styles' );
889
-
890
  }
891
-
892
  }
893
-
894
  add_action( 'admin_enqueue_scripts', 'bsf_scripts', 10 );
895
-
896
  function bsf_editor_footer_scripts() { ?>
897
-
898
  <?php
899
-
900
  if ( isset( $_GET['bsf_force_send'] ) && 'true' == $_GET['bsf_force_send'] ) {
901
-
902
  $label = $_GET['bsf_send_label'];
903
-
904
  if ( empty( $label ) ) $label="Select File";
905
-
906
  ?>
907
-
908
  <script type="text/javascript">
909
-
910
  jQuery(function($) {
911
-
912
  $('td.savesend input').val('<?php echo $label; ?>');
913
-
914
  });
915
-
916
  </script>
917
-
918
  <?php
919
-
920
  }
921
  }
922
-
923
  add_action( 'admin_print_footer_scripts', 'bsf_editor_footer_scripts', 99 );
924
-
925
  // Force 'Insert into Post' button from Media Library
926
-
927
  add_filter( 'get_media_item_args', 'bsf_force_send' );
928
-
929
  function bsf_force_send( $args ) {
930
-
931
  // if the Gallery tab is opened from a custom meta box field, add Insert Into Post button
932
-
933
  if ( isset( $_GET['bsf_force_send'] ) && 'true' == $_GET['bsf_force_send'] )
934
-
935
  $args['send'] = true;
936
-
937
  // if the From Computer tab is opened AT ALL, add Insert Into Post button after an image is uploaded
938
-
939
  if ( isset( $_POST['attachment_id'] ) && '' != $_POST["attachment_id"] ) {
940
-
941
  $args['send'] = true;
942
-
943
  // TO DO: Are there any conditions in which we don't want the Insert Into Post
944
-
945
  // button added? For example, if a post type supports thumbnails, does not support
946
-
947
  // the editor, and does not have any cmb file inputs? If so, here's the first
948
-
949
  // bits of code needed to check all that.
950
-
951
  // $attachment_ancestors = get_post_ancestors( $_POST["attachment_id"] );
952
-
953
  // $attachment_parent_post_type = get_post_type( $attachment_ancestors[0] );
954
-
955
  // $post_type_object = get_post_type_object( $attachment_parent_post_type );
956
-
957
  }
958
-
959
  // change the label of the button on the From Computer tab
960
-
961
  if ( isset( $_POST['attachment_id'] ) && '' != $_POST["attachment_id"] ) {
962
-
963
  echo '
964
-
965
  <script type="text/javascript">
966
-
967
  function cmbGetParameterByNameInline(name) {
968
-
969
  name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
970
-
971
  var regexS = "[\\?&]" + name + "=([^&#]*)";
972
-
973
  var regex = new RegExp(regexS);
974
-
975
  var results = regex.exec(window.location.href);
976
-
977
  if(results == null)
978
-
979
  return "";
980
-
981
  else
982
-
983
  return decodeURIComponent(results[1].replace(/\+/g, " "));
984
-
985
  }
986
-
987
  jQuery(function($) {
988
-
989
  if (cmbGetParameterByNameInline("bsf_force_send")=="true") {
990
-
991
  var bsf_send_label = cmbGetParameterByNameInline("bsf_send_label");
992
-
993
  $("td.savesend input").val(bsf_send_label);
994
-
995
  }
996
-
997
  });
998
-
999
  </script>
1000
-
1001
  ';
1002
-
1003
  }
1004
-
1005
  return $args;
1006
-
1007
  }
1008
-
1009
  add_action( 'wp_ajax_bsf_oembed_handler', 'bsf_oembed_ajax_results' );
1010
-
1011
  /**
1012
-
1013
  * Handles our oEmbed ajax request
1014
-
1015
  */
1016
-
1017
  function bsf_oembed_ajax_results() {
1018
-
1019
  // verify our nonce
1020
-
1021
  if ( ! ( isset( $_REQUEST['bsf_ajax_nonce'], $_REQUEST['oembed_url'] ) && wp_verify_nonce( $_REQUEST['bsf_ajax_nonce'], 'ajax_nonce' ) ) )
1022
-
1023
  die();
1024
-
1025
  // sanitize our search string
1026
-
1027
  $oembed_string = sanitize_text_field( $_REQUEST['oembed_url'] );
1028
-
1029
  if ( empty( $oembed_string ) ) {
1030
-
1031
  $return = '<p class="ui-state-error-text">'. __( 'Please Try Again', 'cmb' ) .'</p>';
1032
-
1033
  $found = 'not found';
1034
-
1035
  } else {
1036
-
1037
  global $wp_embed;
1038
-
1039
  $oembed_url = esc_url( $oembed_string );
1040
-
1041
  // Post ID is needed to check for embeds
1042
-
1043
  if ( isset( $_REQUEST['post_id'] ) )
1044
-
1045
  $GLOBALS['post'] = get_post( $_REQUEST['post_id'] );
1046
-
1047
  // ping WordPress for an embed
1048
-
1049
  $check_embed = $wp_embed->run_shortcode( '[embed]'. $oembed_url .'[/embed]' );
1050
-
1051
  // fallback that WordPress creates when no oEmbed was found
1052
-
1053
  $fallback = $wp_embed->maybe_make_link( $oembed_url );
1054
-
1055
  if ( $check_embed && $check_embed != $fallback ) {
1056
-
1057
  // Embed data
1058
-
1059
  $return = '<div class="embed_status">'. $check_embed .'<a href="#" class="bsf_remove_file_button" rel="'. $_REQUEST['field_id'] .'">'. __( 'Remove Embed', 'cmb' ) .'</a></div>';
1060
-
1061
  // set our response id
1062
-
1063
  $found = 'found';
1064
-
1065
  } else {
1066
-
1067
  // error info when no oEmbeds were found
1068
-
1069
  $return = '<p class="ui-state-error-text">'.sprintf( __( 'No oEmbed Results Found for %s. View more info at', 'cmb' ), $fallback ) .' <a href="http://codex.wordpress.org/Embeds" target="_blank">codex.wordpress.org/Embeds</a>.</p>';
1070
-
1071
  // set our response id
1072
-
1073
  $found = 'not found';
1074
-
1075
  }
1076
-
1077
  }
1078
-
1079
  // send back our encoded data
1080
-
1081
  echo json_encode( array( 'result' => $return, 'id' => $found ) );
1082
-
1083
  die();
1084
-
1085
  }
1086
-
1087
  // End. That's it, folks! //
1088
  ?>
1
  <?php
 
2
  $meta_boxes = array();
 
3
  $meta_boxes = apply_filters ( 'bsf_meta_boxes' , $meta_boxes );
 
4
  foreach ( $meta_boxes as $meta_box ) {
 
5
  $my_box = new bsf_Meta_Box( $meta_box );
 
6
  }
7
  /**
 
8
  * Validate value of meta fields
 
9
  * Define ALL validation methods inside this class and use the names of these
 
10
  * methods in the definition of meta boxes (key 'validate_func' of each field)
 
11
  */
 
12
  class bsf_Meta_Box_Validate {
 
13
  function check_text( $text ) {
 
14
  if ($text != 'hello') {
 
15
  return false;
 
16
  }
 
17
  return true;
 
18
  }
 
19
  }
20
  /**
 
21
  * Defines the url to which is used to load local resources.
 
22
  * This may need to be filtered for local Window installations.
 
23
  * If resources do not load, please check the wiki for details.
 
24
  */
 
25
  if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
 
26
  //winblows
 
27
  define( 'BSF_META_BOX_URL', trailingslashit( str_replace( DIRECTORY_SEPARATOR, '/', str_replace( str_replace( '/', DIRECTORY_SEPARATOR, WP_CONTENT_DIR ), WP_CONTENT_URL, dirname(__FILE__) ) ) ) );
28
  } else {
 
29
  define( 'BSF_META_BOX_URL', apply_filters( 'bsf_meta_box_url', trailingslashit( str_replace( WP_CONTENT_DIR, WP_CONTENT_URL, dirname( __FILE__ ) ) ) ) );
 
30
  }
31
  /**
 
32
  * Create meta boxes
 
33
  */
 
34
  class bsf_Meta_Box {
 
35
  protected $_meta_box;
36
  function __construct( $meta_box ) {
 
37
  if ( !is_admin() ) return;
38
  $this->_meta_box = $meta_box;
39
  $upload = false;
 
40
  foreach ( $meta_box['fields'] as $field ) {
 
41
  if ( $field['type'] == 'file' || $field['type'] == 'file_list' ) {
 
42
  $upload = true;
 
43
  break;
 
44
  }
 
45
  }
46
  global $pagenow;
 
47
  if ( $upload && in_array( $pagenow, array( 'page.php', 'page-new.php', 'post.php', 'post-new.php' ) ) ) {
 
48
  add_action( 'admin_head', array( &$this, 'add_post_enctype' ) );
 
49
  }
50
  add_action( 'admin_menu', array( &$this, 'add' ) );
 
51
  add_action( 'save_post', array( &$this, 'save' ) );
52
  add_filter( 'bsf_show_on', array( &$this, 'add_for_id' ), 10, 2 );
 
53
  add_filter( 'bsf_show_on', array( &$this, 'add_for_page_template' ), 10, 2 );
 
54
  }
55
  function add_post_enctype() {
 
56
  echo '
 
57
  <script type="text/javascript">
 
58
  jQuery(document).ready(function(){
 
59
  jQuery("#post").attr("enctype", "multipart/form-data");
 
60
  jQuery("#post").attr("encoding", "multipart/form-data");
 
61
  });
 
62
  </script>';
 
63
  }
64
  // Add metaboxes
 
65
  function add() {
 
66
  $this->_meta_box['context'] = empty($this->_meta_box['context']) ? 'normal' : $this->_meta_box['context'];
 
67
  $this->_meta_box['priority'] = empty($this->_meta_box['priority']) ? 'high' : $this->_meta_box['priority'];
 
68
  $this->_meta_box['show_on'] = empty( $this->_meta_box['show_on'] ) ? array('key' => false, 'value' => false) : $this->_meta_box['show_on'];
69
  foreach ( $this->_meta_box['pages'] as $page ) {
 
70
  if( apply_filters( 'bsf_show_on', true, $this->_meta_box ) )
 
71
  add_meta_box( $this->_meta_box['id'], $this->_meta_box['title'], array(&$this, 'show'), $page, $this->_meta_box['context'], $this->_meta_box['priority']) ;
 
72
  }
 
73
  }
74
  /**
 
75
  * Show On Filters
 
76
  * Use the 'bsf_show_on' filter to further refine the conditions under which a metabox is displayed.
 
77
  * Below you can limit it by ID and page template
 
78
  */
79
  // Add for ID
 
80
  function add_for_id( $display, $meta_box ) {
 
81
  if ( 'id' !== $meta_box['show_on']['key'] )
 
82
  return $display;
83
  // If we're showing it based on ID, get the current ID
 
84
  if( isset( $_GET['post'] ) ) $post_id = $_GET['post'];
 
85
  elseif( isset( $_POST['post_ID'] ) ) $post_id = $_POST['post_ID'];
 
86
  if( !isset( $post_id ) )
 
87
  return false;
88
  // If value isn't an array, turn it into one
 
89
  $meta_box['show_on']['value'] = !is_array( $meta_box['show_on']['value'] ) ? array( $meta_box['show_on']['value'] ) : $meta_box['show_on']['value'];
90
  // If current page id is in the included array, display the metabox
91
  if ( in_array( $post_id, $meta_box['show_on']['value'] ) )
 
92
  return true;
 
93
  else
 
94
  return false;
 
95
  }
96
  // Add for Page Template
 
97
  function add_for_page_template( $display, $meta_box ) {
 
98
  if( 'page-template' !== $meta_box['show_on']['key'] )
 
99
  return $display;
100
  // Get the current ID
 
101
  if( isset( $_GET['post'] ) ) $post_id = $_GET['post'];
 
102
  elseif( isset( $_POST['post_ID'] ) ) $post_id = $_POST['post_ID'];
 
103
  if( !( isset( $post_id ) || is_page() ) ) return false;
104
  // Get current template
 
105
  $current_template = get_post_meta( $post_id, '_wp_page_template', true );
106
  // If value isn't an array, turn it into one
 
107
  $meta_box['show_on']['value'] = !is_array( $meta_box['show_on']['value'] ) ? array( $meta_box['show_on']['value'] ) : $meta_box['show_on']['value'];
108
  // See if there's a match
 
109
  if( in_array( $current_template, $meta_box['show_on']['value'] ) )
 
110
  return true;
 
111
  else
 
112
  return false;
 
113
  }
114
  // Show fields
 
115
  function show() {
116
  global $post;
 
117
  // Use nonce for verification
 
118
  echo '<input type="hidden" name="wp_meta_box_nonce" value="', wp_create_nonce( basename(__FILE__) ), '" />';
 
119
  echo '<table class="form-table bsf_metabox">';
 
120
  foreach ( $this->_meta_box['fields'] as $field ) {
 
121
  // Set up blank or default values for empty ones
 
122
  if ( !isset( $field['name'] ) ) $field['name'] = '';
 
123
  if ( !isset( $field['desc'] ) ) $field['desc'] = '';
 
124
  if ( !isset( $field['std'] ) ) $field['std'] = '';
 
125
  if ( 'file' == $field['type'] && !isset( $field['allow'] ) ) $field['allow'] = array( 'url', 'attachment' );
 
126
  if ( 'file' == $field['type'] && !isset( $field['save_id'] ) ) $field['save_id'] = false;
 
127
  if ( 'multicheck' == $field['type'] ) $field['multiple'] = true;
 
128
  $meta = get_post_meta( $post->ID, $field['id'], 'multicheck' != $field['type'] /* If multicheck this can be multiple values */ );
 
129
  echo '<tr class="', $field['class'],'">';
 
130
  if ( $field['type'] == "title" ) {
 
131
  echo '<td colspan="2">';
 
132
  } else {
 
133
  if( $this->_meta_box['show_names'] == true ) {
 
134
  echo '<th style="width:18%"><label class="', $field['class'],'" for="', $field['id'], '">', $field['name'], '</label></th>';
 
135
  }
 
136
  echo '<td>';
 
137
  }
138
 
139
  switch ( $field['type'] ) {
 
140
  case 'text':
 
141
  echo '<input class="', $field['class'],'" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', '' !== $meta ? $meta : $field['std'], '" />','<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
 
142
  break;
 
143
  case 'text_small':
 
144
  echo '<input class="bsf_text_small ', $field['class'],'" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', '' !== $meta ? $meta : $field['std'], '" /><span class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</span>';
 
145
  break;
 
146
  case 'text_medium':
 
147
  echo '<input class="bsf_text_medium ', $field['class'],'" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', '' !== $meta ? $meta : $field['std'], '" /><span class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</span>';
 
148
  break;
 
149
  case 'text_date':
 
150
  echo '<input class="bsf_text_small bsf_datepicker ', $field['class'],'" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', '' !== $meta ? $meta : $field['std'], '" /><span class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</span>';
 
151
  break;
 
152
  case 'text_date_timestamp':
 
153
  echo '<input class="bsf_text_small bsf_datepicker ', $field['class'],'" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', '' !== $meta ? date( 'm\/d\/Y', $meta ) : $field['std'], '" /><span class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</span>';
 
154
  break;
155
  case 'text_datetime_timestamp':
 
156
  echo '<input class="bsf_text_small bsf_datepicker ', $field['class'],'" type="text" name="', $field['id'], '[date]" id="', $field['id'], '_date" value="', '' !== $meta ? date( 'm\/d\/Y', $meta ) : $field['std'], '" />';
 
157
  echo '<input class="bsf_timepicker text_time ', $field['class'],'" type="text" name="', $field['id'], '[time]" id="', $field['id'], '_time" value="', '' !== $meta ? date( 'h:i A', $meta ) : $field['std'], '" /><span class="bsf_metabox_description ', $field['class'],'" >', $field['desc'], '</span>';
 
158
  break;
 
159
  case 'text_time':
 
160
  echo '<input class="bsf_timepicker text_time ', $field['class'],'" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', '' !== $meta ? $meta : $field['std'], '" /><span class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</span>';
 
161
  break;
 
162
  case 'text_money':
 
163
  echo '$ <input class="bsf_text_money ', $field['class'],'" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', '' !== $meta ? $meta : $field['std'], '" /><span class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</span>';
 
164
  break;
 
165
  case 'colorpicker':
 
166
  $meta = '' !== $meta ? $meta : $field['std'];
 
167
  $hex_color = '(([a-fA-F0-9]){3}){1,2}$';
 
168
  if ( preg_match( '/^' . $hex_color . '/i', $meta ) ) // Value is just 123abc, so prepend #.
 
169
  $meta = '#' . $meta;
 
170
  elseif ( ! preg_match( '/^#' . $hex_color . '/i', $meta ) ) // Value doesn't match #123abc, so sanitize to just #.
 
171
  $meta = "#";
 
172
  echo '<input class="bsf_colorpicker bsf_text_small ', $field['class'],'" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta, '" /><span class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</span>';
 
173
  break;
 
174
  case 'textarea':
 
175
  echo '<textarea class="', $field['class'],'" name="', $field['id'], '" id="', $field['id'], '" cols="60" rows="10">', '' !== $meta ? $meta : $field['std'], '</textarea>','<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
 
176
  break;
 
177
  case 'textarea_small':
 
178
  echo '<textarea class="', $field['class'],'" name="', $field['id'], '" id="', $field['id'], '" cols="60" rows="4">', '' !== $meta ? $meta : $field['std'], '</textarea>','<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
 
179
  break;
 
180
  case 'textarea_code':
 
181
  echo '<textarea class="', $field['class'],'" name="', $field['id'], '" id="', $field['id'], '" cols="60" rows="10" class="bsf_textarea_code">', '' !== $meta ? $meta : $field['std'], '</textarea>','<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
 
182
  break;
 
183
  case 'select':
 
184
  if( empty( $meta ) && !empty( $field['std'] ) ) $meta = $field['std'];
 
185
  echo '<select class="', $field['class'],'" name="', $field['id'], '" id="', $field['id'], '">';
 
186
  foreach ($field['options'] as $option) {
 
187
  echo '<option class="', $field['class'],'" value="', $option['value'], '"', $meta == $option['value'] ? ' selected="selected"' : '', '>', $option['name'], '</option>';
 
188
  }
 
189
  echo '</select>';
 
190
  echo '<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
 
191
  break;
 
192
  case 'radio_inline':
 
193
  if( empty( $meta ) && !empty( $field['std'] ) ) $meta = $field['std'];
 
194
  echo '<div class="bsf_radio_inline ', $field['class'],'">';
 
195
  $i = 1;
 
196
  foreach ($field['options'] as $option) {
 
197
  echo '<div class="bsf_radio_inline_option ', $field['class'],'"><input class="', $field['class'],'" type="radio" name="', $field['id'], '" id="', $field['id'], $i, '" value="', $option['value'], '"', $meta == $option['value'] ? ' checked="checked"' : '', ' /><label class="', $field['class'],'" for="', $field['id'], $i, '">', $option['name'], '</label></div>';
 
198
  $i++;
 
199
  }
 
200
  echo '</div>';
 
201
  echo '<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
 
202
  break;
 
203
  case 'radio':
 
204
  if( empty( $meta ) && !empty( $field['std'] ) ) $meta = $field['std'];
 
205
  echo '<div class=class="', $field['class'],'"><ul>';
 
206
  $i = 1;
 
207
  foreach ($field['options'] as $option) {
 
208
  if( $field['class'] == "star review" || $field['class'] == "star product" || $field['class'] == "star software")
 
209
  $class = "star";
 
210
  else
 
211
  $class = $field['class'];
 
212
  echo '<li class="', $field['class'],'">
 
213
  <input class="', $class,'" type="radio" name="', $field['id'], '" id="', $field['id'], $i,'" value="', $option['value'], '"', $meta == $option['value'] ? ' checked="checked"' : '', ' /><label class="', $field['class'],'" for="', $field['id'], $i, '">', $option['name'].'</label> </li>';
 
214
  $i++;
 
215
  }
 
216
  echo '</ul></div>';
 
217
  echo '<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
 
218
  break;
 
219
  case 'checkbox':
 
220
  echo '<input type="checkbox" class="', $field['class'],'" name="', $field['id'], '" id="', $field['id'], '"', $meta ? ' checked="checked"' : '', ' />';
 
221
  echo '<span class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</span>';
 
222
  break;
 
223
  case 'multicheck':
 
224
  echo '<ul class="', $field['class'],'">';
 
225
  $i = 1;
 
226
  foreach ( $field['options'] as $value => $name ) {
 
227
  // Append `[]` to the name to get multiple values
 
228
  // Use in_array() to check whether the current option should be checked
 
229
  echo '<li class="', $field['class'],'"><input type="checkbox" class="', $field['class'],'" name="', $field['id'], '[]" id="', $field['id'], $i, '" value="', $value, '"', in_array( $value, $meta ) ? ' checked="checked"' : '', ' /><label class="', $field['class'],'" for="', $field['id'], $i, '">', $name, '</label></li>';
 
230
  $i++;
 
231
  }
 
232
  echo '</ul>';
 
233
  echo '<span class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</span>';
 
234
  break;
 
235
  case 'title':
 
236
  echo '<h5 class="bsf_metabox_title ', $field['class'],'">', $field['name'], '</h5>';
 
237
  echo '<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
 
238
  break;
 
239
  case 'wysiwyg':
 
240
  wp_editor( $meta ? $meta : $field['std'], $field['id'], isset( $field['options'] ) ? $field['options'] : array() );
 
241
  echo '<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
 
242
  break;
 
243
  case 'taxonomy_select':
 
244
  echo '<select class="', $field['class'],'" name="', $field['id'], '" id="', $field['id'], '">';
 
245
  $names= wp_get_object_terms( $post->ID, $field['taxonomy'] );
 
246
  $terms = get_terms( $field['taxonomy'], 'hide_empty=0' );
 
247
  foreach ( $terms as $term ) {
 
248
  if (!is_wp_error( $names ) && !empty( $names ) && !strcmp( $term->slug, $names[0]->slug ) ) {
 
249
  echo '<option value="' . $term->slug . '" selected>' . $term->name . '</option>';
 
250
  } else {
 
251
  echo '<option value="' . $term->slug . ' ' , $meta == $term->slug ? $meta : ' ' ,' ">' . $term->name . '</option>';
 
252
  }
 
253
  }
 
254
  echo '</select>';
 
255
  echo '<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
 
256
  break;
 
257
  case 'taxonomy_radio':
 
258
  $names= wp_get_object_terms( $post->ID, $field['taxonomy'] );
 
259
  $terms = get_terms( $field['taxonomy'], 'hide_empty=0' );
 
260
  echo '<ul class="', $field['class'],'">';
 
261
  foreach ( $terms as $term ) {
 
262
  if ( !is_wp_error( $names ) && !empty( $names ) && !strcmp( $term->slug, $names[0]->slug ) ) {
 
263
  echo '<li class="', $field['class'],'"><input class="', $field['class'],'" type="radio" name="', $field['id'], '" value="'. $term->slug . '" checked>' . $term->name . '</li>';
 
264
  } else {
 
265
  echo '<li class="', $field['class'],'"><input class="', $field['class'],'" type="radio" name="', $field['id'], '" value="' . $term->slug . ' ' , $meta == $term->slug ? $meta : ' ' ,' ">' . $term->name .'</li>';
 
266
  }
 
267
  }
 
268
  echo '</ul>';
 
269
  echo '<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
 
270
  break;
 
271
  case 'taxonomy_multicheck':
 
272
  echo '<ul>';
 
273
  $names = wp_get_object_terms( $post->ID, $field['taxonomy'] );
 
274
  $terms = get_terms( $field['taxonomy'], 'hide_empty=0' );
 
275
  foreach ($terms as $term) {
 
276
  echo '<li><input class="', $field['class'],'" type="checkbox" name="', $field['id'], '[]" id="', $field['id'], '" value="', $term->name , '"';
 
277
  foreach ($names as $name) {
 
278
  if ( $term->slug == $name->slug ){ echo ' checked="checked" ';};
 
279
  }
 
280
  echo' /><label>', $term->name , '</label></li>';
 
281
  }
 
282
  echo '</ul>';
 
283
  echo '<span class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</span>';
 
284
  break;
 
285
  case 'file_list':
 
286
  echo '<input class="bsf_upload_file ', $field['class'],'" type="text" size="36" name="', $field['id'], '" value="" />';
 
287
  echo '<input class="bsf_upload_button button ', $field['class'],'" type="button" value="Upload File" />';
 
288
  echo '<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
 
289
  $args = array(
 
290
  'post_type' => 'attachment',
 
291
  'numberposts' => null,
 
292
  'post_status' => null,
 
293
  'post_parent' => $post->ID
 
294
  );
 
295
  $attachments = get_posts($args);
 
296
  if ($attachments) {
 
297
  echo '<ul class="attach_list">';
 
298
  foreach ($attachments as $attachment) {
 
299
  echo '<li>'.wp_get_attachment_link($attachment->ID, 'thumbnail', 0, 0, 'Download');
 
300
  echo '<span>';
 
301
  echo apply_filters('the_title', '&nbsp;'.$attachment->post_title);
 
302
  echo '</span></li>';
 
303
  }
 
304
  echo '</ul>';
 
305
  }
 
306
  break;
 
307
  case 'file':
 
308
  $input_type_url = "hidden";
 
309
  if ( 'url' == $field['allow'] || ( is_array( $field['allow'] ) && in_array( 'url', $field['allow'] ) ) )
 
310
  $input_type_url="text";
 
311
  echo '<input class="bsf_upload_file ', $field['class'],'" type="' . $input_type_url . '" size="45" id="', $field['id'], '" name="', $field['id'], '" value="', $meta, '" />';
 
312
  echo '<input class="bsf_upload_button button ', $field['class'],'" type="button" value="Upload File" />';
 
313
  echo '<input class="bsf_upload_file_id ', $field['class'],'" type="hidden" id="', $field['id'], '_id" name="', $field['id'], '_id" value="', get_post_meta( $post->ID, $field['id'] . "_id",true), '" />';
 
314
  echo '<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
 
315
  echo '<div id="', $field['id'], '_status" class="bsf_media_status ', $field['class'],'">';
 
316
  if ( $meta != '' ) {
 
317
  $check_image = preg_match( '/(^.*\.jpg|jpeg|png|gif|ico*)/i', $meta );
 
318
  if ( $check_image ) {
 
319
  echo '<div class="img_status">';
 
320
  echo '<img src="', $meta, '" alt="" />';
 
321
  echo '<a href="#" class="bsf_remove_file_button ', $field['class'],'" rel="', $field['id'], '">Remove Image</a>';
 
322
  echo '</div>';
 
323
  } else {
 
324
  $parts = explode( '/', $meta );
 
325
  for( $i = 0; $i < count( $parts ); ++$i ) {
 
326
  $title = $parts[$i];
 
327
  }
 
328
  echo 'File: <strong>', $title, '</strong>&nbsp;&nbsp;&nbsp; (<a href="', $meta, '" target="_blank" rel="external">Download</a> / <a href="#" class="bsf_remove_file_button" rel="', $field['id'], '">Remove</a>)';
 
329
  }
 
330
  }
 
331
  echo '</div>';
 
332
  break;
 
333
  case 'oembed':
 
334
  echo '<input class="bsf_oembed ', $field['class'],'" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', '' !== $meta ? $meta : $field['std'], '" />','<p class="bsf_metabox_description ', $field['class'],'">', $field['desc'], '</p>';
 
335
  echo '<p class="bsf-spinner spinner ', $field['class'],'"></p>';
 
336
  echo '<div id="', $field['id'], '_status" class="bsf_media_status ui-helper-clearfix embed_wrap ', $field['class'],'">';
 
337
  if ( $meta != '' ) {
 
338
  $check_embed = $GLOBALS['wp_embed']->run_shortcode( '[embed]'. esc_url( $meta ) .'[/embed]' );
 
339
  if ( $check_embed ) {
 
340
  echo '<div class="embed_status ', $field['class'],'">';
 
341
  echo $check_embed;
 
342
  echo '<a href="#" class="bsf_remove_file_button ', $field['class'],'" rel="', $field['id'], '">Remove Embed</a>';
 
343
  echo '</div>';
 
344
  } else {
 
345
  echo 'URL is not a valid oEmbed URL.';
 
346
  }
 
347
  }
 
348
  echo '</div>';
 
349
  break;
 
350
  default:
 
351
  do_action('bsf_render_' . $field['type'] , $field, $meta);
 
352
  }
 
353
  echo '</td>','</tr>';
 
354
  }
 
355
  echo '</table>';
 
356
  }
 
357
  // Save data from metabox
 
358
  function save( $post_id) {
 
359
  // verify nonce
 
360
  if ( ! isset( $_POST['wp_meta_box_nonce'] ) || !wp_verify_nonce( $_POST['wp_meta_box_nonce'], basename(__FILE__) ) ) {
 
361
  return $post_id;
 
362
  }
 
363
  // check autosave
 
364
  if ( defined('DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
 
365
  return $post_id;
 
366
  }
 
367
  // check permissions
 
368
  if ( 'page' == $_POST['post_type'] ) {
 
369
  if ( !current_user_can( 'edit_page', $post_id ) ) {
 
370
  return $post_id;
 
371
  }
 
372
  } elseif ( !current_user_can( 'edit_post', $post_id ) ) {
 
373
  return $post_id;
 
374
  }
 
375
  foreach ( $this->_meta_box['fields'] as $field ) {
 
376
  $name = $field['id'];
 
377
  if ( ! isset( $field['multiple'] ) )
 
378
  $field['multiple'] = ( 'multicheck' == $field['type'] ) ? true : false;
 
379
  $old = get_post_meta( $post_id, $name, !$field['multiple'] /* If multicheck this can be multiple values */ );
 
380
  $new = isset( $_POST[$field['id']] ) ? $_POST[$field['id']] : null;
 
381
  if ( in_array( $field['type'], array( 'taxonomy_select', 'taxonomy_radio', 'taxonomy_multicheck' ) ) ) {
 
382
  $new = wp_set_object_terms( $post_id, $new, $field['taxonomy'] );
 
383
  }
 
384
  if ( ($field['type'] == 'textarea') || ($field['type'] == 'textarea_small') ) {
 
385
  $new = htmlspecialchars( $new );
 
386
  }
 
387
  if ( ($field['type'] == 'textarea_code') ) {
 
388
  $new = htmlspecialchars_decode( $new );
 
389
  }
 
390
  if ( $field['type'] == 'text_date_timestamp' ) {
 
391
  $new = strtotime( $new );
 
392
  }
 
393
  if ( $field['type'] == 'text_datetime_timestamp' ) {
 
394
  $string = $new['date'] . ' ' . $new['time'];
 
395
  $new = strtotime( $string );
 
396
  }
 
397
  $new = apply_filters('bsf_validate_' . $field['type'], $new, $post_id, $field);
 
398
  // validate meta value
 
399
  if ( isset( $field['validate_func']) ) {
 
400
  $ok = call_user_func( array( 'bsf_Meta_Box_Validate', $field['validate_func']), $new );
 
401
  if ( $ok === false ) { // pass away when meta value is invalid
 
402
  continue;
 
403
  }
 
404
  } elseif ( $field['multiple'] ) {
 
405
  delete_post_meta( $post_id, $name );
 
406
  if ( !empty( $new ) ) {
 
407
  foreach ( $new as $add_new ) {
 
408
  add_post_meta( $post_id, $name, $add_new, false );
 
409
  }
 
410
  }
 
411
  } elseif ( '' !== $new && $new != $old ) {
 
412
  update_post_meta( $post_id, $name, $new );
 
413
  } elseif ( '' == $new ) {
 
414
  delete_post_meta( $post_id, $name );
 
415
  }
 
416
  if ( 'file' == $field['type'] ) {
 
417
  $name = $field['id'] . "_id";
 
418
  $old = get_post_meta( $post_id, $name, !$field['multiple'] /* If multicheck this can be multiple values */ );
 
419
  if ( isset( $field['save_id'] ) && $field['save_id'] ) {
 
420
  $new = isset( $_POST[$name] ) ? $_POST[$name] : null;
 
421
  } else {
 
422
  $new = "";
 
423
  }
 
424
  if ( $new && $new != $old ) {
 
425
  update_post_meta( $post_id, $name, $new );
 
426
  } elseif ( '' == $new && $old ) {
 
427
  delete_post_meta( $post_id, $name, $old );
 
428
  }
 
429
  }
 
430
  }
 
431
  }
 
432
  }
 
433
  /**
 
434
  * Adding scripts and styles
 
435
  */
 
436
  function bsf_scripts( $hook ) {
 
437
  global $wp_version;
 
438
  // only enqueue our scripts/styles on the proper pages
 
439
  if ( $hook == 'post.php' || $hook == 'post-new.php' || $hook == 'page-new.php' || $hook == 'page.php') {
 
440
  // scripts required for cmb
 
441
  $bsf_script_array = array( 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker', 'media-upload', 'thickbox' );
 
442
  // styles required for cmb
 
443
  $bsf_style_array = array( 'thickbox' );
 
444
  // if we're 3.5 or later, user wp-color-picker
 
445
  if ( 3.5 <= $wp_version ) {
 
446
  $bsf_script_array[] = 'wp-color-picker';
 
447
  $bsf_style_array[] = 'wp-color-picker';
 
448
  } else {
 
449
  // otherwise use the older 'farbtastic'
 
450
  $bsf_script_array[] = 'farbtastic';
 
451
  $bsf_style_array[] = 'farbtastic';
 
452
  }
 
453
  wp_register_script( 'bsf-timepicker', BSF_META_BOX_URL . 'js/jquery.timePicker.min.js' );
 
454
  wp_register_script( 'bsf-scripts', BSF_META_BOX_URL . 'js/cmb.js', $bsf_script_array, '0.9.1' );
 
455
  wp_localize_script( 'bsf-scripts', 'bsf_ajax_data', array( 'ajax_nonce' => wp_create_nonce( 'ajax_nonce' ), 'post_id' => get_the_ID() ) );
 
456
  wp_enqueue_script( 'bsf-timepicker' );
 
457
  wp_enqueue_script( 'bsf-scripts' );
 
458
  wp_register_style( 'bsf-styles', BSF_META_BOX_URL . 'admin/css/style.css', $bsf_style_array );
 
459
  wp_enqueue_style( 'bsf-styles' );
 
460
  }
 
461
  }
 
462
  add_action( 'admin_enqueue_scripts', 'bsf_scripts', 10 );
 
463
  function bsf_editor_footer_scripts() { ?>
 
464
  <?php
 
465
  if ( isset( $_GET['bsf_force_send'] ) && 'true' == $_GET['bsf_force_send'] ) {
 
466
  $label = $_GET['bsf_send_label'];
 
467
  if ( empty( $label ) ) $label="Select File";
 
468
  ?>
 
469
  <script type="text/javascript">
 
470
  jQuery(function($) {
 
471
  $('td.savesend input').val('<?php echo $label; ?>');
 
472
  });
 
473
  </script>
 
474
  <?php
 
475
  }
476
  }
 
477
  add_action( 'admin_print_footer_scripts', 'bsf_editor_footer_scripts', 99 );
 
478
  // Force 'Insert into Post' button from Media Library
 
479
  add_filter( 'get_media_item_args', 'bsf_force_send' );
 
480
  function bsf_force_send( $args ) {
 
481
  // if the Gallery tab is opened from a custom meta box field, add Insert Into Post button
 
482
  if ( isset( $_GET['bsf_force_send'] ) && 'true' == $_GET['bsf_force_send'] )
 
483
  $args['send'] = true;
 
484
  // if the From Computer tab is opened AT ALL, add Insert Into Post button after an image is uploaded
 
485
  if ( isset( $_POST['attachment_id'] ) && '' != $_POST["attachment_id"] ) {
 
486
  $args['send'] = true;
 
487
  // TO DO: Are there any conditions in which we don't want the Insert Into Post
 
488
  // button added? For example, if a post type supports thumbnails, does not support
 
489
  // the editor, and does not have any cmb file inputs? If so, here's the first
 
490
  // bits of code needed to check all that.
 
491
  // $attachment_ancestors = get_post_ancestors( $_POST["attachment_id"] );
 
492
  // $attachment_parent_post_type = get_post_type( $attachment_ancestors[0] );
 
493
  // $post_type_object = get_post_type_object( $attachment_parent_post_type );
 
494
  }
 
495
  // change the label of the button on the From Computer tab
 
496
  if ( isset( $_POST['attachment_id'] ) && '' != $_POST["attachment_id"] ) {
 
497
  echo '
 
498
  <script type="text/javascript">
 
499
  function cmbGetParameterByNameInline(name) {
 
500
  name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
 
501
  var regexS = "[\\?&]" + name + "=([^&#]*)";
 
502
  var regex = new RegExp(regexS);
 
503
  var results = regex.exec(window.location.href);
 
504
  if(results == null)
 
505
  return "";
 
506
  else
 
507
  return decodeURIComponent(results[1].replace(/\+/g, " "));
 
508
  }
 
509
  jQuery(function($) {
 
510
  if (cmbGetParameterByNameInline("bsf_force_send")=="true") {
 
511
  var bsf_send_label = cmbGetParameterByNameInline("bsf_send_label");
 
512
  $("td.savesend input").val(bsf_send_label);
 
513
  }
 
514
  });
 
515
  </script>
 
516
  ';
 
517
  }
 
518
  return $args;
 
519
  }
 
520
  add_action( 'wp_ajax_bsf_oembed_handler', 'bsf_oembed_ajax_results' );
 
521
  /**
 
522
  * Handles our oEmbed ajax request
 
523
  */
 
524
  function bsf_oembed_ajax_results() {
 
525
  // verify our nonce
 
526
  if ( ! ( isset( $_REQUEST['bsf_ajax_nonce'], $_REQUEST['oembed_url'] ) && wp_verify_nonce( $_REQUEST['bsf_ajax_nonce'], 'ajax_nonce' ) ) )
 
527
  die();
 
528
  // sanitize our search string
 
529
  $oembed_string = sanitize_text_field( $_REQUEST['oembed_url'] );
 
530
  if ( empty( $oembed_string ) ) {
 
531
  $return = '<p class="ui-state-error-text">'. __( 'Please Try Again', 'cmb' ) .'</p>';
 
532
  $found = 'not found';
 
533
  } else {
 
534
  global $wp_embed;
 
535
  $oembed_url = esc_url( $oembed_string );
 
536
  // Post ID is needed to check for embeds
 
537
  if ( isset( $_REQUEST['post_id'] ) )
 
538
  $GLOBALS['post'] = get_post( $_REQUEST['post_id'] );
 
539
  // ping WordPress for an embed
 
540
  $check_embed = $wp_embed->run_shortcode( '[embed]'. $oembed_url .'[/embed]' );
 
541
  // fallback that WordPress creates when no oEmbed was found
 
542
  $fallback = $wp_embed->maybe_make_link( $oembed_url );
 
543
  if ( $check_embed && $check_embed != $fallback ) {
 
544
  // Embed data
 
545
  $return = '<div class="embed_status">'. $check_embed .'<a href="#" class="bsf_remove_file_button" rel="'. $_REQUEST['field_id'] .'">'. __( 'Remove Embed', 'cmb' ) .'</a></div>';
 
546
  // set our response id
 
547
  $found = 'found';
 
548
  } else {
 
549
  // error info when no oEmbeds were found
 
550
  $return = '<p class="ui-state-error-text">'.sprintf( __( 'No oEmbed Results Found for %s. View more info at', 'cmb' ), $fallback ) .' <a href="http://codex.wordpress.org/Embeds" target="_blank">codex.wordpress.org/Embeds</a>.</p>';
 
551
  // set our response id
 
552
  $found = 'not found';
 
553
  }
 
554
  }
 
555
  // send back our encoded data
 
556
  echo json_encode( array( 'result' => $return, 'id' => $found ) );
 
557
  die();
 
558
  }
 
559
  // End. That's it, folks! //
560
  ?>
js/cmb.js CHANGED
@@ -1,200 +1,130 @@
1
-
2
- /*jslint browser: true, devel: true, indent: 4, maxerr: 50, sub: true */
3
- /*global jQuery, tb_show, tb_remove */
4
-
5
- /**
6
- * Custom jQuery for Custom Metaboxes and Fields
7
- */
8
- jQuery(document).ready(function (jQuery) {
9
- 'use strict';
10
-
11
- var formfield;
12
-
13
- /**
14
- * Initialize timepicker (this will be moved inline in a future release)
15
- */
16
- jQuery('.bsf_timepicker').each(function () {
17
- jQuery('#' + jQuery(this).attr('id')).timePicker({
18
- startTime: "07:00",
19
- endTime: "22:00",
20
- show24Hours: false,
21
- separator: ':',
22
- step: 30
23
- });
24
- });
25
-
26
- /**
27
- * Initialize jQuery UI datepicker (this will be moved inline in a future release)
28
- */
29
- jQuery('.bsf_datepicker').each(function () {
30
- //jQuery('#' + jQuery(this).attr('id')).datepicker();
31
- jQuery('#' + jQuery(this).attr('id')).datepicker({ dateFormat: 'yy-mm-dd' });
32
- // For more options see http://jqueryui.com/demos/datepicker/#option-dateFormat
33
- });
34
- // Wrap date picker in class to narrow the scope of jQuery UI CSS and prevent conflicts
35
- jQuery("#ui-datepicker-div").wrap('<div class="bsf_element" />');
36
-
37
- /**
38
- * Initialize color picker
39
- */
40
- if (typeof jQuery.wp === 'object' && typeof jQuery.wp.wpColorPicker === 'function') {
41
- jQuery('input:text.bsf_colorpicker').wpColorPicker();
42
- } else {
43
- jQuery('input:text.bsf_colorpicker').each(function (i) {
44
- jQuery(this).after('<div id="picker-' + i + '" style="z-index: 1000; background: #EEE; border: 1px solid #CCC; position: absolute; display: block;"></div>');
45
- jQuery('#picker-' + i).hide().farbtastic(jQuery(this));
46
- })
47
- .focus(function () {
48
- jQuery(this).next().show();
49
- })
50
- .blur(function () {
51
- jQuery(this).next().hide();
52
- });
53
- }
54
-
55
- /**
56
- * File and image upload handling
57
- */
58
- jQuery('.bsf_upload_file').change(function () {
59
- formfield = jQuery(this).attr('name');
60
- jQuery('#' + formfield + '_id').val("");
61
- });
62
-
63
- jQuery('.bsf_upload_button').live('click', function () {
64
- var buttonLabel;
65
- formfield = jQuery(this).prev('input').attr('name');
66
- buttonLabel = 'Use as ' + jQuery('label[for=' + formfield + ']').text();
67
- tb_show('', 'media-upload.php?post_id=' + jQuery('#post_ID').val() + '&type=file&bsf_force_send=true&bsf_send_label=' + buttonLabel + '&TB_iframe=true');
68
- return false;
69
- });
70
-
71
- jQuery('.bsf_remove_file_button').live('click', function () {
72
- formfield = jQuery(this).attr('rel');
73
- jQuery('input#' + formfield).val('');
74
- jQuery('input#' + formfield + '_id').val('');
75
- jQuery(this).parent().remove();
76
- return false;
77
- });
78
-
79
- window.original_send_to_editor = window.send_to_editor;
80
- window.send_to_editor = function (html) {
81
- var itemurl, itemclass, itemClassBits, itemid, htmlBits, itemtitle,
82
- image, uploadStatus = true;
83
-
84
- if (formfield) {
85
-
86
- if (jQuery(html).html(html).find('img').length > 0) {
87
- itemurl = jQuery(html).html(html).find('img').attr('src'); // Use the URL to the size selected.
88
- itemclass = jQuery(html).html(html).find('img').attr('class'); // Extract the ID from the returned class name.
89
- itemClassBits = itemclass.split(" ");
90
- itemid = itemClassBits[itemClassBits.length - 1];
91
- itemid = itemid.replace('wp-image-', '');
92
- } else {
93
- // It's not an image. Get the URL to the file instead.
94
- htmlBits = html.split("'"); // jQuery seems to strip out XHTML when assigning the string to an object. Use alternate method.
95
- itemurl = htmlBits[1]; // Use the URL to the file.
96
- itemtitle = htmlBits[2];
97
- itemtitle = itemtitle.replace('>', '');
98
- itemtitle = itemtitle.replace('</a>', '');
99
- itemid = ""; // TO DO: Get ID for non-image attachments.
100
- }
101
-
102
- image = /(jpe?g|png|gif|ico)jQuery/gi;
103
-
104
- if (itemurl.match(image)) {
105
- uploadStatus = '<div class="img_status"><img src="' + itemurl + '" alt="" /><a href="#" class="bsf_remove_file_button" rel="' + formfield + '">Remove Image</a></div>';
106
- } else {
107
- // No output preview if it's not an image
108
- // Standard generic output if it's not an image.
109
- html = '<a href="' + itemurl + '" target="_blank" rel="external">View File</a>';
110
- uploadStatus = '<div class="no_image"><span class="file_link">' + html + '</span>&nbsp;&nbsp;&nbsp;<a href="#" class="bsf_remove_file_button" rel="' + formfield + '">Remove</a></div>';
111
- }
112
-
113
- jQuery('#' + formfield).val(itemurl);
114
- jQuery('#' + formfield + '_id').val(itemid);
115
- jQuery('#' + formfield).siblings('.bsf_media_status').slideDown().html(uploadStatus);
116
- tb_remove();
117
-
118
- } else {
119
- window.original_send_to_editor(html);
120
- }
121
-
122
- formfield = '';
123
- };
124
-
125
- /**
126
- * Ajax oEmbed display
127
- */
128
-
129
- // ajax on paste
130
- jQuery('.bsf_oembed').bind('paste', function (e) {
131
- var pasteitem = jQuery(this);
132
- // paste event is fired before the value is filled, so wait a bit
133
- setTimeout(function () {
134
- // fire our ajax function
135
- doCMBajax(pasteitem, 'paste');
136
- }, 100);
137
- }).blur(function () {
138
- // when leaving the input
139
- setTimeout(function () {
140
- // if it's been 2 seconds, hide our spinner
141
- jQuery('.postbox table.bsf_metabox .cmb-spinner').hide();
142
- }, 2000);
143
- });
144
-
145
- // ajax when typing
146
- jQuery('.bsf_metabox').on('keyup', '.bsf_oembed', function (event) {
147
- // fire our ajax function
148
- doCMBajax(jQuery(this), event);
149
- });
150
-
151
- // function for running our ajax
152
- function doCMBajax(obj, e) {
153
- // get typed value
154
- var oembed_url = obj.val();
155
- // only proceed if the field contains more than 6 characters
156
- if (oembed_url.length < 6)
157
- return;
158
-
159
- // only proceed if the user has pasted, pressed a number, letter, or whitelisted characters
160
- if (e === 'paste' || e.which <= 90 && e.which >= 48 || e.which >= 96 && e.which <= 111 || e.which == 8 || e.which == 9 || e.which == 187 || e.which == 190) {
161
-
162
- // get field id
163
- var field_id = obj.attr('id');
164
- // get our inputs context for pinpointing
165
- var context = obj.parents('.bsf_metabox tr td');
166
- // show our spinner
167
- jQuery('.cmb-spinner', context).show();
168
- // clear out previous results
169
- jQuery('.embed_wrap', context).html('');
170
- // and run our ajax function
171
- setTimeout(function () {
172
- // if they haven't typed in 500 ms
173
- if (jQuery('.bsf_oembed:focus').val() == oembed_url) {
174
- jQuery.ajax({
175
- type : 'post',
176
- dataType : 'json',
177
- url : window.ajaxurl,
178
- data : {
179
- 'action': 'bsf_oembed_handler',
180
- 'oembed_url': oembed_url,
181
- 'field_id': field_id,
182
- 'post_id': window.bsf_ajax_data.post_id,
183
- 'bsf_ajax_nonce': window.bsf_ajax_data.ajax_nonce
184
- },
185
- success: function (response) {
186
- // if we have a response id
187
- if (typeof response.id !== 'undefined') {
188
- // hide our spinner
189
- jQuery('.cmb-spinner', context).hide();
190
- // and populate our results from ajax response
191
- jQuery('.embed_wrap', context).html(response.result);
192
- }
193
- }
194
- });
195
- }
196
- }, 500);
197
- }
198
- }
199
-
200
- });
1
+ /**
2
+ * Controls the behaviours of custom metabox fields.
3
+ *
4
+ * @author Andrew Norcross
5
+ * @author Jared Atchison
6
+ * @author Bill Erickson
7
+ * @see https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress
8
+ */
9
+ /*jslint browser: true, devel: true, indent: 4, maxerr: 50, sub: true */
10
+ /*global jQuery, tb_show, tb_remove */
11
+ /**
12
+ * Defines the CMBMeta object namespace to prevent conflict with other plugins using similar javascript
13
+ *
14
+ */
15
+ (function ($) {
16
+ 'use strict';
17
+ var CMBMeta;
18
+ CMBMeta = {
19
+ /**
20
+ * Initialize timepicker (this will be moved inline in a future release)
21
+ */
22
+ TimePicker: function () {
23
+ $('.bsf_timepicker').each(function () {
24
+ $('#' + $(this).attr('id')).timePicker({
25
+ startTime: "07:00",
26
+ endTime: "22:00",
27
+ show24Hours: false,
28
+ separator: ':',
29
+ step: 30
30
+ });
31
+ });
32
+ },
33
+ /**
34
+ * Initialize jQuery UI datepicker (this will be moved inline in a future release)
35
+ */
36
+ DatePicker: function () {
37
+ $('.bsf_datepicker').each(function () {
38
+ $('#' + jQuery(this).attr('id')).datepicker();
39
+ //$('#_bsf_event_start_date').datepicker();
40
+ // $('#' + jQuery(this).attr('id')).datepicker({ dateFormat: 'yy-mm-dd' });
41
+ // For more options see http://jqueryui.com/demos/datepicker/#option-dateFormat
42
+ });
43
+ // Wrap date picker in class to narrow the scope of jQuery UI CSS and prevent conflicts
44
+ $("#ui-datepicker-div").wrap('<div class="bsf_element" />');
45
+ }, // End DatePicker
46
+ /**
47
+ * Initialize color picker
48
+ */
49
+ ColorPicker: function () {
50
+ $('input:text.bsf_colorpicker').each(function (i) {
51
+ $(this).after('<div id="picker-' + i + '" style="z-index: 1000; background: #EEE; border: 1px solid #CCC; position: absolute; display: block;"></div>');
52
+ $('#picker-' + i).hide().farbtastic($(this));
53
+ })
54
+ .focus(function () {
55
+ $(this).next().show();
56
+ })
57
+ .blur(function () {
58
+ $(this).next().hide();
59
+ });
60
+ }, // End ColorPicker
61
+ /**
62
+ * File and image upload handling
63
+ */
64
+ FileUpload: function () {
65
+ var formfield;
66
+ $('.bsf_upload_file').change(function () {
67
+ formfield = $(this).attr('name');
68
+ $('#' + formfield + '_id').val("");
69
+ });
70
+ $('.bsf_upload_button').live('click', function () {
71
+ var buttonLabel;
72
+ formfield = $(this).prev('input').attr('name');
73
+ buttonLabel = 'Use as ' + $('label[for=' + formfield + ']').text();
74
+ tb_show('', 'media-upload.php?post_id=' + $('#post_ID').val() + '&type=file&bsf_force_send=true&bsf_send_label=' + buttonLabel + '&TB_iframe=true');
75
+ return false;
76
+ });
77
+ $('.bsf_remove_file_button').live('click', function () {
78
+ formfield = $(this).attr('rel');
79
+ $('input#' + formfield).val('');
80
+ $('input#' + formfield + '_id').val('');
81
+ $(this).parent().remove();
82
+ return false;
83
+ });
84
+ window.bsf_original_send_to_editor = window.send_to_editor;
85
+ window.send_to_editor = function (html) {
86
+ var itemurl, itemclass, itemClassBits, itemid, htmlBits, itemtitle,
87
+ image, uploadStatus = true;
88
+ if (formfield) {
89
+ if ($(html).html(html).find('img').length > 0) {
90
+ itemurl = $(html).html(html).find('img').attr('src'); // Use the URL to the size selected.
91
+ itemclass = $(html).html(html).find('img').attr('class'); // Extract the ID from the returned class name.
92
+ itemClassBits = itemclass.split(" ");
93
+ itemid = itemClassBits[itemClassBits.length - 1];
94
+ itemid = itemid.replace('wp-image-', '');
95
+ } else {
96
+ // It's not an image. Get the URL to the file instead.
97
+ htmlBits = html.split("'"); // jQuery seems to strip out XHTML when assigning the string to an object. Use alternate method.
98
+ itemurl = htmlBits[1]; // Use the URL to the file.
99
+ itemtitle = htmlBits[2];
100
+ itemtitle = itemtitle.replace('>', '');
101
+ itemtitle = itemtitle.replace('</a>', '');
102
+ itemid = ""; // TO DO: Get ID for non-image attachments.
103
+ }
104
+ image = /(jpe?g|png|gif|ico)$/gi;
105
+ if (itemurl.match(image)) {
106
+ uploadStatus = '<div class="img_status"><img src="' + itemurl + '" alt="" /><a href="#" class="bsf_remove_file_button" rel="' + formfield + '">Remove Image</a></div>';
107
+ } else {
108
+ // No output preview if it's not an image
109
+ // Standard generic output if it's not an image.
110
+ html = '<a href="' + itemurl + '" target="_blank" rel="external">View File</a>';
111
+ uploadStatus = '<div class="no_image"><span class="file_link">' + html + '</span>&nbsp;&nbsp;&nbsp;<a href="#" class="bsf_remove_file_button" rel="' + formfield + '">Remove</a></div>';
112
+ }
113
+ $('#' + formfield).val(itemurl);
114
+ $('#' + formfield + '_id').val(itemid);
115
+ $('#' + formfield).siblings('.bsf_upload_status').slideDown().html(uploadStatus);
116
+ tb_remove();
117
+ } else {
118
+ window.bsf_original_send_to_editor(html);
119
+ }
120
+ formfield = '';
121
+ };
122
+ } // End FileUpload
123
+ }; //End CMBMeta object
124
+ $(document).ready(function () {
125
+ CMBMeta.TimePicker();
126
+ CMBMeta.DatePicker();
127
+ CMBMeta.ColorPicker();
128
+ // CMBMeta.FileUpload();
129
+ });
130
+ }(jQuery));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/cp-script.min.js ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var $mbas12 = jQuery.noConflict();
2
+ // Snippet Box BG Color
3
+ (function ($mbas12) {
4
+ "use strict";
5
+ function pickColor(color) {
6
+ $mbas12(".snippet_box_bg").val(color);
7
+ }
8
+ function toggle_text() {
9
+ var BoxBG = $mbas12(".snippet_box_bg");
10
+ if ("" === BoxBG.val().replace("#", "")) {
11
+ BoxBG.val(default_color);
12
+ pickColor(default_color);
13
+ } else pickColor(BoxBG.val());
14
+ }
15
+ var default_color = "F5F5F5";
16
+ $mbas12(document).ready(function () {
17
+ var BoxBG = $mbas12(".snippet_box_bg");
18
+ BoxBG.wpColorPicker({
19
+ change: function (event, ui) {
20
+ pickColor(BoxBG.wpColorPicker("color"));
21
+ },
22
+ clear: function () {
23
+ pickColor("");
24
+ }
25
+ });
26
+ $mbas12(".snippet_box_bg").click(toggle_text);
27
+ toggle_text();
28
+ });
29
+ })($mbas12);
30
+
31
+ // Snippet Title BG color
32
+ (function ($mbas12) {
33
+ "use strict";
34
+ function pickColor(color) {
35
+ $mbas12(".snippet_title_bg").val(color);
36
+ }
37
+ function toggle_text() {
38
+ var TitleBG = $mbas12(".snippet_title_bg");
39
+ if ("" === TitleBG.val().replace("#", "")) {
40
+ TitleBG.val(default_color);
41
+ pickColor(default_color);
42
+ } else pickColor(TitleBG.val());
43
+ }
44
+ var default_color = "E4E4E4";
45
+ $mbas12(document).ready(function () {
46
+ var TitleBG = $mbas12(".snippet_title_bg");
47
+ TitleBG.wpColorPicker({
48
+ change: function (event, ui) {
49
+ pickColor(TitleBG.wpColorPicker("color"));
50
+ },
51
+ clear: function () {
52
+ pickColor("");
53
+ }
54
+ });
55
+ $mbas12(".snippet_title_bg").click(toggle_text);
56
+ toggle_text();
57
+ });
58
+ })($mbas12);
59
+
60
+ // Snippet Border color
61
+ (function ($mbas12) {
62
+ "use strict";
63
+ function pickColor(color) {
64
+ $mbas12(".snippet_border").val(color);
65
+ }
66
+ function toggle_text() {
67
+ var SnippetBorder = $mbas12(".snippet_border");
68
+ if ("" === SnippetBorder.val().replace("#", "")) {
69
+ SnippetBorder.val(default_color);
70
+ pickColor(default_color);
71
+ } else pickColor(SnippetBorder.val());
72
+ }
73
+ var default_color = "ACACAC";
74
+ $mbas12(document).ready(function () {
75
+ var SnippetBorder = $mbas12(".snippet_border");
76
+ SnippetBorder.wpColorPicker({
77
+ change: function (event, ui) {
78
+ pickColor(SnippetBorder.wpColorPicker("color"));
79
+ },
80
+ clear: function () {
81
+ pickColor("");
82
+ }
83
+ });
84
+ $mbas12(".snippet_border").click(toggle_text);
85
+ toggle_text();
86
+ });
87
+ })($mbas12);
88
+ // Snippet title color
89
+ (function ($mbas12) {
90
+ "use strict";
91
+ function pickColor(color) {
92
+ $mbas12(".snippet_title_color").val(color);
93
+ }
94
+ function toggle_text() {
95
+ var TitleColor = $mbas12(".snippet_title_color");
96
+ if ("" === TitleColor.val().replace("#", "")) {
97
+ TitleColor.val(default_color);
98
+ pickColor(default_color);
99
+ } else pickColor(TitleColor.val());
100
+ }
101
+ var default_color = "333333";
102
+ $mbas12(document).ready(function () {
103
+ var TitleColor = $mbas12(".snippet_title_color");
104
+ TitleColor.wpColorPicker({
105
+ change: function (event, ui) {
106
+ pickColor(TitleColor.wpColorPicker("color"));
107
+ },
108
+ clear: function () {
109
+ pickColor("");
110
+ }
111
+ });
112
+ $mbas12(".snippet_title_color").click(toggle_text);
113
+ toggle_text();
114
+ });
115
+ })($mbas12);
116
+
117
+ // Snippet text color
118
+ (function ($mbas12) {
119
+ "use strict";
120
+ function pickColor(color) {
121
+ $mbas12(".snippet_box_color").val(color);
122
+ }
123
+ function toggle_text() {
124
+ var BoxColor = $mbas12(".snippet_box_color");
125
+ if ("" === BoxColor.val().replace("#", "")) {
126
+ BoxColor.val(default_color);
127
+ pickColor(default_color);
128
+ } else pickColor(BoxColor.val());
129
+ }
130
+ var default_color = "333333";
131
+ $mbas12(document).ready(function () {
132
+ var BoxColor = $mbas12(".snippet_box_color");
133
+ BoxColor.wpColorPicker({
134
+ change: function (event, ui) {
135
+ pickColor(BoxColor.wpColorPicker("color"));
136
+ },
137
+ clear: function () {
138
+ pickColor("");
139
+ }
140
+ });
141
+ $mbas12(".snippet_box_color").click(toggle_text);
142
+ toggle_text();
143
+ });
144
+ })($mbas12);
js/jquery.js CHANGED
@@ -1,9597 +1,8082 @@
1
- /*!
2
- * jQuery JavaScript Library v1.9.1
3
- * http://jquery.com/
4
- *
5
- * Includes Sizzle.js
6
- * http://sizzlejs.com/
7
- *
8
- * Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors
9
- * Released under the MIT license
10
- * http://jquery.org/license
11
- *
12
- * Date: 2013-2-4
13
- */
14
- (function( window, undefined ) {
15
-
16
- // Can't do this because several apps including ASP.NET trace
17
- // the stack via arguments.caller.callee and Firefox dies if
18
- // you try to trace through "use strict" call chains. (#13335)
19
- // Support: Firefox 18+
20
- //"use strict";
21
- var
22
- // The deferred used on DOM ready
23
- readyList,
24
-
25
- // A central reference to the root jQuery(document)
26
- rootjQuery,
27
-
28
- // Support: IE<9
29
- // For `typeof node.method` instead of `node.method !== undefined`
30
- core_strundefined = typeof undefined,
31
-
32
- // Use the correct document accordingly with window argument (sandbox)
33
- document = window.document,
34
- location = window.location,
35
-
36
- // Map over jQuery in case of overwrite
37
- _jQuery = window.jQuery,
38
-
39
- // Map over the $ in case of overwrite
40
- _$ = window.$,
41
-
42
- // [[Class]] -> type pairs
43
- class2type = {},
44
-
45
- // List of deleted data cache ids, so we can reuse them
46
- core_deletedIds = [],
47
-
48
- core_version = "1.9.1",
49
-
50
- // Save a reference to some core methods
51
- core_concat = core_deletedIds.concat,
52
- core_push = core_deletedIds.push,
53
- core_slice = core_deletedIds.slice,
54
- core_indexOf = core_deletedIds.indexOf,
55
- core_toString = class2type.toString,
56
- core_hasOwn = class2type.hasOwnProperty,
57
- core_trim = core_version.trim,
58
-
59
- // Define a local copy of jQuery
60
- jQuery = function( selector, context ) {
61
- // The jQuery object is actually just the init constructor 'enhanced'
62
- return new jQuery.fn.init( selector, context, rootjQuery );
63
- },
64
-
65
- // Used for matching numbers
66
- core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
67
-
68
- // Used for splitting on whitespace
69
- core_rnotwhite = /\S+/g,
70
-
71
- // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
72
- rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
73
-
74
- // A simple way to check for HTML strings
75
- // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
76
- // Strict HTML recognition (#11290: must start with <)
77
- rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,
78
-
79
- // Match a standalone tag
80
- rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
81
-
82
- // JSON RegExp
83
- rvalidchars = /^[\],:{}\s]*$/,
84
- rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
85
- rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
86
- rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
87
-
88
- // Matches dashed string for camelizing
89
- rmsPrefix = /^-ms-/,
90
- rdashAlpha = /-([\da-z])/gi,
91
-
92
- // Used by jQuery.camelCase as callback to replace()
93
- fcamelCase = function( all, letter ) {
94
- return letter.toUpperCase();
95
- },
96
-
97
- // The ready event handler
98
- completed = function( event ) {
99
-
100
- // readyState === "complete" is good enough for us to call the dom ready in oldIE
101
- if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
102
- detach();
103
- jQuery.ready();
104
- }
105
- },
106
- // Clean-up method for dom ready events
107
- detach = function() {
108
- if ( document.addEventListener ) {
109
- document.removeEventListener( "DOMContentLoaded", completed, false );
110
- window.removeEventListener( "load", completed, false );
111
-
112
- } else {
113
- document.detachEvent( "onreadystatechange", completed );
114
- window.detachEvent( "onload", completed );
115
- }
116
- };
117
-
118
- jQuery.fn = jQuery.prototype = {
119
- // The current version of jQuery being used
120
- jquery: core_version,
121
-
122
- constructor: jQuery,
123
- init: function( selector, context, rootjQuery ) {
124
- var match, elem;
125
-
126
- // HANDLE: $(""), $(null), $(undefined), $(false)
127
- if ( !selector ) {
128
- return this;
129
- }
130
-
131
- // Handle HTML strings
132
- if ( typeof selector === "string" ) {
133
- if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
134
- // Assume that strings that start and end with <> are HTML and skip the regex check
135
- match = [ null, selector, null ];
136
-
137
- } else {
138
- match = rquickExpr.exec( selector );
139
- }
140
-
141
- // Match html or make sure no context is specified for #id
142
- if ( match && (match[1] || !context) ) {
143
-
144
- // HANDLE: $(html) -> $(array)
145
- if ( match[1] ) {
146
- context = context instanceof jQuery ? context[0] : context;
147
-
148
- // scripts is true for back-compat
149
- jQuery.merge( this, jQuery.parseHTML(
150
- match[1],
151
- context && context.nodeType ? context.ownerDocument || context : document,
152
- true
153
- ) );
154
-
155
- // HANDLE: $(html, props)
156
- if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
157
- for ( match in context ) {
158
- // Properties of context are called as methods if possible
159
- if ( jQuery.isFunction( this[ match ] ) ) {
160
- this[ match ]( context[ match ] );
161
-
162
- // ...and otherwise set as attributes
163
- } else {
164
- this.attr( match, context[ match ] );
165
- }
166
- }
167
- }
168
-
169
- return this;
170
-
171
- // HANDLE: $(#id)
172
- } else {
173
- elem = document.getElementById( match[2] );
174
-
175
- // Check parentNode to catch when Blackberry 4.6 returns
176
- // nodes that are no longer in the document #6963
177
- if ( elem && elem.parentNode ) {
178
- // Handle the case where IE and Opera return items
179
- // by name instead of ID
180
- if ( elem.id !== match[2] ) {
181
- return rootjQuery.find( selector );
182
- }
183
-
184
- // Otherwise, we inject the element directly into the jQuery object
185
- this.length = 1;
186
- this[0] = elem;
187
- }
188
-
189
- this.context = document;
190
- this.selector = selector;
191
- return this;
192
- }
193
-
194
- // HANDLE: $(expr, $(...))
195
- } else if ( !context || context.jquery ) {
196
- return ( context || rootjQuery ).find( selector );
197
-
198
- // HANDLE: $(expr, context)
199
- // (which is just equivalent to: $(context).find(expr)
200
- } else {
201
- return this.constructor( context ).find( selector );
202
- }
203
-
204
- // HANDLE: $(DOMElement)
205
- } else if ( selector.nodeType ) {
206
- this.context = this[0] = selector;
207
- this.length = 1;
208
- return this;
209
-
210
- // HANDLE: $(function)
211
- // Shortcut for document ready
212
- } else if ( jQuery.isFunction( selector ) ) {
213
- return rootjQuery.ready( selector );
214
- }
215
-
216
- if ( selector.selector !== undefined ) {
217
- this.selector = selector.selector;
218
- this.context = selector.context;
219
- }
220
-
221
- return jQuery.makeArray( selector, this );
222
- },
223
-
224
- // Start with an empty selector
225
- selector: "",
226
-
227
- // The default length of a jQuery object is 0
228
- length: 0,
229
-
230
- // The number of elements contained in the matched element set
231
- size: function() {
232
- return this.length;
233
- },
234
-
235
- toArray: function() {
236
- return core_slice.call( this );
237
- },
238
-
239
- // Get the Nth element in the matched element set OR
240
- // Get the whole matched element set as a clean array
241
- get: function( num ) {
242
- return num == null ?
243
-
244
- // Return a 'clean' array
245
- this.toArray() :
246
-
247
- // Return just the object
248
- ( num < 0 ? this[ this.length + num ] : this[ num ] );
249
- },
250
-
251
- // Take an array of elements and push it onto the stack
252
- // (returning the new matched element set)
253
- pushStack: function( elems ) {
254
-
255
- // Build a new jQuery matched element set
256
- var ret = jQuery.merge( this.constructor(), elems );
257
-
258
- // Add the old object onto the stack (as a reference)
259
- ret.prevObject = this;
260
- ret.context = this.context;
261
-
262
- // Return the newly-formed element set
263
- return ret;
264
- },
265
-
266
- // Execute a callback for every element in the matched set.
267
- // (You can seed the arguments with an array of args, but this is
268
- // only used internally.)
269
- each: function( callback, args ) {
270
- return jQuery.each( this, callback, args );
271
- },
272
-
273
- ready: function( fn ) {
274
- // Add the callback
275
- jQuery.ready.promise().done( fn );
276
-
277
- return this;
278
- },
279
-
280
- slice: function() {
281
- return this.pushStack( core_slice.apply( this, arguments ) );
282
- },
283
-
284
- first: function() {
285
- return this.eq( 0 );
286
- },
287
-
288
- last: function() {
289
- return this.eq( -1 );
290
- },
291
-
292
- eq: function( i ) {
293
- var len = this.length,
294
- j = +i + ( i < 0 ? len : 0 );
295
- return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
296
- },
297
-
298
- map: function( callback ) {
299
- return this.pushStack( jQuery.map(this, function( elem, i ) {
300
- return callback.call( elem, i, elem );
301
- }));
302
- },
303
-
304
- end: function() {
305
- return this.prevObject || this.constructor(null);
306
- },
307
-
308
- // For internal use only.
309
- // Behaves like an Array's method, not like a jQuery method.
310
- push: core_push,
311
- sort: [].sort,
312
- splice: [].splice
313
- };
314
-
315
- // Give the init function the jQuery prototype for later instantiation
316
- jQuery.fn.init.prototype = jQuery.fn;
317
-
318
- jQuery.extend = jQuery.fn.extend = function() {
319
- var src, copyIsArray, copy, name, options, clone,
320
- target = arguments[0] || {},
321
- i = 1,
322
- length = arguments.length,
323
- deep = false;
324
-
325
- // Handle a deep copy situation
326
- if ( typeof target === "boolean" ) {
327
- deep = target;
328
- target = arguments[1] || {};
329
- // skip the boolean and the target
330
- i = 2;
331
- }
332
-
333
- // Handle case when target is a string or something (possible in deep copy)
334
- if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
335
- target = {};
336
- }
337
-
338
- // extend jQuery itself if only one argument is passed
339
- if ( length === i ) {
340
- target = this;
341
- --i;
342
- }
343
-
344
- for ( ; i < length; i++ ) {
345
- // Only deal with non-null/undefined values
346
- if ( (options = arguments[ i ]) != null ) {
347
- // Extend the base object
348
- for ( name in options ) {
349
- src = target[ name ];
350
- copy = options[ name ];
351
-
352
- // Prevent never-ending loop
353
- if ( target === copy ) {
354
- continue;
355
- }
356
-
357
- // Recurse if we're merging plain objects or arrays
358
- if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
359
- if ( copyIsArray ) {
360
- copyIsArray = false;
361
- clone = src && jQuery.isArray(src) ? src : [];
362
-
363
- } else {
364
- clone = src && jQuery.isPlainObject(src) ? src : {};
365
- }
366
-
367
- // Never move original objects, clone them
368
- target[ name ] = jQuery.extend( deep, clone, copy );
369
-
370
- // Don't bring in undefined values
371
- } else if ( copy !== undefined ) {
372
- target[ name ] = copy;
373
- }
374
- }
375
- }
376
- }
377
-
378
- // Return the modified object
379
- return target;
380
- };
381
-
382
- jQuery.extend({
383
- noConflict: function( deep ) {
384
- if ( window.$ === jQuery ) {
385
- window.$ = _$;
386
- }
387
-
388
- if ( deep && window.jQuery === jQuery ) {
389
- window.jQuery = _jQuery;
390
- }
391
-
392
- return jQuery;
393
- },
394
-
395
- // Is the DOM ready to be used? Set to true once it occurs.
396
- isReady: false,
397
-
398
- // A counter to track how many items to wait for before
399
- // the ready event fires. See #6781
400
- readyWait: 1,
401
-
402
- // Hold (or release) the ready event
403
- holdReady: function( hold ) {
404
- if ( hold ) {
405
- jQuery.readyWait++;
406
- } else {
407
- jQuery.ready( true );
408
- }
409
- },
410
-
411
- // Handle when the DOM is ready
412
- ready: function( wait ) {
413
-
414
- // Abort if there are pending holds or we're already ready
415
- if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
416
- return;
417
- }
418
-
419
- // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
420
- if ( !document.body ) {
421
- return setTimeout( jQuery.ready );
422
- }
423
-
424
- // Remember that the DOM is ready
425
- jQuery.isReady = true;
426
-
427
- // If a normal DOM Ready event fired, decrement, and wait if need be
428
- if ( wait !== true && --jQuery.readyWait > 0 ) {
429
- return;
430
- }
431
-
432
- // If there are functions bound, to execute
433
- readyList.resolveWith( document, [ jQuery ] );
434
-
435
- // Trigger any bound ready events
436
- if ( jQuery.fn.trigger ) {
437
- jQuery( document ).trigger("ready").off("ready");
438
- }
439
- },
440
-
441
- // See test/unit/core.js for details concerning isFunction.
442
- // Since version 1.3, DOM methods and functions like alert
443
- // aren't supported. They return false on IE (#2968).
444
- isFunction: function( obj ) {
445
- return jQuery.type(obj) === "function";
446
- },
447
-
448
- isArray: Array.isArray || function( obj ) {
449
- return jQuery.type(obj) === "array";
450
- },
451
-
452
- isWindow: function( obj ) {
453
- return obj != null && obj == obj.window;
454
- },
455
-
456
- isNumeric: function( obj ) {
457
- return !isNaN( parseFloat(obj) ) && isFinite( obj );
458
- },
459
-
460
- type: function( obj ) {
461
- if ( obj == null ) {
462
- return String( obj );
463
- }
464
- return typeof obj === "object" || typeof obj === "function" ?
465
- class2type[ core_toString.call(obj) ] || "object" :
466
- typeof obj;
467
- },
468
-
469
- isPlainObject: function( obj ) {
470
- // Must be an Object.
471
- // Because of IE, we also have to check the presence of the constructor property.
472
- // Make sure that DOM nodes and window objects don't pass through, as well
473
- if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
474
- return false;
475
- }
476
-
477
- try {
478
- // Not own constructor property must be Object
479
- if ( obj.constructor &&
480
- !core_hasOwn.call(obj, "constructor") &&
481
- !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
482
- return false;
483
- }
484
- } catch ( e ) {
485
- // IE8,9 Will throw exceptions on certain host objects #9897
486
- return false;
487
- }
488
-
489
- // Own properties are enumerated firstly, so to speed up,
490
- // if last one is own, then all properties are own.
491
-
492
- var key;
493
- for ( key in obj ) {}
494
-
495
- return key === undefined || core_hasOwn.call( obj, key );
496
- },
497
-
498
- isEmptyObject: function( obj ) {
499
- var name;
500
- for ( name in obj ) {
501
- return false;
502
- }
503
- return true;
504
- },
505
-
506
- error: function( msg ) {
507
- throw new Error( msg );
508
- },
509
-
510
- // data: string of html
511
- // context (optional): If specified, the fragment will be created in this context, defaults to document
512
- // keepScripts (optional): If true, will include scripts passed in the html string
513
- parseHTML: function( data, context, keepScripts ) {
514
- if ( !data || typeof data !== "string" ) {
515
- return null;
516
- }
517
- if ( typeof context === "boolean" ) {
518
- keepScripts = context;
519
- context = false;
520
- }
521
- context = context || document;
522
-
523
- var parsed = rsingleTag.exec( data ),
524
- scripts = !keepScripts && [];
525
-
526
- // Single tag
527
- if ( parsed ) {
528
- return [ context.createElement( parsed[1] ) ];
529
- }
530
-
531
- parsed = jQuery.buildFragment( [ data ], context, scripts );
532
- if ( scripts ) {
533
- jQuery( scripts ).remove();
534
- }
535
- return jQuery.merge( [], parsed.childNodes );
536
- },
537
-
538
- parseJSON: function( data ) {
539
- // Attempt to parse using the native JSON parser first
540
- if ( window.JSON && window.JSON.parse ) {
541
- return window.JSON.parse( data );
542
- }
543
-
544
- if ( data === null ) {
545
- return data;
546
- }
547
-
548
- if ( typeof data === "string" ) {
549
-
550
- // Make sure leading/trailing whitespace is removed (IE can't handle it)
551
- data = jQuery.trim( data );
552
-
553
- if ( data ) {
554
- // Make sure the incoming data is actual JSON
555
- // Logic borrowed from http://json.org/json2.js
556
- if ( rvalidchars.test( data.replace( rvalidescape, "@" )
557
- .replace( rvalidtokens, "]" )
558
- .replace( rvalidbraces, "")) ) {
559
-
560
- return ( new Function( "return " + data ) )();
561
- }
562
- }
563
- }
564
-
565
- jQuery.error( "Invalid JSON: " + data );
566
- },
567
-
568
- // Cross-browser xml parsing
569
- parseXML: function( data ) {
570
- var xml, tmp;
571
- if ( !data || typeof data !== "string" ) {
572
- return null;
573
- }
574
- try {
575
- if ( window.DOMParser ) { // Standard
576
- tmp = new DOMParser();
577
- xml = tmp.parseFromString( data , "text/xml" );
578
- } else { // IE
579
- xml = new ActiveXObject( "Microsoft.XMLDOM" );
580
- xml.async = "false";
581
- xml.loadXML( data );
582
- }
583
- } catch( e ) {
584
- xml = undefined;
585
- }
586
- if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
587
- jQuery.error( "Invalid XML: " + data );
588
- }
589
- return xml;
590
- },
591
-
592
- noop: function() {},
593
-
594
- // Evaluates a script in a global context
595
- // Workarounds based on findings by Jim Driscoll
596
- // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
597
- globalEval: function( data ) {
598
- if ( data && jQuery.trim( data ) ) {
599
- // We use execScript on Internet Explorer
600
- // We use an anonymous function so that context is window
601
- // rather than jQuery in Firefox
602
- ( window.execScript || function( data ) {
603
- window[ "eval" ].call( window, data );
604
- } )( data );
605
- }
606
- },
607
-
608
- // Convert dashed to camelCase; used by the css and data modules
609
- // Microsoft forgot to hump their vendor prefix (#9572)
610
- camelCase: function( string ) {
611
- return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
612
- },
613
-
614
- nodeName: function( elem, name ) {
615
- return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
616
- },
617
-
618
- // args is for internal usage only
619
- each: function( obj, callback, args ) {
620
- var value,
621
- i = 0,
622
- length = obj.length,
623
- isArray = isArraylike( obj );
624
-
625
- if ( args ) {
626
- if ( isArray ) {
627
- for ( ; i < length; i++ ) {
628
- value = callback.apply( obj[ i ], args );
629
-
630
- if ( value === false ) {
631
- break;
632
- }
633
- }
634
- } else {
635
- for ( i in obj ) {
636
- value = callback.apply( obj[ i ], args );
637
-
638
- if ( value === false ) {
639
- break;
640
- }
641
- }
642
- }
643
-
644
- // A special, fast, case for the most common use of each
645
- } else {
646
- if ( isArray ) {
647
- for ( ; i < length; i++ ) {
648
- value = callback.call( obj[ i ], i, obj[ i ] );
649
-
650
- if ( value === false ) {
651
- break;
652
- }
653
- }
654
- } else {
655
- for ( i in obj ) {
656
- value = callback.call( obj[ i ], i, obj[ i ] );
657
-
658
- if ( value === false ) {
659
- break;
660
- }
661
- }
662
- }
663
- }
664
-
665
- return obj;
666
- },
667
-
668
- // Use native String.trim function wherever possible
669
- trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
670
- function( text ) {
671
- return text == null ?
672
- "" :
673
- core_trim.call( text );
674
- } :
675
-
676
- // Otherwise use our own trimming functionality
677
- function( text ) {
678
- return text == null ?
679
- "" :
680
- ( text + "" ).replace( rtrim, "" );
681
- },
682
-
683
- // results is for internal usage only
684
- makeArray: function( arr, results ) {
685
- var ret = results || [];
686
-
687
- if ( arr != null ) {
688
- if ( isArraylike( Object(arr) ) ) {
689
- jQuery.merge( ret,
690
- typeof arr === "string" ?
691
- [ arr ] : arr
692
- );
693
- } else {
694
- core_push.call( ret, arr );
695
- }
696
- }
697
-
698
- return ret;
699
- },
700
-
701
- inArray: function( elem, arr, i ) {
702
- var len;
703
-
704
- if ( arr ) {
705
- if ( core_indexOf ) {
706
- return core_indexOf.call( arr, elem, i );
707
- }
708
-
709
- len = arr.length;
710
- i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
711
-
712
- for ( ; i < len; i++ ) {
713
- // Skip accessing in sparse arrays
714
- if ( i in arr && arr[ i ] === elem ) {
715
- return i;
716
- }
717
- }
718
- }
719
-
720
- return -1;
721
- },
722
-
723
- merge: function( first, second ) {
724
- var l = second.length,
725
- i = first.length,
726
- j = 0;
727
-
728
- if ( typeof l === "number" ) {
729
- for ( ; j < l; j++ ) {
730
- first[ i++ ] = second[ j ];
731
- }
732
- } else {
733
- while ( second[j] !== undefined ) {
734
- first[ i++ ] = second[ j++ ];
735
- }
736
- }
737
-
738
- first.length = i;
739
-
740
- return first;
741
- },
742
-
743
- grep: function( elems, callback, inv ) {
744
- var retVal,
745
- ret = [],
746
- i = 0,
747
- length = elems.length;
748
- inv = !!inv;
749
-
750
- // Go through the array, only saving the items
751
- // that pass the validator function
752
- for ( ; i < length; i++ ) {
753
- retVal = !!callback( elems[ i ], i );
754
- if ( inv !== retVal ) {
755
- ret.push( elems[ i ] );
756
- }
757
- }
758
-
759
- return ret;
760
- },
761
-
762
- // arg is for internal usage only
763
- map: function( elems, callback, arg ) {
764
- var value,
765
- i = 0,
766
- length = elems.length,
767
- isArray = isArraylike( elems ),
768
- ret = [];
769
-
770
- // Go through the array, translating each of the items to their
771
- if ( isArray ) {
772
- for ( ; i < length; i++ ) {
773
- value = callback( elems[ i ], i, arg );
774
-
775
- if ( value != null ) {
776
- ret[ ret.length ] = value;
777
- }
778
- }
779
-
780
- // Go through every key on the object,
781
- } else {
782
- for ( i in elems ) {
783
- value = callback( elems[ i ], i, arg );
784
-
785
- if ( value != null ) {
786
- ret[ ret.length ] = value;
787
- }
788
- }
789
- }
790
-
791
- // Flatten any nested arrays
792
- return core_concat.apply( [], ret );
793
- },
794
-
795
- // A global GUID counter for objects
796
- guid: 1,
797
-
798
- // Bind a function to a context, optionally partially applying any
799
- // arguments.
800
- proxy: function( fn, context ) {
801
- var args, proxy, tmp;
802
-
803
- if ( typeof context === "string" ) {
804
- tmp = fn[ context ];
805
- context = fn;
806
- fn = tmp;
807
- }
808
-
809
- // Quick check to determine if target is callable, in the spec
810
- // this throws a TypeError, but we will just return undefined.
811
- if ( !jQuery.isFunction( fn ) ) {
812
- return undefined;
813
- }
814
-
815
- // Simulated bind
816
- args = core_slice.call( arguments, 2 );
817
- proxy = function() {
818
- return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );
819
- };
820
-
821
- // Set the guid of unique handler to the same of original handler, so it can be removed
822
- proxy.guid = fn.guid = fn.guid || jQuery.guid++;
823
-
824
- return proxy;
825
- },
826
-
827
- // Multifunctional method to get and set values of a collection
828
- // The value/s can optionally be executed if it's a function
829
- access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
830
- var i = 0,
831
- length = elems.length,
832
- bulk = key == null;
833
-
834
- // Sets many values
835
- if ( jQuery.type( key ) === "object" ) {
836
- chainable = true;
837
- for ( i in key ) {
838
- jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
839
- }
840
-
841
- // Sets one value
842
- } else if ( value !== undefined ) {
843
- chainable = true;
844
-
845
- if ( !jQuery.isFunction( value ) ) {
846
- raw = true;
847
- }
848
-
849
- if ( bulk ) {
850
- // Bulk operations run against the entire set
851
- if ( raw ) {
852
- fn.call( elems, value );
853
- fn = null;
854
-
855
- // ...except when executing function values
856
- } else {
857
- bulk = fn;
858
- fn = function( elem, key, value ) {
859
- return bulk.call( jQuery( elem ), value );
860
- };
861
- }
862
- }
863
-
864
- if ( fn ) {
865
- for ( ; i < length; i++ ) {
866
- fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
867
- }
868
- }
869
- }
870
-
871
- return chainable ?
872
- elems :
873
-
874
- // Gets
875
- bulk ?
876
- fn.call( elems ) :
877
- length ? fn( elems[0], key ) : emptyGet;
878
- },
879
-
880
- now: function() {
881
- return ( new Date() ).getTime();
882
- }
883
- });
884
-
885
- jQuery.ready.promise = function( obj ) {
886
- if ( !readyList ) {
887
-
888
- readyList = jQuery.Deferred();
889
-
890
- // Catch cases where $(document).ready() is called after the browser event has already occurred.
891
- // we once tried to use readyState "interactive" here, but it caused issues like the one
892
- // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
893
- if ( document.readyState === "complete" ) {
894
- // Handle it asynchronously to allow scripts the opportunity to delay ready
895
- setTimeout( jQuery.ready );
896
-
897
- // Standards-based browsers support DOMContentLoaded
898
- } else if ( document.addEventListener ) {
899
- // Use the handy event callback
900
- document.addEventListener( "DOMContentLoaded", completed, false );
901
-
902
- // A fallback to window.onload, that will always work
903
- window.addEventListener( "load", completed, false );
904
-
905
- // If IE event model is used
906
- } else {
907
- // Ensure firing before onload, maybe late but safe also for iframes
908
- document.attachEvent( "onreadystatechange", completed );
909
-
910
- // A fallback to window.onload, that will always work
911
- window.attachEvent( "onload", completed );
912
-
913
- // If IE and not a frame
914
- // continually check to see if the document is ready
915
- var top = false;
916
-
917
- try {
918
- top = window.frameElement == null && document.documentElement;
919
- } catch(e) {}
920
-
921
- if ( top && top.doScroll ) {
922
- (function doScrollCheck() {
923
- if ( !jQuery.isReady ) {
924
-
925
- try {
926
- // Use the trick by Diego Perini
927
- // http://javascript.nwbox.com/IEContentLoaded/
928
- top.doScroll("left");
929
- } catch(e) {
930
- return setTimeout( doScrollCheck, 50 );
931
- }
932
-
933
- // detach all dom ready events
934
- detach();
935
-
936
- // and execute any waiting functions
937
- jQuery.ready();
938
- }
939
- })();
940
- }
941
- }
942
- }
943
- return readyList.promise( obj );
944
- };
945
-
946
- // Populate the class2type map
947
- jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
948
- class2type[ "[object " + name + "]" ] = name.toLowerCase();
949
- });
950
-
951
- function isArraylike( obj ) {
952
- var length = obj.length,
953
- type = jQuery.type( obj );
954
-
955
- if ( jQuery.isWindow( obj ) ) {
956
- return false;
957
- }
958
-
959
- if ( obj.nodeType === 1 && length ) {
960
- return true;
961
- }
962
-
963
- return type === "array" || type !== "function" &&
964
- ( length === 0 ||
965
- typeof length === "number" && length > 0 && ( length - 1 ) in obj );
966
- }
967
-
968
- // All jQuery objects should point back to these
969
- rootjQuery = jQuery(document);
970
- // String to Object options format cache
971
- var optionsCache = {};
972
-
973
- // Convert String-formatted options into Object-formatted ones and store in cache
974
- function createOptions( options ) {
975
- var object = optionsCache[ options ] = {};
976
- jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {
977
- object[ flag ] = true;
978
- });
979
- return object;
980
- }
981
-
982
- /*
983
- * Create a callback list using the following parameters:
984
- *
985
- * options: an optional list of space-separated options that will change how
986
- * the callback list behaves or a more traditional option object
987
- *
988
- * By default a callback list will act like an event callback list and can be
989
- * "fired" multiple times.
990
- *
991
- * Possible options:
992
- *
993
- * once: will ensure the callback list can only be fired once (like a Deferred)
994
- *
995
- * memory: will keep track of previous values and will call any callback added
996
- * after the list has been fired right away with the latest "memorized"
997
- * values (like a Deferred)
998
- *
999
- * unique: will ensure a callback can only be added once (no duplicate in the list)
1000
- *
1001
- * stopOnFalse: interrupt callings when a callback returns false
1002
- *
1003
- */
1004
- jQuery.Callbacks = function( options ) {
1005
-
1006
- // Convert options from String-formatted to Object-formatted if needed
1007
- // (we check in cache first)
1008
- options = typeof options === "string" ?
1009
- ( optionsCache[ options ] || createOptions( options ) ) :
1010
- jQuery.extend( {}, options );
1011
-
1012
- var // Flag to know if list is currently firing
1013
- firing,
1014
- // Last fire value (for non-forgettable lists)
1015
- memory,
1016
- // Flag to know if list was already fired
1017
- fired,
1018
- // End of the loop when firing
1019
- firingLength,
1020
- // Index of currently firing callback (modified by remove if needed)
1021
- firingIndex,
1022
- // First callback to fire (used internally by add and fireWith)
1023
- firingStart,
1024
- // Actual callback list
1025
- list = [],
1026
- // Stack of fire calls for repeatable lists
1027
- stack = !options.once && [],
1028
- // Fire callbacks
1029
- fire = function( data ) {
1030
- memory = options.memory && data;
1031
- fired = true;
1032
- firingIndex = firingStart || 0;
1033
- firingStart = 0;
1034
- firingLength = list.length;
1035
- firing = true;
1036
- for ( ; list && firingIndex < firingLength; firingIndex++ ) {
1037
- if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
1038
- memory = false; // To prevent further calls using add
1039
- break;
1040
- }
1041
- }
1042
- firing = false;
1043
- if ( list ) {
1044
- if ( stack ) {
1045
- if ( stack.length ) {
1046
- fire( stack.shift() );
1047
- }
1048
- } else if ( memory ) {
1049
- list = [];
1050
- } else {
1051
- self.disable();
1052
- }
1053
- }
1054
- },
1055
- // Actual Callbacks object
1056
- self = {
1057
- // Add a callback or a collection of callbacks to the list
1058
- add: function() {
1059
- if ( list ) {
1060
- // First, we save the current length
1061
- var start = list.length;
1062
- (function add( args ) {
1063
- jQuery.each( args, function( _, arg ) {
1064
- var type = jQuery.type( arg );
1065
- if ( type === "function" ) {
1066
- if ( !options.unique || !self.has( arg ) ) {
1067
- list.push( arg );
1068
- }
1069
- } else if ( arg && arg.length && type !== "string" ) {
1070
- // Inspect recursively
1071
- add( arg );
1072
- }
1073
- });
1074
- })( arguments );
1075
- // Do we need to add the callbacks to the
1076
- // current firing batch?
1077
- if ( firing ) {
1078
- firingLength = list.length;
1079
- // With memory, if we're not firing then
1080
- // we should call right away
1081
- } else if ( memory ) {
1082
- firingStart = start;
1083
- fire( memory );
1084
- }
1085
- }
1086
- return this;
1087
- },
1088
- // Remove a callback from the list
1089
- remove: function() {
1090
- if ( list ) {
1091
- jQuery.each( arguments, function( _, arg ) {
1092
- var index;
1093
- while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
1094
- list.splice( index, 1 );
1095
- // Handle firing indexes
1096
- if ( firing ) {
1097
- if ( index <= firingLength ) {
1098
- firingLength--;
1099
- }
1100
- if ( index <= firingIndex ) {
1101
- firingIndex--;
1102
- }
1103
- }
1104
- }
1105
- });
1106
- }
1107
- return this;
1108
- },
1109
- // Check if a given callback is in the list.
1110
- // If no argument is given, return whether or not list has callbacks attached.
1111
- has: function( fn ) {
1112
- return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
1113
- },
1114
- // Remove all callbacks from the list
1115
- empty: function() {
1116
- list = [];
1117
- return this;
1118
- },
1119
- // Have the list do nothing anymore
1120
- disable: function() {
1121
- list = stack = memory = undefined;
1122
- return this;
1123
- },
1124
- // Is it disabled?
1125
- disabled: function() {
1126
- return !list;
1127
- },
1128
- // Lock the list in its current state
1129
- lock: function() {
1130
- stack = undefined;
1131
- if ( !memory ) {
1132
- self.disable();
1133
- }
1134
- return this;
1135
- },
1136
- // Is it locked?
1137
- locked: function() {
1138
- return !stack;
1139
- },
1140
- // Call all callbacks with the given context and arguments
1141
- fireWith: function( context, args ) {
1142
- args = args || [];
1143
- args = [ context, args.slice ? args.slice() : args ];
1144
- if ( list && ( !fired || stack ) ) {
1145
- if ( firing ) {
1146
- stack.push( args );
1147
- } else {
1148
- fire( args );
1149
- }
1150
- }
1151
- return this;
1152
- },
1153
- // Call all the callbacks with the given arguments
1154
- fire: function() {
1155
- self.fireWith( this, arguments );
1156
- return this;
1157
- },
1158
- // To know if the callbacks have already been called at least once
1159
- fired: function() {
1160
- return !!fired;
1161
- }
1162
- };
1163
-
1164
- return self;
1165
- };
1166
- jQuery.extend({
1167
-
1168
- Deferred: function( func ) {
1169
- var tuples = [
1170
- // action, add listener, listener list, final state
1171
- [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
1172
- [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
1173
- [ "notify", "progress", jQuery.Callbacks("memory") ]
1174
- ],
1175
- state = "pending",
1176
- promise = {
1177
- state: function() {
1178
- return state;
1179
- },
1180
- always: function() {
1181
- deferred.done( arguments ).fail( arguments );
1182
- return this;
1183
- },
1184
- then: function( /* fnDone, fnFail, fnProgress */ ) {
1185
- var fns = arguments;
1186
- return jQuery.Deferred(function( newDefer ) {
1187
- jQuery.each( tuples, function( i, tuple ) {
1188
- var action = tuple[ 0 ],
1189
- fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
1190
- // deferred[ done | fail | progress ] for forwarding actions to newDefer
1191
- deferred[ tuple[1] ](function() {
1192
- var returned = fn && fn.apply( this, arguments );
1193
- if ( returned && jQuery.isFunction( returned.promise ) ) {
1194
- returned.promise()
1195
- .done( newDefer.resolve )
1196
- .fail( newDefer.reject )
1197
- .progress( newDefer.notify );
1198
- } else {
1199
- newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
1200
- }
1201
- });
1202
- });
1203
- fns = null;
1204
- }).promise();
1205
- },
1206
- // Get a promise for this deferred
1207
- // If obj is provided, the promise aspect is added to the object
1208
- promise: function( obj ) {
1209
- return obj != null ? jQuery.extend( obj, promise ) : promise;
1210
- }
1211
- },
1212
- deferred = {};
1213
-
1214
- // Keep pipe for back-compat
1215
- promise.pipe = promise.then;
1216
-
1217
- // Add list-specific methods
1218
- jQuery.each( tuples, function( i, tuple ) {
1219
- var list = tuple[ 2 ],
1220
- stateString = tuple[ 3 ];
1221
-
1222
- // promise[ done | fail | progress ] = list.add
1223
- promise[ tuple[1] ] = list.add;
1224
-
1225
- // Handle state
1226
- if ( stateString ) {
1227
- list.add(function() {
1228
- // state = [ resolved | rejected ]
1229
- state = stateString;
1230
-
1231
- // [ reject_list | resolve_list ].disable; progress_list.lock
1232
- }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
1233
- }
1234
-
1235
- // deferred[ resolve | reject | notify ]
1236
- deferred[ tuple[0] ] = function() {
1237
- deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
1238
- return this;
1239
- };
1240
- deferred[ tuple[0] + "With" ] = list.fireWith;
1241
- });
1242
-
1243
- // Make the deferred a promise
1244
- promise.promise( deferred );
1245
-
1246
- // Call given func if any
1247
- if ( func ) {
1248
- func.call( deferred, deferred );
1249
- }
1250
-
1251
- // All done!
1252
- return deferred;
1253
- },
1254
-
1255
- // Deferred helper
1256
- when: function( subordinate /* , ..., subordinateN */ ) {
1257
- var i = 0,
1258
- resolveValues = core_slice.call( arguments ),
1259
- length = resolveValues.length,
1260
-
1261
- // the count of uncompleted subordinates
1262
- remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
1263
-
1264
- // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
1265
- deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
1266
-
1267
- // Update function for both resolve and progress values
1268
- updateFunc = function( i, contexts, values ) {
1269
- return function( value ) {
1270
- contexts[ i ] = this;
1271
- values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
1272
- if( values === progressValues ) {
1273
- deferred.notifyWith( contexts, values );
1274
- } else if ( !( --remaining ) ) {
1275
- deferred.resolveWith( contexts, values );
1276
- }
1277
- };
1278
- },
1279
-
1280
- progressValues, progressContexts, resolveContexts;
1281
-
1282
- // add listeners to Deferred subordinates; treat others as resolved
1283
- if ( length > 1 ) {
1284
- progressValues = new Array( length );
1285
- progressContexts = new Array( length );
1286
- resolveContexts = new Array( length );
1287
- for ( ; i < length; i++ ) {
1288
- if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
1289
- resolveValues[ i ].promise()
1290
- .done( updateFunc( i, resolveContexts, resolveValues ) )
1291
- .fail( deferred.reject )
1292
- .progress( updateFunc( i, progressContexts, progressValues ) );
1293
- } else {
1294
- --remaining;
1295
- }
1296
- }
1297
- }
1298
-
1299
- // if we're not waiting on anything, resolve the master
1300
- if ( !remaining ) {
1301
- deferred.resolveWith( resolveContexts, resolveValues );
1302
- }
1303
-
1304
- return deferred.promise();
1305
- }
1306
- });
1307
- jQuery.support = (function() {
1308
-
1309
- var support, all, a,
1310
- input, select, fragment,
1311
- opt, eventName, isSupported, i,
1312
- div = document.createElement("div");
1313
-
1314
- // Setup
1315
- div.setAttribute( "className", "t" );
1316
- div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
1317
-
1318
- // Support tests won't run in some limited or non-browser environments
1319
- all = div.getElementsByTagName("*");
1320
- a = div.getElementsByTagName("a")[ 0 ];
1321
- if ( !all || !a || !all.length ) {
1322
- return {};
1323
- }
1324
-
1325
- // First batch of tests
1326
- select = document.createElement("select");
1327
- opt = select.appendChild( document.createElement("option") );
1328
- input = div.getElementsByTagName("input")[ 0 ];
1329
-
1330
- a.style.cssText = "top:1px;float:left;opacity:.5";
1331
- support = {
1332
- // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
1333
- getSetAttribute: div.className !== "t",
1334
-
1335
- // IE strips leading whitespace when .innerHTML is used
1336
- leadingWhitespace: div.firstChild.nodeType === 3,
1337
-
1338
- // Make sure that tbody elements aren't automatically inserted
1339
- // IE will insert them into empty tables
1340
- tbody: !div.getElementsByTagName("tbody").length,
1341
-
1342
- // Make sure that link elements get serialized correctly by innerHTML
1343
- // This requires a wrapper element in IE
1344
- htmlSerialize: !!div.getElementsByTagName("link").length,
1345
-
1346
- // Get the style information from getAttribute
1347
- // (IE uses .cssText instead)
1348
- style: /top/.test( a.getAttribute("style") ),
1349
-
1350
- // Make sure that URLs aren't manipulated
1351
- // (IE normalizes it by default)
1352
- hrefNormalized: a.getAttribute("href") === "/a",
1353
-
1354
- // Make sure that element opacity exists
1355
- // (IE uses filter instead)
1356
- // Use a regex to work around a WebKit issue. See #5145
1357
- opacity: /^0.5/.test( a.style.opacity ),
1358
-
1359
- // Verify style float existence
1360
- // (IE uses styleFloat instead of cssFloat)
1361
- cssFloat: !!a.style.cssFloat,
1362
-
1363
- // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
1364
- checkOn: !!input.value,
1365
-
1366
- // Make sure that a selected-by-default option has a working selected property.
1367
- // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
1368
- optSelected: opt.selected,
1369
-
1370
- // Tests for enctype support on a form (#6743)
1371
- enctype: !!document.createElement("form").enctype,
1372
-
1373
- // Makes sure cloning an html5 element does not cause problems
1374
- // Where outerHTML is undefined, this still works
1375
- html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
1376
-
1377
- // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
1378
- boxModel: document.compatMode === "CSS1Compat",
1379
-
1380
- // Will be defined later
1381
- deleteExpando: true,
1382
- noCloneEvent: true,
1383
- inlineBlockNeedsLayout: false,
1384
- shrinkWrapBlocks: false,
1385
- reliableMarginRight: true,
1386
- boxSizingReliable: true,
1387
- pixelPosition: false
1388
- };
1389
-
1390
- // Make sure checked status is properly cloned
1391
- input.checked = true;
1392
- support.noCloneChecked = input.cloneNode( true ).checked;
1393
-
1394
- // Make sure that the options inside disabled selects aren't marked as disabled
1395
- // (WebKit marks them as disabled)
1396
- select.disabled = true;
1397
- support.optDisabled = !opt.disabled;
1398
-
1399
- // Support: IE<9
1400
- try {
1401
- delete div.test;
1402
- } catch( e ) {
1403
- support.deleteExpando = false;
1404
- }
1405
-
1406
- // Check if we can trust getAttribute("value")
1407
- input = document.createElement("input");
1408
- input.setAttribute( "value", "" );
1409
- support.input = input.getAttribute( "value" ) === "";
1410
-
1411
- // Check if an input maintains its value after becoming a radio
1412
- input.value = "t";
1413
- input.setAttribute( "type", "radio" );
1414
- support.radioValue = input.value === "t";
1415
-
1416
- // #11217 - WebKit loses check when the name is after the checked attribute
1417
- input.setAttribute( "checked", "t" );
1418
- input.setAttribute( "name", "t" );
1419
-
1420
- fragment = document.createDocumentFragment();
1421
- fragment.appendChild( input );
1422
-
1423
- // Check if a disconnected checkbox will retain its checked
1424
- // value of true after appended to the DOM (IE6/7)
1425
- support.appendChecked = input.checked;
1426
-
1427
- // WebKit doesn't clone checked state correctly in fragments
1428
- support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
1429
-
1430
- // Support: IE<9
1431
- // Opera does not clone events (and typeof div.attachEvent === undefined).
1432
- // IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
1433
- if ( div.attachEvent ) {
1434
- div.attachEvent( "onclick", function() {
1435
- support.noCloneEvent = false;
1436
- });
1437
-
1438
- div.cloneNode( true ).click();
1439
- }
1440
-
1441
- // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
1442
- // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php
1443
- for ( i in { submit: true, change: true, focusin: true }) {
1444
- div.setAttribute( eventName = "on" + i, "t" );
1445
-
1446
- support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
1447
- }
1448
-
1449
- div.style.backgroundClip = "content-box";
1450
- div.cloneNode( true ).style.backgroundClip = "";
1451
- support.clearCloneStyle = div.style.backgroundClip === "content-box";
1452
-
1453
- // Run tests that need a body at doc ready
1454
- jQuery(function() {
1455
- var container, marginDiv, tds,
1456
- divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
1457
- body = document.getElementsByTagName("body")[0];
1458
-
1459
- if ( !body ) {
1460
- // Return for frameset docs that don't have a body
1461
- return;
1462
- }
1463
-
1464
- container = document.createElement("div");
1465
- container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
1466
-
1467
- body.appendChild( container ).appendChild( div );
1468
-
1469
- // Support: IE8
1470
- // Check if table cells still have offsetWidth/Height when they are set
1471
- // to display:none and there are still other visible table cells in a
1472
- // table row; if so, offsetWidth/Height are not reliable for use when
1473
- // determining if an element has been hidden directly using
1474
- // display:none (it is still safe to use offsets if a parent element is
1475
- // hidden; don safety goggles and see bug #4512 for more information).
1476
- div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
1477
- tds = div.getElementsByTagName("td");
1478
- tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
1479
- isSupported = ( tds[ 0 ].offsetHeight === 0 );
1480
-
1481
- tds[ 0 ].style.display = "";
1482
- tds[ 1 ].style.display = "none";
1483
-
1484
- // Support: IE8
1485
- // Check if empty table cells still have offsetWidth/Height
1486
- support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
1487
-
1488
- // Check box-sizing and margin behavior
1489
- div.innerHTML = "";
1490
- div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
1491
- support.boxSizing = ( div.offsetWidth === 4 );
1492
- support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
1493
-
1494
- // Use window.getComputedStyle because jsdom on node.js will break without it.
1495
- if ( window.getComputedStyle ) {
1496
- support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
1497
- support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
1498
-
1499
- // Check if div with explicit width and no margin-right incorrectly
1500
- // gets computed margin-right based on width of container. (#3333)
1501
- // Fails in WebKit before Feb 2011 nightlies
1502
- // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
1503
- marginDiv = div.appendChild( document.createElement("div") );
1504
- marginDiv.style.cssText = div.style.cssText = divReset;
1505
- marginDiv.style.marginRight = marginDiv.style.width = "0";
1506
- div.style.width = "1px";
1507
-
1508
- support.reliableMarginRight =
1509
- !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
1510
- }
1511
-
1512
- if ( typeof div.style.zoom !== core_strundefined ) {
1513
- // Support: IE<8
1514
- // Check if natively block-level elements act like inline-block
1515
- // elements when setting their display to 'inline' and giving
1516
- // them layout
1517
- div.innerHTML = "";
1518
- div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
1519
- support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
1520
-
1521
- // Support: IE6
1522
- // Check if elements with layout shrink-wrap their children
1523
- div.style.display = "block";
1524
- div.innerHTML = "<div></div>";
1525
- div.firstChild.style.width = "5px";
1526
- support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
1527
-
1528
- if ( support.inlineBlockNeedsLayout ) {
1529
- // Prevent IE 6 from affecting layout for positioned elements #11048
1530
- // Prevent IE from shrinking the body in IE 7 mode #12869
1531
- // Support: IE<8
1532
- body.style.zoom = 1;
1533
- }
1534
- }
1535
-
1536
- body.removeChild( container );
1537
-
1538
- // Null elements to avoid leaks in IE
1539
- container = div = tds = marginDiv = null;
1540
- });
1541
-
1542
- // Null elements to avoid leaks in IE
1543
- all = select = fragment = opt = a = input = null;
1544
-
1545
- return support;
1546
- })();
1547
-
1548
- var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
1549
- rmultiDash = /([A-Z])/g;
1550
-
1551
- function internalData( elem, name, data, pvt /* Internal Use Only */ ){
1552
- if ( !jQuery.acceptData( elem ) ) {
1553
- return;
1554
- }
1555
-
1556
- var thisCache, ret,
1557
- internalKey = jQuery.expando,
1558
- getByName = typeof name === "string",
1559
-
1560
- // We have to handle DOM nodes and JS objects differently because IE6-7
1561
- // can't GC object references properly across the DOM-JS boundary
1562
- isNode = elem.nodeType,
1563
-
1564
- // Only DOM nodes need the global jQuery cache; JS object data is
1565
- // attached directly to the object so GC can occur automatically
1566
- cache = isNode ? jQuery.cache : elem,
1567
-
1568
- // Only defining an ID for JS objects if its cache already exists allows
1569
- // the code to shortcut on the same path as a DOM node with no cache
1570
- id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
1571
-
1572
- // Avoid doing any more work than we need to when trying to get data on an
1573
- // object that has no data at all
1574
- if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
1575
- return;
1576
- }
1577
-
1578
- if ( !id ) {
1579
- // Only DOM nodes need a new unique ID for each element since their data
1580
- // ends up in the global cache
1581
- if ( isNode ) {
1582
- elem[ internalKey ] = id = core_deletedIds.pop() || jQuery.guid++;
1583
- } else {
1584
- id = internalKey;
1585
- }
1586
- }
1587
-
1588
- if ( !cache[ id ] ) {
1589
- cache[ id ] = {};
1590
-
1591
- // Avoids exposing jQuery metadata on plain JS objects when the object
1592
- // is serialized using JSON.stringify
1593
- if ( !isNode ) {
1594
- cache[ id ].toJSON = jQuery.noop;
1595
- }
1596
- }
1597
-
1598
- // An object can be passed to jQuery.data instead of a key/value pair; this gets
1599
- // shallow copied over onto the existing cache
1600
- if ( typeof name === "object" || typeof name === "function" ) {
1601
- if ( pvt ) {
1602
- cache[ id ] = jQuery.extend( cache[ id ], name );
1603
- } else {
1604
- cache[ id ].data = jQuery.extend( cache[ id ].data, name );
1605
- }
1606
- }
1607
-
1608
- thisCache = cache[ id ];
1609
-
1610
- // jQuery data() is stored in a separate object inside the object's internal data
1611
- // cache in order to avoid key collisions between internal data and user-defined
1612
- // data.
1613
- if ( !pvt ) {
1614
- if ( !thisCache.data ) {
1615
- thisCache.data = {};
1616
- }
1617
-
1618
- thisCache = thisCache.data;
1619
- }
1620
-
1621
- if ( data !== undefined ) {
1622
- thisCache[ jQuery.camelCase( name ) ] = data;
1623
- }
1624
-
1625
- // Check for both converted-to-camel and non-converted data property names
1626
- // If a data property was specified
1627
- if ( getByName ) {
1628
-
1629
- // First Try to find as-is property data
1630
- ret = thisCache[ name ];
1631
-
1632
- // Test for null|undefined property data
1633
- if ( ret == null ) {
1634
-
1635
- // Try to find the camelCased property
1636
- ret = thisCache[ jQuery.camelCase( name ) ];
1637
- }
1638
- } else {
1639
- ret = thisCache;
1640
- }
1641
-
1642
- return ret;
1643
- }
1644
-
1645
- function internalRemoveData( elem, name, pvt ) {
1646
- if ( !jQuery.acceptData( elem ) ) {
1647
- return;
1648
- }
1649
-
1650
- var i, l, thisCache,
1651
- isNode = elem.nodeType,
1652
-
1653
- // See jQuery.data for more information
1654
- cache = isNode ? jQuery.cache : elem,
1655
- id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
1656
-
1657
- // If there is already no cache entry for this object, there is no
1658
- // purpose in continuing
1659
- if ( !cache[ id ] ) {
1660
- return;
1661
- }
1662
-
1663
- if ( name ) {
1664
-
1665
- thisCache = pvt ? cache[ id ] : cache[ id ].data;
1666
-
1667
- if ( thisCache ) {
1668
-
1669
- // Support array or space separated string names for data keys
1670
- if ( !jQuery.isArray( name ) ) {
1671
-
1672
- // try the string as a key before any manipulation
1673
- if ( name in thisCache ) {
1674
- name = [ name ];
1675
- } else {
1676
-
1677
- // split the camel cased version by spaces unless a key with the spaces exists
1678
- name = jQuery.camelCase( name );
1679
- if ( name in thisCache ) {
1680
- name = [ name ];
1681
- } else {
1682
- name = name.split(" ");
1683
- }
1684
- }
1685
- } else {
1686
- // If "name" is an array of keys...
1687
- // When data is initially created, via ("key", "val") signature,
1688
- // keys will be converted to camelCase.
1689
- // Since there is no way to tell _how_ a key was added, remove
1690
- // both plain key and camelCase key. #12786
1691
- // This will only penalize the array argument path.
1692
- name = name.concat( jQuery.map( name, jQuery.camelCase ) );
1693
- }
1694
-
1695
- for ( i = 0, l = name.length; i < l; i++ ) {
1696
- delete thisCache[ name[i] ];
1697
- }
1698
-
1699
- // If there is no data left in the cache, we want to continue
1700
- // and let the cache object itself get destroyed
1701
- if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
1702
- return;
1703
- }
1704
- }
1705
- }
1706
-
1707
- // See jQuery.data for more information
1708
- if ( !pvt ) {
1709
- delete cache[ id ].data;
1710
-
1711
- // Don't destroy the parent cache unless the internal data object
1712
- // had been the only thing left in it
1713
- if ( !isEmptyDataObject( cache[ id ] ) ) {
1714
- return;
1715
- }
1716
- }
1717
-
1718
- // Destroy the cache
1719
- if ( isNode ) {
1720
- jQuery.cleanData( [ elem ], true );
1721
-
1722
- // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
1723
- } else if ( jQuery.support.deleteExpando || cache != cache.window ) {
1724
- delete cache[ id ];
1725
-
1726
- // When all else fails, null
1727
- } else {
1728
- cache[ id ] = null;
1729
- }
1730
- }
1731
-
1732
- jQuery.extend({
1733
- cache: {},
1734
-
1735
- // Unique for each copy of jQuery on the page
1736
- // Non-digits removed to match rinlinejQuery
1737
- expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
1738
-
1739
- // The following elements throw uncatchable exceptions if you
1740
- // attempt to add expando properties to them.
1741
- noData: {
1742
- "embed": true,
1743
- // Ban all objects except for Flash (which handle expandos)
1744
- "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
1745
- "applet": true
1746
- },
1747
-
1748
- hasData: function( elem ) {
1749
- elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
1750
- return !!elem && !isEmptyDataObject( elem );
1751
- },
1752
-
1753
- data: function( elem, name, data ) {
1754
- return internalData( elem, name, data );
1755
- },
1756
-
1757
- removeData: function( elem, name ) {
1758
- return internalRemoveData( elem, name );
1759
- },
1760
-
1761
- // For internal use only.
1762
- _data: function( elem, name, data ) {
1763
- return internalData( elem, name, data, true );
1764
- },
1765
-
1766
- _removeData: function( elem, name ) {
1767
- return internalRemoveData( elem, name, true );
1768
- },
1769
-
1770
- // A method for determining if a DOM node can handle the data expando
1771
- acceptData: function( elem ) {
1772
- // Do not set data on non-element because it will not be cleared (#8335).
1773
- if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {
1774
- return false;
1775
- }
1776
-
1777
- var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
1778
-
1779
- // nodes accept data unless otherwise specified; rejection can be conditional
1780
- return !noData || noData !== true && elem.getAttribute("classid") === noData;
1781
- }
1782
- });
1783
-
1784
- jQuery.fn.extend({
1785
- data: function( key, value ) {
1786
- var attrs, name,
1787
- elem = this[0],
1788
- i = 0,
1789
- data = null;
1790
-
1791
- // Gets all values
1792
- if ( key === undefined ) {
1793
- if ( this.length ) {
1794
- data = jQuery.data( elem );
1795
-
1796
- if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
1797
- attrs = elem.attributes;
1798
- for ( ; i < attrs.length; i++ ) {
1799
- name = attrs[i].name;
1800
-
1801
- if ( !name.indexOf( "data-" ) ) {
1802
- name = jQuery.camelCase( name.slice(5) );
1803
-
1804
- dataAttr( elem, name, data[ name ] );
1805
- }
1806
- }
1807
- jQuery._data( elem, "parsedAttrs", true );
1808
- }
1809
- }
1810
-
1811
- return data;
1812
- }
1813
-
1814
- // Sets multiple values
1815
- if ( typeof key === "object" ) {
1816
- return this.each(function() {
1817
- jQuery.data( this, key );
1818
- });
1819
- }
1820
-
1821
- return jQuery.access( this, function( value ) {
1822
-
1823
- if ( value === undefined ) {
1824
- // Try to fetch any internally stored data first
1825
- return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
1826
- }
1827
-
1828
- this.each(function() {
1829
- jQuery.data( this, key, value );
1830
- });
1831
- }, null, value, arguments.length > 1, null, true );
1832
- },
1833
-
1834
- removeData: function( key ) {
1835
- return this.each(function() {
1836
- jQuery.removeData( this, key );
1837
- });
1838
- }
1839
- });
1840
-
1841
- function dataAttr( elem, key, data ) {
1842
- // If nothing was found internally, try to fetch any
1843
- // data from the HTML5 data-* attribute
1844
- if ( data === undefined && elem.nodeType === 1 ) {
1845
-
1846
- var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
1847
-
1848
- data = elem.getAttribute( name );
1849
-
1850
- if ( typeof data === "string" ) {
1851
- try {
1852
- data = data === "true" ? true :
1853
- data === "false" ? false :
1854
- data === "null" ? null :
1855
- // Only convert to a number if it doesn't change the string
1856
- +data + "" === data ? +data :
1857
- rbrace.test( data ) ? jQuery.parseJSON( data ) :
1858
- data;
1859
- } catch( e ) {}
1860
-
1861
- // Make sure we set the data so it isn't changed later
1862
- jQuery.data( elem, key, data );
1863
-
1864
- } else {
1865
- data = undefined;
1866
- }
1867
- }
1868
-
1869
- return data;
1870
- }
1871
-
1872
- // checks a cache object for emptiness
1873
- function isEmptyDataObject( obj ) {
1874
- var name;
1875
- for ( name in obj ) {
1876
-
1877
- // if the public data object is empty, the private is still empty
1878
- if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
1879
- continue;
1880
- }
1881
- if ( name !== "toJSON" ) {
1882
- return false;
1883
- }
1884
- }
1885
-
1886
- return true;
1887
- }
1888
- jQuery.extend({
1889
- queue: function( elem, type, data ) {
1890
- var queue;
1891
-
1892
- if ( elem ) {
1893
- type = ( type || "fx" ) + "queue";
1894
- queue = jQuery._data( elem, type );
1895
-
1896
- // Speed up dequeue by getting out quickly if this is just a lookup
1897
- if ( data ) {
1898
- if ( !queue || jQuery.isArray(data) ) {
1899
- queue = jQuery._data( elem, type, jQuery.makeArray(data) );
1900
- } else {
1901
- queue.push( data );
1902
- }
1903
- }
1904
- return queue || [];
1905
- }
1906
- },
1907
-
1908
- dequeue: function( elem, type ) {
1909
- type = type || "fx";
1910
-
1911
- var queue = jQuery.queue( elem, type ),
1912
- startLength = queue.length,
1913
- fn = queue.shift(),
1914
- hooks = jQuery._queueHooks( elem, type ),
1915
- next = function() {
1916
- jQuery.dequeue( elem, type );
1917
- };
1918
-
1919
- // If the fx queue is dequeued, always remove the progress sentinel
1920
- if ( fn === "inprogress" ) {
1921
- fn = queue.shift();
1922
- startLength--;
1923
- }
1924
-
1925
- hooks.cur = fn;
1926
- if ( fn ) {
1927
-
1928
- // Add a progress sentinel to prevent the fx queue from being
1929
- // automatically dequeued
1930
- if ( type === "fx" ) {
1931
- queue.unshift( "inprogress" );
1932
- }
1933
-
1934
- // clear up the last queue stop function
1935
- delete hooks.stop;
1936
- fn.call( elem, next, hooks );
1937
- }
1938
-
1939
- if ( !startLength && hooks ) {
1940
- hooks.empty.fire();
1941
- }
1942
- },
1943
-
1944
- // not intended for public consumption - generates a queueHooks object, or returns the current one
1945
- _queueHooks: function( elem, type ) {
1946
- var key = type + "queueHooks";
1947
- return jQuery._data( elem, key ) || jQuery._data( elem, key, {
1948
- empty: jQuery.Callbacks("once memory").add(function() {
1949
- jQuery._removeData( elem, type + "queue" );
1950
- jQuery._removeData( elem, key );
1951
- })
1952
- });
1953
- }
1954
- });
1955
-
1956
- jQuery.fn.extend({
1957
- queue: function( type, data ) {
1958
- var setter = 2;
1959
-
1960
- if ( typeof type !== "string" ) {
1961
- data = type;
1962
- type = "fx";
1963
- setter--;
1964
- }
1965
-
1966
- if ( arguments.length < setter ) {
1967
- return jQuery.queue( this[0], type );
1968
- }
1969
-
1970
- return data === undefined ?
1971
- this :
1972
- this.each(function() {
1973
- var queue = jQuery.queue( this, type, data );
1974
-
1975
- // ensure a hooks for this queue
1976
- jQuery._queueHooks( this, type );
1977
-
1978
- if ( type === "fx" && queue[0] !== "inprogress" ) {
1979
- jQuery.dequeue( this, type );
1980
- }
1981
- });
1982
- },
1983
- dequeue: function( type ) {
1984
- return this.each(function() {
1985
- jQuery.dequeue( this, type );
1986
- });
1987
- },
1988
- // Based off of the plugin by Clint Helfers, with permission.
1989
- // http://blindsignals.com/index.php/2009/07/jquery-delay/
1990
- delay: function( time, type ) {
1991
- time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
1992
- type = type || "fx";
1993
-
1994
- return this.queue( type, function( next, hooks ) {
1995
- var timeout = setTimeout( next, time );
1996
- hooks.stop = function() {
1997
- clearTimeout( timeout );
1998
- };
1999
- });
2000
- },
2001
- clearQueue: function( type ) {
2002
- return this.queue( type || "fx", [] );
2003
- },
2004
- // Get a promise resolved when queues of a certain type
2005
- // are emptied (fx is the type by default)
2006
- promise: function( type, obj ) {
2007
- var tmp,
2008
- count = 1,
2009
- defer = jQuery.Deferred(),
2010
- elements = this,
2011
- i = this.length,
2012
- resolve = function() {
2013
- if ( !( --count ) ) {
2014
- defer.resolveWith( elements, [ elements ] );
2015
- }
2016
- };
2017
-
2018
- if ( typeof type !== "string" ) {
2019
- obj = type;
2020
- type = undefined;
2021
- }
2022
- type = type || "fx";
2023
-
2024
- while( i-- ) {
2025
- tmp = jQuery._data( elements[ i ], type + "queueHooks" );
2026
- if ( tmp && tmp.empty ) {
2027
- count++;
2028
- tmp.empty.add( resolve );
2029
- }
2030
- }
2031
- resolve();
2032
- return defer.promise( obj );
2033
- }
2034
- });
2035
- var nodeHook, boolHook,
2036
- rclass = /[\t\r\n]/g,
2037
- rreturn = /\r/g,
2038
- rfocusable = /^(?:input|select|textarea|button|object)$/i,
2039
- rclickable = /^(?:a|area)$/i,
2040
- rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,
2041
- ruseDefault = /^(?:checked|selected)$/i,
2042
- getSetAttribute = jQuery.support.getSetAttribute,
2043
- getSetInput = jQuery.support.input;
2044
-
2045
- jQuery.fn.extend({
2046
- attr: function( name, value ) {
2047
- return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
2048
- },
2049
-
2050
- removeAttr: function( name ) {
2051
- return this.each(function() {
2052
- jQuery.removeAttr( this, name );
2053
- });
2054
- },
2055
-
2056
- prop: function( name, value ) {
2057
- return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
2058
- },
2059
-
2060
- removeProp: function( name ) {
2061
- name = jQuery.propFix[ name ] || name;
2062
- return this.each(function() {
2063
- // try/catch handles cases where IE balks (such as removing a property on window)
2064
- try {
2065
- this[ name ] = undefined;
2066
- delete this[ name ];
2067
- } catch( e ) {}
2068
- });
2069
- },
2070
-
2071
- addClass: function( value ) {
2072
- var classes, elem, cur, clazz, j,
2073
- i = 0,
2074
- len = this.length,
2075
- proceed = typeof value === "string" && value;
2076
-
2077
- if ( jQuery.isFunction( value ) ) {
2078
- return this.each(function( j ) {
2079
- jQuery( this ).addClass( value.call( this, j, this.className ) );
2080
- });
2081
- }
2082
-
2083
- if ( proceed ) {
2084
- // The disjunction here is for better compressibility (see removeClass)
2085
- classes = ( value || "" ).match( core_rnotwhite ) || [];
2086
-
2087
- for ( ; i < len; i++ ) {
2088
- elem = this[ i ];
2089
- cur = elem.nodeType === 1 && ( elem.className ?
2090
- ( " " + elem.className + " " ).replace( rclass, " " ) :
2091
- " "
2092
- );
2093
-
2094
- if ( cur ) {
2095
- j = 0;
2096
- while ( (clazz = classes[j++]) ) {
2097
- if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
2098
- cur += clazz + " ";
2099
- }
2100
- }
2101
- elem.className = jQuery.trim( cur );
2102
-
2103
- }
2104
- }
2105
- }
2106
-
2107
- return this;
2108
- },
2109
-
2110
- removeClass: function( value ) {
2111
- var classes, elem, cur, clazz, j,
2112
- i = 0,
2113
- len = this.length,
2114
- proceed = arguments.length === 0 || typeof value === "string" && value;
2115
-
2116
- if ( jQuery.isFunction( value ) ) {
2117
- return this.each(function( j ) {
2118
- jQuery( this ).removeClass( value.call( this, j, this.className ) );
2119
- });
2120
- }
2121
- if ( proceed ) {
2122
- classes = ( value || "" ).match( core_rnotwhite ) || [];
2123
-
2124
- for ( ; i < len; i++ ) {
2125
- elem = this[ i ];
2126
- // This expression is here for better compressibility (see addClass)
2127
- cur = elem.nodeType === 1 && ( elem.className ?
2128
- ( " " + elem.className + " " ).replace( rclass, " " ) :
2129
- ""
2130
- );
2131
-
2132
- if ( cur ) {
2133
- j = 0;
2134
- while ( (clazz = classes[j++]) ) {
2135
- // Remove *all* instances
2136
- while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
2137
- cur = cur.replace( " " + clazz + " ", " " );
2138
- }
2139
- }
2140
- elem.className = value ? jQuery.trim( cur ) : "";
2141
- }
2142
- }
2143
- }
2144
-
2145
- return this;
2146
- },
2147
-
2148
- toggleClass: function( value, stateVal ) {
2149
- var type = typeof value,
2150
- isBool = typeof stateVal === "boolean";
2151
-
2152
- if ( jQuery.isFunction( value ) ) {
2153
- return this.each(function( i ) {
2154
- jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
2155
- });
2156
- }
2157
-
2158
- return this.each(function() {
2159
- if ( type === "string" ) {
2160
- // toggle individual class names
2161
- var className,
2162
- i = 0,
2163
- self = jQuery( this ),
2164
- state = stateVal,
2165
- classNames = value.match( core_rnotwhite ) || [];
2166
-
2167
- while ( (className = classNames[ i++ ]) ) {
2168
- // check each className given, space separated list
2169
- state = isBool ? state : !self.hasClass( className );
2170
- self[ state ? "addClass" : "removeClass" ]( className );
2171
- }
2172
-
2173
- // Toggle whole class name
2174
- } else if ( type === core_strundefined || type === "boolean" ) {
2175
- if ( this.className ) {
2176
- // store className if set
2177
- jQuery._data( this, "__className__", this.className );
2178
- }
2179
-
2180
- // If the element has a class name or if we're passed "false",
2181
- // then remove the whole classname (if there was one, the above saved it).
2182
- // Otherwise bring back whatever was previously saved (if anything),
2183
- // falling back to the empty string if nothing was stored.
2184
- this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
2185
- }
2186
- });
2187
- },
2188
-
2189
- hasClass: function( selector ) {
2190
- var className = " " + selector + " ",
2191
- i = 0,
2192
- l = this.length;
2193
- for ( ; i < l; i++ ) {
2194
- if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
2195
- return true;
2196
- }
2197
- }
2198
-
2199
- return false;
2200
- },
2201
-
2202
- val: function( value ) {
2203
- var ret, hooks, isFunction,
2204
- elem = this[0];
2205
-
2206
- if ( !arguments.length ) {
2207
- if ( elem ) {
2208
- hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
2209
-
2210
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
2211
- return ret;
2212
- }
2213
-
2214
- ret = elem.value;
2215
-
2216
- return typeof ret === "string" ?
2217
- // handle most common string cases
2218
- ret.replace(rreturn, "") :
2219
- // handle cases where value is null/undef or number
2220
- ret == null ? "" : ret;
2221
- }
2222
-
2223
- return;
2224
- }
2225
-
2226
- isFunction = jQuery.isFunction( value );
2227
-
2228
- return this.each(function( i ) {
2229
- var val,
2230
- self = jQuery(this);
2231
-
2232
- if ( this.nodeType !== 1 ) {
2233
- return;
2234
- }
2235
-
2236
- if ( isFunction ) {
2237
- val = value.call( this, i, self.val() );
2238
- } else {
2239
- val = value;
2240
- }
2241
-
2242
- // Treat null/undefined as ""; convert numbers to string
2243
- if ( val == null ) {
2244
- val = "";
2245
- } else if ( typeof val === "number" ) {
2246
- val += "";
2247
- } else if ( jQuery.isArray( val ) ) {
2248
- val = jQuery.map(val, function ( value ) {
2249
- return value == null ? "" : value + "";
2250
- });
2251
- }
2252
-
2253
- hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
2254
-
2255
- // If set returns undefined, fall back to normal setting
2256
- if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
2257
- this.value = val;
2258
- }
2259
- });
2260
- }
2261
- });
2262
-
2263
- jQuery.extend({
2264
- valHooks: {
2265
- option: {
2266
- get: function( elem ) {
2267
- // attributes.value is undefined in Blackberry 4.7 but
2268
- // uses .value. See #6932
2269
- var val = elem.attributes.value;
2270
- return !val || val.specified ? elem.value : elem.text;
2271
- }
2272
- },
2273
- select: {
2274
- get: function( elem ) {
2275
- var value, option,
2276
- options = elem.options,
2277
- index = elem.selectedIndex,
2278
- one = elem.type === "select-one" || index < 0,
2279
- values = one ? null : [],
2280
- max = one ? index + 1 : options.length,
2281
- i = index < 0 ?
2282
- max :
2283
- one ? index : 0;
2284
-
2285
- // Loop through all the selected options
2286
- for ( ; i < max; i++ ) {
2287
- option = options[ i ];
2288
-
2289
- // oldIE doesn't update selected after form reset (#2551)
2290
- if ( ( option.selected || i === index ) &&
2291
- // Don't return options that are disabled or in a disabled optgroup
2292
- ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
2293
- ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
2294
-
2295
- // Get the specific value for the option
2296
- value = jQuery( option ).val();
2297
-
2298
- // We don't need an array for one selects
2299
- if ( one ) {
2300
- return value;
2301
- }
2302
-
2303
- // Multi-Selects return an array
2304
- values.push( value );
2305
- }
2306
- }
2307
-
2308
- return values;
2309
- },
2310
-
2311
- set: function( elem, value ) {
2312
- var values = jQuery.makeArray( value );
2313
-
2314
- jQuery(elem).find("option").each(function() {
2315
- this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
2316
- });
2317
-
2318
- if ( !values.length ) {
2319
- elem.selectedIndex = -1;
2320
- }
2321
- return values;
2322
- }
2323
- }
2324
- },
2325
-
2326
- attr: function( elem, name, value ) {
2327
- var hooks, notxml, ret,
2328
- nType = elem.nodeType;
2329
-
2330
- // don't get/set attributes on text, comment and attribute nodes
2331
- if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
2332
- return;
2333
- }
2334
-
2335
- // Fallback to prop when attributes are not supported
2336
- if ( typeof elem.getAttribute === core_strundefined ) {
2337
- return jQuery.prop( elem, name, value );
2338
- }
2339
-
2340
- notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
2341
-
2342
- // All attributes are lowercase
2343
- // Grab necessary hook if one is defined
2344
- if ( notxml ) {
2345
- name = name.toLowerCase();
2346
- hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
2347
- }
2348
-
2349
- if ( value !== undefined ) {
2350
-
2351
- if ( value === null ) {
2352
- jQuery.removeAttr( elem, name );
2353
-
2354
- } else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
2355
- return ret;
2356
-
2357
- } else {
2358
- elem.setAttribute( name, value + "" );
2359
- return value;
2360
- }
2361
-
2362
- } else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
2363
- return ret;
2364
-
2365
- } else {
2366
-
2367
- // In IE9+, Flash objects don't have .getAttribute (#12945)
2368
- // Support: IE9+
2369
- if ( typeof elem.getAttribute !== core_strundefined ) {
2370
- ret = elem.getAttribute( name );
2371
- }
2372
-
2373
- // Non-existent attributes return null, we normalize to undefined
2374
- return ret == null ?
2375
- undefined :
2376
- ret;
2377
- }
2378
- },
2379
-
2380
- removeAttr: function( elem, value ) {
2381
- var name, propName,
2382
- i = 0,
2383
- attrNames = value && value.match( core_rnotwhite );
2384
-
2385
- if ( attrNames && elem.nodeType === 1 ) {
2386
- while ( (name = attrNames[i++]) ) {
2387
- propName = jQuery.propFix[ name ] || name;
2388
-
2389
- // Boolean attributes get special treatment (#10870)
2390
- if ( rboolean.test( name ) ) {
2391
- // Set corresponding property to false for boolean attributes
2392
- // Also clear defaultChecked/defaultSelected (if appropriate) for IE<8
2393
- if ( !getSetAttribute && ruseDefault.test( name ) ) {
2394
- elem[ jQuery.camelCase( "default-" + name ) ] =
2395
- elem[ propName ] = false;
2396
- } else {
2397
- elem[ propName ] = false;
2398
- }
2399
-
2400
- // See #9699 for explanation of this approach (setting first, then removal)
2401
- } else {
2402
- jQuery.attr( elem, name, "" );
2403
- }
2404
-
2405
- elem.removeAttribute( getSetAttribute ? name : propName );
2406
- }
2407
- }
2408
- },
2409
-
2410
- attrHooks: {
2411
- type: {
2412
- set: function( elem, value ) {
2413
- if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
2414
- // Setting the type on a radio button after the value resets the value in IE6-9
2415
- // Reset value to default in case type is set after value during creation
2416
- var val = elem.value;
2417
- elem.setAttribute( "type", value );
2418
- if ( val ) {
2419
- elem.value = val;
2420
- }
2421
- return value;
2422
- }
2423
- }
2424
- }
2425
- },
2426
-
2427
- propFix: {
2428
- tabindex: "tabIndex",
2429
- readonly: "readOnly",
2430
- "for": "htmlFor",
2431
- "class": "className",
2432
- maxlength: "maxLength",
2433
- cellspacing: "cellSpacing",
2434
- cellpadding: "cellPadding",
2435
- rowspan: "rowSpan",
2436
- colspan: "colSpan",
2437
- usemap: "useMap",
2438
- frameborder: "frameBorder",
2439
- contenteditable: "contentEditable"
2440
- },
2441
-
2442
- prop: function( elem, name, value ) {
2443
- var ret, hooks, notxml,
2444
- nType = elem.nodeType;
2445
-
2446
- // don't get/set properties on text, comment and attribute nodes
2447
- if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
2448
- return;
2449
- }
2450
-
2451
- notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
2452
-
2453
- if ( notxml ) {
2454
- // Fix name and attach hooks
2455
- name = jQuery.propFix[ name ] || name;
2456
- hooks = jQuery.propHooks[ name ];
2457
- }
2458
-
2459
- if ( value !== undefined ) {
2460
- if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
2461
- return ret;
2462
-
2463
- } else {
2464
- return ( elem[ name ] = value );
2465
- }
2466
-
2467
- } else {
2468
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
2469
- return ret;
2470
-
2471
- } else {
2472
- return elem[ name ];
2473
- }
2474
- }
2475
- },
2476
-
2477
- propHooks: {
2478
- tabIndex: {
2479
- get: function( elem ) {
2480
- // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
2481
- // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
2482
- var attributeNode = elem.getAttributeNode("tabindex");
2483
-
2484
- return attributeNode && attributeNode.specified ?
2485
- parseInt( attributeNode.value, 10 ) :
2486
- rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
2487
- 0 :
2488
- undefined;
2489
- }
2490
- }
2491
- }
2492
- });
2493
-
2494
- // Hook for boolean attributes
2495
- boolHook = {
2496
- get: function( elem, name ) {
2497
- var
2498
- // Use .prop to determine if this attribute is understood as boolean
2499
- prop = jQuery.prop( elem, name ),
2500
-
2501
- // Fetch it accordingly
2502
- attr = typeof prop === "boolean" && elem.getAttribute( name ),
2503
- detail = typeof prop === "boolean" ?
2504
-
2505
- getSetInput && getSetAttribute ?
2506
- attr != null :
2507
- // oldIE fabricates an empty string for missing boolean attributes
2508
- // and conflates checked/selected into attroperties
2509
- ruseDefault.test( name ) ?
2510
- elem[ jQuery.camelCase( "default-" + name ) ] :
2511
- !!attr :
2512
-
2513
- // fetch an attribute node for properties not recognized as boolean
2514
- elem.getAttributeNode( name );
2515
-
2516
- return detail && detail.value !== false ?
2517
- name.toLowerCase() :
2518
- undefined;
2519
- },
2520
- set: function( elem, value, name ) {
2521
- if ( value === false ) {
2522
- // Remove boolean attributes when set to false
2523
- jQuery.removeAttr( elem, name );
2524
- } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
2525
- // IE<8 needs the *property* name
2526
- elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
2527
-
2528
- // Use defaultChecked and defaultSelected for oldIE
2529
- } else {
2530
- elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
2531
- }
2532
-
2533
- return name;
2534
- }
2535
- };
2536
-
2537
- // fix oldIE value attroperty
2538
- if ( !getSetInput || !getSetAttribute ) {
2539
- jQuery.attrHooks.value = {
2540
- get: function( elem, name ) {
2541
- var ret = elem.getAttributeNode( name );
2542
- return jQuery.nodeName( elem, "input" ) ?
2543
-
2544
- // Ignore the value *property* by using defaultValue
2545
- elem.defaultValue :
2546
-
2547
- ret && ret.specified ? ret.value : undefined;
2548
- },
2549
- set: function( elem, value, name ) {
2550
- if ( jQuery.nodeName( elem, "input" ) ) {
2551
- // Does not return so that setAttribute is also used
2552
- elem.defaultValue = value;
2553
- } else {
2554
- // Use nodeHook if defined (#1954); otherwise setAttribute is fine
2555
- return nodeHook && nodeHook.set( elem, value, name );
2556
- }
2557
- }
2558
- };
2559
- }
2560
-
2561
- // IE6/7 do not support getting/setting some attributes with get/setAttribute
2562
- if ( !getSetAttribute ) {
2563
-
2564
- // Use this for any attribute in IE6/7
2565
- // This fixes almost every IE6/7 issue
2566
- nodeHook = jQuery.valHooks.button = {
2567
- get: function( elem, name ) {
2568
- var ret = elem.getAttributeNode( name );
2569
- return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ?
2570
- ret.value :
2571
- undefined;
2572
- },
2573
- set: function( elem, value, name ) {
2574
- // Set the existing or create a new attribute node
2575
- var ret = elem.getAttributeNode( name );
2576
- if ( !ret ) {
2577
- elem.setAttributeNode(
2578
- (ret = elem.ownerDocument.createAttribute( name ))
2579
- );
2580
- }
2581
-
2582
- ret.value = value += "";
2583
-
2584
- // Break association with cloned elements by also using setAttribute (#9646)
2585
- return name === "value" || value === elem.getAttribute( name ) ?
2586
- value :
2587
- undefined;
2588
- }
2589
- };
2590
-
2591
- // Set contenteditable to false on removals(#10429)
2592
- // Setting to empty string throws an error as an invalid value
2593
- jQuery.attrHooks.contenteditable = {
2594
- get: nodeHook.get,
2595
- set: function( elem, value, name ) {
2596
- nodeHook.set( elem, value === "" ? false : value, name );
2597
- }
2598
- };
2599
-
2600
- // Set width and height to auto instead of 0 on empty string( Bug #8150 )
2601
- // This is for removals
2602
- jQuery.each([ "width", "height" ], function( i, name ) {
2603
- jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
2604
- set: function( elem, value ) {
2605
- if ( value === "" ) {
2606
- elem.setAttribute( name, "auto" );
2607
- return value;
2608
- }
2609
- }
2610
- });
2611
- });
2612
- }
2613
-
2614
-
2615
- // Some attributes require a special call on IE
2616
- // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
2617
- if ( !jQuery.support.hrefNormalized ) {
2618
- jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
2619
- jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
2620
- get: function( elem ) {
2621
- var ret = elem.getAttribute( name, 2 );
2622
- return ret == null ? undefined : ret;
2623
- }
2624
- });
2625
- });
2626
-
2627
- // href/src property should get the full normalized URL (#10299/#12915)
2628
- jQuery.each([ "href", "src" ], function( i, name ) {
2629
- jQuery.propHooks[ name ] = {
2630
- get: function( elem ) {
2631
- return elem.getAttribute( name, 4 );
2632
- }
2633
- };
2634
- });
2635
- }
2636
-
2637
- if ( !jQuery.support.style ) {
2638
- jQuery.attrHooks.style = {
2639
- get: function( elem ) {
2640
- // Return undefined in the case of empty string
2641
- // Note: IE uppercases css property names, but if we were to .toLowerCase()
2642
- // .cssText, that would destroy case senstitivity in URL's, like in "background"
2643
- return elem.style.cssText || undefined;
2644
- },
2645
- set: function( elem, value ) {
2646
- return ( elem.style.cssText = value + "" );
2647
- }
2648
- };
2649
- }
2650
-
2651
- // Safari mis-reports the default selected property of an option
2652
- // Accessing the parent's selectedIndex property fixes it
2653
- if ( !jQuery.support.optSelected ) {
2654
- jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
2655
- get: function( elem ) {
2656
- var parent = elem.parentNode;
2657
-
2658
- if ( parent ) {
2659
- parent.selectedIndex;
2660
-
2661
- // Make sure that it also works with optgroups, see #5701
2662
- if ( parent.parentNode ) {
2663
- parent.parentNode.selectedIndex;
2664
- }
2665
- }
2666
- return null;
2667
- }
2668
- });
2669
- }
2670
-
2671
- // IE6/7 call enctype encoding
2672
- if ( !jQuery.support.enctype ) {
2673
- jQuery.propFix.enctype = "encoding";
2674
- }
2675
-
2676
- // Radios and checkboxes getter/setter
2677
- if ( !jQuery.support.checkOn ) {
2678
- jQuery.each([ "radio", "checkbox" ], function() {
2679
- jQuery.valHooks[ this ] = {
2680
- get: function( elem ) {
2681
- // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
2682
- return elem.getAttribute("value") === null ? "on" : elem.value;
2683
- }
2684
- };
2685
- });
2686
- }
2687
- jQuery.each([ "radio", "checkbox" ], function() {
2688
- jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
2689
- set: function( elem, value ) {
2690
- if ( jQuery.isArray( value ) ) {
2691
- return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
2692
- }
2693
- }
2694
- });
2695
- });
2696
- var rformElems = /^(?:input|select|textarea)$/i,
2697
- rkeyEvent = /^key/,
2698
- rmouseEvent = /^(?:mouse|contextmenu)|click/,
2699
- rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
2700
- rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
2701
-
2702
- function returnTrue() {
2703
- return true;
2704
- }
2705
-
2706
- function returnFalse() {
2707
- return false;
2708
- }
2709
-
2710
- /*
2711
- * Helper functions for managing events -- not part of the public interface.
2712
- * Props to Dean Edwards' addEvent library for many of the ideas.
2713
- */
2714
- jQuery.event = {
2715
-
2716
- global: {},
2717
-
2718
- add: function( elem, types, handler, data, selector ) {
2719
- var tmp, events, t, handleObjIn,
2720
- special, eventHandle, handleObj,
2721
- handlers, type, namespaces, origType,
2722
- elemData = jQuery._data( elem );
2723
-
2724
- // Don't attach events to noData or text/comment nodes (but allow plain objects)
2725
- if ( !elemData ) {
2726
- return;
2727
- }
2728
-
2729
- // Caller can pass in an object of custom data in lieu of the handler
2730
- if ( handler.handler ) {
2731
- handleObjIn = handler;
2732
- handler = handleObjIn.handler;
2733
- selector = handleObjIn.selector;
2734
- }
2735
-
2736
- // Make sure that the handler has a unique ID, used to find/remove it later
2737
- if ( !handler.guid ) {
2738
- handler.guid = jQuery.guid++;
2739
- }
2740
-
2741
- // Init the element's event structure and main handler, if this is the first
2742
- if ( !(events = elemData.events) ) {
2743
- events = elemData.events = {};
2744
- }
2745
- if ( !(eventHandle = elemData.handle) ) {
2746
- eventHandle = elemData.handle = function( e ) {
2747
- // Discard the second event of a jQuery.event.trigger() and
2748
- // when an event is called after a page has unloaded
2749
- return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ?
2750
- jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
2751
- undefined;
2752
- };
2753
- // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
2754
- eventHandle.elem = elem;
2755
- }
2756
-
2757
- // Handle multiple events separated by a space
2758
- // jQuery(...).bind("mouseover mouseout", fn);
2759
- types = ( types || "" ).match( core_rnotwhite ) || [""];
2760
- t = types.length;
2761
- while ( t-- ) {
2762
- tmp = rtypenamespace.exec( types[t] ) || [];
2763
- type = origType = tmp[1];
2764
- namespaces = ( tmp[2] || "" ).split( "." ).sort();
2765
-
2766
- // If event changes its type, use the special event handlers for the changed type
2767
- special = jQuery.event.special[ type ] || {};
2768
-
2769
- // If selector defined, determine special event api type, otherwise given type
2770
- type = ( selector ? special.delegateType : special.bindType ) || type;
2771
-
2772
- // Update special based on newly reset type
2773
- special = jQuery.event.special[ type ] || {};
2774
-
2775
- // handleObj is passed to all event handlers
2776
- handleObj = jQuery.extend({
2777
- type: type,
2778
- origType: origType,
2779
- data: data,
2780
- handler: handler,
2781
- guid: handler.guid,
2782
- selector: selector,
2783
- needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
2784
- namespace: namespaces.join(".")
2785
- }, handleObjIn );
2786
-
2787
- // Init the event handler queue if we're the first
2788
- if ( !(handlers = events[ type ]) ) {
2789
- handlers = events[ type ] = [];
2790
- handlers.delegateCount = 0;
2791
-
2792
- // Only use addEventListener/attachEvent if the special events handler returns false
2793
- if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
2794
- // Bind the global event handler to the element
2795
- if ( elem.addEventListener ) {
2796
- elem.addEventListener( type, eventHandle, false );
2797
-
2798
- } else if ( elem.attachEvent ) {
2799
- elem.attachEvent( "on" + type, eventHandle );
2800
- }
2801
- }
2802
- }
2803
-
2804
- if ( special.add ) {
2805
- special.add.call( elem, handleObj );
2806
-
2807
- if ( !handleObj.handler.guid ) {
2808
- handleObj.handler.guid = handler.guid;
2809
- }
2810
- }
2811
-
2812
- // Add to the element's handler list, delegates in front
2813
- if ( selector ) {
2814
- handlers.splice( handlers.delegateCount++, 0, handleObj );
2815
- } else {
2816
- handlers.push( handleObj );
2817
- }
2818
-
2819
- // Keep track of which events have ever been used, for event optimization
2820
- jQuery.event.global[ type ] = true;
2821
- }
2822
-
2823
- // Nullify elem to prevent memory leaks in IE
2824
- elem = null;
2825
- },
2826
-
2827
- // Detach an event or set of events from an element
2828
- remove: function( elem, types, handler, selector, mappedTypes ) {
2829
- var j, handleObj, tmp,
2830
- origCount, t, events,
2831
- special, handlers, type,
2832
- namespaces, origType,
2833
- elemData = jQuery.hasData( elem ) && jQuery._data( elem );
2834
-
2835
- if ( !elemData || !(events = elemData.events) ) {
2836
- return;
2837
- }
2838
-
2839
- // Once for each type.namespace in types; type may be omitted
2840
- types = ( types || "" ).match( core_rnotwhite ) || [""];
2841
- t = types.length;
2842
- while ( t-- ) {
2843
- tmp = rtypenamespace.exec( types[t] ) || [];
2844
- type = origType = tmp[1];
2845
- namespaces = ( tmp[2] || "" ).split( "." ).sort();
2846
-
2847
- // Unbind all events (on this namespace, if provided) for the element
2848
- if ( !type ) {
2849
- for ( type in events ) {
2850
- jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
2851
- }
2852
- continue;
2853
- }
2854
-
2855
- special = jQuery.event.special[ type ] || {};
2856
- type = ( selector ? special.delegateType : special.bindType ) || type;
2857
- handlers = events[ type ] || [];
2858
- tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
2859
-
2860
- // Remove matching events
2861
- origCount = j = handlers.length;
2862
- while ( j-- ) {
2863
- handleObj = handlers[ j ];
2864
-
2865
- if ( ( mappedTypes || origType === handleObj.origType ) &&
2866
- ( !handler || handler.guid === handleObj.guid ) &&
2867
- ( !tmp || tmp.test( handleObj.namespace ) ) &&
2868
- ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
2869
- handlers.splice( j, 1 );
2870
-
2871
- if ( handleObj.selector ) {
2872
- handlers.delegateCount--;
2873
- }
2874
- if ( special.remove ) {
2875
- special.remove.call( elem, handleObj );
2876
- }
2877
- }
2878
- }
2879
-
2880
- // Remove generic event handler if we removed something and no more handlers exist
2881
- // (avoids potential for endless recursion during removal of special event handlers)
2882
- if ( origCount && !handlers.length ) {
2883
- if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
2884
- jQuery.removeEvent( elem, type, elemData.handle );
2885
- }
2886
-
2887
- delete events[ type ];
2888
- }
2889
- }
2890
-
2891
- // Remove the expando if it's no longer used
2892
- if ( jQuery.isEmptyObject( events ) ) {
2893
- delete elemData.handle;
2894
-
2895
- // removeData also checks for emptiness and clears the expando if empty
2896
- // so use it instead of delete
2897
- jQuery._removeData( elem, "events" );
2898
- }
2899
- },
2900
-
2901
- trigger: function( event, data, elem, onlyHandlers ) {
2902
- var handle, ontype, cur,
2903
- bubbleType, special, tmp, i,
2904
- eventPath = [ elem || document ],
2905
- type = core_hasOwn.call( event, "type" ) ? event.type : event,
2906
- namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
2907
-
2908
- cur = tmp = elem = elem || document;
2909
-
2910
- // Don't do events on text and comment nodes
2911
- if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
2912
- return;
2913
- }
2914
-
2915
- // focus/blur morphs to focusin/out; ensure we're not firing them right now
2916
- if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
2917
- return;
2918
- }
2919
-
2920
- if ( type.indexOf(".") >= 0 ) {
2921
- // Namespaced trigger; create a regexp to match event type in handle()
2922
- namespaces = type.split(".");
2923
- type = namespaces.shift();
2924
- namespaces.sort();
2925
- }
2926
- ontype = type.indexOf(":") < 0 && "on" + type;
2927
-
2928
- // Caller can pass in a jQuery.Event object, Object, or just an event type string
2929
- event = event[ jQuery.expando ] ?
2930
- event :
2931
- new jQuery.Event( type, typeof event === "object" && event );
2932
-
2933
- event.isTrigger = true;
2934
- event.namespace = namespaces.join(".");
2935
- event.namespace_re = event.namespace ?
2936
- new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
2937
- null;
2938
-
2939
- // Clean up the event in case it is being reused
2940
- event.result = undefined;
2941
- if ( !event.target ) {
2942
- event.target = elem;
2943
- }
2944
-
2945
- // Clone any incoming data and prepend the event, creating the handler arg list
2946
- data = data == null ?
2947
- [ event ] :
2948
- jQuery.makeArray( data, [ event ] );
2949
-
2950
- // Allow special events to draw outside the lines
2951
- special = jQuery.event.special[ type ] || {};
2952
- if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
2953
- return;
2954
- }
2955
-
2956
- // Determine event propagation path in advance, per W3C events spec (#9951)
2957
- // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
2958
- if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
2959
-
2960
- bubbleType = special.delegateType || type;
2961
- if ( !rfocusMorph.test( bubbleType + type ) ) {
2962
- cur = cur.parentNode;
2963
- }
2964
- for ( ; cur; cur = cur.parentNode ) {
2965
- eventPath.push( cur );
2966
- tmp = cur;
2967
- }
2968
-
2969
- // Only add window if we got to document (e.g., not plain obj or detached DOM)
2970
- if ( tmp === (elem.ownerDocument || document) ) {
2971
- eventPath.push( tmp.defaultView || tmp.parentWindow || window );
2972
- }
2973
- }
2974
-
2975
- // Fire handlers on the event path
2976
- i = 0;
2977
- while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
2978
-
2979
- event.type = i > 1 ?
2980
- bubbleType :
2981
- special.bindType || type;
2982
-
2983
- // jQuery handler
2984
- handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
2985
- if ( handle ) {
2986
- handle.apply( cur, data );
2987
- }
2988
-
2989
- // Native handler
2990
- handle = ontype && cur[ ontype ];
2991
- if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
2992
- event.preventDefault();
2993
- }
2994
- }
2995
- event.type = type;
2996
-
2997
- // If nobody prevented the default action, do it now
2998
- if ( !onlyHandlers && !event.isDefaultPrevented() ) {
2999
-
3000
- if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
3001
- !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
3002
-
3003
- // Call a native DOM method on the target with the same name name as the event.
3004
- // Can't use an .isFunction() check here because IE6/7 fails that test.
3005
- // Don't do default actions on window, that's where global variables be (#6170)
3006
- if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
3007
-
3008
- // Don't re-trigger an onFOO event when we call its FOO() method
3009
- tmp = elem[ ontype ];
3010
-
3011
- if ( tmp ) {
3012
- elem[ ontype ] = null;
3013
- }
3014
-
3015
- // Prevent re-triggering of the same event, since we already bubbled it above
3016
- jQuery.event.triggered = type;
3017
- try {
3018
- elem[ type ]();
3019
- } catch ( e ) {
3020
- // IE<9 dies on focus/blur to hidden element (#1486,#12518)
3021
- // only reproducible on winXP IE8 native, not IE9 in IE8 mode
3022
- }
3023
- jQuery.event.triggered = undefined;
3024
-
3025
- if ( tmp ) {
3026
- elem[ ontype ] = tmp;
3027
- }
3028
- }
3029
- }
3030
- }
3031
-
3032
- return event.result;
3033
- },
3034
-
3035
- dispatch: function( event ) {
3036
-
3037
- // Make a writable jQuery.Event from the native event object
3038
- event = jQuery.event.fix( event );
3039
-
3040
- var i, ret, handleObj, matched, j,
3041
- handlerQueue = [],
3042
- args = core_slice.call( arguments ),
3043
- handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
3044
- special = jQuery.event.special[ event.type ] || {};
3045
-
3046
- // Use the fix-ed jQuery.Event rather than the (read-only) native event
3047
- args[0] = event;
3048
- event.delegateTarget = this;
3049
-
3050
- // Call the preDispatch hook for the mapped type, and let it bail if desired
3051
- if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
3052
- return;
3053
- }
3054
-
3055
- // Determine handlers
3056
- handlerQueue = jQuery.event.handlers.call( this, event, handlers );
3057
-
3058
- // Run delegates first; they may want to stop propagation beneath us
3059
- i = 0;
3060
- while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
3061
- event.currentTarget = matched.elem;
3062
-
3063
- j = 0;
3064
- while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
3065
-
3066
- // Triggered event must either 1) have no namespace, or
3067
- // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
3068
- if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
3069
-
3070
- event.handleObj = handleObj;
3071
- event.data = handleObj.data;
3072
-
3073
- ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
3074
- .apply( matched.elem, args );
3075
-
3076
- if ( ret !== undefined ) {
3077
- if ( (event.result = ret) === false ) {
3078
- event.preventDefault();
3079
- event.stopPropagation();
3080
- }
3081
- }
3082
- }
3083
- }
3084
- }
3085
-
3086
- // Call the postDispatch hook for the mapped type
3087
- if ( special.postDispatch ) {
3088
- special.postDispatch.call( this, event );
3089
- }
3090
-
3091
- return event.result;
3092
- },
3093
-
3094
- handlers: function( event, handlers ) {
3095
- var sel, handleObj, matches, i,
3096
- handlerQueue = [],
3097
- delegateCount = handlers.delegateCount,
3098
- cur = event.target;
3099
-
3100
- // Find delegate handlers
3101
- // Black-hole SVG <use> instance trees (#13180)
3102
- // Avoid non-left-click bubbling in Firefox (#3861)
3103
- if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
3104
-
3105
- for ( ; cur != this; cur = cur.parentNode || this ) {
3106
-
3107
- // Don't check non-elements (#13208)
3108
- // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
3109
- if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) {
3110
- matches = [];
3111
- for ( i = 0; i < delegateCount; i++ ) {
3112
- handleObj = handlers[ i ];
3113
-
3114
- // Don't conflict with Object.prototype properties (#13203)
3115
- sel = handleObj.selector + " ";
3116
-
3117
- if ( matches[ sel ] === undefined ) {
3118
- matches[ sel ] = handleObj.needsContext ?
3119
- jQuery( sel, this ).index( cur ) >= 0 :
3120
- jQuery.find( sel, this, null, [ cur ] ).length;
3121
- }
3122
- if ( matches[ sel ] ) {
3123
- matches.push( handleObj );
3124
- }
3125
- }
3126
- if ( matches.length ) {
3127
- handlerQueue.push({ elem: cur, handlers: matches });
3128
- }
3129
- }
3130
- }
3131
- }
3132
-
3133
- // Add the remaining (directly-bound) handlers
3134
- if ( delegateCount < handlers.length ) {
3135
- handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
3136
- }
3137
-
3138
- return handlerQueue;
3139
- },
3140
-
3141
- fix: function( event ) {
3142
- if ( event[ jQuery.expando ] ) {
3143
- return event;
3144
- }
3145
-
3146
- // Create a writable copy of the event object and normalize some properties
3147
- var i, prop, copy,
3148
- type = event.type,
3149
- originalEvent = event,
3150
- fixHook = this.fixHooks[ type ];
3151
-
3152
- if ( !fixHook ) {
3153
- this.fixHooks[ type ] = fixHook =
3154
- rmouseEvent.test( type ) ? this.mouseHooks :
3155
- rkeyEvent.test( type ) ? this.keyHooks :
3156
- {};
3157
- }
3158
- copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
3159
-
3160
- event = new jQuery.Event( originalEvent );
3161
-
3162
- i = copy.length;
3163
- while ( i-- ) {
3164
- prop = copy[ i ];
3165
- event[ prop ] = originalEvent[ prop ];
3166
- }
3167
-
3168
- // Support: IE<9
3169
- // Fix target property (#1925)
3170
- if ( !event.target ) {
3171
- event.target = originalEvent.srcElement || document;
3172
- }
3173
-
3174
- // Support: Chrome 23+, Safari?
3175
- // Target should not be a text node (#504, #13143)
3176
- if ( event.target.nodeType === 3 ) {
3177
- event.target = event.target.parentNode;
3178
- }
3179
-
3180
- // Support: IE<9
3181
- // For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
3182
- event.metaKey = !!event.metaKey;
3183
-
3184
- return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
3185
- },
3186
-
3187
- // Includes some event props shared by KeyEvent and MouseEvent
3188
- props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
3189
-
3190
- fixHooks: {},
3191
-
3192
- keyHooks: {
3193
- props: "char charCode key keyCode".split(" "),
3194
- filter: function( event, original ) {
3195
-
3196
- // Add which for key events
3197
- if ( event.which == null ) {
3198
- event.which = original.charCode != null ? original.charCode : original.keyCode;
3199
- }
3200
-
3201
- return event;
3202
- }
3203
- },
3204
-
3205
- mouseHooks: {
3206
- props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
3207
- filter: function( event, original ) {
3208
- var body, eventDoc, doc,
3209
- button = original.button,
3210
- fromElement = original.fromElement;
3211
-
3212
- // Calculate pageX/Y if missing and clientX/Y available
3213
- if ( event.pageX == null && original.clientX != null ) {
3214
- eventDoc = event.target.ownerDocument || document;
3215
- doc = eventDoc.documentElement;
3216
- body = eventDoc.body;
3217
-
3218
- event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
3219
- event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
3220
- }
3221
-
3222
- // Add relatedTarget, if necessary
3223
- if ( !event.relatedTarget && fromElement ) {
3224
- event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
3225
- }
3226
-
3227
- // Add which for click: 1 === left; 2 === middle; 3 === right
3228
- // Note: button is not normalized, so don't use it
3229
- if ( !event.which && button !== undefined ) {
3230
- event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
3231
- }
3232
-
3233
- return event;
3234
- }
3235
- },
3236
-
3237
- special: {
3238
- load: {
3239
- // Prevent triggered image.load events from bubbling to window.load
3240
- noBubble: true
3241
- },
3242
- click: {
3243
- // For checkbox, fire native event so checked state will be right
3244
- trigger: function() {
3245
- if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
3246
- this.click();
3247
- return false;
3248
- }
3249
- }
3250
- },
3251
- focus: {
3252
- // Fire native event if possible so blur/focus sequence is correct
3253
- trigger: function() {
3254
- if ( this !== document.activeElement && this.focus ) {
3255
- try {
3256
- this.focus();
3257
- return false;
3258
- } catch ( e ) {
3259
- // Support: IE<9
3260
- // If we error on focus to hidden element (#1486, #12518),
3261
- // let .trigger() run the handlers
3262
- }
3263
- }
3264
- },
3265
- delegateType: "focusin"
3266
- },
3267
- blur: {
3268
- trigger: function() {
3269
- if ( this === document.activeElement && this.blur ) {
3270
- this.blur();
3271
- return false;
3272
- }
3273
- },
3274
- delegateType: "focusout"
3275
- },
3276
-
3277
- beforeunload: {
3278
- postDispatch: function( event ) {
3279
-
3280
- // Even when returnValue equals to undefined Firefox will still show alert
3281
- if ( event.result !== undefined ) {
3282
- event.originalEvent.returnValue = event.result;
3283
- }
3284
- }
3285
- }
3286
- },
3287
-
3288
- simulate: function( type, elem, event, bubble ) {
3289
- // Piggyback on a donor event to simulate a different one.
3290
- // Fake originalEvent to avoid donor's stopPropagation, but if the
3291
- // simulated event prevents default then we do the same on the donor.
3292
- var e = jQuery.extend(
3293
- new jQuery.Event(),
3294
- event,
3295
- { type: type,
3296
- isSimulated: true,
3297
- originalEvent: {}
3298
- }
3299
- );
3300
- if ( bubble ) {
3301
- jQuery.event.trigger( e, null, elem );
3302
- } else {
3303
- jQuery.event.dispatch.call( elem, e );
3304
- }
3305
- if ( e.isDefaultPrevented() ) {
3306
- event.preventDefault();
3307
- }
3308
- }
3309
- };
3310
-
3311
- jQuery.removeEvent = document.removeEventListener ?
3312
- function( elem, type, handle ) {
3313
- if ( elem.removeEventListener ) {
3314
- elem.removeEventListener( type, handle, false );
3315
- }
3316
- } :
3317
- function( elem, type, handle ) {
3318
- var name = "on" + type;
3319
-
3320
- if ( elem.detachEvent ) {
3321
-
3322
- // #8545, #7054, preventing memory leaks for custom events in IE6-8
3323
- // detachEvent needed property on element, by name of that event, to properly expose it to GC
3324
- if ( typeof elem[ name ] === core_strundefined ) {
3325
- elem[ name ] = null;
3326
- }
3327
-
3328
- elem.detachEvent( name, handle );
3329
- }
3330
- };
3331
-
3332
- jQuery.Event = function( src, props ) {
3333
- // Allow instantiation without the 'new' keyword
3334
- if ( !(this instanceof jQuery.Event) ) {
3335
- return new jQuery.Event( src, props );
3336
- }
3337
-
3338
- // Event object
3339
- if ( src && src.type ) {
3340
- this.originalEvent = src;
3341
- this.type = src.type;
3342
-
3343
- // Events bubbling up the document may have been marked as prevented
3344
- // by a handler lower down the tree; reflect the correct value.
3345
- this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
3346
- src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
3347
-
3348
- // Event type
3349
- } else {
3350
- this.type = src;
3351
- }
3352
-
3353
- // Put explicitly provided properties onto the event object
3354
- if ( props ) {
3355
- jQuery.extend( this, props );
3356
- }
3357
-
3358
- // Create a timestamp if incoming event doesn't have one
3359
- this.timeStamp = src && src.timeStamp || jQuery.now();
3360
-
3361
- // Mark it as fixed
3362
- this[ jQuery.expando ] = true;
3363
- };
3364
-
3365
- // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
3366
- // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
3367
- jQuery.Event.prototype = {
3368
- isDefaultPrevented: returnFalse,
3369
- isPropagationStopped: returnFalse,
3370
- isImmediatePropagationStopped: returnFalse,
3371
-
3372
- preventDefault: function() {
3373
- var e = this.originalEvent;
3374
-
3375
- this.isDefaultPrevented = returnTrue;
3376
- if ( !e ) {
3377
- return;
3378
- }
3379
-
3380
- // If preventDefault exists, run it on the original event
3381
- if ( e.preventDefault ) {
3382
- e.preventDefault();
3383
-
3384
- // Support: IE
3385
- // Otherwise set the returnValue property of the original event to false
3386
- } else {
3387
- e.returnValue = false;
3388
- }
3389
- },
3390
- stopPropagation: function() {
3391
- var e = this.originalEvent;
3392
-
3393
- this.isPropagationStopped = returnTrue;
3394
- if ( !e ) {
3395
- return;
3396
- }
3397
- // If stopPropagation exists, run it on the original event
3398
- if ( e.stopPropagation ) {
3399
- e.stopPropagation();
3400
- }
3401
-
3402
- // Support: IE
3403
- // Set the cancelBubble property of the original event to true
3404
- e.cancelBubble = true;
3405
- },
3406
- stopImmediatePropagation: function() {
3407
- this.isImmediatePropagationStopped = returnTrue;
3408
- this.stopPropagation();
3409
- }
3410
- };
3411
-
3412
- // Create mouseenter/leave events using mouseover/out and event-time checks
3413
- jQuery.each({
3414
- mouseenter: "mouseover",
3415
- mouseleave: "mouseout"
3416
- }, function( orig, fix ) {
3417
- jQuery.event.special[ orig ] = {
3418
- delegateType: fix,
3419
- bindType: fix,
3420
-
3421
- handle: function( event ) {
3422
- var ret,
3423
- target = this,
3424
- related = event.relatedTarget,
3425
- handleObj = event.handleObj;
3426
-
3427
- // For mousenter/leave call the handler if related is outside the target.
3428
- // NB: No relatedTarget if the mouse left/entered the browser window
3429
- if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
3430
- event.type = handleObj.origType;
3431
- ret = handleObj.handler.apply( this, arguments );
3432
- event.type = fix;
3433
- }
3434
- return ret;
3435
- }
3436
- };
3437
- });
3438
-
3439
- // IE submit delegation
3440
- if ( !jQuery.support.submitBubbles ) {
3441
-
3442
- jQuery.event.special.submit = {
3443
- setup: function() {
3444
- // Only need this for delegated form submit events
3445
- if ( jQuery.nodeName( this, "form" ) ) {
3446
- return false;
3447
- }
3448
-
3449
- // Lazy-add a submit handler when a descendant form may potentially be submitted
3450
- jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
3451
- // Node name check avoids a VML-related crash in IE (#9807)
3452
- var elem = e.target,
3453
- form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
3454
- if ( form && !jQuery._data( form, "submitBubbles" ) ) {
3455
- jQuery.event.add( form, "submit._submit", function( event ) {
3456
- event._submit_bubble = true;
3457
- });
3458
- jQuery._data( form, "submitBubbles", true );
3459
- }
3460
- });
3461
- // return undefined since we don't need an event listener
3462
- },
3463
-
3464
- postDispatch: function( event ) {
3465
- // If form was submitted by the user, bubble the event up the tree
3466
- if ( event._submit_bubble ) {
3467
- delete event._submit_bubble;
3468
- if ( this.parentNode && !event.isTrigger ) {
3469
- jQuery.event.simulate( "submit", this.parentNode, event, true );
3470
- }
3471
- }
3472
- },
3473
-
3474
- teardown: function() {
3475
- // Only need this for delegated form submit events
3476
- if ( jQuery.nodeName( this, "form" ) ) {
3477
- return false;
3478
- }
3479
-
3480
- // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
3481
- jQuery.event.remove( this, "._submit" );
3482
- }
3483
- };
3484
- }
3485
-
3486
- // IE change delegation and checkbox/radio fix
3487
- if ( !jQuery.support.changeBubbles ) {
3488
-
3489
- jQuery.event.special.change = {
3490
-
3491
- setup: function() {
3492
-
3493
- if ( rformElems.test( this.nodeName ) ) {
3494
- // IE doesn't fire change on a check/radio until blur; trigger it on click
3495
- // after a propertychange. Eat the blur-change in special.change.handle.
3496
- // This still fires onchange a second time for check/radio after blur.
3497
- if ( this.type === "checkbox" || this.type === "radio" ) {
3498
- jQuery.event.add( this, "propertychange._change", function( event ) {
3499
- if ( event.originalEvent.propertyName === "checked" ) {
3500
- this._just_changed = true;
3501
- }
3502
- });
3503
- jQuery.event.add( this, "click._change", function( event ) {
3504
- if ( this._just_changed && !event.isTrigger ) {
3505
- this._just_changed = false;
3506
- }
3507
- // Allow triggered, simulated change events (#11500)
3508
- jQuery.event.simulate( "change", this, event, true );
3509
- });
3510
- }
3511
- return false;
3512
- }
3513
- // Delegated event; lazy-add a change handler on descendant inputs
3514
- jQuery.event.add( this, "beforeactivate._change", function( e ) {
3515
- var elem = e.target;
3516
-
3517
- if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) {
3518
- jQuery.event.add( elem, "change._change", function( event ) {
3519
- if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
3520
- jQuery.event.simulate( "change", this.parentNode, event, true );
3521
- }
3522
- });
3523
- jQuery._data( elem, "changeBubbles", true );
3524
- }
3525
- });
3526
- },
3527
-
3528
- handle: function( event ) {
3529
- var elem = event.target;
3530
-
3531
- // Swallow native change events from checkbox/radio, we already triggered them above
3532
- if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
3533
- return event.handleObj.handler.apply( this, arguments );
3534
- }
3535
- },
3536
-
3537
- teardown: function() {
3538
- jQuery.event.remove( this, "._change" );
3539
-
3540
- return !rformElems.test( this.nodeName );
3541
- }
3542
- };
3543
- }
3544
-
3545
- // Create "bubbling" focus and blur events
3546
- if ( !jQuery.support.focusinBubbles ) {
3547
- jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
3548
-
3549
- // Attach a single capturing handler while someone wants focusin/focusout
3550
- var attaches = 0,
3551
- handler = function( event ) {
3552
- jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
3553
- };
3554
-
3555
- jQuery.event.special[ fix ] = {
3556
- setup: function() {
3557
- if ( attaches++ === 0 ) {
3558
- document.addEventListener( orig, handler, true );
3559
- }
3560
- },
3561
- teardown: function() {
3562
- if ( --attaches === 0 ) {
3563
- document.removeEventListener( orig, handler, true );
3564
- }
3565
- }
3566
- };
3567
- });
3568
- }
3569
-
3570
- jQuery.fn.extend({
3571
-
3572
- on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
3573
- var type, origFn;
3574
-
3575
- // Types can be a map of types/handlers
3576
- if ( typeof types === "object" ) {
3577
- // ( types-Object, selector, data )
3578
- if ( typeof selector !== "string" ) {
3579
- // ( types-Object, data )
3580
- data = data || selector;
3581
- selector = undefined;
3582
- }
3583
- for ( type in types ) {
3584
- this.on( type, selector, data, types[ type ], one );
3585
- }
3586
- return this;
3587
- }
3588
-
3589
- if ( data == null && fn == null ) {
3590
- // ( types, fn )
3591
- fn = selector;
3592
- data = selector = undefined;
3593
- } else if ( fn == null ) {
3594
- if ( typeof selector === "string" ) {
3595
- // ( types, selector, fn )
3596
- fn = data;
3597
- data = undefined;
3598
- } else {
3599
- // ( types, data, fn )
3600
- fn = data;
3601
- data = selector;
3602
- selector = undefined;
3603
- }
3604
- }
3605
- if ( fn === false ) {
3606
- fn = returnFalse;
3607
- } else if ( !fn ) {
3608
- return this;
3609
- }
3610
-
3611
- if ( one === 1 ) {
3612
- origFn = fn;
3613
- fn = function( event ) {
3614
- // Can use an empty set, since event contains the info
3615
- jQuery().off( event );
3616
- return origFn.apply( this, arguments );
3617
- };
3618
- // Use same guid so caller can remove using origFn
3619
- fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
3620
- }
3621
- return this.each( function() {
3622
- jQuery.event.add( this, types, fn, data, selector );
3623
- });
3624
- },
3625
- one: function( types, selector, data, fn ) {
3626
- return this.on( types, selector, data, fn, 1 );
3627
- },
3628
- off: function( types, selector, fn ) {
3629
- var handleObj, type;
3630
- if ( types && types.preventDefault && types.handleObj ) {
3631
- // ( event ) dispatched jQuery.Event
3632
- handleObj = types.handleObj;
3633
- jQuery( types.delegateTarget ).off(
3634
- handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
3635
- handleObj.selector,
3636
- handleObj.handler
3637
- );
3638
- return this;
3639
- }
3640
- if ( typeof types === "object" ) {
3641
- // ( types-object [, selector] )
3642
- for ( type in types ) {
3643
- this.off( type, selector, types[ type ] );
3644
- }
3645
- return this;
3646
- }
3647
- if ( selector === false || typeof selector === "function" ) {
3648
- // ( types [, fn] )
3649
- fn = selector;
3650
- selector = undefined;
3651
- }
3652
- if ( fn === false ) {
3653
- fn = returnFalse;
3654
- }
3655
- return this.each(function() {
3656
- jQuery.event.remove( this, types, fn, selector );
3657
- });
3658
- },
3659
-
3660
- bind: function( types, data, fn ) {
3661
- return this.on( types, null, data, fn );
3662
- },
3663
- unbind: function( types, fn ) {
3664
- return this.off( types, null, fn );
3665
- },
3666
-
3667
- delegate: function( selector, types, data, fn ) {
3668
- return this.on( types, selector, data, fn );
3669
- },
3670
- undelegate: function( selector, types, fn ) {
3671
- // ( namespace ) or ( selector, types [, fn] )
3672
- return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
3673
- },
3674
-
3675
- trigger: function( type, data ) {
3676
- return this.each(function() {
3677
- jQuery.event.trigger( type, data, this );
3678
- });
3679
- },
3680
- triggerHandler: function( type, data ) {
3681
- var elem = this[0];
3682
- if ( elem ) {
3683
- return jQuery.event.trigger( type, data, elem, true );
3684
- }
3685
- }
3686
- });
3687
- /*!
3688
- * Sizzle CSS Selector Engine
3689
- * Copyright 2012 jQuery Foundation and other contributors
3690
- * Released under the MIT license
3691
- * http://sizzlejs.com/
3692
- */
3693
- (function( window, undefined ) {
3694
-
3695
- var i,
3696
- cachedruns,
3697
- Expr,
3698
- getText,
3699
- isXML,
3700
- compile,
3701
- hasDuplicate,
3702
- outermostContext,
3703
-
3704
- // Local document vars
3705
- setDocument,
3706
- document,
3707
- docElem,
3708
- documentIsXML,
3709
- rbuggyQSA,
3710
- rbuggyMatches,
3711
- matches,
3712
- contains,
3713
- sortOrder,
3714
-
3715
- // Instance-specific data
3716
- expando = "sizzle" + -(new Date()),
3717
- preferredDoc = window.document,
3718
- support = {},
3719
- dirruns = 0,
3720
- done = 0,
3721
- classCache = createCache(),
3722
- tokenCache = createCache(),
3723
- compilerCache = createCache(),
3724
-
3725
- // General-purpose constants
3726
- strundefined = typeof undefined,
3727
- MAX_NEGATIVE = 1 << 31,
3728
-
3729
- // Array methods
3730
- arr = [],
3731
- pop = arr.pop,
3732
- push = arr.push,
3733
- slice = arr.slice,
3734
- // Use a stripped-down indexOf if we can't use a native one
3735
- indexOf = arr.indexOf || function( elem ) {
3736
- var i = 0,
3737
- len = this.length;
3738
- for ( ; i < len; i++ ) {
3739
- if ( this[i] === elem ) {
3740
- return i;
3741
- }
3742
- }
3743
- return -1;
3744
- },
3745
-
3746
-
3747
- // Regular expressions
3748
-
3749
- // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
3750
- whitespace = "[\\x20\\t\\r\\n\\f]",
3751
- // http://www.w3.org/TR/css3-syntax/#characters
3752
- characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
3753
-
3754
- // Loosely modeled on CSS identifier characters
3755
- // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
3756
- // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
3757
- identifier = characterEncoding.replace( "w", "w#" ),
3758
-
3759
- // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
3760
- operators = "([*^$|!~]?=)",
3761
- attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
3762
- "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
3763
-
3764
- // Prefer arguments quoted,
3765
- // then not containing pseudos/brackets,
3766
- // then attribute selectors/non-parenthetical expressions,
3767
- // then anything else
3768
- // These preferences are here to reduce the number of selectors
3769
- // needing tokenize in the PSEUDO preFilter
3770
- pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
3771
-
3772
- // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
3773
- rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
3774
-
3775
- rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
3776
- rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ),
3777
- rpseudo = new RegExp( pseudos ),
3778
- ridentifier = new RegExp( "^" + identifier + "$" ),
3779
-
3780
- matchExpr = {
3781
- "ID": new RegExp( "^#(" + characterEncoding + ")" ),
3782
- "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
3783
- "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ),
3784
- "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
3785
- "ATTR": new RegExp( "^" + attributes ),
3786
- "PSEUDO": new RegExp( "^" + pseudos ),
3787
- "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
3788
- "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
3789
- "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
3790
- // For use in libraries implementing .is()
3791
- // We use this for POS matching in `select`
3792
- "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
3793
- whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
3794
- },
3795
-
3796
- rsibling = /[\x20\t\r\n\f]*[+~]/,
3797
-
3798
- rnative = /^[^{]+\{\s*\[native code/,
3799
-
3800
- // Easily-parseable/retrievable ID or TAG or CLASS selectors
3801
- rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
3802
-
3803
- rinputs = /^(?:input|select|textarea|button)$/i,
3804
- rheader = /^h\d$/i,
3805
-
3806
- rescape = /'|\\/g,
3807
- rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
3808
-
3809
- // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
3810
- runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,
3811
- funescape = function( _, escaped ) {
3812
- var high = "0x" + escaped - 0x10000;
3813
- // NaN means non-codepoint
3814
- return high !== high ?
3815
- escaped :
3816
- // BMP codepoint
3817
- high < 0 ?
3818
- String.fromCharCode( high + 0x10000 ) :
3819
- // Supplemental Plane codepoint (surrogate pair)
3820
- String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
3821
- };
3822
-
3823
- // Use a stripped-down slice if we can't use a native one
3824
- try {
3825
- slice.call( preferredDoc.documentElement.childNodes, 0 )[0].nodeType;
3826
- } catch ( e ) {
3827
- slice = function( i ) {
3828
- var elem,
3829
- results = [];
3830
- while ( (elem = this[i++]) ) {
3831
- results.push( elem );
3832
- }
3833
- return results;
3834
- };
3835
- }
3836
-
3837
- /**
3838
- * For feature detection
3839
- * @param {Function} fn The function to test for native support
3840
- */
3841
- function isNative( fn ) {
3842
- return rnative.test( fn + "" );
3843
- }
3844
-
3845
- /**
3846
- * Create key-value caches of limited size
3847
- * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
3848
- * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
3849
- * deleting the oldest entry
3850
- */
3851
- function createCache() {
3852
- var cache,
3853
- keys = [];
3854
-
3855
- return (cache = function( key, value ) {
3856
- // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
3857
- if ( keys.push( key += " " ) > Expr.cacheLength ) {
3858
- // Only keep the most recent entries
3859
- delete cache[ keys.shift() ];
3860
- }
3861
- return (cache[ key ] = value);
3862
- });
3863
- }
3864
-
3865
- /**
3866
- * Mark a function for special use by Sizzle
3867
- * @param {Function} fn The function to mark
3868
- */
3869
- function markFunction( fn ) {
3870
- fn[ expando ] = true;
3871
- return fn;
3872
- }
3873
-
3874
- /**
3875
- * Support testing using an element
3876
- * @param {Function} fn Passed the created div and expects a boolean result
3877
- */
3878
- function assert( fn ) {
3879
- var div = document.createElement("div");
3880
-
3881
- try {
3882
- return fn( div );
3883
- } catch (e) {
3884
- return false;
3885
- } finally {
3886
- // release memory in IE
3887
- div = null;
3888
- }
3889
- }
3890
-
3891
- function Sizzle( selector, context, results, seed ) {
3892
- var match, elem, m, nodeType,
3893
- // QSA vars
3894
- i, groups, old, nid, newContext, newSelector;
3895
-
3896
- if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
3897
- setDocument( context );
3898
- }
3899
-
3900
- context = context || document;
3901
- results = results || [];
3902
-
3903
- if ( !selector || typeof selector !== "string" ) {
3904
- return results;
3905
- }
3906
-
3907
- if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
3908
- return [];
3909
- }
3910
-
3911
- if ( !documentIsXML && !seed ) {
3912
-
3913
- // Shortcuts
3914
- if ( (match = rquickExpr.exec( selector )) ) {
3915
- // Speed-up: Sizzle("#ID")
3916
- if ( (m = match[1]) ) {
3917
- if ( nodeType === 9 ) {
3918
- elem = context.getElementById( m );
3919
- // Check parentNode to catch when Blackberry 4.6 returns
3920
- // nodes that are no longer in the document #6963
3921
- if ( elem && elem.parentNode ) {
3922
- // Handle the case where IE, Opera, and Webkit return items
3923
- // by name instead of ID
3924
- if ( elem.id === m ) {
3925
- results.push( elem );
3926
- return results;
3927
- }
3928
- } else {
3929
- return results;
3930
- }
3931
- } else {
3932
- // Context is not a document
3933
- if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
3934
- contains( context, elem ) && elem.id === m ) {
3935
- results.push( elem );
3936
- return results;
3937
- }
3938
- }
3939
-
3940
- // Speed-up: Sizzle("TAG")
3941
- } else if ( match[2] ) {
3942
- push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
3943
- return results;
3944
-
3945
- // Speed-up: Sizzle(".CLASS")
3946
- } else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) {
3947
- push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
3948
- return results;
3949
- }
3950
- }
3951
-
3952
- // QSA path
3953
- if ( support.qsa && !rbuggyQSA.test(selector) ) {
3954
- old = true;
3955
- nid = expando;
3956
- newContext = context;
3957
- newSelector = nodeType === 9 && selector;
3958
-
3959
- // qSA works strangely on Element-rooted queries
3960
- // We can work around this by specifying an extra ID on the root
3961
- // and working up from there (Thanks to Andrew Dupont for the technique)
3962
- // IE 8 doesn't work on object elements
3963
- if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
3964
- groups = tokenize( selector );
3965
-
3966
- if ( (old = context.getAttribute("id")) ) {
3967
- nid = old.replace( rescape, "\\$&" );
3968
- } else {
3969
- context.setAttribute( "id", nid );
3970
- }
3971
- nid = "[id='" + nid + "'] ";
3972
-
3973
- i = groups.length;
3974
- while ( i-- ) {
3975
- groups[i] = nid + toSelector( groups[i] );
3976
- }
3977
- newContext = rsibling.test( selector ) && context.parentNode || context;
3978
- newSelector = groups.join(",");
3979
- }
3980
-
3981
- if ( newSelector ) {
3982
- try {
3983
- push.apply( results, slice.call( newContext.querySelectorAll(
3984
- newSelector
3985
- ), 0 ) );
3986
- return results;
3987
- } catch(qsaError) {
3988
- } finally {
3989
- if ( !old ) {
3990
- context.removeAttribute("id");
3991
- }
3992
- }
3993
- }
3994
- }
3995
- }
3996
-
3997
- // All others
3998
- return select( selector.replace( rtrim, "$1" ), context, results, seed );
3999
- }
4000
-
4001
- /**
4002
- * Detect xml
4003
- * @param {Element|Object} elem An element or a document
4004
- */
4005
- isXML = Sizzle.isXML = function( elem ) {
4006
- // documentElement is verified for cases where it doesn't yet exist
4007
- // (such as loading iframes in IE - #4833)
4008
- var documentElement = elem && (elem.ownerDocument || elem).documentElement;
4009
- return documentElement ? documentElement.nodeName !== "HTML" : false;
4010
- };
4011
-
4012
- /**
4013
- * Sets document-related variables once based on the current document
4014
- * @param {Element|Object} [doc] An element or document object to use to set the document
4015
- * @returns {Object} Returns the current document
4016
- */
4017
- setDocument = Sizzle.setDocument = function( node ) {
4018
- var doc = node ? node.ownerDocument || node : preferredDoc;
4019
-
4020
- // If no document and documentElement is available, return
4021
- if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
4022
- return document;
4023
- }
4024
-
4025
- // Set our document
4026
- document = doc;
4027
- docElem = doc.documentElement;
4028
-
4029
- // Support tests
4030
- documentIsXML = isXML( doc );
4031
-
4032
- // Check if getElementsByTagName("*") returns only elements
4033
- support.tagNameNoComments = assert(function( div ) {
4034
- div.appendChild( doc.createComment("") );
4035
- return !div.getElementsByTagName("*").length;
4036
- });
4037
-
4038
- // Check if attributes should be retrieved by attribute nodes
4039
- support.attributes = assert(function( div ) {
4040
- div.innerHTML = "<select></select>";
4041
- var type = typeof div.lastChild.getAttribute("multiple");
4042
- // IE8 returns a string for some attributes even when not present
4043
- return type !== "boolean" && type !== "string";
4044
- });
4045
-
4046
- // Check if getElementsByClassName can be trusted
4047
- support.getByClassName = assert(function( div ) {
4048
- // Opera can't find a second classname (in 9.6)
4049
- div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>";
4050
- if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) {
4051
- return false;
4052
- }
4053
-
4054
- // Safari 3.2 caches class attributes and doesn't catch changes
4055
- div.lastChild.className = "e";
4056
- return div.getElementsByClassName("e").length === 2;
4057
- });
4058
-
4059
- // Check if getElementById returns elements by name
4060
- // Check if getElementsByName privileges form controls or returns elements by ID
4061
- support.getByName = assert(function( div ) {
4062
- // Inject content
4063
- div.id = expando + 0;
4064
- div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";
4065
- docElem.insertBefore( div, docElem.firstChild );
4066
-
4067
- // Test
4068
- var pass = doc.getElementsByName &&
4069
- // buggy browsers will return fewer than the correct 2
4070
- doc.getElementsByName( expando ).length === 2 +
4071
- // buggy browsers will return more than the correct 0
4072
- doc.getElementsByName( expando + 0 ).length;
4073
- support.getIdNotName = !doc.getElementById( expando );
4074
-
4075
- // Cleanup
4076
- docElem.removeChild( div );
4077
-
4078
- return pass;
4079
- });
4080
-
4081
- // IE6/7 return modified attributes
4082
- Expr.attrHandle = assert(function( div ) {
4083
- div.innerHTML = "<a href='#'></a>";
4084
- return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&
4085
- div.firstChild.getAttribute("href") === "#";
4086
- }) ?
4087
- {} :
4088
- {
4089
- "href": function( elem ) {
4090
- return elem.getAttribute( "href", 2 );
4091
- },
4092
- "type": function( elem ) {
4093
- return elem.getAttribute("type");
4094
- }
4095
- };
4096
-
4097
- // ID find and filter
4098
- if ( support.getIdNotName ) {
4099
- Expr.find["ID"] = function( id, context ) {
4100
- if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
4101
- var m = context.getElementById( id );
4102
- // Check parentNode to catch when Blackberry 4.6 returns
4103
- // nodes that are no longer in the document #6963
4104
- return m && m.parentNode ? [m] : [];
4105
- }
4106
- };
4107
- Expr.filter["ID"] = function( id ) {
4108
- var attrId = id.replace( runescape, funescape );
4109
- return function( elem ) {
4110
- return elem.getAttribute("id") === attrId;
4111
- };
4112
- };
4113
- } else {
4114
- Expr.find["ID"] = function( id, context ) {
4115
- if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
4116
- var m = context.getElementById( id );
4117
-
4118
- return m ?
4119
- m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
4120
- [m] :
4121
- undefined :
4122
- [];
4123
- }
4124
- };
4125
- Expr.filter["ID"] = function( id ) {
4126
- var attrId = id.replace( runescape, funescape );
4127
- return function( elem ) {
4128
- var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
4129
- return node && node.value === attrId;
4130
- };
4131
- };
4132
- }
4133
-
4134
- // Tag
4135
- Expr.find["TAG"] = support.tagNameNoComments ?
4136
- function( tag, context ) {
4137
- if ( typeof context.getElementsByTagName !== strundefined ) {
4138
- return context.getElementsByTagName( tag );
4139
- }
4140
- } :
4141
- function( tag, context ) {
4142
- var elem,
4143
- tmp = [],
4144
- i = 0,
4145
- results = context.getElementsByTagName( tag );
4146
-
4147
- // Filter out possible comments
4148
- if ( tag === "*" ) {
4149
- while ( (elem = results[i++]) ) {
4150
- if ( elem.nodeType === 1 ) {
4151
- tmp.push( elem );
4152
- }
4153
- }
4154
-
4155
- return tmp;
4156
- }
4157
- return results;
4158
- };
4159
-
4160
- // Name
4161
- Expr.find["NAME"] = support.getByName && function( tag, context ) {
4162
- if ( typeof context.getElementsByName !== strundefined ) {
4163
- return context.getElementsByName( name );
4164
- }
4165
- };
4166
-
4167
- // Class
4168
- Expr.find["CLASS"] = support.getByClassName && function( className, context ) {
4169
- if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) {
4170
- return context.getElementsByClassName( className );
4171
- }
4172
- };
4173
-
4174
- // QSA and matchesSelector support
4175
-
4176
- // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
4177
- rbuggyMatches = [];
4178
-
4179
- // qSa(:focus) reports false when true (Chrome 21),
4180
- // no need to also add to buggyMatches since matches checks buggyQSA
4181
- // A support test would require too much code (would include document ready)
4182
- rbuggyQSA = [ ":focus" ];
4183
-
4184
- if ( (support.qsa = isNative(doc.querySelectorAll)) ) {
4185
- // Build QSA regex
4186
- // Regex strategy adopted from Diego Perini
4187
- assert(function( div ) {
4188
- // Select is set to empty string on purpose
4189
- // This is to test IE's treatment of not explictly
4190
- // setting a boolean content attribute,
4191
- // since its presence should be enough
4192
- // http://bugs.jquery.com/ticket/12359
4193
- div.innerHTML = "<select><option selected=''></option></select>";
4194
-
4195
- // IE8 - Some boolean attributes are not treated correctly
4196
- if ( !div.querySelectorAll("[selected]").length ) {
4197
- rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
4198
- }
4199
-
4200
- // Webkit/Opera - :checked should return selected option elements
4201
- // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
4202
- // IE8 throws error here and will not see later tests
4203
- if ( !div.querySelectorAll(":checked").length ) {
4204
- rbuggyQSA.push(":checked");
4205
- }
4206
- });
4207
-
4208
- assert(function( div ) {
4209
-
4210
- // Opera 10-12/IE8 - ^= $= *= and empty values
4211
- // Should not select anything
4212
- div.innerHTML = "<input type='hidden' i=''/>";
4213
- if ( div.querySelectorAll("[i^='']").length ) {
4214
- rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
4215
- }
4216
-
4217
- // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
4218
- // IE8 throws error here and will not see later tests
4219
- if ( !div.querySelectorAll(":enabled").length ) {
4220
- rbuggyQSA.push( ":enabled", ":disabled" );
4221
- }
4222
-
4223
- // Opera 10-11 does not throw on post-comma invalid pseudos
4224
- div.querySelectorAll("*,:x");
4225
- rbuggyQSA.push(",.*:");
4226
- });
4227
- }
4228
-
4229
- if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector ||
4230
- docElem.mozMatchesSelector ||
4231
- docElem.webkitMatchesSelector ||
4232
- docElem.oMatchesSelector ||
4233
- docElem.msMatchesSelector) )) ) {
4234
-
4235
- assert(function( div ) {
4236
- // Check to see if it's possible to do matchesSelector
4237
- // on a disconnected node (IE 9)
4238
- support.disconnectedMatch = matches.call( div, "div" );
4239
-
4240
- // This should fail with an exception
4241
- // Gecko does not error, returns false instead
4242
- matches.call( div, "[s!='']:x" );
4243
- rbuggyMatches.push( "!=", pseudos );
4244
- });
4245
- }
4246
-
4247
- rbuggyQSA = new RegExp( rbuggyQSA.join("|") );
4248
- rbuggyMatches = new RegExp( rbuggyMatches.join("|") );
4249
-
4250
- // Element contains another
4251
- // Purposefully does not implement inclusive descendent
4252
- // As in, an element does not contain itself
4253
- contains = isNative(docElem.contains) || docElem.compareDocumentPosition ?
4254
- function( a, b ) {
4255
- var adown = a.nodeType === 9 ? a.documentElement : a,
4256
- bup = b && b.parentNode;
4257
- return a === bup || !!( bup && bup.nodeType === 1 && (
4258
- adown.contains ?
4259
- adown.contains( bup ) :
4260
- a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
4261
- ));
4262
- } :
4263
- function( a, b ) {
4264
- if ( b ) {
4265
- while ( (b = b.parentNode) ) {
4266
- if ( b === a ) {
4267
- return true;
4268
- }
4269
- }
4270
- }
4271
- return false;
4272
- };
4273
-
4274
- // Document order sorting
4275
- sortOrder = docElem.compareDocumentPosition ?
4276
- function( a, b ) {
4277
- var compare;
4278
-
4279
- if ( a === b ) {
4280
- hasDuplicate = true;
4281
- return 0;
4282
- }
4283
-
4284
- if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) {
4285
- if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) {
4286
- if ( a === doc || contains( preferredDoc, a ) ) {
4287
- return -1;
4288
- }
4289
- if ( b === doc || contains( preferredDoc, b ) ) {
4290
- return 1;
4291
- }
4292
- return 0;
4293
- }
4294
- return compare & 4 ? -1 : 1;
4295
- }
4296
-
4297
- return a.compareDocumentPosition ? -1 : 1;
4298
- } :
4299
- function( a, b ) {
4300
- var cur,
4301
- i = 0,
4302
- aup = a.parentNode,
4303
- bup = b.parentNode,
4304
- ap = [ a ],
4305
- bp = [ b ];
4306
-
4307
- // Exit early if the nodes are identical
4308
- if ( a === b ) {
4309
- hasDuplicate = true;
4310
- return 0;
4311
-
4312
- // Parentless nodes are either documents or disconnected
4313
- } else if ( !aup || !bup ) {
4314
- return a === doc ? -1 :
4315
- b === doc ? 1 :
4316
- aup ? -1 :
4317
- bup ? 1 :
4318
- 0;
4319
-
4320
- // If the nodes are siblings, we can do a quick check
4321
- } else if ( aup === bup ) {
4322
- return siblingCheck( a, b );
4323
- }
4324
-
4325
- // Otherwise we need full lists of their ancestors for comparison
4326
- cur = a;
4327
- while ( (cur = cur.parentNode) ) {
4328
- ap.unshift( cur );
4329
- }
4330
- cur = b;
4331
- while ( (cur = cur.parentNode) ) {
4332
- bp.unshift( cur );
4333
- }
4334
-
4335
- // Walk down the tree looking for a discrepancy
4336
- while ( ap[i] === bp[i] ) {
4337
- i++;
4338
- }
4339
-
4340
- return i ?
4341
- // Do a sibling check if the nodes have a common ancestor
4342
- siblingCheck( ap[i], bp[i] ) :
4343
-
4344
- // Otherwise nodes in our document sort first
4345
- ap[i] === preferredDoc ? -1 :
4346
- bp[i] === preferredDoc ? 1 :
4347
- 0;
4348
- };
4349
-
4350
- // Always assume the presence of duplicates if sort doesn't
4351
- // pass them to our comparison function (as in Google Chrome).
4352
- hasDuplicate = false;
4353
- [0, 0].sort( sortOrder );
4354
- support.detectDuplicates = hasDuplicate;
4355
-
4356
- return document;
4357
- };
4358
-
4359
- Sizzle.matches = function( expr, elements ) {
4360
- return Sizzle( expr, null, null, elements );
4361
- };
4362
-
4363
- Sizzle.matchesSelector = function( elem, expr ) {
4364
- // Set document vars if needed
4365
- if ( ( elem.ownerDocument || elem ) !== document ) {
4366
- setDocument( elem );
4367
- }
4368
-
4369
- // Make sure that attribute selectors are quoted
4370
- expr = expr.replace( rattributeQuotes, "='$1']" );
4371
-
4372
- // rbuggyQSA always contains :focus, so no need for an existence check
4373
- if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) {
4374
- try {
4375
- var ret = matches.call( elem, expr );
4376
-
4377
- // IE 9's matchesSelector returns false on disconnected nodes
4378
- if ( ret || support.disconnectedMatch ||
4379
- // As well, disconnected nodes are said to be in a document
4380
- // fragment in IE 9
4381
- elem.document && elem.document.nodeType !== 11 ) {
4382
- return ret;
4383
- }
4384
- } catch(e) {}
4385
- }
4386
-
4387
- return Sizzle( expr, document, null, [elem] ).length > 0;
4388
- };
4389
-
4390
- Sizzle.contains = function( context, elem ) {
4391
- // Set document vars if needed
4392
- if ( ( context.ownerDocument || context ) !== document ) {
4393
- setDocument( context );
4394
- }
4395
- return contains( context, elem );
4396
- };
4397
-
4398
- Sizzle.attr = function( elem, name ) {
4399
- var val;
4400
-
4401
- // Set document vars if needed
4402
- if ( ( elem.ownerDocument || elem ) !== document ) {
4403
- setDocument( elem );
4404
- }
4405
-
4406
- if ( !documentIsXML ) {
4407
- name = name.toLowerCase();
4408
- }
4409
- if ( (val = Expr.attrHandle[ name ]) ) {
4410
- return val( elem );
4411
- }
4412
- if ( documentIsXML || support.attributes ) {
4413
- return elem.getAttribute( name );
4414
- }
4415
- return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ?
4416
- name :
4417
- val && val.specified ? val.value : null;
4418
- };
4419
-
4420
- Sizzle.error = function( msg ) {
4421
- throw new Error( "Syntax error, unrecognized expression: " + msg );
4422
- };
4423
-
4424
- // Document sorting and removing duplicates
4425
- Sizzle.uniqueSort = function( results ) {
4426
- var elem,
4427
- duplicates = [],
4428
- i = 1,
4429
- j = 0;
4430
-
4431
- // Unless we *know* we can detect duplicates, assume their presence
4432
- hasDuplicate = !support.detectDuplicates;
4433
- results.sort( sortOrder );
4434
-
4435
- if ( hasDuplicate ) {
4436
- for ( ; (elem = results[i]); i++ ) {
4437
- if ( elem === results[ i - 1 ] ) {
4438
- j = duplicates.push( i );
4439
- }
4440
- }
4441
- while ( j-- ) {
4442
- results.splice( duplicates[ j ], 1 );
4443
- }
4444
- }
4445
-
4446
- return results;
4447
- };
4448
-
4449
- function siblingCheck( a, b ) {
4450
- var cur = b && a,
4451
- diff = cur && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE );
4452
-
4453
- // Use IE sourceIndex if available on both nodes
4454
- if ( diff ) {
4455
- return diff;
4456
- }
4457
-
4458
- // Check if b follows a
4459
- if ( cur ) {
4460
- while ( (cur = cur.nextSibling) ) {
4461
- if ( cur === b ) {
4462
- return -1;
4463
- }
4464
- }
4465
- }
4466
-
4467
- return a ? 1 : -1;
4468
- }
4469
-
4470
- // Returns a function to use in pseudos for input types
4471
- function createInputPseudo( type ) {
4472
- return function( elem ) {
4473
- var name = elem.nodeName.toLowerCase();
4474
- return name === "input" && elem.type === type;
4475
- };
4476
- }
4477
-
4478
- // Returns a function to use in pseudos for buttons
4479
- function createButtonPseudo( type ) {
4480
- return function( elem ) {
4481
- var name = elem.nodeName.toLowerCase();
4482
- return (name === "input" || name === "button") && elem.type === type;
4483
- };
4484
- }
4485
-
4486
- // Returns a function to use in pseudos for positionals
4487
- function createPositionalPseudo( fn ) {
4488
- return markFunction(function( argument ) {
4489
- argument = +argument;
4490
- return markFunction(function( seed, matches ) {
4491
- var j,
4492
- matchIndexes = fn( [], seed.length, argument ),
4493
- i = matchIndexes.length;
4494
-
4495
- // Match elements found at the specified indexes
4496
- while ( i-- ) {
4497
- if ( seed[ (j = matchIndexes[i]) ] ) {
4498
- seed[j] = !(matches[j] = seed[j]);
4499
- }
4500
- }
4501
- });
4502
- });
4503
- }
4504
-
4505
- /**
4506
- * Utility function for retrieving the text value of an array of DOM nodes
4507
- * @param {Array|Element} elem
4508
- */
4509
- getText = Sizzle.getText = function( elem ) {
4510
- var node,
4511
- ret = "",
4512
- i = 0,
4513
- nodeType = elem.nodeType;
4514
-
4515
- if ( !nodeType ) {
4516
- // If no nodeType, this is expected to be an array
4517
- for ( ; (node = elem[i]); i++ ) {
4518
- // Do not traverse comment nodes
4519
- ret += getText( node );
4520
- }
4521
- } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
4522
- // Use textContent for elements
4523
- // innerText usage removed for consistency of new lines (see #11153)
4524
- if ( typeof elem.textContent === "string" ) {
4525
- return elem.textContent;
4526
- } else {
4527
- // Traverse its children
4528
- for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
4529
- ret += getText( elem );
4530
- }
4531
- }
4532
- } else if ( nodeType === 3 || nodeType === 4 ) {
4533
- return elem.nodeValue;
4534
- }
4535
- // Do not include comment or processing instruction nodes
4536
-
4537
- return ret;
4538
- };
4539
-
4540
- Expr = Sizzle.selectors = {
4541
-
4542
- // Can be adjusted by the user
4543
- cacheLength: 50,
4544
-
4545
- createPseudo: markFunction,
4546
-
4547
- match: matchExpr,
4548
-
4549
- find: {},
4550
-
4551
- relative: {
4552
- ">": { dir: "parentNode", first: true },
4553
- " ": { dir: "parentNode" },
4554
- "+": { dir: "previousSibling", first: true },
4555
- "~": { dir: "previousSibling" }
4556
- },
4557
-
4558
- preFilter: {
4559
- "ATTR": function( match ) {
4560
- match[1] = match[1].replace( runescape, funescape );
4561
-
4562
- // Move the given value to match[3] whether quoted or unquoted
4563
- match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
4564
-
4565
- if ( match[2] === "~=" ) {
4566
- match[3] = " " + match[3] + " ";
4567
- }
4568
-
4569
- return match.slice( 0, 4 );
4570
- },
4571
-
4572
- "CHILD": function( match ) {
4573
- /* matches from matchExpr["CHILD"]
4574
- 1 type (only|nth|...)
4575
- 2 what (child|of-type)
4576
- 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
4577
- 4 xn-component of xn+y argument ([+-]?\d*n|)
4578
- 5 sign of xn-component
4579
- 6 x of xn-component
4580
- 7 sign of y-component
4581
- 8 y of y-component
4582
- */
4583
- match[1] = match[1].toLowerCase();
4584
-
4585
- if ( match[1].slice( 0, 3 ) === "nth" ) {
4586
- // nth-* requires argument
4587
- if ( !match[3] ) {
4588
- Sizzle.error( match[0] );
4589
- }
4590
-
4591
- // numeric x and y parameters for Expr.filter.CHILD
4592
- // remember that false/true cast respectively to 0/1
4593
- match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
4594
- match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
4595
-
4596
- // other types prohibit arguments
4597
- } else if ( match[3] ) {
4598
- Sizzle.error( match[0] );
4599
- }
4600
-
4601
- return match;
4602
- },
4603
-
4604
- "PSEUDO": function( match ) {
4605
- var excess,
4606
- unquoted = !match[5] && match[2];
4607
-
4608
- if ( matchExpr["CHILD"].test( match[0] ) ) {
4609
- return null;
4610
- }
4611
-
4612
- // Accept quoted arguments as-is
4613
- if ( match[4] ) {
4614
- match[2] = match[4];
4615
-
4616
- // Strip excess characters from unquoted arguments
4617
- } else if ( unquoted && rpseudo.test( unquoted ) &&
4618
- // Get excess from tokenize (recursively)
4619
- (excess = tokenize( unquoted, true )) &&
4620
- // advance to the next closing parenthesis
4621
- (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
4622
-
4623
- // excess is a negative index
4624
- match[0] = match[0].slice( 0, excess );
4625
- match[2] = unquoted.slice( 0, excess );
4626
- }
4627
-
4628
- // Return only captures needed by the pseudo filter method (type and argument)
4629
- return match.slice( 0, 3 );
4630
- }
4631
- },
4632
-
4633
- filter: {
4634
-
4635
- "TAG": function( nodeName ) {
4636
- if ( nodeName === "*" ) {
4637
- return function() { return true; };
4638
- }
4639
-
4640
- nodeName = nodeName.replace( runescape, funescape ).toLowerCase();
4641
- return function( elem ) {
4642
- return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
4643
- };
4644
- },
4645
-
4646
- "CLASS": function( className ) {
4647
- var pattern = classCache[ className + " " ];
4648
-
4649
- return pattern ||
4650
- (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
4651
- classCache( className, function( elem ) {
4652
- return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
4653
- });
4654
- },
4655
-
4656
- "ATTR": function( name, operator, check ) {
4657
- return function( elem ) {
4658
- var result = Sizzle.attr( elem, name );
4659
-
4660
- if ( result == null ) {
4661
- return operator === "!=";
4662
- }
4663
- if ( !operator ) {
4664
- return true;
4665
- }
4666
-
4667
- result += "";
4668
-
4669
- return operator === "=" ? result === check :
4670
- operator === "!=" ? result !== check :
4671
- operator === "^=" ? check && result.indexOf( check ) === 0 :
4672
- operator === "*=" ? check && result.indexOf( check ) > -1 :
4673
- operator === "$=" ? check && result.slice( -check.length ) === check :
4674
- operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
4675
- operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
4676
- false;
4677
- };
4678
- },
4679
-
4680
- "CHILD": function( type, what, argument, first, last ) {
4681
- var simple = type.slice( 0, 3 ) !== "nth",
4682
- forward = type.slice( -4 ) !== "last",
4683
- ofType = what === "of-type";
4684
-
4685
- return first === 1 && last === 0 ?
4686
-
4687
- // Shortcut for :nth-*(n)
4688
- function( elem ) {
4689
- return !!elem.parentNode;
4690
- } :
4691
-
4692
- function( elem, context, xml ) {
4693
- var cache, outerCache, node, diff, nodeIndex, start,
4694
- dir = simple !== forward ? "nextSibling" : "previousSibling",
4695
- parent = elem.parentNode,
4696
- name = ofType && elem.nodeName.toLowerCase(),
4697
- useCache = !xml && !ofType;
4698
-
4699
- if ( parent ) {
4700
-
4701
- // :(first|last|only)-(child|of-type)
4702
- if ( simple ) {
4703
- while ( dir ) {
4704
- node = elem;
4705
- while ( (node = node[ dir ]) ) {
4706
- if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
4707
- return false;
4708
- }
4709
- }
4710
- // Reverse direction for :only-* (if we haven't yet done so)
4711
- start = dir = type === "only" && !start && "nextSibling";
4712
- }
4713
- return true;
4714
- }
4715
-
4716
- start = [ forward ? parent.firstChild : parent.lastChild ];
4717
-
4718
- // non-xml :nth-child(...) stores cache data on `parent`
4719
- if ( forward && useCache ) {
4720
- // Seek `elem` from a previously-cached index
4721
- outerCache = parent[ expando ] || (parent[ expando ] = {});
4722
- cache = outerCache[ type ] || [];
4723
- nodeIndex = cache[0] === dirruns && cache[1];
4724
- diff = cache[0] === dirruns && cache[2];
4725
- node = nodeIndex && parent.childNodes[ nodeIndex ];
4726
-
4727
- while ( (node = ++nodeIndex && node && node[ dir ] ||
4728
-
4729
- // Fallback to seeking `elem` from the start
4730
- (diff = nodeIndex = 0) || start.pop()) ) {
4731
-
4732
- // When found, cache indexes on `parent` and break
4733
- if ( node.nodeType === 1 && ++diff && node === elem ) {
4734
- outerCache[ type ] = [ dirruns, nodeIndex, diff ];
4735
- break;
4736
- }
4737
- }
4738
-
4739
- // Use previously-cached element index if available
4740
- } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
4741
- diff = cache[1];
4742
-
4743
- // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
4744
- } else {
4745
- // Use the same loop as above to seek `elem` from the start
4746
- while ( (node = ++nodeIndex && node && node[ dir ] ||
4747
- (diff = nodeIndex = 0) || start.pop()) ) {
4748
-
4749
- if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
4750
- // Cache the index of each encountered element
4751
- if ( useCache ) {
4752
- (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
4753
- }
4754
-
4755
- if ( node === elem ) {
4756
- break;
4757
- }
4758
- }
4759
- }
4760
- }
4761
-
4762
- // Incorporate the offset, then check against cycle size
4763
- diff -= last;
4764
- return diff === first || ( diff % first === 0 && diff / first >= 0 );
4765
- }
4766
- };
4767
- },
4768
-
4769
- "PSEUDO": function( pseudo, argument ) {
4770
- // pseudo-class names are case-insensitive
4771
- // http://www.w3.org/TR/selectors/#pseudo-classes
4772
- // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
4773
- // Remember that setFilters inherits from pseudos
4774
- var args,
4775
- fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
4776
- Sizzle.error( "unsupported pseudo: " + pseudo );
4777
-
4778
- // The user may use createPseudo to indicate that
4779
- // arguments are needed to create the filter function
4780
- // just as Sizzle does
4781
- if ( fn[ expando ] ) {
4782
- return fn( argument );
4783
- }
4784
-
4785
- // But maintain support for old signatures
4786
- if ( fn.length > 1 ) {
4787
- args = [ pseudo, pseudo, "", argument ];
4788
- return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
4789
- markFunction(function( seed, matches ) {
4790
- var idx,
4791
- matched = fn( seed, argument ),
4792
- i = matched.length;
4793
- while ( i-- ) {
4794
- idx = indexOf.call( seed, matched[i] );
4795
- seed[ idx ] = !( matches[ idx ] = matched[i] );
4796
- }
4797
- }) :
4798
- function( elem ) {
4799
- return fn( elem, 0, args );
4800
- };
4801
- }
4802
-
4803
- return fn;
4804
- }
4805
- },
4806
-
4807
- pseudos: {
4808
- // Potentially complex pseudos
4809
- "not": markFunction(function( selector ) {
4810
- // Trim the selector passed to compile
4811
- // to avoid treating leading and trailing
4812
- // spaces as combinators
4813
- var input = [],
4814
- results = [],
4815
- matcher = compile( selector.replace( rtrim, "$1" ) );
4816
-
4817
- return matcher[ expando ] ?
4818
- markFunction(function( seed, matches, context, xml ) {
4819
- var elem,
4820
- unmatched = matcher( seed, null, xml, [] ),
4821
- i = seed.length;
4822
-
4823
- // Match elements unmatched by `matcher`
4824
- while ( i-- ) {
4825
- if ( (elem = unmatched[i]) ) {
4826
- seed[i] = !(matches[i] = elem);
4827
- }
4828
- }
4829
- }) :
4830
- function( elem, context, xml ) {
4831
- input[0] = elem;
4832
- matcher( input, null, xml, results );
4833
- return !results.pop();
4834
- };
4835
- }),
4836
-
4837
- "has": markFunction(function( selector ) {
4838
- return function( elem ) {
4839
- return Sizzle( selector, elem ).length > 0;
4840
- };
4841
- }),
4842
-
4843
- "contains": markFunction(function( text ) {
4844
- return function( elem ) {
4845
- return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
4846
- };
4847
- }),
4848
-
4849
- // "Whether an element is represented by a :lang() selector
4850
- // is based solely on the element's language value
4851
- // being equal to the identifier C,
4852
- // or beginning with the identifier C immediately followed by "-".
4853
- // The matching of C against the element's language value is performed case-insensitively.
4854
- // The identifier C does not have to be a valid language name."
4855
- // http://www.w3.org/TR/selectors/#lang-pseudo
4856
- "lang": markFunction( function( lang ) {
4857
- // lang value must be a valid identifider
4858
- if ( !ridentifier.test(lang || "") ) {
4859
- Sizzle.error( "unsupported lang: " + lang );
4860
- }
4861
- lang = lang.replace( runescape, funescape ).toLowerCase();
4862
- return function( elem ) {
4863
- var elemLang;
4864
- do {
4865
- if ( (elemLang = documentIsXML ?
4866
- elem.getAttribute("xml:lang") || elem.getAttribute("lang") :
4867
- elem.lang) ) {
4868
-
4869
- elemLang = elemLang.toLowerCase();
4870
- return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
4871
- }
4872
- } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
4873
- return false;
4874
- };
4875
- }),
4876
-
4877
- // Miscellaneous
4878
- "target": function( elem ) {
4879
- var hash = window.location && window.location.hash;
4880
- return hash && hash.slice( 1 ) === elem.id;
4881
- },
4882
-
4883
- "root": function( elem ) {
4884
- return elem === docElem;
4885
- },
4886
-
4887
- "focus": function( elem ) {
4888
- return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
4889
- },
4890
-
4891
- // Boolean properties
4892
- "enabled": function( elem ) {
4893
- return elem.disabled === false;
4894
- },
4895
-
4896
- "disabled": function( elem ) {
4897
- return elem.disabled === true;
4898
- },
4899
-
4900
- "checked": function( elem ) {
4901
- // In CSS3, :checked should return both checked and selected elements
4902
- // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
4903
- var nodeName = elem.nodeName.toLowerCase();
4904
- return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
4905
- },
4906
-
4907
- "selected": function( elem ) {
4908
- // Accessing this property makes selected-by-default
4909
- // options in Safari work properly
4910
- if ( elem.parentNode ) {
4911
- elem.parentNode.selectedIndex;
4912
- }
4913
-
4914
- return elem.selected === true;
4915
- },
4916
-
4917
- // Contents
4918
- "empty": function( elem ) {
4919
- // http://www.w3.org/TR/selectors/#empty-pseudo
4920
- // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
4921
- // not comment, processing instructions, or others
4922
- // Thanks to Diego Perini for the nodeName shortcut
4923
- // Greater than "@" means alpha characters (specifically not starting with "#" or "?")
4924
- for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
4925
- if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) {
4926
- return false;
4927
- }
4928
- }
4929
- return true;
4930
- },
4931
-
4932
- "parent": function( elem ) {
4933
- return !Expr.pseudos["empty"]( elem );
4934
- },
4935
-
4936
- // Element/input types
4937
- "header": function( elem ) {
4938
- return rheader.test( elem.nodeName );
4939
- },
4940
-
4941
- "input": function( elem ) {
4942
- return rinputs.test( elem.nodeName );
4943
- },
4944
-
4945
- "button": function( elem ) {
4946
- var name = elem.nodeName.toLowerCase();
4947
- return name === "input" && elem.type === "button" || name === "button";
4948
- },
4949
-
4950
- "text": function( elem ) {
4951
- var attr;
4952
- // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
4953
- // use getAttribute instead to test this case
4954
- return elem.nodeName.toLowerCase() === "input" &&
4955
- elem.type === "text" &&
4956
- ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type );
4957
- },
4958
-
4959
- // Position-in-collection
4960
- "first": createPositionalPseudo(function() {
4961
- return [ 0 ];
4962
- }),
4963
-
4964
- "last": createPositionalPseudo(function( matchIndexes, length ) {
4965
- return [ length - 1 ];
4966
- }),
4967
-
4968
- "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
4969
- return [ argument < 0 ? argument + length : argument ];
4970
- }),
4971
-
4972
- "even": createPositionalPseudo(function( matchIndexes, length ) {
4973
- var i = 0;
4974
- for ( ; i < length; i += 2 ) {
4975
- matchIndexes.push( i );
4976
- }
4977
- return matchIndexes;
4978
- }),
4979
-
4980
- "odd": createPositionalPseudo(function( matchIndexes, length ) {
4981
- var i = 1;
4982
- for ( ; i < length; i += 2 ) {
4983
- matchIndexes.push( i );
4984
- }
4985
- return matchIndexes;
4986
- }),
4987
-
4988
- "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
4989
- var i = argument < 0 ? argument + length : argument;
4990
- for ( ; --i >= 0; ) {
4991
- matchIndexes.push( i );
4992
- }
4993
- return matchIndexes;
4994
- }),
4995
-
4996
- "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
4997
- var i = argument < 0 ? argument + length : argument;
4998
- for ( ; ++i < length; ) {
4999
- matchIndexes.push( i );
5000
- }
5001
- return matchIndexes;
5002
- })
5003
- }
5004
- };
5005
-
5006
- // Add button/input type pseudos
5007
- for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
5008
- Expr.pseudos[ i ] = createInputPseudo( i );
5009
- }
5010
- for ( i in { submit: true, reset: true } ) {
5011
- Expr.pseudos[ i ] = createButtonPseudo( i );
5012
- }
5013
-
5014
- function tokenize( selector, parseOnly ) {
5015
- var matched, match, tokens, type,
5016
- soFar, groups, preFilters,
5017
- cached = tokenCache[ selector + " " ];
5018
-
5019
- if ( cached ) {
5020
- return parseOnly ? 0 : cached.slice( 0 );
5021
- }
5022
-
5023
- soFar = selector;
5024
- groups = [];
5025
- preFilters = Expr.preFilter;
5026
-
5027
- while ( soFar ) {
5028
-
5029
- // Comma and first run
5030
- if ( !matched || (match = rcomma.exec( soFar )) ) {
5031
- if ( match ) {
5032
- // Don't consume trailing commas as valid
5033
- soFar = soFar.slice( match[0].length ) || soFar;
5034
- }
5035
- groups.push( tokens = [] );
5036
- }
5037
-
5038
- matched = false;
5039
-
5040
- // Combinators
5041
- if ( (match = rcombinators.exec( soFar )) ) {
5042
- matched = match.shift();
5043
- tokens.push( {
5044
- value: matched,
5045
- // Cast descendant combinators to space
5046
- type: match[0].replace( rtrim, " " )
5047
- } );
5048
- soFar = soFar.slice( matched.length );
5049
- }
5050
-
5051
- // Filters
5052
- for ( type in Expr.filter ) {
5053
- if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
5054
- (match = preFilters[ type ]( match ))) ) {
5055
- matched = match.shift();
5056
- tokens.push( {
5057
- value: matched,
5058
- type: type,
5059
- matches: match
5060
- } );
5061
- soFar = soFar.slice( matched.length );
5062
- }
5063
- }
5064
-
5065
- if ( !matched ) {
5066
- break;
5067
- }
5068
- }
5069
-
5070
- // Return the length of the invalid excess
5071
- // if we're just parsing
5072
- // Otherwise, throw an error or return tokens
5073
- return parseOnly ?
5074
- soFar.length :
5075
- soFar ?
5076
- Sizzle.error( selector ) :
5077
- // Cache the tokens
5078
- tokenCache( selector, groups ).slice( 0 );
5079
- }
5080
-
5081
- function toSelector( tokens ) {
5082
- var i = 0,
5083
- len = tokens.length,
5084
- selector = "";
5085
- for ( ; i < len; i++ ) {
5086
- selector += tokens[i].value;
5087
- }
5088
- return selector;
5089
- }
5090
-
5091
- function addCombinator( matcher, combinator, base ) {
5092
- var dir = combinator.dir,
5093
- checkNonElements = base && dir === "parentNode",
5094
- doneName = done++;
5095
-
5096
- return combinator.first ?
5097
- // Check against closest ancestor/preceding element
5098
- function( elem, context, xml ) {
5099
- while ( (elem = elem[ dir ]) ) {
5100
- if ( elem.nodeType === 1 || checkNonElements ) {
5101
- return matcher( elem, context, xml );
5102
- }
5103
- }
5104
- } :
5105
-
5106
- // Check against all ancestor/preceding elements
5107
- function( elem, context, xml ) {
5108
- var data, cache, outerCache,
5109
- dirkey = dirruns + " " + doneName;
5110
-
5111
- // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
5112
- if ( xml ) {
5113
- while ( (elem = elem[ dir ]) ) {
5114
- if ( elem.nodeType === 1 || checkNonElements ) {
5115
- if ( matcher( elem, context, xml ) ) {
5116
- return true;
5117
- }
5118
- }
5119
- }
5120
- } else {
5121
- while ( (elem = elem[ dir ]) ) {
5122
- if ( elem.nodeType === 1 || checkNonElements ) {
5123
- outerCache = elem[ expando ] || (elem[ expando ] = {});
5124
- if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {
5125
- if ( (data = cache[1]) === true || data === cachedruns ) {
5126
- return data === true;
5127
- }
5128
- } else {
5129
- cache = outerCache[ dir ] = [ dirkey ];
5130
- cache[1] = matcher( elem, context, xml ) || cachedruns;
5131
- if ( cache[1] === true ) {
5132
- return true;
5133
- }
5134
- }
5135
- }
5136
- }
5137
- }
5138
- };
5139
- }
5140
-
5141
- function elementMatcher( matchers ) {
5142
- return matchers.length > 1 ?
5143
- function( elem, context, xml ) {
5144
- var i = matchers.length;
5145
- while ( i-- ) {
5146
- if ( !matchers[i]( elem, context, xml ) ) {
5147
- return false;
5148
- }
5149
- }
5150
- return true;
5151
- } :
5152
- matchers[0];
5153
- }
5154
-
5155
- function condense( unmatched, map, filter, context, xml ) {
5156
- var elem,
5157
- newUnmatched = [],
5158
- i = 0,
5159
- len = unmatched.length,
5160
- mapped = map != null;
5161
-
5162
- for ( ; i < len; i++ ) {
5163
- if ( (elem = unmatched[i]) ) {
5164
- if ( !filter || filter( elem, context, xml ) ) {
5165
- newUnmatched.push( elem );
5166
- if ( mapped ) {
5167
- map.push( i );
5168
- }
5169
- }
5170
- }
5171
- }
5172
-
5173
- return newUnmatched;
5174
- }
5175
-
5176
- function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
5177
- if ( postFilter && !postFilter[ expando ] ) {
5178
- postFilter = setMatcher( postFilter );
5179
- }
5180
- if ( postFinder && !postFinder[ expando ] ) {
5181
- postFinder = setMatcher( postFinder, postSelector );
5182
- }
5183
- return markFunction(function( seed, results, context, xml ) {
5184
- var temp, i, elem,
5185
- preMap = [],
5186
- postMap = [],
5187
- preexisting = results.length,
5188
-
5189
- // Get initial elements from seed or context
5190
- elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
5191
-
5192
- // Prefilter to get matcher input, preserving a map for seed-results synchronization
5193
- matcherIn = preFilter && ( seed || !selector ) ?
5194
- condense( elems, preMap, preFilter, context, xml ) :
5195
- elems,
5196
-
5197
- matcherOut = matcher ?
5198
- // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
5199
- postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
5200
-
5201
- // ...intermediate processing is necessary
5202
- [] :
5203
-
5204
- // ...otherwise use results directly
5205
- results :
5206
- matcherIn;
5207
-
5208
- // Find primary matches
5209
- if ( matcher ) {
5210
- matcher( matcherIn, matcherOut, context, xml );
5211
- }
5212
-
5213
- // Apply postFilter
5214
- if ( postFilter ) {
5215
- temp = condense( matcherOut, postMap );
5216
- postFilter( temp, [], context, xml );
5217
-
5218
- // Un-match failing elements by moving them back to matcherIn
5219
- i = temp.length;
5220
- while ( i-- ) {
5221
- if ( (elem = temp[i]) ) {
5222
- matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
5223
- }
5224
- }
5225
- }
5226
-
5227
- if ( seed ) {
5228
- if ( postFinder || preFilter ) {
5229
- if ( postFinder ) {
5230
- // Get the final matcherOut by condensing this intermediate into postFinder contexts
5231
- temp = [];
5232
- i = matcherOut.length;
5233
- while ( i-- ) {
5234
- if ( (elem = matcherOut[i]) ) {
5235
- // Restore matcherIn since elem is not yet a final match
5236
- temp.push( (matcherIn[i] = elem) );
5237
- }
5238
- }
5239
- postFinder( null, (matcherOut = []), temp, xml );
5240
- }
5241
-
5242
- // Move matched elements from seed to results to keep them synchronized
5243
- i = matcherOut.length;
5244
- while ( i-- ) {
5245
- if ( (elem = matcherOut[i]) &&
5246
- (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
5247
-
5248
- seed[temp] = !(results[temp] = elem);
5249
- }
5250
- }
5251
- }
5252
-
5253
- // Add elements to results, through postFinder if defined
5254
- } else {
5255
- matcherOut = condense(
5256
- matcherOut === results ?
5257
- matcherOut.splice( preexisting, matcherOut.length ) :
5258
- matcherOut
5259
- );
5260
- if ( postFinder ) {
5261
- postFinder( null, results, matcherOut, xml );
5262
- } else {
5263
- push.apply( results, matcherOut );
5264
- }
5265
- }
5266
- });
5267
- }
5268
-
5269
- function matcherFromTokens( tokens ) {
5270
- var checkContext, matcher, j,
5271
- len = tokens.length,
5272
- leadingRelative = Expr.relative[ tokens[0].type ],
5273
- implicitRelative = leadingRelative || Expr.relative[" "],
5274
- i = leadingRelative ? 1 : 0,
5275
-
5276
- // The foundational matcher ensures that elements are reachable from top-level context(s)
5277
- matchContext = addCombinator( function( elem ) {
5278
- return elem === checkContext;
5279
- }, implicitRelative, true ),
5280
- matchAnyContext = addCombinator( function( elem ) {
5281
- return indexOf.call( checkContext, elem ) > -1;
5282
- }, implicitRelative, true ),
5283
- matchers = [ function( elem, context, xml ) {
5284
- return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
5285
- (checkContext = context).nodeType ?
5286
- matchContext( elem, context, xml ) :
5287
- matchAnyContext( elem, context, xml ) );
5288
- } ];
5289
-
5290
- for ( ; i < len; i++ ) {
5291
- if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
5292
- matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
5293
- } else {
5294
- matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
5295
-
5296
- // Return special upon seeing a positional matcher
5297
- if ( matcher[ expando ] ) {
5298
- // Find the next relative operator (if any) for proper handling
5299
- j = ++i;
5300
- for ( ; j < len; j++ ) {
5301
- if ( Expr.relative[ tokens[j].type ] ) {
5302
- break;
5303
- }
5304
- }
5305
- return setMatcher(
5306
- i > 1 && elementMatcher( matchers ),
5307
- i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ),
5308
- matcher,
5309
- i < j && matcherFromTokens( tokens.slice( i, j ) ),
5310
- j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
5311
- j < len && toSelector( tokens )
5312
- );
5313
- }
5314
- matchers.push( matcher );
5315
- }
5316
- }
5317
-
5318
- return elementMatcher( matchers );
5319
- }
5320
-
5321
- function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
5322
- // A counter to specify which element is currently being matched
5323
- var matcherCachedRuns = 0,
5324
- bySet = setMatchers.length > 0,
5325
- byElement = elementMatchers.length > 0,
5326
- superMatcher = function( seed, context, xml, results, expandContext ) {
5327
- var elem, j, matcher,
5328
- setMatched = [],
5329
- matchedCount = 0,
5330
- i = "0",
5331
- unmatched = seed && [],
5332
- outermost = expandContext != null,
5333
- contextBackup = outermostContext,
5334
- // We must always have either seed elements or context
5335
- elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
5336
- // Use integer dirruns iff this is the outermost matcher
5337
- dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1);
5338
-
5339
- if ( outermost ) {
5340
- outermostContext = context !== document && context;
5341
- cachedruns = matcherCachedRuns;
5342
- }
5343
-
5344
- // Add elements passing elementMatchers directly to results
5345
- // Keep `i` a string if there are no elements so `matchedCount` will be "00" below
5346
- for ( ; (elem = elems[i]) != null; i++ ) {
5347
- if ( byElement && elem ) {
5348
- j = 0;
5349
- while ( (matcher = elementMatchers[j++]) ) {
5350
- if ( matcher( elem, context, xml ) ) {
5351
- results.push( elem );
5352
- break;
5353
- }
5354
- }
5355
- if ( outermost ) {
5356
- dirruns = dirrunsUnique;
5357
- cachedruns = ++matcherCachedRuns;
5358
- }
5359
- }
5360
-
5361
- // Track unmatched elements for set filters
5362
- if ( bySet ) {
5363
- // They will have gone through all possible matchers
5364
- if ( (elem = !matcher && elem) ) {
5365
- matchedCount--;
5366
- }
5367
-
5368
- // Lengthen the array for every element, matched or not
5369
- if ( seed ) {
5370
- unmatched.push( elem );
5371
- }
5372
- }
5373
- }
5374
-
5375
- // Apply set filters to unmatched elements
5376
- matchedCount += i;
5377
- if ( bySet && i !== matchedCount ) {
5378
- j = 0;
5379
- while ( (matcher = setMatchers[j++]) ) {
5380
- matcher( unmatched, setMatched, context, xml );
5381
- }
5382
-
5383
- if ( seed ) {
5384
- // Reintegrate element matches to eliminate the need for sorting
5385
- if ( matchedCount > 0 ) {
5386
- while ( i-- ) {
5387
- if ( !(unmatched[i] || setMatched[i]) ) {
5388
- setMatched[i] = pop.call( results );
5389
- }
5390
- }
5391
- }
5392
-
5393
- // Discard index placeholder values to get only actual matches
5394
- setMatched = condense( setMatched );
5395
- }
5396
-
5397
- // Add matches to results
5398
- push.apply( results, setMatched );
5399
-
5400
- // Seedless set matches succeeding multiple successful matchers stipulate sorting
5401
- if ( outermost && !seed && setMatched.length > 0 &&
5402
- ( matchedCount + setMatchers.length ) > 1 ) {
5403
-
5404
- Sizzle.uniqueSort( results );
5405
- }
5406
- }
5407
-
5408
- // Override manipulation of globals by nested matchers
5409
- if ( outermost ) {
5410
- dirruns = dirrunsUnique;
5411
- outermostContext = contextBackup;
5412
- }
5413
-
5414
- return unmatched;
5415
- };
5416
-
5417
- return bySet ?
5418
- markFunction( superMatcher ) :
5419
- superMatcher;
5420
- }
5421
-
5422
- compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
5423
- var i,
5424
- setMatchers = [],
5425
- elementMatchers = [],
5426
- cached = compilerCache[ selector + " " ];
5427
-
5428
- if ( !cached ) {
5429
- // Generate a function of recursive functions that can be used to check each element
5430
- if ( !group ) {
5431
- group = tokenize( selector );
5432
- }
5433
- i = group.length;
5434
- while ( i-- ) {
5435
- cached = matcherFromTokens( group[i] );
5436
- if ( cached[ expando ] ) {
5437
- setMatchers.push( cached );
5438
- } else {
5439
- elementMatchers.push( cached );
5440
- }
5441
- }
5442
-
5443
- // Cache the compiled function
5444
- cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
5445
- }
5446
- return cached;
5447
- };
5448
-
5449
- function multipleContexts( selector, contexts, results ) {
5450
- var i = 0,
5451
- len = contexts.length;
5452
- for ( ; i < len; i++ ) {
5453
- Sizzle( selector, contexts[i], results );
5454
- }
5455
- return results;
5456
- }
5457
-
5458
- function select( selector, context, results, seed ) {
5459
- var i, tokens, token, type, find,
5460
- match = tokenize( selector );
5461
-
5462
- if ( !seed ) {
5463
- // Try to minimize operations if there is only one group
5464
- if ( match.length === 1 ) {
5465
-
5466
- // Take a shortcut and set the context if the root selector is an ID
5467
- tokens = match[0] = match[0].slice( 0 );
5468
- if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
5469
- context.nodeType === 9 && !documentIsXML &&
5470
- Expr.relative[ tokens[1].type ] ) {
5471
-
5472
- context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0];
5473
- if ( !context ) {
5474
- return results;
5475
- }
5476
-
5477
- selector = selector.slice( tokens.shift().value.length );
5478
- }
5479
-
5480
- // Fetch a seed set for right-to-left matching
5481
- i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
5482
- while ( i-- ) {
5483
- token = tokens[i];
5484
-
5485
- // Abort if we hit a combinator
5486
- if ( Expr.relative[ (type = token.type) ] ) {
5487
- break;
5488
- }
5489
- if ( (find = Expr.find[ type ]) ) {
5490
- // Search, expanding context for leading sibling combinators
5491
- if ( (seed = find(
5492
- token.matches[0].replace( runescape, funescape ),
5493
- rsibling.test( tokens[0].type ) && context.parentNode || context
5494
- )) ) {
5495
-
5496
- // If seed is empty or no tokens remain, we can return early
5497
- tokens.splice( i, 1 );
5498
- selector = seed.length && toSelector( tokens );
5499
- if ( !selector ) {
5500
- push.apply( results, slice.call( seed, 0 ) );
5501
- return results;
5502
- }
5503
-
5504
- break;
5505
- }
5506
- }
5507
- }
5508
- }
5509
- }
5510
-
5511
- // Compile and execute a filtering function
5512
- // Provide `match` to avoid retokenization if we modified the selector above
5513
- compile( selector, match )(
5514
- seed,
5515
- context,
5516
- documentIsXML,
5517
- results,
5518
- rsibling.test( selector )
5519
- );
5520
- return results;
5521
- }
5522
-
5523
- // Deprecated
5524
- Expr.pseudos["nth"] = Expr.pseudos["eq"];
5525
-
5526
- // Easy API for creating new setFilters
5527
- function setFilters() {}
5528
- Expr.filters = setFilters.prototype = Expr.pseudos;
5529
- Expr.setFilters = new setFilters();
5530
-
5531
- // Initialize with the default document
5532
- setDocument();
5533
-
5534
- // Override sizzle attribute retrieval
5535
- Sizzle.attr = jQuery.attr;
5536
- jQuery.find = Sizzle;
5537
- jQuery.expr = Sizzle.selectors;
5538
- jQuery.expr[":"] = jQuery.expr.pseudos;
5539
- jQuery.unique = Sizzle.uniqueSort;
5540
- jQuery.text = Sizzle.getText;
5541
- jQuery.isXMLDoc = Sizzle.isXML;
5542
- jQuery.contains = Sizzle.contains;
5543
-
5544
-
5545
- })( window );
5546
- var runtil = /Until$/,
5547
- rparentsprev = /^(?:parents|prev(?:Until|All))/,
5548
- isSimple = /^.[^:#\[\.,]*$/,
5549
- rneedsContext = jQuery.expr.match.needsContext,
5550
- // methods guaranteed to produce a unique set when starting from a unique set
5551
- guaranteedUnique = {
5552
- children: true,
5553
- contents: true,
5554
- next: true,
5555
- prev: true
5556
- };
5557
-
5558
- jQuery.fn.extend({
5559
- find: function( selector ) {
5560
- var i, ret, self,
5561
- len = this.length;
5562
-
5563
- if ( typeof selector !== "string" ) {
5564
- self = this;
5565
- return this.pushStack( jQuery( selector ).filter(function() {
5566
- for ( i = 0; i < len; i++ ) {
5567
- if ( jQuery.contains( self[ i ], this ) ) {
5568
- return true;
5569
- }
5570
- }
5571
- }) );
5572
- }
5573
-
5574
- ret = [];
5575
- for ( i = 0; i < len; i++ ) {
5576
- jQuery.find( selector, this[ i ], ret );
5577
- }
5578
-
5579
- // Needed because $( selector, context ) becomes $( context ).find( selector )
5580
- ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
5581
- ret.selector = ( this.selector ? this.selector + " " : "" ) + selector;
5582
- return ret;
5583
- },
5584
-
5585
- has: function( target ) {
5586
- var i,
5587
- targets = jQuery( target, this ),
5588
- len = targets.length;
5589
-
5590
- return this.filter(function() {
5591
- for ( i = 0; i < len; i++ ) {
5592
- if ( jQuery.contains( this, targets[i] ) ) {
5593
- return true;
5594
- }
5595
- }
5596
- });
5597
- },
5598
-
5599
- not: function( selector ) {
5600
- return this.pushStack( winnow(this, selector, false) );
5601
- },
5602
-
5603
- filter: function( selector ) {
5604
- return this.pushStack( winnow(this, selector, true) );
5605
- },
5606
-
5607
- is: function( selector ) {
5608
- return !!selector && (
5609
- typeof selector === "string" ?
5610
- // If this is a positional/relative selector, check membership in the returned set
5611
- // so $("p:first").is("p:last") won't return true for a doc with two "p".
5612
- rneedsContext.test( selector ) ?
5613
- jQuery( selector, this.context ).index( this[0] ) >= 0 :
5614
- jQuery.filter( selector, this ).length > 0 :
5615
- this.filter( selector ).length > 0 );
5616
- },
5617
-
5618
- closest: function( selectors, context ) {
5619
- var cur,
5620
- i = 0,
5621
- l = this.length,
5622
- ret = [],
5623
- pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
5624
- jQuery( selectors, context || this.context ) :
5625
- 0;
5626
-
5627
- for ( ; i < l; i++ ) {
5628
- cur = this[i];
5629
-
5630
- while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {
5631
- if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
5632
- ret.push( cur );
5633
- break;
5634
- }
5635
- cur = cur.parentNode;
5636
- }
5637
- }
5638
-
5639
- return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret );
5640
- },
5641
-
5642
- // Determine the position of an element within
5643
- // the matched set of elements
5644
- index: function( elem ) {
5645
-
5646
- // No argument, return index in parent
5647
- if ( !elem ) {
5648
- return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1;
5649
- }
5650
-
5651
- // index in selector
5652
- if ( typeof elem === "string" ) {
5653
- return jQuery.inArray( this[0], jQuery( elem ) );
5654
- }
5655
-
5656
- // Locate the position of the desired element
5657
- return jQuery.inArray(
5658
- // If it receives a jQuery object, the first element is used
5659
- elem.jquery ? elem[0] : elem, this );
5660
- },
5661
-
5662
- add: function( selector, context ) {
5663
- var set = typeof selector === "string" ?
5664
- jQuery( selector, context ) :
5665
- jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
5666
- all = jQuery.merge( this.get(), set );
5667
-
5668
- return this.pushStack( jQuery.unique(all) );
5669
- },
5670
-
5671
- addBack: function( selector ) {
5672
- return this.add( selector == null ?
5673
- this.prevObject : this.prevObject.filter(selector)
5674
- );
5675
- }
5676
- });
5677
-
5678
- jQuery.fn.andSelf = jQuery.fn.addBack;
5679
-
5680
- function sibling( cur, dir ) {
5681
- do {
5682
- cur = cur[ dir ];
5683
- } while ( cur && cur.nodeType !== 1 );
5684
-
5685
- return cur;
5686
- }
5687
-
5688
- jQuery.each({
5689
- parent: function( elem ) {
5690
- var parent = elem.parentNode;
5691
- return parent && parent.nodeType !== 11 ? parent : null;
5692
- },
5693
- parents: function( elem ) {
5694
- return jQuery.dir( elem, "parentNode" );
5695
- },
5696
- parentsUntil: function( elem, i, until ) {
5697
- return jQuery.dir( elem, "parentNode", until );
5698
- },
5699
- next: function( elem ) {
5700
- return sibling( elem, "nextSibling" );
5701
- },
5702
- prev: function( elem ) {
5703
- return sibling( elem, "previousSibling" );
5704
- },
5705
- nextAll: function( elem ) {
5706
- return jQuery.dir( elem, "nextSibling" );
5707
- },
5708
- prevAll: function( elem ) {
5709
- return jQuery.dir( elem, "previousSibling" );
5710
- },
5711
- nextUntil: function( elem, i, until ) {
5712
- return jQuery.dir( elem, "nextSibling", until );
5713
- },
5714
- prevUntil: function( elem, i, until ) {
5715
- return jQuery.dir( elem, "previousSibling", until );
5716
- },
5717
- siblings: function( elem ) {
5718
- return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
5719
- },
5720
- children: function( elem ) {
5721
- return jQuery.sibling( elem.firstChild );
5722
- },
5723
- contents: function( elem ) {
5724
- return jQuery.nodeName( elem, "iframe" ) ?
5725
- elem.contentDocument || elem.contentWindow.document :
5726
- jQuery.merge( [], elem.childNodes );
5727
- }
5728
- }, function( name, fn ) {
5729
- jQuery.fn[ name ] = function( until, selector ) {
5730
- var ret = jQuery.map( this, fn, until );
5731
-
5732
- if ( !runtil.test( name ) ) {
5733
- selector = until;
5734
- }
5735
-
5736
- if ( selector && typeof selector === "string" ) {
5737
- ret = jQuery.filter( selector, ret );
5738
- }
5739
-
5740
- ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
5741
-
5742
- if ( this.length > 1 && rparentsprev.test( name ) ) {
5743
- ret = ret.reverse();
5744
- }
5745
-
5746
- return this.pushStack( ret );
5747
- };
5748
- });
5749
-
5750
- jQuery.extend({
5751
- filter: function( expr, elems, not ) {
5752
- if ( not ) {
5753
- expr = ":not(" + expr + ")";
5754
- }
5755
-
5756
- return elems.length === 1 ?
5757
- jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
5758
- jQuery.find.matches(expr, elems);
5759
- },
5760
-
5761
- dir: function( elem, dir, until ) {
5762
- var matched = [],
5763
- cur = elem[ dir ];
5764
-
5765
- while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
5766
- if ( cur.nodeType === 1 ) {
5767
- matched.push( cur );
5768
- }
5769
- cur = cur[dir];
5770
- }
5771
- return matched;
5772
- },
5773
-
5774
- sibling: function( n, elem ) {
5775
- var r = [];
5776
-
5777
- for ( ; n; n = n.nextSibling ) {
5778
- if ( n.nodeType === 1 && n !== elem ) {
5779
- r.push( n );
5780
- }
5781
- }
5782
-
5783
- return r;
5784
- }
5785
- });
5786
-
5787
- // Implement the identical functionality for filter and not
5788
- function winnow( elements, qualifier, keep ) {
5789
-
5790
- // Can't pass null or undefined to indexOf in Firefox 4
5791
- // Set to 0 to skip string check
5792
- qualifier = qualifier || 0;
5793
-
5794
- if ( jQuery.isFunction( qualifier ) ) {
5795
- return jQuery.grep(elements, function( elem, i ) {
5796
- var retVal = !!qualifier.call( elem, i, elem );
5797
- return retVal === keep;
5798
- });
5799
-
5800
- } else if ( qualifier.nodeType ) {
5801
- return jQuery.grep(elements, function( elem ) {
5802
- return ( elem === qualifier ) === keep;
5803
- });
5804
-
5805
- } else if ( typeof qualifier === "string" ) {
5806
- var filtered = jQuery.grep(elements, function( elem ) {
5807
- return elem.nodeType === 1;
5808
- });
5809
-
5810
- if ( isSimple.test( qualifier ) ) {
5811
- return jQuery.filter(qualifier, filtered, !keep);
5812
- } else {
5813
- qualifier = jQuery.filter( qualifier, filtered );
5814
- }
5815
- }
5816
-
5817
- return jQuery.grep(elements, function( elem ) {
5818
- return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
5819
- });
5820
- }
5821
- function createSafeFragment( document ) {
5822
- var list = nodeNames.split( "|" ),
5823
- safeFrag = document.createDocumentFragment();
5824
-
5825
- if ( safeFrag.createElement ) {
5826
- while ( list.length ) {
5827
- safeFrag.createElement(
5828
- list.pop()
5829
- );
5830
- }
5831
- }
5832
- return safeFrag;
5833
- }
5834
-
5835
- var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
5836
- "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
5837
- rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
5838
- rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
5839
- rleadingWhitespace = /^\s+/,
5840
- rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
5841
- rtagName = /<([\w:]+)/,
5842
- rtbody = /<tbody/i,
5843
- rhtml = /<|&#?\w+;/,
5844
- rnoInnerhtml = /<(?:script|style|link)/i,
5845
- manipulation_rcheckableType = /^(?:checkbox|radio)$/i,
5846
- // checked="checked" or checked
5847
- rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
5848
- rscriptType = /^$|\/(?:java|ecma)script/i,
5849
- rscriptTypeMasked = /^true\/(.*)/,
5850
- rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
5851
-
5852
- // We have to close these tags to support XHTML (#13200)
5853
- wrapMap = {
5854
- option: [ 1, "<select multiple='multiple'>", "</select>" ],
5855
- legend: [ 1, "<fieldset>", "</fieldset>" ],
5856
- area: [ 1, "<map>", "</map>" ],
5857
- param: [ 1, "<object>", "</object>" ],
5858
- thead: [ 1, "<table>", "</table>" ],
5859
- tr: [ 2, "<table><tbody>", "</tbody></table>" ],
5860
- col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
5861
- td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
5862
-
5863
- // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
5864
- // unless wrapped in a div with non-breaking characters in front of it.
5865
- _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
5866
- },
5867
- safeFragment = createSafeFragment( document ),
5868
- fragmentDiv = safeFragment.appendChild( document.createElement("div") );
5869
-
5870
- wrapMap.optgroup = wrapMap.option;
5871
- wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
5872
- wrapMap.th = wrapMap.td;
5873
-
5874
- jQuery.fn.extend({
5875
- text: function( value ) {
5876
- return jQuery.access( this, function( value ) {
5877
- return value === undefined ?
5878
- jQuery.text( this ) :
5879
- this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
5880
- }, null, value, arguments.length );
5881
- },
5882
-
5883
- wrapAll: function( html ) {
5884
- if ( jQuery.isFunction( html ) ) {
5885
- return this.each(function(i) {
5886
- jQuery(this).wrapAll( html.call(this, i) );
5887
- });
5888
- }
5889
-
5890
- if ( this[0] ) {
5891
- // The elements to wrap the target around
5892
- var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
5893
-
5894
- if ( this[0].parentNode ) {
5895
- wrap.insertBefore( this[0] );
5896
- }
5897
-
5898
- wrap.map(function() {
5899
- var elem = this;
5900
-
5901
- while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
5902
- elem = elem.firstChild;
5903
- }
5904
-
5905
- return elem;
5906
- }).append( this );
5907
- }
5908
-
5909
- return this;
5910
- },
5911
-
5912
- wrapInner: function( html ) {
5913
- if ( jQuery.isFunction( html ) ) {
5914
- return this.each(function(i) {
5915
- jQuery(this).wrapInner( html.call(this, i) );
5916
- });
5917
- }
5918
-
5919
- return this.each(function() {
5920
- var self = jQuery( this ),
5921
- contents = self.contents();
5922
-
5923
- if ( contents.length ) {
5924
- contents.wrapAll( html );
5925
-
5926
- } else {
5927
- self.append( html );
5928
- }
5929
- });
5930
- },
5931
-
5932
- wrap: function( html ) {
5933
- var isFunction = jQuery.isFunction( html );
5934
-
5935
- return this.each(function(i) {
5936
- jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
5937
- });
5938
- },
5939
-
5940
- unwrap: function() {
5941
- return this.parent().each(function() {
5942
- if ( !jQuery.nodeName( this, "body" ) ) {
5943
- jQuery( this ).replaceWith( this.childNodes );
5944
- }
5945
- }).end();
5946
- },
5947
-
5948
- append: function() {
5949
- return this.domManip(arguments, true, function( elem ) {
5950
- if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5951
- this.appendChild( elem );
5952
- }
5953
- });
5954
- },
5955
-
5956
- prepend: function() {
5957
- return this.domManip(arguments, true, function( elem ) {
5958
- if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5959
- this.insertBefore( elem, this.firstChild );
5960
- }
5961
- });
5962
- },
5963
-
5964
- before: function() {
5965
- return this.domManip( arguments, false, function( elem ) {
5966
- if ( this.parentNode ) {
5967
- this.parentNode.insertBefore( elem, this );
5968
- }
5969
- });
5970
- },
5971
-
5972
- after: function() {
5973
- return this.domManip( arguments, false, function( elem ) {
5974
- if ( this.parentNode ) {
5975
- this.parentNode.insertBefore( elem, this.nextSibling );
5976
- }
5977
- });
5978
- },
5979
-
5980
- // keepData is for internal use only--do not document
5981
- remove: function( selector, keepData ) {
5982
- var elem,
5983
- i = 0;
5984
-
5985
- for ( ; (elem = this[i]) != null; i++ ) {
5986
- if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) {
5987
- if ( !keepData && elem.nodeType === 1 ) {
5988
- jQuery.cleanData( getAll( elem ) );
5989
- }
5990
-
5991
- if ( elem.parentNode ) {
5992
- if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
5993
- setGlobalEval( getAll( elem, "script" ) );
5994
- }
5995
- elem.parentNode.removeChild( elem );
5996
- }
5997
- }
5998
- }
5999
-
6000
- return this;
6001
- },
6002
-
6003
- empty: function() {
6004
- var elem,
6005
- i = 0;
6006
-
6007
- for ( ; (elem = this[i]) != null; i++ ) {
6008
- // Remove element nodes and prevent memory leaks
6009
- if ( elem.nodeType === 1 ) {
6010
- jQuery.cleanData( getAll( elem, false ) );
6011
- }
6012
-
6013
- // Remove any remaining nodes
6014
- while ( elem.firstChild ) {
6015
- elem.removeChild( elem.firstChild );
6016
- }
6017
-
6018
- // If this is a select, ensure that it displays empty (#12336)
6019
- // Support: IE<9
6020
- if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
6021
- elem.options.length = 0;
6022
- }
6023
- }
6024
-
6025
- return this;
6026
- },
6027
-
6028
- clone: function( dataAndEvents, deepDataAndEvents ) {
6029
- dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
6030
- deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
6031
-
6032
- return this.map( function () {
6033
- return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
6034
- });
6035
- },
6036
-
6037
- html: function( value ) {
6038
- return jQuery.access( this, function( value ) {
6039
- var elem = this[0] || {},
6040
- i = 0,
6041
- l = this.length;
6042
-
6043
- if ( value === undefined ) {
6044
- return elem.nodeType === 1 ?
6045
- elem.innerHTML.replace( rinlinejQuery, "" ) :
6046
- undefined;
6047
- }
6048
-
6049
- // See if we can take a shortcut and just use innerHTML
6050
- if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
6051
- ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
6052
- ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
6053
- !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
6054
-
6055
- value = value.replace( rxhtmlTag, "<$1></$2>" );
6056
-
6057
- try {
6058
- for (; i < l; i++ ) {
6059
- // Remove element nodes and prevent memory leaks
6060
- elem = this[i] || {};
6061
- if ( elem.nodeType === 1 ) {
6062
- jQuery.cleanData( getAll( elem, false ) );
6063
- elem.innerHTML = value;
6064
- }
6065
- }
6066
-
6067
- elem = 0;
6068
-
6069
- // If using innerHTML throws an exception, use the fallback method
6070
- } catch(e) {}
6071
- }
6072
-
6073
- if ( elem ) {
6074
- this.empty().append( value );
6075
- }
6076
- }, null, value, arguments.length );
6077
- },
6078
-
6079
- replaceWith: function( value ) {
6080
- var isFunc = jQuery.isFunction( value );
6081
-
6082
- // Make sure that the elements are removed from the DOM before they are inserted
6083
- // this can help fix replacing a parent with child elements
6084
- if ( !isFunc && typeof value !== "string" ) {
6085
- value = jQuery( value ).not( this ).detach();
6086
- }
6087
-
6088
- return this.domManip( [ value ], true, function( elem ) {
6089
- var next = this.nextSibling,
6090
- parent = this.parentNode;
6091
-
6092
- if ( parent ) {
6093
- jQuery( this ).remove();
6094
- parent.insertBefore( elem, next );
6095
- }
6096
- });
6097
- },
6098
-
6099
- detach: function( selector ) {
6100
- return this.remove( selector, true );
6101
- },
6102
-
6103
- domManip: function( args, table, callback ) {
6104
-
6105
- // Flatten any nested arrays
6106
- args = core_concat.apply( [], args );
6107
-
6108
- var first, node, hasScripts,
6109
- scripts, doc, fragment,
6110
- i = 0,
6111
- l = this.length,
6112
- set = this,
6113
- iNoClone = l - 1,
6114
- value = args[0],
6115
- isFunction = jQuery.isFunction( value );
6116
-
6117
- // We can't cloneNode fragments that contain checked, in WebKit
6118
- if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {
6119
- return this.each(function( index ) {
6120
- var self = set.eq( index );
6121
- if ( isFunction ) {
6122
- args[0] = value.call( this, index, table ? self.html() : undefined );
6123
- }
6124
- self.domManip( args, table, callback );
6125
- });
6126
- }
6127
-
6128
- if ( l ) {
6129
- fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
6130
- first = fragment.firstChild;
6131
-
6132
- if ( fragment.childNodes.length === 1 ) {
6133
- fragment = first;
6134
- }
6135
-
6136
- if ( first ) {
6137
- table = table && jQuery.nodeName( first, "tr" );
6138
- scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
6139
- hasScripts = scripts.length;
6140
-
6141
- // Use the original fragment for the last item instead of the first because it can end up
6142
- // being emptied incorrectly in certain situations (#8070).
6143
- for ( ; i < l; i++ ) {
6144
- node = fragment;
6145
-
6146
- if ( i !== iNoClone ) {
6147
- node = jQuery.clone( node, true, true );
6148
-
6149
- // Keep references to cloned scripts for later restoration
6150
- if ( hasScripts ) {
6151
- jQuery.merge( scripts, getAll( node, "script" ) );
6152
- }
6153
- }
6154
-
6155
- callback.call(
6156
- table && jQuery.nodeName( this[i], "table" ) ?
6157
- findOrAppend( this[i], "tbody" ) :
6158
- this[i],
6159
- node,
6160
- i
6161
- );
6162
- }
6163
-
6164
- if ( hasScripts ) {
6165
- doc = scripts[ scripts.length - 1 ].ownerDocument;
6166
-
6167
- // Reenable scripts
6168
- jQuery.map( scripts, restoreScript );
6169
-
6170
- // Evaluate executable scripts on first document insertion
6171
- for ( i = 0; i < hasScripts; i++ ) {
6172
- node = scripts[ i ];
6173
- if ( rscriptType.test( node.type || "" ) &&
6174
- !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
6175
-
6176
- if ( node.src ) {
6177
- // Hope ajax is available...
6178
- jQuery.ajax({
6179
- url: node.src,
6180
- type: "GET",
6181
- dataType: "script",
6182
- async: false,
6183
- global: false,
6184
- "throws": true
6185
- });
6186
- } else {
6187
- jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );
6188
- }
6189
- }
6190
- }
6191
- }
6192
-
6193
- // Fix #11809: Avoid leaking memory
6194
- fragment = first = null;
6195
- }
6196
- }
6197
-
6198
- return this;
6199
- }
6200
- });
6201
-
6202
- function findOrAppend( elem, tag ) {
6203
- return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
6204
- }
6205
-
6206
- // Replace/restore the type attribute of script elements for safe DOM manipulation
6207
- function disableScript( elem ) {
6208
- var attr = elem.getAttributeNode("type");
6209
- elem.type = ( attr && attr.specified ) + "/" + elem.type;
6210
- return elem;
6211
- }
6212
- function restoreScript( elem ) {
6213
- var match = rscriptTypeMasked.exec( elem.type );
6214
- if ( match ) {
6215
- elem.type = match[1];
6216
- } else {
6217
- elem.removeAttribute("type");
6218
- }
6219
- return elem;
6220
- }
6221
-
6222
- // Mark scripts as having already been evaluated
6223
- function setGlobalEval( elems, refElements ) {
6224
- var elem,
6225
- i = 0;
6226
- for ( ; (elem = elems[i]) != null; i++ ) {
6227
- jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
6228
- }
6229
- }
6230
-
6231
- function cloneCopyEvent( src, dest ) {
6232
-
6233
- if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
6234
- return;
6235
- }
6236
-
6237
- var type, i, l,
6238
- oldData = jQuery._data( src ),
6239
- curData = jQuery._data( dest, oldData ),
6240
- events = oldData.events;
6241
-
6242
- if ( events ) {
6243
- delete curData.handle;
6244
- curData.events = {};
6245
-
6246
- for ( type in events ) {
6247
- for ( i = 0, l = events[ type ].length; i < l; i++ ) {
6248
- jQuery.event.add( dest, type, events[ type ][ i ] );
6249
- }
6250
- }
6251
- }
6252
-
6253
- // make the cloned public data object a copy from the original
6254
- if ( curData.data ) {
6255
- curData.data = jQuery.extend( {}, curData.data );
6256
- }
6257
- }
6258
-
6259
- function fixCloneNodeIssues( src, dest ) {
6260
- var nodeName, e, data;
6261
-
6262
- // We do not need to do anything for non-Elements
6263
- if ( dest.nodeType !== 1 ) {
6264
- return;
6265
- }
6266
-
6267
- nodeName = dest.nodeName.toLowerCase();
6268
-
6269
- // IE6-8 copies events bound via attachEvent when using cloneNode.
6270
- if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) {
6271
- data = jQuery._data( dest );
6272
-
6273
- for ( e in data.events ) {
6274
- jQuery.removeEvent( dest, e, data.handle );
6275
- }
6276
-
6277
- // Event data gets referenced instead of copied if the expando gets copied too
6278
- dest.removeAttribute( jQuery.expando );
6279
- }
6280
-
6281
- // IE blanks contents when cloning scripts, and tries to evaluate newly-set text
6282
- if ( nodeName === "script" && dest.text !== src.text ) {
6283
- disableScript( dest ).text = src.text;
6284
- restoreScript( dest );
6285
-
6286
- // IE6-10 improperly clones children of object elements using classid.
6287
- // IE10 throws NoModificationAllowedError if parent is null, #12132.
6288
- } else if ( nodeName === "object" ) {
6289
- if ( dest.parentNode ) {
6290
- dest.outerHTML = src.outerHTML;
6291
- }
6292
-
6293
- // This path appears unavoidable for IE9. When cloning an object
6294
- // element in IE9, the outerHTML strategy above is not sufficient.
6295
- // If the src has innerHTML and the destination does not,
6296
- // copy the src.innerHTML into the dest.innerHTML. #10324
6297
- if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
6298
- dest.innerHTML = src.innerHTML;
6299
- }
6300
-
6301
- } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
6302
- // IE6-8 fails to persist the checked state of a cloned checkbox
6303
- // or radio button. Worse, IE6-7 fail to give the cloned element
6304
- // a checked appearance if the defaultChecked value isn't also set
6305
-
6306
- dest.defaultChecked = dest.checked = src.checked;
6307
-
6308
- // IE6-7 get confused and end up setting the value of a cloned
6309
- // checkbox/radio button to an empty string instead of "on"
6310
- if ( dest.value !== src.value ) {
6311
- dest.value = src.value;
6312
- }
6313
-
6314
- // IE6-8 fails to return the selected option to the default selected
6315
- // state when cloning options
6316
- } else if ( nodeName === "option" ) {
6317
- dest.defaultSelected = dest.selected = src.defaultSelected;
6318
-
6319
- // IE6-8 fails to set the defaultValue to the correct value when
6320
- // cloning other types of input fields
6321
- } else if ( nodeName === "input" || nodeName === "textarea" ) {
6322
- dest.defaultValue = src.defaultValue;
6323
- }
6324
- }
6325
-
6326
- jQuery.each({
6327
- appendTo: "append",
6328
- prependTo: "prepend",
6329
- insertBefore: "before",
6330
- insertAfter: "after",
6331
- replaceAll: "replaceWith"
6332
- }, function( name, original ) {
6333
- jQuery.fn[ name ] = function( selector ) {
6334
- var elems,
6335
- i = 0,
6336
- ret = [],
6337
- insert = jQuery( selector ),
6338
- last = insert.length - 1;
6339
-
6340
- for ( ; i <= last; i++ ) {
6341
- elems = i === last ? this : this.clone(true);
6342
- jQuery( insert[i] )[ original ]( elems );
6343
-
6344
- // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
6345
- core_push.apply( ret, elems.get() );
6346
- }
6347
-
6348
- return this.pushStack( ret );
6349
- };
6350
- });
6351
-
6352
- function getAll( context, tag ) {
6353
- var elems, elem,
6354
- i = 0,
6355
- found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) :
6356
- typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) :
6357
- undefined;
6358
-
6359
- if ( !found ) {
6360
- for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
6361
- if ( !tag || jQuery.nodeName( elem, tag ) ) {
6362
- found.push( elem );
6363
- } else {
6364
- jQuery.merge( found, getAll( elem, tag ) );
6365
- }
6366
- }
6367
- }
6368
-
6369
- return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
6370
- jQuery.merge( [ context ], found ) :
6371
- found;
6372
- }
6373
-
6374
- // Used in buildFragment, fixes the defaultChecked property
6375
- function fixDefaultChecked( elem ) {
6376
- if ( manipulation_rcheckableType.test( elem.type ) ) {
6377
- elem.defaultChecked = elem.checked;
6378
- }
6379
- }
6380
-
6381
- jQuery.extend({
6382
- clone: function( elem, dataAndEvents, deepDataAndEvents ) {
6383
- var destElements, node, clone, i, srcElements,
6384
- inPage = jQuery.contains( elem.ownerDocument, elem );
6385
-
6386
- if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
6387
- clone = elem.cloneNode( true );
6388
-
6389
- // IE<=8 does not properly clone detached, unknown element nodes
6390
- } else {
6391
- fragmentDiv.innerHTML = elem.outerHTML;
6392
- fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
6393
- }
6394
-
6395
- if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
6396
- (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
6397
-
6398
- // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
6399
- destElements = getAll( clone );
6400
- srcElements = getAll( elem );
6401
-
6402
- // Fix all IE cloning issues
6403
- for ( i = 0; (node = srcElements[i]) != null; ++i ) {
6404
- // Ensure that the destination node is not null; Fixes #9587
6405
- if ( destElements[i] ) {
6406
- fixCloneNodeIssues( node, destElements[i] );
6407
- }
6408
- }
6409
- }
6410
-
6411
- // Copy the events from the original to the clone
6412
- if ( dataAndEvents ) {
6413
- if ( deepDataAndEvents ) {
6414
- srcElements = srcElements || getAll( elem );
6415
- destElements = destElements || getAll( clone );
6416
-
6417
- for ( i = 0; (node = srcElements[i]) != null; i++ ) {
6418
- cloneCopyEvent( node, destElements[i] );
6419
- }
6420
- } else {
6421
- cloneCopyEvent( elem, clone );
6422
- }
6423
- }
6424
-
6425
- // Preserve script evaluation history
6426
- destElements = getAll( clone, "script" );
6427
- if ( destElements.length > 0 ) {
6428
- setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
6429
- }
6430
-
6431
- destElements = srcElements = node = null;
6432
-
6433
- // Return the cloned set
6434
- return clone;
6435
- },
6436
-
6437
- buildFragment: function( elems, context, scripts, selection ) {
6438
- var j, elem, contains,
6439
- tmp, tag, tbody, wrap,
6440
- l = elems.length,
6441
-
6442
- // Ensure a safe fragment
6443
- safe = createSafeFragment( context ),
6444
-
6445
- nodes = [],
6446
- i = 0;
6447
-
6448
- for ( ; i < l; i++ ) {
6449
- elem = elems[ i ];
6450
-
6451
- if ( elem || elem === 0 ) {
6452
-
6453
- // Add nodes directly
6454
- if ( jQuery.type( elem ) === "object" ) {
6455
- jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
6456
-
6457
- // Convert non-html into a text node
6458
- } else if ( !rhtml.test( elem ) ) {
6459
- nodes.push( context.createTextNode( elem ) );
6460
-
6461
- // Convert html into DOM nodes
6462
- } else {
6463
- tmp = tmp || safe.appendChild( context.createElement("div") );
6464
-
6465
- // Deserialize a standard representation
6466
- tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
6467
- wrap = wrapMap[ tag ] || wrapMap._default;
6468
-
6469
- tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
6470
-
6471
- // Descend through wrappers to the right content
6472
- j = wrap[0];
6473
- while ( j-- ) {
6474
- tmp = tmp.lastChild;
6475
- }
6476
-
6477
- // Manually add leading whitespace removed by IE
6478
- if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
6479
- nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
6480
- }
6481
-
6482
- // Remove IE's autoinserted <tbody> from table fragments
6483
- if ( !jQuery.support.tbody ) {
6484
-
6485
- // String was a <table>, *may* have spurious <tbody>
6486
- elem = tag === "table" && !rtbody.test( elem ) ?
6487
- tmp.firstChild :
6488
-
6489
- // String was a bare <thead> or <tfoot>
6490
- wrap[1] === "<table>" && !rtbody.test( elem ) ?
6491
- tmp :
6492
- 0;
6493
-
6494
- j = elem && elem.childNodes.length;
6495
- while ( j-- ) {
6496
- if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
6497
- elem.removeChild( tbody );
6498
- }
6499
- }
6500
- }
6501
-
6502
- jQuery.merge( nodes, tmp.childNodes );
6503
-
6504
- // Fix #12392 for WebKit and IE > 9
6505
- tmp.textContent = "";
6506
-
6507
- // Fix #12392 for oldIE
6508
- while ( tmp.firstChild ) {
6509
- tmp.removeChild( tmp.firstChild );
6510
- }
6511
-
6512
- // Remember the top-level container for proper cleanup
6513
- tmp = safe.lastChild;
6514
- }
6515
- }
6516
- }
6517
-
6518
- // Fix #11356: Clear elements from fragment
6519
- if ( tmp ) {
6520
- safe.removeChild( tmp );
6521
- }
6522
-
6523
- // Reset defaultChecked for any radios and checkboxes
6524
- // about to be appended to the DOM in IE 6/7 (#8060)
6525
- if ( !jQuery.support.appendChecked ) {
6526
- jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
6527
- }
6528
-
6529
- i = 0;
6530
- while ( (elem = nodes[ i++ ]) ) {
6531
-
6532
- // #4087 - If origin and destination elements are the same, and this is
6533
- // that element, do not do anything
6534
- if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
6535
- continue;
6536
- }
6537
-
6538
- contains = jQuery.contains( elem.ownerDocument, elem );
6539
-
6540
- // Append to fragment
6541
- tmp = getAll( safe.appendChild( elem ), "script" );
6542
-
6543
- // Preserve script evaluation history
6544
- if ( contains ) {
6545
- setGlobalEval( tmp );
6546
- }
6547
-
6548
- // Capture executables
6549
- if ( scripts ) {
6550
- j = 0;
6551
- while ( (elem = tmp[ j++ ]) ) {
6552
- if ( rscriptType.test( elem.type || "" ) ) {
6553
- scripts.push( elem );
6554
- }
6555
- }
6556
- }
6557
- }
6558
-
6559
- tmp = null;
6560
-
6561
- return safe;
6562
- },
6563
-
6564
- cleanData: function( elems, /* internal */ acceptData ) {
6565
- var elem, type, id, data,
6566
- i = 0,
6567
- internalKey = jQuery.expando,
6568
- cache = jQuery.cache,
6569
- deleteExpando = jQuery.support.deleteExpando,
6570
- special = jQuery.event.special;
6571
-
6572
- for ( ; (elem = elems[i]) != null; i++ ) {
6573
-
6574
- if ( acceptData || jQuery.acceptData( elem ) ) {
6575
-
6576
- id = elem[ internalKey ];
6577
- data = id && cache[ id ];
6578
-
6579
- if ( data ) {
6580
- if ( data.events ) {
6581
- for ( type in data.events ) {
6582
- if ( special[ type ] ) {
6583
- jQuery.event.remove( elem, type );
6584
-
6585
- // This is a shortcut to avoid jQuery.event.remove's overhead
6586
- } else {
6587
- jQuery.removeEvent( elem, type, data.handle );
6588
- }
6589
- }
6590
- }
6591
-
6592
- // Remove cache only if it was not already removed by jQuery.event.remove
6593
- if ( cache[ id ] ) {
6594
-
6595
- delete cache[ id ];
6596
-
6597
- // IE does not allow us to delete expando properties from nodes,
6598
- // nor does it have a removeAttribute function on Document nodes;
6599
- // we must handle all of these cases
6600
- if ( deleteExpando ) {
6601
- delete elem[ internalKey ];
6602
-
6603
- } else if ( typeof elem.removeAttribute !== core_strundefined ) {
6604
- elem.removeAttribute( internalKey );
6605
-
6606
- } else {
6607
- elem[ internalKey ] = null;
6608
- }
6609
-
6610
- core_deletedIds.push( id );
6611
- }
6612
- }
6613
- }
6614
- }
6615
- }
6616
- });
6617
- var iframe, getStyles, curCSS,
6618
- ralpha = /alpha\([^)]*\)/i,
6619
- ropacity = /opacity\s*=\s*([^)]*)/,
6620
- rposition = /^(top|right|bottom|left)$/,
6621
- // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
6622
- // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
6623
- rdisplayswap = /^(none|table(?!-c[ea]).+)/,
6624
- rmargin = /^margin/,
6625
- rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
6626
- rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
6627
- rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ),
6628
- elemdisplay = { BODY: "block" },
6629
-
6630
- cssShow = { position: "absolute", visibility: "hidden", display: "block" },
6631
- cssNormalTransform = {
6632
- letterSpacing: 0,
6633
- fontWeight: 400
6634
- },
6635
-
6636
- cssExpand = [ "Top", "Right", "Bottom", "Left" ],
6637
- cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
6638
-
6639
- // return a css property mapped to a potentially vendor prefixed property
6640
- function vendorPropName( style, name ) {
6641
-
6642
- // shortcut for names that are not vendor prefixed
6643
- if ( name in style ) {
6644
- return name;
6645
- }
6646
-
6647
- // check for vendor prefixed names
6648
- var capName = name.charAt(0).toUpperCase() + name.slice(1),
6649
- origName = name,
6650
- i = cssPrefixes.length;
6651
-
6652
- while ( i-- ) {
6653
- name = cssPrefixes[ i ] + capName;
6654
- if ( name in style ) {
6655
- return name;
6656
- }
6657
- }
6658
-
6659
- return origName;
6660
- }
6661
-
6662
- function isHidden( elem, el ) {
6663
- // isHidden might be called from jQuery#filter function;
6664
- // in that case, element will be second argument
6665
- elem = el || elem;
6666
- return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
6667
- }
6668
-
6669
- function showHide( elements, show ) {
6670
- var display, elem, hidden,
6671
- values = [],
6672
- index = 0,
6673
- length = elements.length;
6674
-
6675
- for ( ; index < length; index++ ) {
6676
- elem = elements[ index ];
6677
- if ( !elem.style ) {
6678
- continue;
6679
- }
6680
-
6681
- values[ index ] = jQuery._data( elem, "olddisplay" );
6682
- display = elem.style.display;
6683
- if ( show ) {
6684
- // Reset the inline display of this element to learn if it is
6685
- // being hidden by cascaded rules or not
6686
- if ( !values[ index ] && display === "none" ) {
6687
- elem.style.display = "";
6688
- }
6689
-
6690
- // Set elements which have been overridden with display: none
6691
- // in a stylesheet to whatever the default browser style is
6692
- // for such an element
6693
- if ( elem.style.display === "" && isHidden( elem ) ) {
6694
- values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
6695
- }
6696
- } else {
6697
-
6698
- if ( !values[ index ] ) {
6699
- hidden = isHidden( elem );
6700
-
6701
- if ( display && display !== "none" || !hidden ) {
6702
- jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
6703
- }
6704
- }
6705
- }
6706
- }
6707
-
6708
- // Set the display of most of the elements in a second loop
6709
- // to avoid the constant reflow
6710
- for ( index = 0; index < length; index++ ) {
6711
- elem = elements[ index ];
6712
- if ( !elem.style ) {
6713
- continue;
6714
- }
6715
- if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
6716
- elem.style.display = show ? values[ index ] || "" : "none";
6717
- }
6718
- }
6719
-
6720
- return elements;
6721
- }
6722
-
6723
- jQuery.fn.extend({
6724
- css: function( name, value ) {
6725
- return jQuery.access( this, function( elem, name, value ) {
6726
- var len, styles,
6727
- map = {},
6728
- i = 0;
6729
-
6730
- if ( jQuery.isArray( name ) ) {
6731
- styles = getStyles( elem );
6732
- len = name.length;
6733
-
6734
- for ( ; i < len; i++ ) {
6735
- map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
6736
- }
6737
-
6738
- return map;
6739
- }
6740
-
6741
- return value !== undefined ?
6742
- jQuery.style( elem, name, value ) :
6743
- jQuery.css( elem, name );
6744
- }, name, value, arguments.length > 1 );
6745
- },
6746
- show: function() {
6747
- return showHide( this, true );
6748
- },
6749
- hide: function() {
6750
- return showHide( this );
6751
- },
6752
- toggle: function( state ) {
6753
- var bool = typeof state === "boolean";
6754
-
6755
- return this.each(function() {
6756
- if ( bool ? state : isHidden( this ) ) {
6757
- jQuery( this ).show();
6758
- } else {
6759
- jQuery( this ).hide();
6760
- }
6761
- });
6762
- }
6763
- });
6764
-
6765
- jQuery.extend({
6766
- // Add in style property hooks for overriding the default
6767
- // behavior of getting and setting a style property
6768
- cssHooks: {
6769
- opacity: {
6770
- get: function( elem, computed ) {
6771
- if ( computed ) {
6772
- // We should always get a number back from opacity
6773
- var ret = curCSS( elem, "opacity" );
6774
- return ret === "" ? "1" : ret;
6775
- }
6776
- }
6777
- }
6778
- },
6779
-
6780
- // Exclude the following css properties to add px
6781
- cssNumber: {
6782
- "columnCount": true,
6783
- "fillOpacity": true,
6784
- "fontWeight": true,
6785
- "lineHeight": true,
6786
- "opacity": true,
6787
- "orphans": true,
6788
- "widows": true,
6789
- "zIndex": true,
6790
- "zoom": true
6791
- },
6792
-
6793
- // Add in properties whose names you wish to fix before
6794
- // setting or getting the value
6795
- cssProps: {
6796
- // normalize float css property
6797
- "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
6798
- },
6799
-
6800
- // Get and set the style property on a DOM Node
6801
- style: function( elem, name, value, extra ) {
6802
- // Don't set styles on text and comment nodes
6803
- if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
6804
- return;
6805
- }
6806
-
6807
- // Make sure that we're working with the right name
6808
- var ret, type, hooks,
6809
- origName = jQuery.camelCase( name ),
6810
- style = elem.style;
6811
-
6812
- name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
6813
-
6814
- // gets hook for the prefixed version
6815
- // followed by the unprefixed version
6816
- hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6817
-
6818
- // Check if we're setting a value
6819
- if ( value !== undefined ) {
6820
- type = typeof value;
6821
-
6822
- // convert relative number strings (+= or -=) to relative numbers. #7345
6823
- if ( type === "string" && (ret = rrelNum.exec( value )) ) {
6824
- value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
6825
- // Fixes bug #9237
6826
- type = "number";
6827
- }
6828
-
6829
- // Make sure that NaN and null values aren't set. See: #7116
6830
- if ( value == null || type === "number" && isNaN( value ) ) {
6831
- return;
6832
- }
6833
-
6834
- // If a number was passed in, add 'px' to the (except for certain CSS properties)
6835
- if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
6836
- value += "px";
6837
- }
6838
-
6839
- // Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
6840
- // but it would mean to define eight (for every problematic property) identical functions
6841
- if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
6842
- style[ name ] = "inherit";
6843
- }
6844
-
6845
- // If a hook was provided, use that value, otherwise just set the specified value
6846
- if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
6847
-
6848
- // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
6849
- // Fixes bug #5509
6850
- try {
6851
- style[ name ] = value;
6852
- } catch(e) {}
6853
- }
6854
-
6855
- } else {
6856
- // If a hook was provided get the non-computed value from there
6857
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
6858
- return ret;
6859
- }
6860
-
6861
- // Otherwise just get the value from the style object
6862
- return style[ name ];
6863
- }
6864
- },
6865
-
6866
- css: function( elem, name, extra, styles ) {
6867
- var num, val, hooks,
6868
- origName = jQuery.camelCase( name );
6869
-
6870
- // Make sure that we're working with the right name
6871
- name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
6872
-
6873
- // gets hook for the prefixed version
6874
- // followed by the unprefixed version
6875
- hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6876
-
6877
- // If a hook was provided get the computed value from there
6878
- if ( hooks && "get" in hooks ) {
6879
- val = hooks.get( elem, true, extra );
6880
- }
6881
-
6882
- // Otherwise, if a way to get the computed value exists, use that
6883
- if ( val === undefined ) {
6884
- val = curCSS( elem, name, styles );
6885
- }
6886
-
6887
- //convert "normal" to computed value
6888
- if ( val === "normal" && name in cssNormalTransform ) {
6889
- val = cssNormalTransform[ name ];
6890
- }
6891
-
6892
- // Return, converting to number if forced or a qualifier was provided and val looks numeric
6893
- if ( extra === "" || extra ) {
6894
- num = parseFloat( val );
6895
- return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
6896
- }
6897
- return val;
6898
- },
6899
-
6900
- // A method for quickly swapping in/out CSS properties to get correct calculations
6901
- swap: function( elem, options, callback, args ) {
6902
- var ret, name,
6903
- old = {};
6904
-
6905
- // Remember the old values, and insert the new ones
6906
- for ( name in options ) {
6907
- old[ name ] = elem.style[ name ];
6908
- elem.style[ name ] = options[ name ];
6909
- }
6910
-
6911
- ret = callback.apply( elem, args || [] );
6912
-
6913
- // Revert the old values
6914
- for ( name in options ) {
6915
- elem.style[ name ] = old[ name ];
6916
- }
6917
-
6918
- return ret;
6919
- }
6920
- });
6921
-
6922
- // NOTE: we've included the "window" in window.getComputedStyle
6923
- // because jsdom on node.js will break without it.
6924
- if ( window.getComputedStyle ) {
6925
- getStyles = function( elem ) {
6926
- return window.getComputedStyle( elem, null );
6927
- };
6928
-
6929
- curCSS = function( elem, name, _computed ) {
6930
- var width, minWidth, maxWidth,
6931
- computed = _computed || getStyles( elem ),
6932
-
6933
- // getPropertyValue is only needed for .css('filter') in IE9, see #12537
6934
- ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined,
6935
- style = elem.style;
6936
-
6937
- if ( computed ) {
6938
-
6939
- if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
6940
- ret = jQuery.style( elem, name );
6941
- }
6942
-
6943
- // A tribute to the "awesome hack by Dean Edwards"
6944
- // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
6945
- // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
6946
- // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
6947
- if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
6948
-
6949
- // Remember the original values
6950
- width = style.width;
6951
- minWidth = style.minWidth;
6952
- maxWidth = style.maxWidth;
6953
-
6954
- // Put in the new values to get a computed value out
6955
- style.minWidth = style.maxWidth = style.width = ret;
6956
- ret = computed.width;
6957
-
6958
- // Revert the changed values
6959
- style.width = width;
6960
- style.minWidth = minWidth;
6961
- style.maxWidth = maxWidth;
6962
- }
6963
- }
6964
-
6965
- return ret;
6966
- };
6967
- } else if ( document.documentElement.currentStyle ) {
6968
- getStyles = function( elem ) {
6969
- return elem.currentStyle;
6970
- };
6971
-
6972
- curCSS = function( elem, name, _computed ) {
6973
- var left, rs, rsLeft,
6974
- computed = _computed || getStyles( elem ),
6975
- ret = computed ? computed[ name ] : undefined,
6976
- style = elem.style;
6977
-
6978
- // Avoid setting ret to empty string here
6979
- // so we don't default to auto
6980
- if ( ret == null && style && style[ name ] ) {
6981
- ret = style[ name ];
6982
- }
6983
-
6984
- // From the awesome hack by Dean Edwards
6985
- // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
6986
-
6987
- // If we're not dealing with a regular pixel number
6988
- // but a number that has a weird ending, we need to convert it to pixels
6989
- // but not position css attributes, as those are proportional to the parent element instead
6990
- // and we can't measure the parent instead because it might trigger a "stacking dolls" problem
6991
- if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
6992
-
6993
- // Remember the original values
6994
- left = style.left;
6995
- rs = elem.runtimeStyle;
6996
- rsLeft = rs && rs.left;
6997
-
6998
- // Put in the new values to get a computed value out
6999
- if ( rsLeft ) {
7000
- rs.left = elem.currentStyle.left;
7001
- }
7002
- style.left = name === "fontSize" ? "1em" : ret;
7003
- ret = style.pixelLeft + "px";
7004
-
7005
- // Revert the changed values
7006
- style.left = left;
7007
- if ( rsLeft ) {
7008
- rs.left = rsLeft;
7009
- }
7010
- }
7011
-
7012
- return ret === "" ? "auto" : ret;
7013
- };
7014
- }
7015
-
7016
- function setPositiveNumber( elem, value, subtract ) {
7017
- var matches = rnumsplit.exec( value );
7018
- return matches ?
7019
- // Guard against undefined "subtract", e.g., when used as in cssHooks
7020
- Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
7021
- value;
7022
- }
7023
-
7024
- function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
7025
- var i = extra === ( isBorderBox ? "border" : "content" ) ?
7026
- // If we already have the right measurement, avoid augmentation
7027
- 4 :
7028
- // Otherwise initialize for horizontal or vertical properties
7029
- name === "width" ? 1 : 0,
7030
-
7031
- val = 0;
7032
-
7033
- for ( ; i < 4; i += 2 ) {
7034
- // both box models exclude margin, so add it if we want it
7035
- if ( extra === "margin" ) {
7036
- val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
7037
- }
7038
-
7039
- if ( isBorderBox ) {
7040
- // border-box includes padding, so remove it if we want content
7041
- if ( extra === "content" ) {
7042
- val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
7043
- }
7044
-
7045
- // at this point, extra isn't border nor margin, so remove border
7046
- if ( extra !== "margin" ) {
7047
- val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
7048
- }
7049
- } else {
7050
- // at this point, extra isn't content, so add padding
7051
- val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
7052
-
7053
- // at this point, extra isn't content nor padding, so add border
7054
- if ( extra !== "padding" ) {
7055
- val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
7056
- }
7057
- }
7058
- }
7059
-
7060
- return val;
7061
- }
7062
-
7063
- function getWidthOrHeight( elem, name, extra ) {
7064
-
7065
- // Start with offset property, which is equivalent to the border-box value
7066
- var valueIsBorderBox = true,
7067
- val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
7068
- styles = getStyles( elem ),
7069
- isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
7070
-
7071
- // some non-html elements return undefined for offsetWidth, so check for null/undefined
7072
- // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
7073
- // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
7074
- if ( val <= 0 || val == null ) {
7075
- // Fall back to computed then uncomputed css if necessary
7076
- val = curCSS( elem, name, styles );
7077
- if ( val < 0 || val == null ) {
7078
- val = elem.style[ name ];
7079
- }
7080
-
7081
- // Computed unit is not pixels. Stop here and return.
7082
- if ( rnumnonpx.test(val) ) {
7083
- return val;
7084
- }
7085
-
7086
- // we need the check for style in case a browser which returns unreliable values
7087
- // for getComputedStyle silently falls back to the reliable elem.style
7088
- valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
7089
-
7090
- // Normalize "", auto, and prepare for extra
7091
- val = parseFloat( val ) || 0;
7092
- }
7093
-
7094
- // use the active box-sizing model to add/subtract irrelevant styles
7095
- return ( val +
7096
- augmentWidthOrHeight(
7097
- elem,
7098
- name,
7099
- extra || ( isBorderBox ? "border" : "content" ),
7100
- valueIsBorderBox,
7101
- styles
7102
- )
7103
- ) + "px";
7104
- }
7105
-
7106
- // Try to determine the default display value of an element
7107
- function css_defaultDisplay( nodeName ) {
7108
- var doc = document,
7109
- display = elemdisplay[ nodeName ];
7110
-
7111
- if ( !display ) {
7112
- display = actualDisplay( nodeName, doc );
7113
-
7114
- // If the simple way fails, read from inside an iframe
7115
- if ( display === "none" || !display ) {
7116
- // Use the already-created iframe if possible
7117
- iframe = ( iframe ||
7118
- jQuery("<iframe frameborder='0' width='0' height='0'/>")
7119
- .css( "cssText", "display:block !important" )
7120
- ).appendTo( doc.documentElement );
7121
-
7122
- // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
7123
- doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
7124
- doc.write("<!doctype html><html><body>");
7125
- doc.close();
7126
-
7127
- display = actualDisplay( nodeName, doc );
7128
- iframe.detach();
7129
- }
7130
-
7131
- // Store the correct default display
7132
- elemdisplay[ nodeName ] = display;
7133
- }
7134
-
7135
- return display;
7136
- }
7137
-
7138
- // Called ONLY from within css_defaultDisplay
7139
- function actualDisplay( name, doc ) {
7140
- var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
7141
- display = jQuery.css( elem[0], "display" );
7142
- elem.remove();
7143
- return display;
7144
- }
7145
-
7146
- jQuery.each([ "height", "width" ], function( i, name ) {
7147
- jQuery.cssHooks[ name ] = {
7148
- get: function( elem, computed, extra ) {
7149
- if ( computed ) {
7150
- // certain elements can have dimension info if we invisibly show them
7151
- // however, it must have a current display style that would benefit from this
7152
- return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ?
7153
- jQuery.swap( elem, cssShow, function() {
7154
- return getWidthOrHeight( elem, name, extra );
7155
- }) :
7156
- getWidthOrHeight( elem, name, extra );
7157
- }
7158
- },
7159
-
7160
- set: function( elem, value, extra ) {
7161
- var styles = extra && getStyles( elem );
7162
- return setPositiveNumber( elem, value, extra ?
7163
- augmentWidthOrHeight(
7164
- elem,
7165
- name,
7166
- extra,
7167
- jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
7168
- styles
7169
- ) : 0
7170
- );
7171
- }
7172
- };
7173
- });
7174
-
7175
- if ( !jQuery.support.opacity ) {
7176
- jQuery.cssHooks.opacity = {
7177
- get: function( elem, computed ) {
7178
- // IE uses filters for opacity
7179
- return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
7180
- ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
7181
- computed ? "1" : "";
7182
- },
7183
-
7184
- set: function( elem, value ) {
7185
- var style = elem.style,
7186
- currentStyle = elem.currentStyle,
7187
- opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
7188
- filter = currentStyle && currentStyle.filter || style.filter || "";
7189
-
7190
- // IE has trouble with opacity if it does not have layout
7191
- // Force it by setting the zoom level
7192
- style.zoom = 1;
7193
-
7194
- // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
7195
- // if value === "", then remove inline opacity #12685
7196
- if ( ( value >= 1 || value === "" ) &&
7197
- jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
7198
- style.removeAttribute ) {
7199
-
7200
- // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
7201
- // if "filter:" is present at all, clearType is disabled, we want to avoid this
7202
- // style.removeAttribute is IE Only, but so apparently is this code path...
7203
- style.removeAttribute( "filter" );
7204
-
7205
- // if there is no filter style applied in a css rule or unset inline opacity, we are done
7206
- if ( value === "" || currentStyle && !currentStyle.filter ) {
7207
- return;
7208
- }
7209
- }
7210
-
7211
- // otherwise, set new filter values
7212
- style.filter = ralpha.test( filter ) ?
7213
- filter.replace( ralpha, opacity ) :
7214
- filter + " " + opacity;
7215
- }
7216
- };
7217
- }
7218
-
7219
- // These hooks cannot be added until DOM ready because the support test
7220
- // for it is not run until after DOM ready
7221
- jQuery(function() {
7222
- if ( !jQuery.support.reliableMarginRight ) {
7223
- jQuery.cssHooks.marginRight = {
7224
- get: function( elem, computed ) {
7225
- if ( computed ) {
7226
- // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
7227
- // Work around by temporarily setting element display to inline-block
7228
- return jQuery.swap( elem, { "display": "inline-block" },
7229
- curCSS, [ elem, "marginRight" ] );
7230
- }
7231
- }
7232
- };
7233
- }
7234
-
7235
- // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
7236
- // getComputedStyle returns percent when specified for top/left/bottom/right
7237
- // rather than make the css module depend on the offset module, we just check for it here
7238
- if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
7239
- jQuery.each( [ "top", "left" ], function( i, prop ) {
7240
- jQuery.cssHooks[ prop ] = {
7241
- get: function( elem, computed ) {
7242
- if ( computed ) {
7243
- computed = curCSS( elem, prop );
7244
- // if curCSS returns percentage, fallback to offset
7245
- return rnumnonpx.test( computed ) ?
7246
- jQuery( elem ).position()[ prop ] + "px" :
7247
- computed;
7248
- }
7249
- }
7250
- };
7251
- });
7252
- }
7253
-
7254
- });
7255
-
7256
- if ( jQuery.expr && jQuery.expr.filters ) {
7257
- jQuery.expr.filters.hidden = function( elem ) {
7258
- // Support: Opera <= 12.12
7259
- // Opera reports offsetWidths and offsetHeights less than zero on some elements
7260
- return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 ||
7261
- (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
7262
- };
7263
-
7264
- jQuery.expr.filters.visible = function( elem ) {
7265
- return !jQuery.expr.filters.hidden( elem );
7266
- };
7267
- }
7268
-
7269
- // These hooks are used by animate to expand properties
7270
- jQuery.each({
7271
- margin: "",
7272
- padding: "",
7273
- border: "Width"
7274
- }, function( prefix, suffix ) {
7275
- jQuery.cssHooks[ prefix + suffix ] = {
7276
- expand: function( value ) {
7277
- var i = 0,
7278
- expanded = {},
7279
-
7280
- // assumes a single number if not a string
7281
- parts = typeof value === "string" ? value.split(" ") : [ value ];
7282
-
7283
- for ( ; i < 4; i++ ) {
7284
- expanded[ prefix + cssExpand[ i ] + suffix ] =
7285
- parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
7286
- }
7287
-
7288
- return expanded;
7289
- }
7290
- };
7291
-
7292
- if ( !rmargin.test( prefix ) ) {
7293
- jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
7294
- }
7295
- });
7296
- var r20 = /%20/g,
7297
- rbracket = /\[\]$/,
7298
- rCRLF = /\r?\n/g,
7299
- rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
7300
- rsubmittable = /^(?:input|select|textarea|keygen)/i;
7301
-
7302
- jQuery.fn.extend({
7303
- serialize: function() {
7304
- return jQuery.param( this.serializeArray() );
7305
- },
7306
- serializeArray: function() {
7307
- return this.map(function(){
7308
- // Can add propHook for "elements" to filter or add form elements
7309
- var elements = jQuery.prop( this, "elements" );
7310
- return elements ? jQuery.makeArray( elements ) : this;
7311
- })
7312
- .filter(function(){
7313
- var type = this.type;
7314
- // Use .is(":disabled") so that fieldset[disabled] works
7315
- return this.name && !jQuery( this ).is( ":disabled" ) &&
7316
- rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
7317
- ( this.checked || !manipulation_rcheckableType.test( type ) );
7318
- })
7319
- .map(function( i, elem ){
7320
- var val = jQuery( this ).val();
7321
-
7322
- return val == null ?
7323
- null :
7324
- jQuery.isArray( val ) ?
7325
- jQuery.map( val, function( val ){
7326
- return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
7327
- }) :
7328
- { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
7329
- }).get();
7330
- }
7331
- });
7332
-
7333
- //Serialize an array of form elements or a set of
7334
- //key/values into a query string
7335
- jQuery.param = function( a, traditional ) {
7336
- var prefix,
7337
- s = [],
7338
- add = function( key, value ) {
7339
- // If value is a function, invoke it and return its value
7340
- value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
7341
- s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
7342
- };
7343
-
7344
- // Set traditional to true for jQuery <= 1.3.2 behavior.
7345
- if ( traditional === undefined ) {
7346
- traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
7347
- }
7348
-
7349
- // If an array was passed in, assume that it is an array of form elements.
7350
- if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
7351
- // Serialize the form elements
7352
- jQuery.each( a, function() {
7353
- add( this.name, this.value );
7354
- });
7355
-
7356
- } else {
7357
- // If traditional, encode the "old" way (the way 1.3.2 or older
7358
- // did it), otherwise encode params recursively.
7359
- for ( prefix in a ) {
7360
- buildParams( prefix, a[ prefix ], traditional, add );
7361
- }
7362
- }
7363
-
7364
- // Return the resulting serialization
7365
- return s.join( "&" ).replace( r20, "+" );
7366
- };
7367
-
7368
- function buildParams( prefix, obj, traditional, add ) {
7369
- var name;
7370
-
7371
- if ( jQuery.isArray( obj ) ) {
7372
- // Serialize array item.
7373
- jQuery.each( obj, function( i, v ) {
7374
- if ( traditional || rbracket.test( prefix ) ) {
7375
- // Treat each array item as a scalar.
7376
- add( prefix, v );
7377
-
7378
- } else {
7379
- // Item is non-scalar (array or object), encode its numeric index.
7380
- buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
7381
- }
7382
- });
7383
-
7384
- } else if ( !traditional && jQuery.type( obj ) === "object" ) {
7385
- // Serialize object item.
7386
- for ( name in obj ) {
7387
- buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
7388
- }
7389
-
7390
- } else {
7391
- // Serialize scalar item.
7392
- add( prefix, obj );
7393
- }
7394
- }
7395
- jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
7396
- "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
7397
- "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
7398
-
7399
- // Handle event binding
7400
- jQuery.fn[ name ] = function( data, fn ) {
7401
- return arguments.length > 0 ?
7402
- this.on( name, null, data, fn ) :
7403
- this.trigger( name );
7404
- };
7405
- });
7406
-
7407
- jQuery.fn.hover = function( fnOver, fnOut ) {
7408
- return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
7409
- };
7410
- var
7411
- // Document location
7412
- ajaxLocParts,
7413
- ajaxLocation,
7414
- ajax_nonce = jQuery.now(),
7415
-
7416
- ajax_rquery = /\?/,
7417
- rhash = /#.*$/,
7418
- rts = /([?&])_=[^&]*/,
7419
- rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
7420
- // #7653, #8125, #8152: local protocol detection
7421
- rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
7422
- rnoContent = /^(?:GET|HEAD)$/,
7423
- rprotocol = /^\/\//,
7424
- rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
7425
-
7426
- // Keep a copy of the old load method
7427
- _load = jQuery.fn.load,
7428
-
7429
- /* Prefilters
7430
- * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
7431
- * 2) These are called:
7432
- * - BEFORE asking for a transport
7433
- * - AFTER param serialization (s.data is a string if s.processData is true)
7434
- * 3) key is the dataType
7435
- * 4) the catchall symbol "*" can be used
7436
- * 5) execution will start with transport dataType and THEN continue down to "*" if needed
7437
- */
7438
- prefilters = {},
7439
-
7440
- /* Transports bindings
7441
- * 1) key is the dataType
7442
- * 2) the catchall symbol "*" can be used
7443
- * 3) selection will start with transport dataType and THEN go to "*" if needed
7444
- */
7445
- transports = {},
7446
-
7447
- // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
7448
- allTypes = "*/".concat("*");
7449
-
7450
- // #8138, IE may throw an exception when accessing
7451
- // a field from window.location if document.domain has been set
7452
- try {
7453
- ajaxLocation = location.href;
7454
- } catch( e ) {
7455
- // Use the href attribute of an A element
7456
- // since IE will modify it given document.location
7457
- ajaxLocation = document.createElement( "a" );
7458
- ajaxLocation.href = "";
7459
- ajaxLocation = ajaxLocation.href;
7460
- }
7461
-
7462
- // Segment location into parts
7463
- ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
7464
-
7465
- // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
7466
- function addToPrefiltersOrTransports( structure ) {
7467
-
7468
- // dataTypeExpression is optional and defaults to "*"
7469
- return function( dataTypeExpression, func ) {
7470
-
7471
- if ( typeof dataTypeExpression !== "string" ) {
7472
- func = dataTypeExpression;
7473
- dataTypeExpression = "*";
7474
- }
7475
-
7476
- var dataType,
7477
- i = 0,
7478
- dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
7479
-
7480
- if ( jQuery.isFunction( func ) ) {
7481
- // For each dataType in the dataTypeExpression
7482
- while ( (dataType = dataTypes[i++]) ) {
7483
- // Prepend if requested
7484
- if ( dataType[0] === "+" ) {
7485
- dataType = dataType.slice( 1 ) || "*";
7486
- (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
7487
-
7488
- // Otherwise append
7489
- } else {
7490
- (structure[ dataType ] = structure[ dataType ] || []).push( func );
7491
- }
7492
- }
7493
- }
7494
- };
7495
- }
7496
-
7497
- // Base inspection function for prefilters and transports
7498
- function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
7499
-
7500
- var inspected = {},
7501
- seekingTransport = ( structure === transports );
7502
-
7503
- function inspect( dataType ) {
7504
- var selected;
7505
- inspected[ dataType ] = true;
7506
- jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
7507
- var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
7508
- if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
7509
- options.dataTypes.unshift( dataTypeOrTransport );
7510
- inspect( dataTypeOrTransport );
7511
- return false;
7512
- } else if ( seekingTransport ) {
7513
- return !( selected = dataTypeOrTransport );
7514
- }
7515
- });
7516
- return selected;
7517
- }
7518
-
7519
- return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
7520
- }
7521
-
7522
- // A special extend for ajax options
7523
- // that takes "flat" options (not to be deep extended)
7524
- // Fixes #9887
7525
- function ajaxExtend( target, src ) {
7526
- var deep, key,
7527
- flatOptions = jQuery.ajaxSettings.flatOptions || {};
7528
-
7529
- for ( key in src ) {
7530
- if ( src[ key ] !== undefined ) {
7531
- ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
7532
- }
7533
- }
7534
- if ( deep ) {
7535
- jQuery.extend( true, target, deep );
7536
- }
7537
-
7538
- return target;
7539
- }
7540
-
7541
- jQuery.fn.load = function( url, params, callback ) {
7542
- if ( typeof url !== "string" && _load ) {
7543
- return _load.apply( this, arguments );
7544
- }
7545
-
7546
- var selector, response, type,
7547
- self = this,
7548
- off = url.indexOf(" ");
7549
-
7550
- if ( off >= 0 ) {
7551
- selector = url.slice( off, url.length );
7552
- url = url.slice( 0, off );
7553
- }
7554
-
7555
- // If it's a function
7556
- if ( jQuery.isFunction( params ) ) {
7557
-
7558
- // We assume that it's the callback
7559
- callback = params;
7560
- params = undefined;
7561
-
7562
- // Otherwise, build a param string
7563
- } else if ( params && typeof params === "object" ) {
7564
- type = "POST";
7565
- }
7566
-
7567
- // If we have elements to modify, make the request
7568
- if ( self.length > 0 ) {
7569
- jQuery.ajax({
7570
- url: url,
7571
-
7572
- // if "type" variable is undefined, then "GET" method will be used
7573
- type: type,
7574
- dataType: "html",
7575
- data: params
7576
- }).done(function( responseText ) {
7577
-
7578
- // Save response for use in complete callback
7579
- response = arguments;
7580
-
7581
- self.html( selector ?
7582
-
7583
- // If a selector was specified, locate the right elements in a dummy div
7584
- // Exclude scripts to avoid IE 'Permission Denied' errors
7585
- jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
7586
-
7587
- // Otherwise use the full result
7588
- responseText );
7589
-
7590
- }).complete( callback && function( jqXHR, status ) {
7591
- self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
7592
- });
7593
- }
7594
-
7595
- return this;
7596
- };
7597
-
7598
- // Attach a bunch of functions for handling common AJAX events
7599
- jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
7600
- jQuery.fn[ type ] = function( fn ){
7601
- return this.on( type, fn );
7602
- };
7603
- });
7604
-
7605
- jQuery.each( [ "get", "post" ], function( i, method ) {
7606
- jQuery[ method ] = function( url, data, callback, type ) {
7607
- // shift arguments if data argument was omitted
7608
- if ( jQuery.isFunction( data ) ) {
7609
- type = type || callback;
7610
- callback = data;
7611
- data = undefined;
7612
- }
7613
-
7614
- return jQuery.ajax({
7615
- url: url,
7616
- type: method,
7617
- dataType: type,
7618
- data: data,
7619
- success: callback
7620
- });
7621
- };
7622
- });
7623
-
7624
- jQuery.extend({
7625
-
7626
- // Counter for holding the number of active queries
7627
- active: 0,
7628
-
7629
- // Last-Modified header cache for next request
7630
- lastModified: {},
7631
- etag: {},
7632
-
7633
- ajaxSettings: {
7634
- url: ajaxLocation,
7635
- type: "GET",
7636
- isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
7637
- global: true,
7638
- processData: true,
7639
- async: true,
7640
- contentType: "application/x-www-form-urlencoded; charset=UTF-8",
7641
- /*
7642
- timeout: 0,
7643
- data: null,
7644
- dataType: null,
7645
- username: null,
7646
- password: null,
7647
- cache: null,
7648
- throws: false,
7649
- traditional: false,
7650
- headers: {},
7651
- */
7652
-
7653
- accepts: {
7654
- "*": allTypes,
7655
- text: "text/plain",
7656
- html: "text/html",
7657
- xml: "application/xml, text/xml",
7658
- json: "application/json, text/javascript"
7659
- },
7660
-
7661
- contents: {
7662
- xml: /xml/,
7663
- html: /html/,
7664
- json: /json/
7665
- },
7666
-
7667
- responseFields: {
7668
- xml: "responseXML",
7669
- text: "responseText"
7670
- },
7671
-
7672
- // Data converters
7673
- // Keys separate source (or catchall "*") and destination types with a single space
7674
- converters: {
7675
-
7676
- // Convert anything to text
7677
- "* text": window.String,
7678
-
7679
- // Text to html (true = no transformation)
7680
- "text html": true,
7681
-
7682
- // Evaluate text as a json expression
7683
- "text json": jQuery.parseJSON,
7684
-
7685
- // Parse text as xml
7686
- "text xml": jQuery.parseXML
7687
- },
7688
-
7689
- // For options that shouldn't be deep extended:
7690
- // you can add your own custom options here if
7691
- // and when you create one that shouldn't be
7692
- // deep extended (see ajaxExtend)
7693
- flatOptions: {
7694
- url: true,
7695
- context: true
7696
- }
7697
- },
7698
-
7699
- // Creates a full fledged settings object into target
7700
- // with both ajaxSettings and settings fields.
7701
- // If target is omitted, writes into ajaxSettings.
7702
- ajaxSetup: function( target, settings ) {
7703
- return settings ?
7704
-
7705
- // Building a settings object
7706
- ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
7707
-
7708
- // Extending ajaxSettings
7709
- ajaxExtend( jQuery.ajaxSettings, target );
7710
- },
7711
-
7712
- ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
7713
- ajaxTransport: addToPrefiltersOrTransports( transports ),
7714
-
7715
- // Main method
7716
- ajax: function( url, options ) {
7717
-
7718
- // If url is an object, simulate pre-1.5 signature
7719
- if ( typeof url === "object" ) {
7720
- options = url;
7721
- url = undefined;
7722
- }
7723
-
7724
- // Force options to be an object
7725
- options = options || {};
7726
-
7727
- var // Cross-domain detection vars
7728
- parts,
7729
- // Loop variable
7730
- i,
7731
- // URL without anti-cache param
7732
- cacheURL,
7733
- // Response headers as string
7734
- responseHeadersString,
7735
- // timeout handle
7736
- timeoutTimer,
7737
-
7738
- // To know if global events are to be dispatched
7739
- fireGlobals,
7740
-
7741
- transport,
7742
- // Response headers
7743
- responseHeaders,
7744
- // Create the final options object
7745
- s = jQuery.ajaxSetup( {}, options ),
7746
- // Callbacks context
7747
- callbackContext = s.context || s,
7748
- // Context for global events is callbackContext if it is a DOM node or jQuery collection
7749
- globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
7750
- jQuery( callbackContext ) :
7751
- jQuery.event,
7752
- // Deferreds
7753
- deferred = jQuery.Deferred(),
7754
- completeDeferred = jQuery.Callbacks("once memory"),
7755
- // Status-dependent callbacks
7756
- statusCode = s.statusCode || {},
7757
- // Headers (they are sent all at once)
7758
- requestHeaders = {},
7759
- requestHeadersNames = {},
7760
- // The jqXHR state
7761
- state = 0,
7762
- // Default abort message
7763
- strAbort = "canceled",
7764
- // Fake xhr
7765
- jqXHR = {
7766
- readyState: 0,
7767
-
7768
- // Builds headers hashtable if needed
7769
- getResponseHeader: function( key ) {
7770
- var match;
7771
- if ( state === 2 ) {
7772
- if ( !responseHeaders ) {
7773
- responseHeaders = {};
7774
- while ( (match = rheaders.exec( responseHeadersString )) ) {
7775
- responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
7776
- }
7777
- }
7778
- match = responseHeaders[ key.toLowerCase() ];
7779
- }
7780
- return match == null ? null : match;
7781
- },
7782
-
7783
- // Raw string
7784
- getAllResponseHeaders: function() {
7785
- return state === 2 ? responseHeadersString : null;
7786
- },
7787
-
7788
- // Caches the header
7789
- setRequestHeader: function( name, value ) {
7790
- var lname = name.toLowerCase();
7791
- if ( !state ) {
7792
- name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
7793
- requestHeaders[ name ] = value;
7794
- }
7795
- return this;
7796
- },
7797
-
7798
- // Overrides response content-type header
7799
- overrideMimeType: function( type ) {
7800
- if ( !state ) {
7801
- s.mimeType = type;
7802
- }
7803
- return this;
7804
- },
7805
-
7806
- // Status-dependent callbacks
7807
- statusCode: function( map ) {
7808
- var code;
7809
- if ( map ) {
7810
- if ( state < 2 ) {
7811
- for ( code in map ) {
7812
- // Lazy-add the new callback in a way that preserves old ones
7813
- statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
7814
- }
7815
- } else {
7816
- // Execute the appropriate callbacks
7817
- jqXHR.always( map[ jqXHR.status ] );
7818
- }
7819
- }
7820
- return this;
7821
- },
7822
-
7823
- // Cancel the request
7824
- abort: function( statusText ) {
7825
- var finalText = statusText || strAbort;
7826
- if ( transport ) {
7827
- transport.abort( finalText );
7828
- }
7829
- done( 0, finalText );
7830
- return this;
7831
- }
7832
- };
7833
-
7834
- // Attach deferreds
7835
- deferred.promise( jqXHR ).complete = completeDeferred.add;
7836
- jqXHR.success = jqXHR.done;
7837
- jqXHR.error = jqXHR.fail;
7838
-
7839
- // Remove hash character (#7531: and string promotion)
7840
- // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
7841
- // Handle falsy url in the settings object (#10093: consistency with old signature)
7842
- // We also use the url parameter if available
7843
- s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
7844
-
7845
- // Alias method option to type as per ticket #12004
7846
- s.type = options.method || options.type || s.method || s.type;
7847
-
7848
- // Extract dataTypes list
7849
- s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
7850
-
7851
- // A cross-domain request is in order when we have a protocol:host:port mismatch
7852
- if ( s.crossDomain == null ) {
7853
- parts = rurl.exec( s.url.toLowerCase() );
7854
- s.crossDomain = !!( parts &&
7855
- ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
7856
- ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
7857
- ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
7858
- );
7859
- }
7860
-
7861
- // Convert data if not already a string
7862
- if ( s.data && s.processData && typeof s.data !== "string" ) {
7863
- s.data = jQuery.param( s.data, s.traditional );
7864
- }
7865
-
7866
- // Apply prefilters
7867
- inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
7868
-
7869
- // If request was aborted inside a prefilter, stop there
7870
- if ( state === 2 ) {
7871
- return jqXHR;
7872
- }
7873
-
7874
- // We can fire global events as of now if asked to
7875
- fireGlobals = s.global;
7876
-
7877
- // Watch for a new set of requests
7878
- if ( fireGlobals && jQuery.active++ === 0 ) {
7879
- jQuery.event.trigger("ajaxStart");
7880
- }
7881
-
7882
- // Uppercase the type
7883
- s.type = s.type.toUpperCase();
7884
-
7885
- // Determine if request has content
7886
- s.hasContent = !rnoContent.test( s.type );
7887
-
7888
- // Save the URL in case we're toying with the If-Modified-Since
7889
- // and/or If-None-Match header later on
7890
- cacheURL = s.url;
7891
-
7892
- // More options handling for requests with no content
7893
- if ( !s.hasContent ) {
7894
-
7895
- // If data is available, append data to url
7896
- if ( s.data ) {
7897
- cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
7898
- // #9682: remove data so that it's not used in an eventual retry
7899
- delete s.data;
7900
- }
7901
-
7902
- // Add anti-cache in url if needed
7903
- if ( s.cache === false ) {
7904
- s.url = rts.test( cacheURL ) ?
7905
-
7906
- // If there is already a '_' parameter, set its value
7907
- cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) :
7908
-
7909
- // Otherwise add one to the end
7910
- cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++;
7911
- }
7912
- }
7913
-
7914
- // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
7915
- if ( s.ifModified ) {
7916
- if ( jQuery.lastModified[ cacheURL ] ) {
7917
- jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
7918
- }
7919
- if ( jQuery.etag[ cacheURL ] ) {
7920
- jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
7921
- }
7922
- }
7923
-
7924
- // Set the correct header, if data is being sent
7925
- if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
7926
- jqXHR.setRequestHeader( "Content-Type", s.contentType );
7927
- }
7928
-
7929
- // Set the Accepts header for the server, depending on the dataType
7930
- jqXHR.setRequestHeader(
7931
- "Accept",
7932
- s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
7933
- s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
7934
- s.accepts[ "*" ]
7935
- );
7936
-
7937
- // Check for headers option
7938
- for ( i in s.headers ) {
7939
- jqXHR.setRequestHeader( i, s.headers[ i ] );
7940
- }
7941
-
7942
- // Allow custom headers/mimetypes and early abort
7943
- if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
7944
- // Abort if not done already and return
7945
- return jqXHR.abort();
7946
- }
7947
-
7948
- // aborting is no longer a cancellation
7949
- strAbort = "abort";
7950
-
7951
- // Install callbacks on deferreds
7952
- for ( i in { success: 1, error: 1, complete: 1 } ) {
7953
- jqXHR[ i ]( s[ i ] );
7954
- }
7955
-
7956
- // Get transport
7957
- transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
7958
-
7959
- // If no transport, we auto-abort
7960
- if ( !transport ) {
7961
- done( -1, "No Transport" );
7962
- } else {
7963
- jqXHR.readyState = 1;
7964
-
7965
- // Send global event
7966
- if ( fireGlobals ) {
7967
- globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
7968
- }
7969
- // Timeout
7970
- if ( s.async && s.timeout > 0 ) {
7971
- timeoutTimer = setTimeout(function() {
7972
- jqXHR.abort("timeout");
7973
- }, s.timeout );
7974
- }
7975
-
7976
- try {
7977
- state = 1;
7978
- transport.send( requestHeaders, done );
7979
- } catch ( e ) {
7980
- // Propagate exception as error if not done
7981
- if ( state < 2 ) {
7982
- done( -1, e );
7983
- // Simply rethrow otherwise
7984
- } else {
7985
- throw e;
7986
- }
7987
- }
7988
- }
7989
-
7990
- // Callback for when everything is done
7991
- function done( status, nativeStatusText, responses, headers ) {
7992
- var isSuccess, success, error, response, modified,
7993
- statusText = nativeStatusText;
7994
-
7995
- // Called once
7996
- if ( state === 2 ) {
7997
- return;
7998
- }
7999
-
8000
- // State is "done" now
8001
- state = 2;
8002
-
8003
- // Clear timeout if it exists
8004
- if ( timeoutTimer ) {
8005
- clearTimeout( timeoutTimer );
8006
- }
8007
-
8008
- // Dereference transport for early garbage collection
8009
- // (no matter how long the jqXHR object will be used)
8010
- transport = undefined;
8011
-
8012
- // Cache response headers
8013
- responseHeadersString = headers || "";
8014
-
8015
- // Set readyState
8016
- jqXHR.readyState = status > 0 ? 4 : 0;
8017
-
8018
- // Get response data
8019
- if ( responses ) {
8020
- response = ajaxHandleResponses( s, jqXHR, responses );
8021
- }
8022
-
8023
- // If successful, handle type chaining
8024
- if ( status >= 200 && status < 300 || status === 304 ) {
8025
-
8026
- // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
8027
- if ( s.ifModified ) {
8028
- modified = jqXHR.getResponseHeader("Last-Modified");
8029
- if ( modified ) {
8030
- jQuery.lastModified[ cacheURL ] = modified;
8031
- }
8032
- modified = jqXHR.getResponseHeader("etag");
8033
- if ( modified ) {
8034
- jQuery.etag[ cacheURL ] = modified;
8035
- }
8036
- }
8037
-
8038
- // if no content
8039
- if ( status === 204 ) {
8040
- isSuccess = true;
8041
- statusText = "nocontent";
8042
-
8043
- // if not modified
8044
- } else if ( status === 304 ) {
8045
- isSuccess = true;
8046
- statusText = "notmodified";
8047
-
8048
- // If we have data, let's convert it
8049
- } else {
8050
- isSuccess = ajaxConvert( s, response );
8051
- statusText = isSuccess.state;
8052
- success = isSuccess.data;
8053
- error = isSuccess.error;
8054
- isSuccess = !error;
8055
- }
8056
- } else {
8057
- // We extract error from statusText
8058
- // then normalize statusText and status for non-aborts
8059
- error = statusText;
8060
- if ( status || !statusText ) {
8061
- statusText = "error";
8062
- if ( status < 0 ) {
8063
- status = 0;
8064
- }
8065
- }
8066
- }
8067
-
8068
- // Set data for the fake xhr object
8069
- jqXHR.status = status;
8070
- jqXHR.statusText = ( nativeStatusText || statusText ) + "";
8071
-
8072
- // Success/Error
8073
- if ( isSuccess ) {
8074
- deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
8075
- } else {
8076
- deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
8077
- }
8078
-
8079
- // Status-dependent callbacks
8080
- jqXHR.statusCode( statusCode );
8081
- statusCode = undefined;
8082
-
8083
- if ( fireGlobals ) {
8084
- globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
8085
- [ jqXHR, s, isSuccess ? success : error ] );
8086
- }
8087
-
8088
- // Complete
8089
- completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
8090
-
8091
- if ( fireGlobals ) {
8092
- globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
8093
- // Handle the global AJAX counter
8094
- if ( !( --jQuery.active ) ) {
8095
- jQuery.event.trigger("ajaxStop");
8096
- }
8097
- }
8098
- }
8099
-
8100
- return jqXHR;
8101
- },
8102
-
8103
- getScript: function( url, callback ) {
8104
- return jQuery.get( url, undefined, callback, "script" );
8105
- },
8106
-
8107
- getJSON: function( url, data, callback ) {
8108
- return jQuery.get( url, data, callback, "json" );
8109
- }
8110
- });
8111
-
8112
- /* Handles responses to an ajax request:
8113
- * - sets all responseXXX fields accordingly
8114
- * - finds the right dataType (mediates between content-type and expected dataType)
8115
- * - returns the corresponding response
8116
- */
8117
- function ajaxHandleResponses( s, jqXHR, responses ) {
8118
- var firstDataType, ct, finalDataType, type,
8119
- contents = s.contents,
8120
- dataTypes = s.dataTypes,
8121
- responseFields = s.responseFields;
8122
-
8123
- // Fill responseXXX fields
8124
- for ( type in responseFields ) {
8125
- if ( type in responses ) {
8126
- jqXHR[ responseFields[type] ] = responses[ type ];
8127
- }
8128
- }
8129
-
8130
- // Remove auto dataType and get content-type in the process
8131
- while( dataTypes[ 0 ] === "*" ) {
8132
- dataTypes.shift();
8133
- if ( ct === undefined ) {
8134
- ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
8135
- }
8136
- }
8137
-
8138
- // Check if we're dealing with a known content-type
8139
- if ( ct ) {
8140
- for ( type in contents ) {
8141
- if ( contents[ type ] && contents[ type ].test( ct ) ) {
8142
- dataTypes.unshift( type );
8143
- break;
8144
- }
8145
- }
8146
- }
8147
-
8148
- // Check to see if we have a response for the expected dataType
8149
- if ( dataTypes[ 0 ] in responses ) {
8150
- finalDataType = dataTypes[ 0 ];
8151
- } else {
8152
- // Try convertible dataTypes
8153
- for ( type in responses ) {
8154
- if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
8155
- finalDataType = type;
8156
- break;
8157
- }
8158
- if ( !firstDataType ) {
8159
- firstDataType = type;
8160
- }
8161
- }
8162
- // Or just use first one
8163
- finalDataType = finalDataType || firstDataType;
8164
- }
8165
-
8166
- // If we found a dataType
8167
- // We add the dataType to the list if needed
8168
- // and return the corresponding response
8169
- if ( finalDataType ) {
8170
- if ( finalDataType !== dataTypes[ 0 ] ) {
8171
- dataTypes.unshift( finalDataType );
8172
- }
8173
- return responses[ finalDataType ];
8174
- }
8175
- }
8176
-
8177
- // Chain conversions given the request and the original response
8178
- function ajaxConvert( s, response ) {
8179
- var conv2, current, conv, tmp,
8180
- converters = {},
8181
- i = 0,
8182
- // Work with a copy of dataTypes in case we need to modify it for conversion
8183
- dataTypes = s.dataTypes.slice(),
8184
- prev = dataTypes[ 0 ];
8185
-
8186
- // Apply the dataFilter if provided
8187
- if ( s.dataFilter ) {
8188
- response = s.dataFilter( response, s.dataType );
8189
- }
8190
-
8191
- // Create converters map with lowercased keys
8192
- if ( dataTypes[ 1 ] ) {
8193
- for ( conv in s.converters ) {
8194
- converters[ conv.toLowerCase() ] = s.converters[ conv ];
8195
- }
8196
- }
8197
-
8198
- // Convert to each sequential dataType, tolerating list modification
8199
- for ( ; (current = dataTypes[++i]); ) {
8200
-
8201
- // There's only work to do if current dataType is non-auto
8202
- if ( current !== "*" ) {
8203
-
8204
- // Convert response if prev dataType is non-auto and differs from current
8205
- if ( prev !== "*" && prev !== current ) {
8206
-
8207
- // Seek a direct converter
8208
- conv = converters[ prev + " " + current ] || converters[ "* " + current ];
8209
-
8210
- // If none found, seek a pair
8211
- if ( !conv ) {
8212
- for ( conv2 in converters ) {
8213
-
8214
- // If conv2 outputs current
8215
- tmp = conv2.split(" ");
8216
- if ( tmp[ 1 ] === current ) {
8217
-
8218
- // If prev can be converted to accepted input
8219
- conv = converters[ prev + " " + tmp[ 0 ] ] ||
8220
- converters[ "* " + tmp[ 0 ] ];
8221
- if ( conv ) {
8222
- // Condense equivalence converters
8223
- if ( conv === true ) {
8224
- conv = converters[ conv2 ];
8225
-
8226
- // Otherwise, insert the intermediate dataType
8227
- } else if ( converters[ conv2 ] !== true ) {
8228
- current = tmp[ 0 ];
8229
- dataTypes.splice( i--, 0, current );
8230
- }
8231
-
8232
- break;
8233
- }
8234
- }
8235
- }
8236
- }
8237
-
8238
- // Apply converter (if not an equivalence)
8239
- if ( conv !== true ) {
8240
-
8241
- // Unless errors are allowed to bubble, catch and return them
8242
- if ( conv && s["throws"] ) {
8243
- response = conv( response );
8244
- } else {
8245
- try {
8246
- response = conv( response );
8247
- } catch ( e ) {
8248
- return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
8249
- }
8250
- }
8251
- }
8252
- }
8253
-
8254
- // Update prev for next iteration
8255
- prev = current;
8256
- }
8257
- }
8258
-
8259
- return { state: "success", data: response };
8260
- }
8261
- // Install script dataType
8262
- jQuery.ajaxSetup({
8263
- accepts: {
8264
- script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
8265
- },
8266
- contents: {
8267
- script: /(?:java|ecma)script/
8268
- },
8269
- converters: {
8270
- "text script": function( text ) {
8271
- jQuery.globalEval( text );
8272
- return text;
8273
- }
8274
- }
8275
- });
8276
-
8277
- // Handle cache's special case and global
8278
- jQuery.ajaxPrefilter( "script", function( s ) {
8279
- if ( s.cache === undefined ) {
8280
- s.cache = false;
8281
- }
8282
- if ( s.crossDomain ) {
8283
- s.type = "GET";
8284
- s.global = false;
8285
- }
8286
- });
8287
-
8288
- // Bind script tag hack transport
8289
- jQuery.ajaxTransport( "script", function(s) {
8290
-
8291
- // This transport only deals with cross domain requests
8292
- if ( s.crossDomain ) {
8293
-
8294
- var script,
8295
- head = document.head || jQuery("head")[0] || document.documentElement;
8296
-
8297
- return {
8298
-
8299
- send: function( _, callback ) {
8300
-
8301
- script = document.createElement("script");
8302
-
8303
- script.async = true;
8304
-
8305
- if ( s.scriptCharset ) {
8306
- script.charset = s.scriptCharset;
8307
- }
8308
-
8309
- script.src = s.url;
8310
-
8311
- // Attach handlers for all browsers
8312
- script.onload = script.onreadystatechange = function( _, isAbort ) {
8313
-
8314
- if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
8315
-
8316
- // Handle memory leak in IE
8317
- script.onload = script.onreadystatechange = null;
8318
-
8319
- // Remove the script
8320
- if ( script.parentNode ) {
8321
- script.parentNode.removeChild( script );
8322
- }
8323
-
8324
- // Dereference the script
8325
- script = null;
8326
-
8327
- // Callback if not abort
8328
- if ( !isAbort ) {
8329
- callback( 200, "success" );
8330
- }
8331
- }
8332
- };
8333
-
8334
- // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
8335
- // Use native DOM manipulation to avoid our domManip AJAX trickery
8336
- head.insertBefore( script, head.firstChild );
8337
- },
8338
-
8339
- abort: function() {
8340
- if ( script ) {
8341
- script.onload( undefined, true );
8342
- }
8343
- }
8344
- };
8345
- }
8346
- });
8347
- var oldCallbacks = [],
8348
- rjsonp = /(=)\?(?=&|$)|\?\?/;
8349
-
8350
- // Default jsonp settings
8351
- jQuery.ajaxSetup({
8352
- jsonp: "callback",
8353
- jsonpCallback: function() {
8354
- var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );
8355
- this[ callback ] = true;
8356
- return callback;
8357
- }
8358
- });
8359
-
8360
- // Detect, normalize options and install callbacks for jsonp requests
8361
- jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
8362
-
8363
- var callbackName, overwritten, responseContainer,
8364
- jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
8365
- "url" :
8366
- typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
8367
- );
8368
-
8369
- // Handle iff the expected data type is "jsonp" or we have a parameter to set
8370
- if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
8371
-
8372
- // Get callback name, remembering preexisting value associated with it
8373
- callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
8374
- s.jsonpCallback() :
8375
- s.jsonpCallback;
8376
-
8377
- // Insert callback into url or form data
8378
- if ( jsonProp ) {
8379
- s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
8380
- } else if ( s.jsonp !== false ) {
8381
- s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
8382
- }
8383
-
8384
- // Use data converter to retrieve json after script execution
8385
- s.converters["script json"] = function() {
8386
- if ( !responseContainer ) {
8387
- jQuery.error( callbackName + " was not called" );
8388
- }
8389
- return responseContainer[ 0 ];
8390
- };
8391
-
8392
- // force json dataType
8393
- s.dataTypes[ 0 ] = "json";
8394
-
8395
- // Install callback
8396
- overwritten = window[ callbackName ];
8397
- window[ callbackName ] = function() {
8398
- responseContainer = arguments;
8399
- };
8400
-
8401
- // Clean-up function (fires after converters)
8402
- jqXHR.always(function() {
8403
- // Restore preexisting value
8404
- window[ callbackName ] = overwritten;
8405
-
8406
- // Save back as free
8407
- if ( s[ callbackName ] ) {
8408
- // make sure that re-using the options doesn't screw things around
8409
- s.jsonpCallback = originalSettings.jsonpCallback;
8410
-
8411
- // save the callback name for future use
8412
- oldCallbacks.push( callbackName );
8413
- }
8414
-
8415
- // Call if it was a function and we have a response
8416
- if ( responseContainer && jQuery.isFunction( overwritten ) ) {
8417
- overwritten( responseContainer[ 0 ] );
8418
- }
8419
-
8420
- responseContainer = overwritten = undefined;
8421
- });
8422
-
8423
- // Delegate to script
8424
- return "script";
8425
- }
8426
- });
8427
- var xhrCallbacks, xhrSupported,
8428
- xhrId = 0,
8429
- // #5280: Internet Explorer will keep connections alive if we don't abort on unload
8430
- xhrOnUnloadAbort = window.ActiveXObject && function() {
8431
- // Abort all pending requests
8432
- var key;
8433
- for ( key in xhrCallbacks ) {
8434
- xhrCallbacks[ key ]( undefined, true );
8435
- }
8436
- };
8437
-
8438
- // Functions to create xhrs
8439
- function createStandardXHR() {
8440
- try {
8441
- return new window.XMLHttpRequest();
8442
- } catch( e ) {}
8443
- }
8444
-
8445
- function createActiveXHR() {
8446
- try {
8447
- return new window.ActiveXObject("Microsoft.XMLHTTP");
8448
- } catch( e ) {}
8449
- }
8450
-
8451
- // Create the request object
8452
- // (This is still attached to ajaxSettings for backward compatibility)
8453
- jQuery.ajaxSettings.xhr = window.ActiveXObject ?
8454
- /* Microsoft failed to properly
8455
- * implement the XMLHttpRequest in IE7 (can't request local files),
8456
- * so we use the ActiveXObject when it is available
8457
- * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
8458
- * we need a fallback.
8459
- */
8460
- function() {
8461
- return !this.isLocal && createStandardXHR() || createActiveXHR();
8462
- } :
8463
- // For all other browsers, use the standard XMLHttpRequest object
8464
- createStandardXHR;
8465
-
8466
- // Determine support properties
8467
- xhrSupported = jQuery.ajaxSettings.xhr();
8468
- jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
8469
- xhrSupported = jQuery.support.ajax = !!xhrSupported;
8470
-
8471
- // Create transport if the browser can provide an xhr
8472
- if ( xhrSupported ) {
8473
-
8474
- jQuery.ajaxTransport(function( s ) {
8475
- // Cross domain only allowed if supported through XMLHttpRequest
8476
- if ( !s.crossDomain || jQuery.support.cors ) {
8477
-
8478
- var callback;
8479
-
8480
- return {
8481
- send: function( headers, complete ) {
8482
-
8483
- // Get a new xhr
8484
- var handle, i,
8485
- xhr = s.xhr();
8486
-
8487
- // Open the socket
8488
- // Passing null username, generates a login popup on Opera (#2865)
8489
- if ( s.username ) {
8490
- xhr.open( s.type, s.url, s.async, s.username, s.password );
8491
- } else {
8492
- xhr.open( s.type, s.url, s.async );
8493
- }
8494
-
8495
- // Apply custom fields if provided
8496
- if ( s.xhrFields ) {
8497
- for ( i in s.xhrFields ) {
8498
- xhr[ i ] = s.xhrFields[ i ];
8499
- }
8500
- }
8501
-
8502
- // Override mime type if needed
8503
- if ( s.mimeType && xhr.overrideMimeType ) {
8504
- xhr.overrideMimeType( s.mimeType );
8505
- }
8506
-
8507
- // X-Requested-With header
8508
- // For cross-domain requests, seeing as conditions for a preflight are
8509
- // akin to a jigsaw puzzle, we simply never set it to be sure.
8510
- // (it can always be set on a per-request basis or even using ajaxSetup)
8511
- // For same-domain requests, won't change header if already provided.
8512
- if ( !s.crossDomain && !headers["X-Requested-With"] ) {
8513
- headers["X-Requested-With"] = "XMLHttpRequest";
8514
- }
8515
-
8516
- // Need an extra try/catch for cross domain requests in Firefox 3
8517
- try {
8518
- for ( i in headers ) {
8519
- xhr.setRequestHeader( i, headers[ i ] );
8520
- }
8521
- } catch( err ) {}
8522
-
8523
- // Do send the request
8524
- // This may raise an exception which is actually
8525
- // handled in jQuery.ajax (so no try/catch here)
8526
- xhr.send( ( s.hasContent && s.data ) || null );
8527
-
8528
- // Listener
8529
- callback = function( _, isAbort ) {
8530
- var status, responseHeaders, statusText, responses;
8531
-
8532
- // Firefox throws exceptions when accessing properties
8533
- // of an xhr when a network error occurred
8534
- // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
8535
- try {
8536
-
8537
- // Was never called and is aborted or complete
8538
- if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
8539
-
8540
- // Only called once
8541
- callback = undefined;
8542
-
8543
- // Do not keep as active anymore
8544
- if ( handle ) {
8545
- xhr.onreadystatechange = jQuery.noop;
8546
- if ( xhrOnUnloadAbort ) {
8547
- delete xhrCallbacks[ handle ];
8548
- }
8549
- }
8550
-
8551
- // If it's an abort
8552
- if ( isAbort ) {
8553
- // Abort it manually if needed
8554
- if ( xhr.readyState !== 4 ) {
8555
- xhr.abort();
8556
- }
8557
- } else {
8558
- responses = {};
8559
- status = xhr.status;
8560
- responseHeaders = xhr.getAllResponseHeaders();
8561
-
8562
- // When requesting binary data, IE6-9 will throw an exception
8563
- // on any attempt to access responseText (#11426)
8564
- if ( typeof xhr.responseText === "string" ) {
8565
- responses.text = xhr.responseText;
8566
- }
8567
-
8568
- // Firefox throws an exception when accessing
8569
- // statusText for faulty cross-domain requests
8570
- try {
8571
- statusText = xhr.statusText;
8572
- } catch( e ) {
8573
- // We normalize with Webkit giving an empty statusText
8574
- statusText = "";
8575
- }
8576
-
8577
- // Filter status for non standard behaviors
8578
-
8579
- // If the request is local and we have data: assume a success
8580
- // (success with no data won't get notified, that's the best we
8581
- // can do given current implementations)
8582
- if ( !status && s.isLocal && !s.crossDomain ) {
8583
- status = responses.text ? 200 : 404;
8584
- // IE - #1450: sometimes returns 1223 when it should be 204
8585
- } else if ( status === 1223 ) {
8586
- status = 204;
8587
- }
8588
- }
8589
- }
8590
- } catch( firefoxAccessException ) {
8591
- if ( !isAbort ) {
8592
- complete( -1, firefoxAccessException );
8593
- }
8594
- }
8595
-
8596
- // Call complete if needed
8597
- if ( responses ) {
8598
- complete( status, statusText, responses, responseHeaders );
8599
- }
8600
- };
8601
-
8602
- if ( !s.async ) {
8603
- // if we're in sync mode we fire the callback
8604
- callback();
8605
- } else if ( xhr.readyState === 4 ) {
8606
- // (IE6 & IE7) if it's in cache and has been
8607
- // retrieved directly we need to fire the callback
8608
- setTimeout( callback );
8609
- } else {
8610
- handle = ++xhrId;
8611
- if ( xhrOnUnloadAbort ) {
8612
- // Create the active xhrs callbacks list if needed
8613
- // and attach the unload handler
8614
- if ( !xhrCallbacks ) {
8615
- xhrCallbacks = {};
8616
- jQuery( window ).unload( xhrOnUnloadAbort );
8617
- }
8618
- // Add to list of active xhrs callbacks
8619
- xhrCallbacks[ handle ] = callback;
8620
- }
8621
- xhr.onreadystatechange = callback;
8622
- }
8623
- },
8624
-
8625
- abort: function() {
8626
- if ( callback ) {
8627
- callback( undefined, true );
8628
- }
8629
- }
8630
- };
8631
- }
8632
- });
8633
- }
8634
- var fxNow, timerId,
8635
- rfxtypes = /^(?:toggle|show|hide)$/,
8636
- rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
8637
- rrun = /queueHooks$/,
8638
- animationPrefilters = [ defaultPrefilter ],
8639
- tweeners = {
8640
- "*": [function( prop, value ) {
8641
- var end, unit,
8642
- tween = this.createTween( prop, value ),
8643
- parts = rfxnum.exec( value ),
8644
- target = tween.cur(),
8645
- start = +target || 0,
8646
- scale = 1,
8647
- maxIterations = 20;
8648
-
8649
- if ( parts ) {
8650
- end = +parts[2];
8651
- unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" );
8652
-
8653
- // We need to compute starting value
8654
- if ( unit !== "px" && start ) {
8655
- // Iteratively approximate from a nonzero starting point
8656
- // Prefer the current property, because this process will be trivial if it uses the same units
8657
- // Fallback to end or a simple constant
8658
- start = jQuery.css( tween.elem, prop, true ) || end || 1;
8659
-
8660
- do {
8661
- // If previous iteration zeroed out, double until we get *something*
8662
- // Use a string for doubling factor so we don't accidentally see scale as unchanged below
8663
- scale = scale || ".5";
8664
-
8665
- // Adjust and apply
8666
- start = start / scale;
8667
- jQuery.style( tween.elem, prop, start + unit );
8668
-
8669
- // Update scale, tolerating zero or NaN from tween.cur()
8670
- // And breaking the loop if scale is unchanged or perfect, or if we've just had enough
8671
- } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
8672
- }
8673
-
8674
- tween.unit = unit;
8675
- tween.start = start;
8676
- // If a +=/-= token was provided, we're doing a relative animation
8677
- tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end;
8678
- }
8679
- return tween;
8680
- }]
8681
- };
8682
-
8683
- // Animations created synchronously will run synchronously
8684
- function createFxNow() {
8685
- setTimeout(function() {
8686
- fxNow = undefined;
8687
- });
8688
- return ( fxNow = jQuery.now() );
8689
- }
8690
-
8691
- function createTweens( animation, props ) {
8692
- jQuery.each( props, function( prop, value ) {
8693
- var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
8694
- index = 0,
8695
- length = collection.length;
8696
- for ( ; index < length; index++ ) {
8697
- if ( collection[ index ].call( animation, prop, value ) ) {
8698
-
8699
- // we're done with this property
8700
- return;
8701
- }
8702
- }
8703
- });
8704
- }
8705
-
8706
- function Animation( elem, properties, options ) {
8707
- var result,
8708
- stopped,
8709
- index = 0,
8710
- length = animationPrefilters.length,
8711
- deferred = jQuery.Deferred().always( function() {
8712
- // don't match elem in the :animated selector
8713
- delete tick.elem;
8714
- }),
8715
- tick = function() {
8716
- if ( stopped ) {
8717
- return false;
8718
- }
8719
- var currentTime = fxNow || createFxNow(),
8720
- remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
8721
- // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
8722
- temp = remaining / animation.duration || 0,
8723
- percent = 1 - temp,
8724
- index = 0,
8725
- length = animation.tweens.length;
8726
-
8727
- for ( ; index < length ; index++ ) {
8728
- animation.tweens[ index ].run( percent );
8729
- }
8730
-
8731
- deferred.notifyWith( elem, [ animation, percent, remaining ]);
8732
-
8733
- if ( percent < 1 && length ) {
8734
- return remaining;
8735
- } else {
8736
- deferred.resolveWith( elem, [ animation ] );
8737
- return false;
8738
- }
8739
- },
8740
- animation = deferred.promise({
8741
- elem: elem,
8742
- props: jQuery.extend( {}, properties ),
8743
- opts: jQuery.extend( true, { specialEasing: {} }, options ),
8744
- originalProperties: properties,
8745
- originalOptions: options,
8746
- startTime: fxNow || createFxNow(),
8747
- duration: options.duration,
8748
- tweens: [],
8749
- createTween: function( prop, end ) {
8750
- var tween = jQuery.Tween( elem, animation.opts, prop, end,
8751
- animation.opts.specialEasing[ prop ] || animation.opts.easing );
8752
- animation.tweens.push( tween );
8753
- return tween;
8754
- },
8755
- stop: function( gotoEnd ) {
8756
- var index = 0,
8757
- // if we are going to the end, we want to run all the tweens
8758
- // otherwise we skip this part
8759
- length = gotoEnd ? animation.tweens.length : 0;
8760
- if ( stopped ) {
8761
- return this;
8762
- }
8763
- stopped = true;
8764
- for ( ; index < length ; index++ ) {
8765
- animation.tweens[ index ].run( 1 );
8766
- }
8767
-
8768
- // resolve when we played the last frame
8769
- // otherwise, reject
8770
- if ( gotoEnd ) {
8771
- deferred.resolveWith( elem, [ animation, gotoEnd ] );
8772
- } else {
8773
- deferred.rejectWith( elem, [ animation, gotoEnd ] );
8774
- }
8775
- return this;
8776
- }
8777
- }),
8778
- props = animation.props;
8779
-
8780
- propFilter( props, animation.opts.specialEasing );
8781
-
8782
- for ( ; index < length ; index++ ) {
8783
- result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
8784
- if ( result ) {
8785
- return result;
8786
- }
8787
- }
8788
-
8789
- createTweens( animation, props );
8790
-
8791
- if ( jQuery.isFunction( animation.opts.start ) ) {
8792
- animation.opts.start.call( elem, animation );
8793
- }
8794
-
8795
- jQuery.fx.timer(
8796
- jQuery.extend( tick, {
8797
- elem: elem,
8798
- anim: animation,
8799
- queue: animation.opts.queue
8800
- })
8801
- );
8802
-
8803
- // attach callbacks from options
8804
- return animation.progress( animation.opts.progress )
8805
- .done( animation.opts.done, animation.opts.complete )
8806
- .fail( animation.opts.fail )
8807
- .always( animation.opts.always );
8808
- }
8809
-
8810
- function propFilter( props, specialEasing ) {
8811
- var value, name, index, easing, hooks;
8812
-
8813
- // camelCase, specialEasing and expand cssHook pass
8814
- for ( index in props ) {
8815
- name = jQuery.camelCase( index );
8816
- easing = specialEasing[ name ];
8817
- value = props[ index ];
8818
- if ( jQuery.isArray( value ) ) {
8819
- easing = value[ 1 ];
8820
- value = props[ index ] = value[ 0 ];
8821
- }
8822
-
8823
- if ( index !== name ) {
8824
- props[ name ] = value;
8825
- delete props[ index ];
8826
- }
8827
-
8828
- hooks = jQuery.cssHooks[ name ];
8829
- if ( hooks && "expand" in hooks ) {
8830
- value = hooks.expand( value );
8831
- delete props[ name ];
8832
-
8833
- // not quite $.extend, this wont overwrite keys already present.
8834
- // also - reusing 'index' from above because we have the correct "name"
8835
- for ( index in value ) {
8836
- if ( !( index in props ) ) {
8837
- props[ index ] = value[ index ];
8838
- specialEasing[ index ] = easing;
8839
- }
8840
- }
8841
- } else {
8842
- specialEasing[ name ] = easing;
8843
- }
8844
- }
8845
- }
8846
-
8847
- jQuery.Animation = jQuery.extend( Animation, {
8848
-
8849
- tweener: function( props, callback ) {
8850
- if ( jQuery.isFunction( props ) ) {
8851
- callback = props;
8852
- props = [ "*" ];
8853
- } else {
8854
- props = props.split(" ");
8855
- }
8856
-
8857
- var prop,
8858
- index = 0,
8859
- length = props.length;
8860
-
8861
- for ( ; index < length ; index++ ) {
8862
- prop = props[ index ];
8863
- tweeners[ prop ] = tweeners[ prop ] || [];
8864
- tweeners[ prop ].unshift( callback );
8865
- }
8866
- },
8867
-
8868
- prefilter: function( callback, prepend ) {
8869
- if ( prepend ) {
8870
- animationPrefilters.unshift( callback );
8871
- } else {
8872
- animationPrefilters.push( callback );
8873
- }
8874
- }
8875
- });
8876
-
8877
- function defaultPrefilter( elem, props, opts ) {
8878
- /*jshint validthis:true */
8879
- var prop, index, length,
8880
- value, dataShow, toggle,
8881
- tween, hooks, oldfire,
8882
- anim = this,
8883
- style = elem.style,
8884
- orig = {},
8885
- handled = [],
8886
- hidden = elem.nodeType && isHidden( elem );
8887
-
8888
- // handle queue: false promises
8889
- if ( !opts.queue ) {
8890
- hooks = jQuery._queueHooks( elem, "fx" );
8891
- if ( hooks.unqueued == null ) {
8892
- hooks.unqueued = 0;
8893
- oldfire = hooks.empty.fire;
8894
- hooks.empty.fire = function() {
8895
- if ( !hooks.unqueued ) {
8896
- oldfire();
8897
- }
8898
- };
8899
- }
8900
- hooks.unqueued++;
8901
-
8902
- anim.always(function() {
8903
- // doing this makes sure that the complete handler will be called
8904
- // before this completes
8905
- anim.always(function() {
8906
- hooks.unqueued--;
8907
- if ( !jQuery.queue( elem, "fx" ).length ) {
8908
- hooks.empty.fire();
8909
- }
8910
- });
8911
- });
8912
- }
8913
-
8914
- // height/width overflow pass
8915
- if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
8916
- // Make sure that nothing sneaks out
8917
- // Record all 3 overflow attributes because IE does not
8918
- // change the overflow attribute when overflowX and
8919
- // overflowY are set to the same value
8920
- opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
8921
-
8922
- // Set display property to inline-block for height/width
8923
- // animations on inline elements that are having width/height animated
8924
- if ( jQuery.css( elem, "display" ) === "inline" &&
8925
- jQuery.css( elem, "float" ) === "none" ) {
8926
-
8927
- // inline-level elements accept inline-block;
8928
- // block-level elements need to be inline with layout
8929
- if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
8930
- style.display = "inline-block";
8931
-
8932
- } else {
8933
- style.zoom = 1;
8934
- }
8935
- }
8936
- }
8937
-
8938
- if ( opts.overflow ) {
8939
- style.overflow = "hidden";
8940
- if ( !jQuery.support.shrinkWrapBlocks ) {
8941
- anim.always(function() {
8942
- style.overflow = opts.overflow[ 0 ];
8943
- style.overflowX = opts.overflow[ 1 ];
8944
- style.overflowY = opts.overflow[ 2 ];
8945
- });
8946
- }
8947
- }
8948
-
8949
-
8950
- // show/hide pass
8951
- for ( index in props ) {
8952
- value = props[ index ];
8953
- if ( rfxtypes.exec( value ) ) {
8954
- delete props[ index ];
8955
- toggle = toggle || value === "toggle";
8956
- if ( value === ( hidden ? "hide" : "show" ) ) {
8957
- continue;
8958
- }
8959
- handled.push( index );
8960
- }
8961
- }
8962
-
8963
- length = handled.length;
8964
- if ( length ) {
8965
- dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
8966
- if ( "hidden" in dataShow ) {
8967
- hidden = dataShow.hidden;
8968
- }
8969
-
8970
- // store state if its toggle - enables .stop().toggle() to "reverse"
8971
- if ( toggle ) {
8972
- dataShow.hidden = !hidden;
8973
- }
8974
- if ( hidden ) {
8975
- jQuery( elem ).show();
8976
- } else {
8977
- anim.done(function() {
8978
- jQuery( elem ).hide();
8979
- });
8980
- }
8981
- anim.done(function() {
8982
- var prop;
8983
- jQuery._removeData( elem, "fxshow" );
8984
- for ( prop in orig ) {
8985
- jQuery.style( elem, prop, orig[ prop ] );
8986
- }
8987
- });
8988
- for ( index = 0 ; index < length ; index++ ) {
8989
- prop = handled[ index ];
8990
- tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );
8991
- orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop );
8992
-
8993
- if ( !( prop in dataShow ) ) {
8994
- dataShow[ prop ] = tween.start;
8995
- if ( hidden ) {
8996
- tween.end = tween.start;
8997
- tween.start = prop === "width" || prop === "height" ? 1 : 0;
8998
- }
8999
- }
9000
- }
9001
- }
9002
- }
9003
-
9004
- function Tween( elem, options, prop, end, easing ) {
9005
- return new Tween.prototype.init( elem, options, prop, end, easing );
9006
- }
9007
- jQuery.Tween = Tween;
9008
-
9009
- Tween.prototype = {
9010
- constructor: Tween,
9011
- init: function( elem, options, prop, end, easing, unit ) {
9012
- this.elem = elem;
9013
- this.prop = prop;
9014
- this.easing = easing || "swing";
9015
- this.options = options;
9016
- this.start = this.now = this.cur();
9017
- this.end = end;
9018
- this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
9019
- },
9020
- cur: function() {
9021
- var hooks = Tween.propHooks[ this.prop ];
9022
-
9023
- return hooks && hooks.get ?
9024
- hooks.get( this ) :
9025
- Tween.propHooks._default.get( this );
9026
- },
9027
- run: function( percent ) {
9028
- var eased,
9029
- hooks = Tween.propHooks[ this.prop ];
9030
-
9031
- if ( this.options.duration ) {
9032
- this.pos = eased = jQuery.easing[ this.easing ](
9033
- percent, this.options.duration * percent, 0, 1, this.options.duration
9034
- );
9035
- } else {
9036
- this.pos = eased = percent;
9037
- }
9038
- this.now = ( this.end - this.start ) * eased + this.start;
9039
-
9040
- if ( this.options.step ) {
9041
- this.options.step.call( this.elem, this.now, this );
9042
- }
9043
-
9044
- if ( hooks && hooks.set ) {
9045
- hooks.set( this );
9046
- } else {
9047
- Tween.propHooks._default.set( this );
9048
- }
9049
- return this;
9050
- }
9051
- };
9052
-
9053
- Tween.prototype.init.prototype = Tween.prototype;
9054
-
9055
- Tween.propHooks = {
9056
- _default: {
9057
- get: function( tween ) {
9058
- var result;
9059
-
9060
- if ( tween.elem[ tween.prop ] != null &&
9061
- (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
9062
- return tween.elem[ tween.prop ];
9063
- }
9064
-
9065
- // passing an empty string as a 3rd parameter to .css will automatically
9066
- // attempt a parseFloat and fallback to a string if the parse fails
9067
- // so, simple values such as "10px" are parsed to Float.
9068
- // complex values such as "rotate(1rad)" are returned as is.
9069
- result = jQuery.css( tween.elem, tween.prop, "" );
9070
- // Empty strings, null, undefined and "auto" are converted to 0.
9071
- return !result || result === "auto" ? 0 : result;
9072
- },
9073
- set: function( tween ) {
9074
- // use step hook for back compat - use cssHook if its there - use .style if its
9075
- // available and use plain properties where available
9076
- if ( jQuery.fx.step[ tween.prop ] ) {
9077
- jQuery.fx.step[ tween.prop ]( tween );
9078
- } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
9079
- jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
9080
- } else {
9081
- tween.elem[ tween.prop ] = tween.now;
9082
- }
9083
- }
9084
- }
9085
- };
9086
-
9087
- // Remove in 2.0 - this supports IE8's panic based approach
9088
- // to setting things on disconnected nodes
9089
-
9090
- Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
9091
- set: function( tween ) {
9092
- if ( tween.elem.nodeType && tween.elem.parentNode ) {
9093
- tween.elem[ tween.prop ] = tween.now;
9094
- }
9095
- }
9096
- };
9097
-
9098
- jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
9099
- var cssFn = jQuery.fn[ name ];
9100
- jQuery.fn[ name ] = function( speed, easing, callback ) {
9101
- return speed == null || typeof speed === "boolean" ?
9102
- cssFn.apply( this, arguments ) :
9103
- this.animate( genFx( name, true ), speed, easing, callback );
9104
- };
9105
- });
9106
-
9107
- jQuery.fn.extend({
9108
- fadeTo: function( speed, to, easing, callback ) {
9109
-
9110
- // show any hidden elements after setting opacity to 0
9111
- return this.filter( isHidden ).css( "opacity", 0 ).show()
9112
-
9113
- // animate to the value specified
9114
- .end().animate({ opacity: to }, speed, easing, callback );
9115
- },
9116
- animate: function( prop, speed, easing, callback ) {
9117
- var empty = jQuery.isEmptyObject( prop ),
9118
- optall = jQuery.speed( speed, easing, callback ),
9119
- doAnimation = function() {
9120
- // Operate on a copy of prop so per-property easing won't be lost
9121
- var anim = Animation( this, jQuery.extend( {}, prop ), optall );
9122
- doAnimation.finish = function() {
9123
- anim.stop( true );
9124
- };
9125
- // Empty animations, or finishing resolves immediately
9126
- if ( empty || jQuery._data( this, "finish" ) ) {
9127
- anim.stop( true );
9128
- }
9129
- };
9130
- doAnimation.finish = doAnimation;
9131
-
9132
- return empty || optall.queue === false ?
9133
- this.each( doAnimation ) :
9134
- this.queue( optall.queue, doAnimation );
9135
- },
9136
- stop: function( type, clearQueue, gotoEnd ) {
9137
- var stopQueue = function( hooks ) {
9138
- var stop = hooks.stop;
9139
- delete hooks.stop;
9140
- stop( gotoEnd );
9141
- };
9142
-
9143
- if ( typeof type !== "string" ) {
9144
- gotoEnd = clearQueue;
9145
- clearQueue = type;
9146
- type = undefined;
9147
- }
9148
- if ( clearQueue && type !== false ) {
9149
- this.queue( type || "fx", [] );
9150
- }
9151
-
9152
- return this.each(function() {
9153
- var dequeue = true,
9154
- index = type != null && type + "queueHooks",
9155
- timers = jQuery.timers,
9156
- data = jQuery._data( this );
9157
-
9158
- if ( index ) {
9159
- if ( data[ index ] && data[ index ].stop ) {
9160
- stopQueue( data[ index ] );
9161
- }
9162
- } else {
9163
- for ( index in data ) {
9164
- if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
9165
- stopQueue( data[ index ] );
9166
- }
9167
- }
9168
- }
9169
-
9170
- for ( index = timers.length; index--; ) {
9171
- if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
9172
- timers[ index ].anim.stop( gotoEnd );
9173
- dequeue = false;
9174
- timers.splice( index, 1 );
9175
- }
9176
- }
9177
-
9178
- // start the next in the queue if the last step wasn't forced
9179
- // timers currently will call their complete callbacks, which will dequeue
9180
- // but only if they were gotoEnd
9181
- if ( dequeue || !gotoEnd ) {
9182
- jQuery.dequeue( this, type );
9183
- }
9184
- });
9185
- },
9186
- finish: function( type ) {
9187
- if ( type !== false ) {
9188
- type = type || "fx";
9189
- }
9190
- return this.each(function() {
9191
- var index,
9192
- data = jQuery._data( this ),
9193
- queue = data[ type + "queue" ],
9194
- hooks = data[ type + "queueHooks" ],
9195
- timers = jQuery.timers,
9196
- length = queue ? queue.length : 0;
9197
-
9198
- // enable finishing flag on private data
9199
- data.finish = true;
9200
-
9201
- // empty the queue first
9202
- jQuery.queue( this, type, [] );
9203
-
9204
- if ( hooks && hooks.cur && hooks.cur.finish ) {
9205
- hooks.cur.finish.call( this );
9206
- }
9207
-
9208
- // look for any active animations, and finish them
9209
- for ( index = timers.length; index--; ) {
9210
- if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
9211
- timers[ index ].anim.stop( true );
9212
- timers.splice( index, 1 );
9213
- }
9214
- }
9215
-
9216
- // look for any animations in the old queue and finish them
9217
- for ( index = 0; index < length; index++ ) {
9218
- if ( queue[ index ] && queue[ index ].finish ) {
9219
- queue[ index ].finish.call( this );
9220
- }
9221
- }
9222
-
9223
- // turn off finishing flag
9224
- delete data.finish;
9225
- });
9226
- }
9227
- });
9228
-
9229
- // Generate parameters to create a standard animation
9230
- function genFx( type, includeWidth ) {
9231
- var which,
9232
- attrs = { height: type },
9233
- i = 0;
9234
-
9235
- // if we include width, step value is 1 to do all cssExpand values,
9236
- // if we don't include width, step value is 2 to skip over Left and Right
9237
- includeWidth = includeWidth? 1 : 0;
9238
- for( ; i < 4 ; i += 2 - includeWidth ) {
9239
- which = cssExpand[ i ];
9240
- attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
9241
- }
9242
-
9243
- if ( includeWidth ) {
9244
- attrs.opacity = attrs.width = type;
9245
- }
9246
-
9247
- return attrs;
9248
- }
9249
-
9250
- // Generate shortcuts for custom animations
9251
- jQuery.each({
9252
- slideDown: genFx("show"),
9253
- slideUp: genFx("hide"),
9254
- slideToggle: genFx("toggle"),
9255
- fadeIn: { opacity: "show" },
9256
- fadeOut: { opacity: "hide" },
9257
- fadeToggle: { opacity: "toggle" }
9258
- }, function( name, props ) {
9259
- jQuery.fn[ name ] = function( speed, easing, callback ) {
9260
- return this.animate( props, speed, easing, callback );
9261
- };
9262
- });
9263
-
9264
- jQuery.speed = function( speed, easing, fn ) {
9265
- var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
9266
- complete: fn || !fn && easing ||
9267
- jQuery.isFunction( speed ) && speed,
9268
- duration: speed,
9269
- easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
9270
- };
9271
-
9272
- opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
9273
- opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
9274
-
9275
- // normalize opt.queue - true/undefined/null -> "fx"
9276
- if ( opt.queue == null || opt.queue === true ) {
9277
- opt.queue = "fx";
9278
- }
9279
-
9280
- // Queueing
9281
- opt.old = opt.complete;
9282
-
9283
- opt.complete = function() {
9284
- if ( jQuery.isFunction( opt.old ) ) {
9285
- opt.old.call( this );
9286
- }
9287
-
9288
- if ( opt.queue ) {
9289
- jQuery.dequeue( this, opt.queue );
9290
- }
9291
- };
9292
-
9293
- return opt;
9294
- };
9295
-
9296
- jQuery.easing = {
9297
- linear: function( p ) {
9298
- return p;
9299
- },
9300
- swing: function( p ) {
9301
- return 0.5 - Math.cos( p*Math.PI ) / 2;
9302
- }
9303
- };
9304
-
9305
- jQuery.timers = [];
9306
- jQuery.fx = Tween.prototype.init;
9307
- jQuery.fx.tick = function() {
9308
- var timer,
9309
- timers = jQuery.timers,
9310
- i = 0;
9311
-
9312
- fxNow = jQuery.now();
9313
-
9314
- for ( ; i < timers.length; i++ ) {
9315
- timer = timers[ i ];
9316
- // Checks the timer has not already been removed
9317
- if ( !timer() && timers[ i ] === timer ) {
9318
- timers.splice( i--, 1 );
9319
- }
9320
- }
9321
-
9322
- if ( !timers.length ) {
9323
- jQuery.fx.stop();
9324
- }
9325
- fxNow = undefined;
9326
- };
9327
-
9328
- jQuery.fx.timer = function( timer ) {
9329
- if ( timer() && jQuery.timers.push( timer ) ) {
9330
- jQuery.fx.start();
9331
- }
9332
- };
9333
-
9334
- jQuery.fx.interval = 13;
9335
-
9336
- jQuery.fx.start = function() {
9337
- if ( !timerId ) {
9338
- timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
9339
- }
9340
- };
9341
-
9342
- jQuery.fx.stop = function() {
9343
- clearInterval( timerId );
9344
- timerId = null;
9345
- };
9346
-
9347
- jQuery.fx.speeds = {
9348
- slow: 600,
9349
- fast: 200,
9350
- // Default speed
9351
- _default: 400
9352
- };
9353
-
9354
- // Back Compat <1.8 extension point
9355
- jQuery.fx.step = {};
9356
-
9357
- if ( jQuery.expr && jQuery.expr.filters ) {
9358
- jQuery.expr.filters.animated = function( elem ) {
9359
- return jQuery.grep(jQuery.timers, function( fn ) {
9360
- return elem === fn.elem;
9361
- }).length;
9362
- };
9363
- }
9364
- jQuery.fn.offset = function( options ) {
9365
- if ( arguments.length ) {
9366
- return options === undefined ?
9367
- this :
9368
- this.each(function( i ) {
9369
- jQuery.offset.setOffset( this, options, i );
9370
- });
9371
- }
9372
-
9373
- var docElem, win,
9374
- box = { top: 0, left: 0 },
9375
- elem = this[ 0 ],
9376
- doc = elem && elem.ownerDocument;
9377
-
9378
- if ( !doc ) {
9379
- return;
9380
- }
9381
-
9382
- docElem = doc.documentElement;
9383
-
9384
- // Make sure it's not a disconnected DOM node
9385
- if ( !jQuery.contains( docElem, elem ) ) {
9386
- return box;
9387
- }
9388
-
9389
- // If we don't have gBCR, just use 0,0 rather than error
9390
- // BlackBerry 5, iOS 3 (original iPhone)
9391
- if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
9392
- box = elem.getBoundingClientRect();
9393
- }
9394
- win = getWindow( doc );
9395
- return {
9396
- top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
9397
- left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
9398
- };
9399
- };
9400
-
9401
- jQuery.offset = {
9402
-
9403
- setOffset: function( elem, options, i ) {
9404
- var position = jQuery.css( elem, "position" );
9405
-
9406
- // set position first, in-case top/left are set even on static elem
9407
- if ( position === "static" ) {
9408
- elem.style.position = "relative";
9409
- }
9410
-
9411
- var curElem = jQuery( elem ),
9412
- curOffset = curElem.offset(),
9413
- curCSSTop = jQuery.css( elem, "top" ),
9414
- curCSSLeft = jQuery.css( elem, "left" ),
9415
- calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
9416
- props = {}, curPosition = {}, curTop, curLeft;
9417
-
9418
- // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
9419
- if ( calculatePosition ) {
9420
- curPosition = curElem.position();
9421
- curTop = curPosition.top;
9422
- curLeft = curPosition.left;
9423
- } else {
9424
- curTop = parseFloat( curCSSTop ) || 0;
9425
- curLeft = parseFloat( curCSSLeft ) || 0;
9426
- }
9427
-
9428
- if ( jQuery.isFunction( options ) ) {
9429
- options = options.call( elem, i, curOffset );
9430
- }
9431
-
9432
- if ( options.top != null ) {
9433
- props.top = ( options.top - curOffset.top ) + curTop;
9434
- }
9435
- if ( options.left != null ) {
9436
- props.left = ( options.left - curOffset.left ) + curLeft;
9437
- }
9438
-
9439
- if ( "using" in options ) {
9440
- options.using.call( elem, props );
9441
- } else {
9442
- curElem.css( props );
9443
- }
9444
- }
9445
- };
9446
-
9447
-
9448
- jQuery.fn.extend({
9449
-
9450
- position: function() {
9451
- if ( !this[ 0 ] ) {
9452
- return;
9453
- }
9454
-
9455
- var offsetParent, offset,
9456
- parentOffset = { top: 0, left: 0 },
9457
- elem = this[ 0 ];
9458
-
9459
- // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent
9460
- if ( jQuery.css( elem, "position" ) === "fixed" ) {
9461
- // we assume that getBoundingClientRect is available when computed position is fixed
9462
- offset = elem.getBoundingClientRect();
9463
- } else {
9464
- // Get *real* offsetParent
9465
- offsetParent = this.offsetParent();
9466
-
9467
- // Get correct offsets
9468
- offset = this.offset();
9469
- if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
9470
- parentOffset = offsetParent.offset();
9471
- }
9472
-
9473
- // Add offsetParent borders
9474
- parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
9475
- parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
9476
- }
9477
-
9478
- // Subtract parent offsets and element margins
9479
- // note: when an element has margin: auto the offsetLeft and marginLeft
9480
- // are the same in Safari causing offset.left to incorrectly be 0
9481
- return {
9482
- top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
9483
- left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
9484
- };
9485
- },
9486
-
9487
- offsetParent: function() {
9488
- return this.map(function() {
9489
- var offsetParent = this.offsetParent || document.documentElement;
9490
- while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) {
9491
- offsetParent = offsetParent.offsetParent;
9492
- }
9493
- return offsetParent || document.documentElement;
9494
- });
9495
- }
9496
- });
9497
-
9498
-
9499
- // Create scrollLeft and scrollTop methods
9500
- jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
9501
- var top = /Y/.test( prop );
9502
-
9503
- jQuery.fn[ method ] = function( val ) {
9504
- return jQuery.access( this, function( elem, method, val ) {
9505
- var win = getWindow( elem );
9506
-
9507
- if ( val === undefined ) {
9508
- return win ? (prop in win) ? win[ prop ] :
9509
- win.document.documentElement[ method ] :
9510
- elem[ method ];
9511
- }
9512
-
9513
- if ( win ) {
9514
- win.scrollTo(
9515
- !top ? val : jQuery( win ).scrollLeft(),
9516
- top ? val : jQuery( win ).scrollTop()
9517
- );
9518
-
9519
- } else {
9520
- elem[ method ] = val;
9521
- }
9522
- }, method, val, arguments.length, null );
9523
- };
9524
- });
9525
-
9526
- function getWindow( elem ) {
9527
- return jQuery.isWindow( elem ) ?
9528
- elem :
9529
- elem.nodeType === 9 ?
9530
- elem.defaultView || elem.parentWindow :
9531
- false;
9532
- }
9533
- // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
9534
- jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
9535
- jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
9536
- // margin is only for outerHeight, outerWidth
9537
- jQuery.fn[ funcName ] = function( margin, value ) {
9538
- var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
9539
- extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
9540
-
9541
- return jQuery.access( this, function( elem, type, value ) {
9542
- var doc;
9543
-
9544
- if ( jQuery.isWindow( elem ) ) {
9545
- // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
9546
- // isn't a whole lot we can do. See pull request at this URL for discussion:
9547
- // https://github.com/jquery/jquery/pull/764
9548
- return elem.document.documentElement[ "client" + name ];
9549
- }
9550
-
9551
- // Get document width or height
9552
- if ( elem.nodeType === 9 ) {
9553
- doc = elem.documentElement;
9554
-
9555
- // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
9556
- // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
9557
- return Math.max(
9558
- elem.body[ "scroll" + name ], doc[ "scroll" + name ],
9559
- elem.body[ "offset" + name ], doc[ "offset" + name ],
9560
- doc[ "client" + name ]
9561
- );
9562
- }
9563
-
9564
- return value === undefined ?
9565
- // Get width or height on the element, requesting but not forcing parseFloat
9566
- jQuery.css( elem, type, extra ) :
9567
-
9568
- // Set width or height on the element
9569
- jQuery.style( elem, type, value, extra );
9570
- }, type, chainable ? margin : undefined, chainable, null );
9571
- };
9572
- });
9573
- });
9574
- // Limit scope pollution from any deprecated API
9575
- // (function() {
9576
-
9577
- // })();
9578
- // Expose jQuery to the global object
9579
- window.jQuery = window.$ = jQuery;
9580
-
9581
- // Expose jQuery as an AMD module, but only for AMD loaders that
9582
- // understand the issues with loading multiple versions of jQuery
9583
- // in a page that all might call define(). The loader will indicate
9584
- // they have special allowances for multiple jQuery versions by
9585
- // specifying define.amd.jQuery = true. Register as a named module,
9586
- // since jQuery can be concatenated with other files that may use define,
9587
- // but not use a proper concatenation script that understands anonymous
9588
- // AMD modules. A named AMD is safest and most robust way to register.
9589
- // Lowercase jquery is used because AMD module names are derived from
9590
- // file names, and jQuery is normally delivered in a lowercase file name.
9591
- // Do this after creating the global so that if an AMD module wants to call
9592
- // noConflict to hide this version of jQuery, it will work.
9593
- if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
9594
- define( "jquery", [], function () { return jQuery; } );
9595
- }
9596
-
9597
- })( window );
1
+ /*!
2
+ * jQuery JavaScript Library v1.9.1
3
+ * http://jquery.com/
4
+ *
5
+ * Includes Sizzle.js
6
+ * http://sizzlejs.com/
7
+ *
8
+ * Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors
9
+ * Released under the MIT license
10
+ * http://jquery.org/license
11
+ *
12
+ * Date: 2013-2-4
13
+ */
14
+ (function( window, undefined ) {
15
+ // Can't do this because several apps including ASP.NET trace
16
+ // the stack via arguments.caller.callee and Firefox dies if
17
+ // you try to trace through "use strict" call chains. (#13335)
18
+ // Support: Firefox 18+
19
+ //"use strict";
20
+ var
21
+ // The deferred used on DOM ready
22
+ readyList,
23
+ // A central reference to the root jQuery(document)
24
+ rootjQuery,
25
+ // Support: IE<9
26
+ // For `typeof node.method` instead of `node.method !== undefined`
27
+ core_strundefined = typeof undefined,
28
+ // Use the correct document accordingly with window argument (sandbox)
29
+ document = window.document,
30
+ location = window.location,
31
+ // Map over jQuery in case of overwrite
32
+ _jQuery = window.jQuery,
33
+ // Map over the $ in case of overwrite
34
+ _$ = window.$,
35
+ // [[Class]] -> type pairs
36
+ class2type = {},
37
+ // List of deleted data cache ids, so we can reuse them
38
+ core_deletedIds = [],
39
+ core_version = "1.9.1",
40
+ // Save a reference to some core methods
41
+ core_concat = core_deletedIds.concat,
42
+ core_push = core_deletedIds.push,
43
+ core_slice = core_deletedIds.slice,
44
+ core_indexOf = core_deletedIds.indexOf,
45
+ core_toString = class2type.toString,
46
+ core_hasOwn = class2type.hasOwnProperty,
47
+ core_trim = core_version.trim,
48
+ // Define a local copy of jQuery
49
+ jQuery = function( selector, context ) {
50
+ // The jQuery object is actually just the init constructor 'enhanced'
51
+ return new jQuery.fn.init( selector, context, rootjQuery );
52
+ },
53
+ // Used for matching numbers
54
+ core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
55
+ // Used for splitting on whitespace
56
+ core_rnotwhite = /\S+/g,
57
+ // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
58
+ rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
59
+ // A simple way to check for HTML strings
60
+ // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
61
+ // Strict HTML recognition (#11290: must start with <)
62
+ rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,
63
+ // Match a standalone tag
64
+ rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
65
+ // JSON RegExp
66
+ rvalidchars = /^[\],:{}\s]*$/,
67
+ rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
68
+ rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
69
+ rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
70
+ // Matches dashed string for camelizing
71
+ rmsPrefix = /^-ms-/,
72
+ rdashAlpha = /-([\da-z])/gi,
73
+ // Used by jQuery.camelCase as callback to replace()
74
+ fcamelCase = function( all, letter ) {
75
+ return letter.toUpperCase();
76
+ },
77
+ // The ready event handler
78
+ completed = function( event ) {
79
+ // readyState === "complete" is good enough for us to call the dom ready in oldIE
80
+ if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
81
+ detach();
82
+ jQuery.ready();
83
+ }
84
+ },
85
+ // Clean-up method for dom ready events
86
+ detach = function() {
87
+ if ( document.addEventListener ) {
88
+ document.removeEventListener( "DOMContentLoaded", completed, false );
89
+ window.removeEventListener( "load", completed, false );
90
+ } else {
91
+ document.detachEvent( "onreadystatechange", completed );
92
+ window.detachEvent( "onload", completed );
93
+ }
94
+ };
95
+ jQuery.fn = jQuery.prototype = {
96
+ // The current version of jQuery being used
97
+ jquery: core_version,
98
+ constructor: jQuery,
99
+ init: function( selector, context, rootjQuery ) {
100
+ var match, elem;
101
+ // HANDLE: $(""), $(null), $(undefined), $(false)
102
+ if ( !selector ) {
103
+ return this;
104
+ }
105
+ // Handle HTML strings
106
+ if ( typeof selector === "string" ) {
107
+ if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
108
+ // Assume that strings that start and end with <> are HTML and skip the regex check
109
+ match = [ null, selector, null ];
110
+ } else {
111
+ match = rquickExpr.exec( selector );
112
+ }
113
+ // Match html or make sure no context is specified for #id
114
+ if ( match && (match[1] || !context) ) {
115
+ // HANDLE: $(html) -> $(array)
116
+ if ( match[1] ) {
117
+ context = context instanceof jQuery ? context[0] : context;
118
+ // scripts is true for back-compat
119
+ jQuery.merge( this, jQuery.parseHTML(
120
+ match[1],
121
+ context && context.nodeType ? context.ownerDocument || context : document,
122
+ true
123
+ ) );
124
+ // HANDLE: $(html, props)
125
+ if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
126
+ for ( match in context ) {
127
+ // Properties of context are called as methods if possible
128
+ if ( jQuery.isFunction( this[ match ] ) ) {
129
+ this[ match ]( context[ match ] );
130
+ // ...and otherwise set as attributes
131
+ } else {
132
+ this.attr( match, context[ match ] );
133
+ }
134
+ }
135
+ }
136
+ return this;
137
+ // HANDLE: $(#id)
138
+ } else {
139
+ elem = document.getElementById( match[2] );
140
+ // Check parentNode to catch when Blackberry 4.6 returns
141
+ // nodes that are no longer in the document #6963
142
+ if ( elem && elem.parentNode ) {
143
+ // Handle the case where IE and Opera return items
144
+ // by name instead of ID
145
+ if ( elem.id !== match[2] ) {
146
+ return rootjQuery.find( selector );
147
+ }
148
+ // Otherwise, we inject the element directly into the jQuery object
149
+ this.length = 1;
150
+ this[0] = elem;
151
+ }
152
+ this.context = document;
153
+ this.selector = selector;
154
+ return this;
155
+ }
156
+ // HANDLE: $(expr, $(...))
157
+ } else if ( !context || context.jquery ) {
158
+ return ( context || rootjQuery ).find( selector );
159
+ // HANDLE: $(expr, context)
160
+ // (which is just equivalent to: $(context).find(expr)
161
+ } else {
162
+ return this.constructor( context ).find( selector );
163
+ }
164
+ // HANDLE: $(DOMElement)
165
+ } else if ( selector.nodeType ) {
166
+ this.context = this[0] = selector;
167
+ this.length = 1;
168
+ return this;
169
+ // HANDLE: $(function)
170
+ // Shortcut for document ready
171
+ } else if ( jQuery.isFunction( selector ) ) {
172
+ return rootjQuery.ready( selector );
173
+ }
174
+ if ( selector.selector !== undefined ) {
175
+ this.selector = selector.selector;
176
+ this.context = selector.context;
177
+ }
178
+ return jQuery.makeArray( selector, this );
179
+ },
180
+ // Start with an empty selector
181
+ selector: "",
182
+ // The default length of a jQuery object is 0
183
+ length: 0,
184
+ // The number of elements contained in the matched element set
185
+ size: function() {
186
+ return this.length;
187
+ },
188
+ toArray: function() {
189
+ return core_slice.call( this );
190
+ },
191
+ // Get the Nth element in the matched element set OR
192
+ // Get the whole matched element set as a clean array
193
+ get: function( num ) {
194
+ return num == null ?
195
+ // Return a 'clean' array
196
+ this.toArray() :
197
+ // Return just the object
198
+ ( num < 0 ? this[ this.length + num ] : this[ num ] );
199
+ },
200
+ // Take an array of elements and push it onto the stack
201
+ // (returning the new matched element set)
202
+ pushStack: function( elems ) {
203
+ // Build a new jQuery matched element set
204
+ var ret = jQuery.merge( this.constructor(), elems );
205
+ // Add the old object onto the stack (as a reference)
206
+ ret.prevObject = this;
207
+ ret.context = this.context;
208
+ // Return the newly-formed element set
209
+ return ret;
210
+ },
211
+ // Execute a callback for every element in the matched set.
212
+ // (You can seed the arguments with an array of args, but this is
213
+ // only used internally.)
214
+ each: function( callback, args ) {
215
+ return jQuery.each( this, callback, args );
216
+ },
217
+ ready: function( fn ) {
218
+ // Add the callback
219
+ jQuery.ready.promise().done( fn );
220
+ return this;
221
+ },
222
+ slice: function() {
223
+ return this.pushStack( core_slice.apply( this, arguments ) );
224
+ },
225
+ first: function() {
226
+ return this.eq( 0 );
227
+ },
228
+ last: function() {
229
+ return this.eq( -1 );
230
+ },
231
+ eq: function( i ) {
232
+ var len = this.length,
233
+ j = +i + ( i < 0 ? len : 0 );
234
+ return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
235
+ },
236
+ map: function( callback ) {
237
+ return this.pushStack( jQuery.map(this, function( elem, i ) {
238
+ return callback.call( elem, i, elem );
239
+ }));
240
+ },
241
+ end: function() {
242
+ return this.prevObject || this.constructor(null);
243
+ },
244
+ // For internal use only.
245
+ // Behaves like an Array's method, not like a jQuery method.
246
+ push: core_push,
247
+ sort: [].sort,
248
+ splice: [].splice
249
+ };
250
+ // Give the init function the jQuery prototype for later instantiation
251
+ jQuery.fn.init.prototype = jQuery.fn;
252
+ jQuery.extend = jQuery.fn.extend = function() {
253
+ var src, copyIsArray, copy, name, options, clone,
254
+ target = arguments[0] || {},
255
+ i = 1,
256
+ length = arguments.length,
257
+ deep = false;
258
+ // Handle a deep copy situation
259
+ if ( typeof target === "boolean" ) {
260
+ deep = target;
261
+ target = arguments[1] || {};
262
+ // skip the boolean and the target
263
+ i = 2;
264
+ }
265
+ // Handle case when target is a string or something (possible in deep copy)
266
+ if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
267
+ target = {};
268
+ }
269
+ // extend jQuery itself if only one argument is passed
270
+ if ( length === i ) {
271
+ target = this;
272
+ --i;
273
+ }
274
+ for ( ; i < length; i++ ) {
275
+ // Only deal with non-null/undefined values
276
+ if ( (options = arguments[ i ]) != null ) {
277
+ // Extend the base object
278
+ for ( name in options ) {
279
+ src = target[ name ];
280
+ copy = options[ name ];
281
+ // Prevent never-ending loop
282
+ if ( target === copy ) {
283
+ continue;
284
+ }
285
+ // Recurse if we're merging plain objects or arrays
286
+ if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
287
+ if ( copyIsArray ) {
288
+ copyIsArray = false;
289
+ clone = src && jQuery.isArray(src) ? src : [];
290
+ } else {
291
+ clone = src && jQuery.isPlainObject(src) ? src : {};
292
+ }
293
+ // Never move original objects, clone them
294
+ target[ name ] = jQuery.extend( deep, clone, copy );
295
+ // Don't bring in undefined values
296
+ } else if ( copy !== undefined ) {
297
+ target[ name ] = copy;
298
+ }
299
+ }
300
+ }
301
+ }
302
+ // Return the modified object
303
+ return target;
304
+ };
305
+ jQuery.extend({
306
+ noConflict: function( deep ) {
307
+ if ( window.$ === jQuery ) {
308
+ window.$ = _$;
309
+ }
310
+ if ( deep && window.jQuery === jQuery ) {
311
+ window.jQuery = _jQuery;
312
+ }
313
+ return jQuery;
314
+ },
315
+ // Is the DOM ready to be used? Set to true once it occurs.
316
+ isReady: false,
317
+ // A counter to track how many items to wait for before
318
+ // the ready event fires. See #6781
319
+ readyWait: 1,
320
+ // Hold (or release) the ready event
321
+ holdReady: function( hold ) {
322
+ if ( hold ) {
323
+ jQuery.readyWait++;
324
+ } else {
325
+ jQuery.ready( true );
326
+ }
327
+ },
328
+ // Handle when the DOM is ready
329
+ ready: function( wait ) {
330
+ // Abort if there are pending holds or we're already ready
331
+ if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
332
+ return;
333
+ }
334
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
335
+ if ( !document.body ) {
336
+ return setTimeout( jQuery.ready );
337
+ }
338
+ // Remember that the DOM is ready
339
+ jQuery.isReady = true;
340
+ // If a normal DOM Ready event fired, decrement, and wait if need be
341
+ if ( wait !== true && --jQuery.readyWait > 0 ) {
342
+ return;
343
+ }
344
+ // If there are functions bound, to execute
345
+ readyList.resolveWith( document, [ jQuery ] );
346
+ // Trigger any bound ready events
347
+ if ( jQuery.fn.trigger ) {
348
+ jQuery( document ).trigger("ready").off("ready");
349
+ }
350
+ },
351
+ // See test/unit/core.js for details concerning isFunction.
352
+ // Since version 1.3, DOM methods and functions like alert
353
+ // aren't supported. They return false on IE (#2968).
354
+ isFunction: function( obj ) {
355
+ return jQuery.type(obj) === "function";
356
+ },
357
+ isArray: Array.isArray || function( obj ) {
358
+ return jQuery.type(obj) === "array";
359
+ },
360
+ isWindow: function( obj ) {
361
+ return obj != null && obj == obj.window;
362
+ },
363
+ isNumeric: function( obj ) {
364
+ return !isNaN( parseFloat(obj) ) && isFinite( obj );
365
+ },
366
+ type: function( obj ) {
367
+ if ( obj == null ) {
368
+ return String( obj );
369
+ }
370
+ return typeof obj === "object" || typeof obj === "function" ?
371
+ class2type[ core_toString.call(obj) ] || "object" :
372
+ typeof obj;
373
+ },
374
+ isPlainObject: function( obj ) {
375
+ // Must be an Object.
376
+ // Because of IE, we also have to check the presence of the constructor property.
377
+ // Make sure that DOM nodes and window objects don't pass through, as well
378
+ if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
379
+ return false;
380
+ }
381
+ try {
382
+ // Not own constructor property must be Object
383
+ if ( obj.constructor &&
384
+ !core_hasOwn.call(obj, "constructor") &&
385
+ !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
386
+ return false;
387
+ }
388
+ } catch ( e ) {
389
+ // IE8,9 Will throw exceptions on certain host objects #9897
390
+ return false;
391
+ }
392
+ // Own properties are enumerated firstly, so to speed up,
393
+ // if last one is own, then all properties are own.
394
+ var key;
395
+ for ( key in obj ) {}
396
+ return key === undefined || core_hasOwn.call( obj, key );
397
+ },
398
+ isEmptyObject: function( obj ) {
399
+ var name;
400
+ for ( name in obj ) {
401
+ return false;
402
+ }
403
+ return true;
404
+ },
405
+ error: function( msg ) {
406
+ throw new Error( msg );
407
+ },
408
+ // data: string of html
409
+ // context (optional): If specified, the fragment will be created in this context, defaults to document
410
+ // keepScripts (optional): If true, will include scripts passed in the html string
411
+ parseHTML: function( data, context, keepScripts ) {
412
+ if ( !data || typeof data !== "string" ) {
413
+ return null;
414
+ }
415
+ if ( typeof context === "boolean" ) {
416
+ keepScripts = context;
417
+ context = false;
418
+ }
419
+ context = context || document;
420
+ var parsed = rsingleTag.exec( data ),
421
+ scripts = !keepScripts && [];
422
+ // Single tag
423
+ if ( parsed ) {
424
+ return [ context.createElement( parsed[1] ) ];
425
+ }
426
+ parsed = jQuery.buildFragment( [ data ], context, scripts );
427
+ if ( scripts ) {
428
+ jQuery( scripts ).remove();
429
+ }
430
+ return jQuery.merge( [], parsed.childNodes );
431
+ },
432
+ parseJSON: function( data ) {
433
+ // Attempt to parse using the native JSON parser first
434
+ if ( window.JSON && window.JSON.parse ) {
435
+ return window.JSON.parse( data );
436
+ }
437
+ if ( data === null ) {
438
+ return data;
439
+ }
440
+ if ( typeof data === "string" ) {
441
+ // Make sure leading/trailing whitespace is removed (IE can't handle it)
442
+ data = jQuery.trim( data );
443
+ if ( data ) {
444
+ // Make sure the incoming data is actual JSON
445
+ // Logic borrowed from http://json.org/json2.js
446
+ if ( rvalidchars.test( data.replace( rvalidescape, "@" )
447
+ .replace( rvalidtokens, "]" )
448
+ .replace( rvalidbraces, "")) ) {
449
+ return ( new Function( "return " + data ) )();
450
+ }
451
+ }
452
+ }
453
+ jQuery.error( "Invalid JSON: " + data );
454
+ },
455
+ // Cross-browser xml parsing
456
+ parseXML: function( data ) {
457
+ var xml, tmp;
458
+ if ( !data || typeof data !== "string" ) {
459
+ return null;
460
+ }
461
+ try {
462
+ if ( window.DOMParser ) { // Standard
463
+ tmp = new DOMParser();
464
+ xml = tmp.parseFromString( data , "text/xml" );
465
+ } else { // IE
466
+ xml = new ActiveXObject( "Microsoft.XMLDOM" );
467
+ xml.async = "false";
468
+ xml.loadXML( data );
469
+ }
470
+ } catch( e ) {
471
+ xml = undefined;
472
+ }
473
+ if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
474
+ jQuery.error( "Invalid XML: " + data );
475
+ }
476
+ return xml;
477
+ },
478
+ noop: function() {},
479
+ // Evaluates a script in a global context
480
+ // Workarounds based on findings by Jim Driscoll
481
+ // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
482
+ globalEval: function( data ) {
483
+ if ( data && jQuery.trim( data ) ) {
484
+ // We use execScript on Internet Explorer
485
+ // We use an anonymous function so that context is window
486
+ // rather than jQuery in Firefox
487
+ ( window.execScript || function( data ) {
488
+ window[ "eval" ].call( window, data );
489
+ } )( data );
490
+ }
491
+ },
492
+ // Convert dashed to camelCase; used by the css and data modules
493
+ // Microsoft forgot to hump their vendor prefix (#9572)
494
+ camelCase: function( string ) {
495
+ return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
496
+ },
497
+ nodeName: function( elem, name ) {
498
+ return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
499
+ },
500
+ // args is for internal usage only
501
+ each: function( obj, callback, args ) {
502
+ var value,
503
+ i = 0,
504
+ length = obj.length,
505
+ isArray = isArraylike( obj );
506
+ if ( args ) {
507
+ if ( isArray ) {
508
+ for ( ; i < length; i++ ) {
509
+ value = callback.apply( obj[ i ], args );
510
+ if ( value === false ) {
511
+ break;
512
+ }
513
+ }
514
+ } else {
515
+ for ( i in obj ) {
516
+ value = callback.apply( obj[ i ], args );
517
+ if ( value === false ) {
518
+ break;
519
+ }
520
+ }
521
+ }
522
+ // A special, fast, case for the most common use of each
523
+ } else {
524
+ if ( isArray ) {
525
+ for ( ; i < length; i++ ) {
526
+ value = callback.call( obj[ i ], i, obj[ i ] );
527
+ if ( value === false ) {
528
+ break;
529
+ }
530
+ }
531
+ } else {
532
+ for ( i in obj ) {
533
+ value = callback.call( obj[ i ], i, obj[ i ] );
534
+ if ( value === false ) {
535
+ break;
536
+ }
537
+ }
538
+ }
539
+ }
540
+ return obj;
541
+ },
542
+ // Use native String.trim function wherever possible
543
+ trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
544
+ function( text ) {
545
+ return text == null ?
546
+ "" :
547
+ core_trim.call( text );
548
+ } :
549
+ // Otherwise use our own trimming functionality
550
+ function( text ) {
551
+ return text == null ?
552
+ "" :
553
+ ( text + "" ).replace( rtrim, "" );
554
+ },
555
+ // results is for internal usage only
556
+ makeArray: function( arr, results ) {
557
+ var ret = results || [];
558
+ if ( arr != null ) {
559
+ if ( isArraylike( Object(arr) ) ) {
560
+ jQuery.merge( ret,
561
+ typeof arr === "string" ?
562
+ [ arr ] : arr
563
+ );
564
+ } else {
565
+ core_push.call( ret, arr );
566
+ }
567
+ }
568
+ return ret;
569
+ },
570
+ inArray: function( elem, arr, i ) {
571
+ var len;
572
+ if ( arr ) {
573
+ if ( core_indexOf ) {
574
+ return core_indexOf.call( arr, elem, i );
575
+ }
576
+ len = arr.length;
577
+ i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
578
+ for ( ; i < len; i++ ) {
579
+ // Skip accessing in sparse arrays
580
+ if ( i in arr && arr[ i ] === elem ) {
581
+ return i;
582
+ }
583
+ }
584
+ }
585
+ return -1;
586
+ },
587
+ merge: function( first, second ) {
588
+ var l = second.length,
589
+ i = first.length,
590
+ j = 0;
591
+ if ( typeof l === "number" ) {
592
+ for ( ; j < l; j++ ) {
593
+ first[ i++ ] = second[ j ];
594
+ }
595
+ } else {
596
+ while ( second[j] !== undefined ) {
597
+ first[ i++ ] = second[ j++ ];
598
+ }
599
+ }
600
+ first.length = i;
601
+ return first;
602
+ },
603
+ grep: function( elems, callback, inv ) {
604
+ var retVal,
605
+ ret = [],
606
+ i = 0,
607
+ length = elems.length;
608
+ inv = !!inv;
609
+ // Go through the array, only saving the items
610
+ // that pass the validator function
611
+ for ( ; i < length; i++ ) {
612
+ retVal = !!callback( elems[ i ], i );
613
+ if ( inv !== retVal ) {
614
+ ret.push( elems[ i ] );
615
+ }
616
+ }
617
+ return ret;
618
+ },
619
+ // arg is for internal usage only
620
+ map: function( elems, callback, arg ) {
621
+ var value,
622
+ i = 0,
623
+ length = elems.length,
624
+ isArray = isArraylike( elems ),
625
+ ret = [];
626
+ // Go through the array, translating each of the items to their
627
+ if ( isArray ) {
628
+ for ( ; i < length; i++ ) {
629
+ value = callback( elems[ i ], i, arg );
630
+ if ( value != null ) {
631
+ ret[ ret.length ] = value;
632
+ }
633
+ }
634
+ // Go through every key on the object,
635
+ } else {
636
+ for ( i in elems ) {
637
+ value = callback( elems[ i ], i, arg );
638
+ if ( value != null ) {
639
+ ret[ ret.length ] = value;
640
+ }
641
+ }
642
+ }
643
+ // Flatten any nested arrays
644
+ return core_concat.apply( [], ret );
645
+ },
646
+ // A global GUID counter for objects
647
+ guid: 1,
648
+ // Bind a function to a context, optionally partially applying any
649
+ // arguments.
650
+ proxy: function( fn, context ) {
651
+ var args, proxy, tmp;
652
+ if ( typeof context === "string" ) {
653
+ tmp = fn[ context ];
654
+ context = fn;
655
+ fn = tmp;
656
+ }
657
+ // Quick check to determine if target is callable, in the spec
658
+ // this throws a TypeError, but we will just return undefined.
659
+ if ( !jQuery.isFunction( fn ) ) {
660
+ return undefined;
661
+ }
662
+ // Simulated bind
663
+ args = core_slice.call( arguments, 2 );
664
+ proxy = function() {
665
+ return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );
666
+ };
667
+ // Set the guid of unique handler to the same of original handler, so it can be removed
668
+ proxy.guid = fn.guid = fn.guid || jQuery.guid++;
669
+ return proxy;
670
+ },
671
+ // Multifunctional method to get and set values of a collection
672
+ // The value/s can optionally be executed if it's a function
673
+ access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
674
+ var i = 0,
675
+ length = elems.length,
676
+ bulk = key == null;
677
+ // Sets many values
678
+ if ( jQuery.type( key ) === "object" ) {
679
+ chainable = true;
680
+ for ( i in key ) {
681
+ jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
682
+ }
683
+ // Sets one value
684
+ } else if ( value !== undefined ) {
685
+ chainable = true;
686
+ if ( !jQuery.isFunction( value ) ) {
687
+ raw = true;
688
+ }
689
+ if ( bulk ) {
690
+ // Bulk operations run against the entire set
691
+ if ( raw ) {
692
+ fn.call( elems, value );
693
+ fn = null;
694
+ // ...except when executing function values
695
+ } else {
696
+ bulk = fn;
697
+ fn = function( elem, key, value ) {
698
+ return bulk.call( jQuery( elem ), value );
699
+ };
700
+ }
701
+ }
702
+ if ( fn ) {
703
+ for ( ; i < length; i++ ) {
704
+ fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
705
+ }
706
+ }
707
+ }
708
+ return chainable ?
709
+ elems :
710
+ // Gets
711
+ bulk ?
712
+ fn.call( elems ) :
713
+ length ? fn( elems[0], key ) : emptyGet;
714
+ },
715
+ now: function() {
716
+ return ( new Date() ).getTime();
717
+ }
718
+ });
719
+ jQuery.ready.promise = function( obj ) {
720
+ if ( !readyList ) {
721
+ readyList = jQuery.Deferred();
722
+ // Catch cases where $(document).ready() is called after the browser event has already occurred.
723
+ // we once tried to use readyState "interactive" here, but it caused issues like the one
724
+ // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
725
+ if ( document.readyState === "complete" ) {
726
+ // Handle it asynchronously to allow scripts the opportunity to delay ready
727
+ setTimeout( jQuery.ready );
728
+ // Standards-based browsers support DOMContentLoaded
729
+ } else if ( document.addEventListener ) {
730
+ // Use the handy event callback
731
+ document.addEventListener( "DOMContentLoaded", completed, false );
732
+ // A fallback to window.onload, that will always work
733
+ window.addEventListener( "load", completed, false );
734
+ // If IE event model is used
735
+ } else {
736
+ // Ensure firing before onload, maybe late but safe also for iframes
737
+ document.attachEvent( "onreadystatechange", completed );
738
+ // A fallback to window.onload, that will always work
739
+ window.attachEvent( "onload", completed );
740
+ // If IE and not a frame
741
+ // continually check to see if the document is ready
742
+ var top = false;
743
+ try {
744
+ top = window.frameElement == null && document.documentElement;
745
+ } catch(e) {}
746
+ if ( top && top.doScroll ) {
747
+ (function doScrollCheck() {
748
+ if ( !jQuery.isReady ) {
749
+ try {
750
+ // Use the trick by Diego Perini
751
+ // http://javascript.nwbox.com/IEContentLoaded/
752
+ top.doScroll("left");
753
+ } catch(e) {
754
+ return setTimeout( doScrollCheck, 50 );
755
+ }
756
+ // detach all dom ready events
757
+ detach();
758
+ // and execute any waiting functions
759
+ jQuery.ready();
760
+ }
761
+ })();
762
+ }
763
+ }
764
+ }
765
+ return readyList.promise( obj );
766
+ };
767
+ // Populate the class2type map
768
+ jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
769
+ class2type[ "[object " + name + "]" ] = name.toLowerCase();
770
+ });
771
+ function isArraylike( obj ) {
772
+ var length = obj.length,
773
+ type = jQuery.type( obj );
774
+ if ( jQuery.isWindow( obj ) ) {
775
+ return false;
776
+ }
777
+ if ( obj.nodeType === 1 && length ) {
778
+ return true;
779
+ }
780
+ return type === "array" || type !== "function" &&
781
+ ( length === 0 ||
782
+ typeof length === "number" && length > 0 && ( length - 1 ) in obj );
783
+ }
784
+ // All jQuery objects should point back to these
785
+ rootjQuery = jQuery(document);
786
+ // String to Object options format cache
787
+ var optionsCache = {};
788
+ // Convert String-formatted options into Object-formatted ones and store in cache
789
+ function createOptions( options ) {
790
+ var object = optionsCache[ options ] = {};
791
+ jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {
792
+ object[ flag ] = true;
793
+ });
794
+ return object;
795
+ }
796
+ /*
797
+ * Create a callback list using the following parameters:
798
+ *
799
+ * options: an optional list of space-separated options that will change how
800
+ * the callback list behaves or a more traditional option object
801
+ *
802
+ * By default a callback list will act like an event callback list and can be
803
+ * "fired" multiple times.
804
+ *
805
+ * Possible options:
806
+ *
807
+ * once: will ensure the callback list can only be fired once (like a Deferred)
808
+ *
809
+ * memory: will keep track of previous values and will call any callback added
810
+ * after the list has been fired right away with the latest "memorized"
811
+ * values (like a Deferred)
812
+ *
813
+ * unique: will ensure a callback can only be added once (no duplicate in the list)
814
+ *
815
+ * stopOnFalse: interrupt callings when a callback returns false
816
+ *
817
+ */
818
+ jQuery.Callbacks = function( options ) {
819
+ // Convert options from String-formatted to Object-formatted if needed
820
+ // (we check in cache first)
821
+ options = typeof options === "string" ?
822
+ ( optionsCache[ options ] || createOptions( options ) ) :
823
+ jQuery.extend( {}, options );
824
+ var // Flag to know if list is currently firing
825
+ firing,
826
+ // Last fire value (for non-forgettable lists)
827
+ memory,
828
+ // Flag to know if list was already fired
829
+ fired,
830
+ // End of the loop when firing
831
+ firingLength,
832
+ // Index of currently firing callback (modified by remove if needed)
833
+ firingIndex,
834
+ // First callback to fire (used internally by add and fireWith)
835
+ firingStart,
836
+ // Actual callback list
837
+ list = [],
838
+ // Stack of fire calls for repeatable lists
839
+ stack = !options.once && [],
840
+ // Fire callbacks
841
+ fire = function( data ) {
842
+ memory = options.memory && data;
843
+ fired = true;
844
+ firingIndex = firingStart || 0;
845
+ firingStart = 0;
846
+ firingLength = list.length;
847
+ firing = true;
848
+ for ( ; list && firingIndex < firingLength; firingIndex++ ) {
849
+ if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
850
+ memory = false; // To prevent further calls using add
851
+ break;
852
+ }
853
+ }
854
+ firing = false;
855
+ if ( list ) {
856
+ if ( stack ) {
857
+ if ( stack.length ) {
858
+ fire( stack.shift() );
859
+ }
860
+ } else if ( memory ) {
861
+ list = [];
862
+ } else {
863
+ self.disable();
864
+ }
865
+ }
866
+ },
867
+ // Actual Callbacks object
868
+ self = {
869
+ // Add a callback or a collection of callbacks to the list
870
+ add: function() {
871
+ if ( list ) {
872
+ // First, we save the current length
873
+ var start = list.length;
874
+ (function add( args ) {
875
+ jQuery.each( args, function( _, arg ) {
876
+ var type = jQuery.type( arg );
877
+ if ( type === "function" ) {
878
+ if ( !options.unique || !self.has( arg ) ) {
879
+ list.push( arg );
880
+ }
881
+ } else if ( arg && arg.length && type !== "string" ) {
882
+ // Inspect recursively
883
+ add( arg );
884
+ }
885
+ });
886
+ })( arguments );
887
+ // Do we need to add the callbacks to the
888
+ // current firing batch?
889
+ if ( firing ) {
890
+ firingLength = list.length;
891
+ // With memory, if we're not firing then
892
+ // we should call right away
893
+ } else if ( memory ) {
894
+ firingStart = start;
895
+ fire( memory );
896
+ }
897
+ }
898
+ return this;
899
+ },
900
+ // Remove a callback from the list
901
+ remove: function() {
902
+ if ( list ) {
903
+ jQuery.each( arguments, function( _, arg ) {
904
+ var index;
905
+ while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
906
+ list.splice( index, 1 );
907
+ // Handle firing indexes
908
+ if ( firing ) {
909
+ if ( index <= firingLength ) {
910
+ firingLength--;
911
+ }
912
+ if ( index <= firingIndex ) {
913
+ firingIndex--;
914
+ }
915
+ }
916
+ }
917
+ });
918
+ }
919
+ return this;
920
+ },
921
+ // Check if a given callback is in the list.
922
+ // If no argument is given, return whether or not list has callbacks attached.
923
+ has: function( fn ) {
924
+ return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
925
+ },
926
+ // Remove all callbacks from the list
927
+ empty: function() {
928
+ list = [];
929
+ return this;
930
+ },
931
+ // Have the list do nothing anymore
932
+ disable: function() {
933
+ list = stack = memory = undefined;
934
+ return this;
935
+ },
936
+ // Is it disabled?
937
+ disabled: function() {
938
+ return !list;
939
+ },
940
+ // Lock the list in its current state
941
+ lock: function() {
942
+ stack = undefined;
943
+ if ( !memory ) {
944
+ self.disable();
945
+ }
946
+ return this;
947
+ },
948
+ // Is it locked?
949
+ locked: function() {
950
+ return !stack;
951
+ },
952
+ // Call all callbacks with the given context and arguments
953
+ fireWith: function( context, args ) {
954
+ args = args || [];
955
+ args = [ context, args.slice ? args.slice() : args ];
956
+ if ( list && ( !fired || stack ) ) {
957
+ if ( firing ) {
958
+ stack.push( args );
959
+ } else {
960
+ fire( args );
961
+ }
962
+ }
963
+ return this;
964
+ },
965
+ // Call all the callbacks with the given arguments
966
+ fire: function() {
967
+ self.fireWith( this, arguments );
968
+ return this;
969
+ },
970
+ // To know if the callbacks have already been called at least once
971
+ fired: function() {
972
+ return !!fired;
973
+ }
974
+ };
975
+ return self;
976
+ };
977
+ jQuery.extend({
978
+ Deferred: function( func ) {
979
+ var tuples = [
980
+ // action, add listener, listener list, final state
981
+ [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
982
+ [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
983
+ [ "notify", "progress", jQuery.Callbacks("memory") ]
984
+ ],
985
+ state = "pending",
986
+ promise = {
987
+ state: function() {
988
+ return state;
989
+ },
990
+ always: function() {
991
+ deferred.done( arguments ).fail( arguments );
992
+ return this;
993
+ },
994
+ then: function( /* fnDone, fnFail, fnProgress */ ) {
995
+ var fns = arguments;
996
+ return jQuery.Deferred(function( newDefer ) {
997
+ jQuery.each( tuples, function( i, tuple ) {
998
+ var action = tuple[ 0 ],
999
+ fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
1000
+ // deferred[ done | fail | progress ] for forwarding actions to newDefer
1001
+ deferred[ tuple[1] ](function() {
1002
+ var returned = fn && fn.apply( this, arguments );
1003
+ if ( returned && jQuery.isFunction( returned.promise ) ) {
1004
+ returned.promise()
1005
+ .done( newDefer.resolve )
1006
+ .fail( newDefer.reject )
1007
+ .progress( newDefer.notify );
1008
+ } else {
1009
+ newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
1010
+ }
1011
+ });
1012
+ });
1013
+ fns = null;
1014
+ }).promise();
1015
+ },
1016
+ // Get a promise for this deferred
1017
+ // If obj is provided, the promise aspect is added to the object
1018
+ promise: function( obj ) {
1019
+ return obj != null ? jQuery.extend( obj, promise ) : promise;
1020
+ }
1021
+ },
1022
+ deferred = {};
1023
+ // Keep pipe for back-compat
1024
+ promise.pipe = promise.then;
1025
+ // Add list-specific methods
1026
+ jQuery.each( tuples, function( i, tuple ) {
1027
+ var list = tuple[ 2 ],
1028
+ stateString = tuple[ 3 ];
1029
+ // promise[ done | fail | progress ] = list.add
1030
+ promise[ tuple[1] ] = list.add;
1031
+ // Handle state
1032
+ if ( stateString ) {
1033
+ list.add(function() {
1034
+ // state = [ resolved | rejected ]
1035
+ state = stateString;
1036
+ // [ reject_list | resolve_list ].disable; progress_list.lock
1037
+ }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
1038
+ }
1039
+ // deferred[ resolve | reject | notify ]
1040
+ deferred[ tuple[0] ] = function() {
1041
+ deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
1042
+ return this;
1043
+ };
1044
+ deferred[ tuple[0] + "With" ] = list.fireWith;
1045
+ });
1046
+ // Make the deferred a promise
1047
+ promise.promise( deferred );
1048
+ // Call given func if any
1049
+ if ( func ) {
1050
+ func.call( deferred, deferred );
1051
+ }
1052
+ // All done!
1053
+ return deferred;
1054
+ },
1055
+ // Deferred helper
1056
+ when: function( subordinate /* , ..., subordinateN */ ) {
1057
+ var i = 0,
1058
+ resolveValues = core_slice.call( arguments ),
1059
+ length = resolveValues.length,
1060
+ // the count of uncompleted subordinates
1061
+ remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
1062
+ // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
1063
+ deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
1064
+ // Update function for both resolve and progress values
1065
+ updateFunc = function( i, contexts, values ) {
1066
+ return function( value ) {
1067
+ contexts[ i ] = this;
1068
+ values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
1069
+ if( values === progressValues ) {
1070
+ deferred.notifyWith( contexts, values );
1071
+ } else if ( !( --remaining ) ) {
1072
+ deferred.resolveWith( contexts, values );
1073
+ }
1074
+ };
1075
+ },
1076
+ progressValues, progressContexts, resolveContexts;
1077
+ // add listeners to Deferred subordinates; treat others as resolved
1078
+ if ( length > 1 ) {
1079
+ progressValues = new Array( length );
1080
+ progressContexts = new Array( length );
1081
+ resolveContexts = new Array( length );
1082
+ for ( ; i < length; i++ ) {
1083
+ if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
1084
+ resolveValues[ i ].promise()
1085
+ .done( updateFunc( i, resolveContexts, resolveValues ) )
1086
+ .fail( deferred.reject )
1087
+ .progress( updateFunc( i, progressContexts, progressValues ) );
1088
+ } else {
1089
+ --remaining;
1090
+ }
1091
+ }
1092
+ }
1093
+ // if we're not waiting on anything, resolve the master
1094
+ if ( !remaining ) {
1095
+ deferred.resolveWith( resolveContexts, resolveValues );
1096
+ }
1097
+ return deferred.promise();
1098
+ }
1099
+ });
1100
+ jQuery.support = (function() {
1101
+ var support, all, a,
1102
+ input, select, fragment,
1103
+ opt, eventName, isSupported, i,
1104
+ div = document.createElement("div");
1105
+ // Setup
1106
+ div.setAttribute( "className", "t" );
1107
+ div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
1108
+ // Support tests won't run in some limited or non-browser environments
1109
+ all = div.getElementsByTagName("*");
1110
+ a = div.getElementsByTagName("a")[ 0 ];
1111
+ if ( !all || !a || !all.length ) {
1112
+ return {};
1113
+ }
1114
+ // First batch of tests
1115
+ select = document.createElement("select");
1116
+ opt = select.appendChild( document.createElement("option") );
1117
+ input = div.getElementsByTagName("input")[ 0 ];
1118
+ a.style.cssText = "top:1px;float:left;opacity:.5";
1119
+ support = {
1120
+ // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
1121
+ getSetAttribute: div.className !== "t",
1122
+ // IE strips leading whitespace when .innerHTML is used
1123
+ leadingWhitespace: div.firstChild.nodeType === 3,
1124
+ // Make sure that tbody elements aren't automatically inserted
1125
+ // IE will insert them into empty tables
1126
+ tbody: !div.getElementsByTagName("tbody").length,
1127
+ // Make sure that link elements get serialized correctly by innerHTML
1128
+ // This requires a wrapper element in IE
1129
+ htmlSerialize: !!div.getElementsByTagName("link").length,
1130
+ // Get the style information from getAttribute
1131
+ // (IE uses .cssText instead)
1132
+ style: /top/.test( a.getAttribute("style") ),
1133
+ // Make sure that URLs aren't manipulated
1134
+ // (IE normalizes it by default)
1135
+ hrefNormalized: a.getAttribute("href") === "/a",
1136
+ // Make sure that element opacity exists
1137
+ // (IE uses filter instead)
1138
+ // Use a regex to work around a WebKit issue. See #5145
1139
+ opacity: /^0.5/.test( a.style.opacity ),
1140
+ // Verify style float existence
1141
+ // (IE uses styleFloat instead of cssFloat)
1142
+ cssFloat: !!a.style.cssFloat,
1143
+ // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
1144
+ checkOn: !!input.value,
1145
+ // Make sure that a selected-by-default option has a working selected property.
1146
+ // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
1147
+ optSelected: opt.selected,
1148
+ // Tests for enctype support on a form (#6743)
1149
+ enctype: !!document.createElement("form").enctype,
1150
+ // Makes sure cloning an html5 element does not cause problems
1151
+ // Where outerHTML is undefined, this still works
1152
+ html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
1153
+ // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
1154
+ boxModel: document.compatMode === "CSS1Compat",
1155
+ // Will be defined later
1156
+ deleteExpando: true,
1157
+ noCloneEvent: true,
1158
+ inlineBlockNeedsLayout: false,
1159
+ shrinkWrapBlocks: false,
1160
+ reliableMarginRight: true,
1161
+ boxSizingReliable: true,
1162
+ pixelPosition: false
1163
+ };
1164
+ // Make sure checked status is properly cloned
1165
+ input.checked = true;
1166
+ support.noCloneChecked = input.cloneNode( true ).checked;
1167
+ // Make sure that the options inside disabled selects aren't marked as disabled
1168
+ // (WebKit marks them as disabled)
1169
+ select.disabled = true;
1170
+ support.optDisabled = !opt.disabled;
1171
+ // Support: IE<9
1172
+ try {
1173
+ delete div.test;
1174
+ } catch( e ) {
1175
+ support.deleteExpando = false;
1176
+ }
1177
+ // Check if we can trust getAttribute("value")
1178
+ input = document.createElement("input");
1179
+ input.setAttribute( "value", "" );
1180
+ support.input = input.getAttribute( "value" ) === "";
1181
+ // Check if an input maintains its value after becoming a radio
1182
+ input.value = "t";
1183
+ input.setAttribute( "type", "radio" );
1184
+ support.radioValue = input.value === "t";
1185
+ // #11217 - WebKit loses check when the name is after the checked attribute
1186
+ input.setAttribute( "checked", "t" );
1187
+ input.setAttribute( "name", "t" );
1188
+ fragment = document.createDocumentFragment();
1189
+ fragment.appendChild( input );
1190
+ // Check if a disconnected checkbox will retain its checked
1191
+ // value of true after appended to the DOM (IE6/7)
1192
+ support.appendChecked = input.checked;
1193
+ // WebKit doesn't clone checked state correctly in fragments
1194
+ support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
1195
+ // Support: IE<9
1196
+ // Opera does not clone events (and typeof div.attachEvent === undefined).
1197
+ // IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
1198
+ if ( div.attachEvent ) {
1199
+ div.attachEvent( "onclick", function() {
1200
+ support.noCloneEvent = false;
1201
+ });
1202
+ div.cloneNode( true ).click();
1203
+ }
1204
+ // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
1205
+ // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php
1206
+ for ( i in { submit: true, change: true, focusin: true }) {
1207
+ div.setAttribute( eventName = "on" + i, "t" );
1208
+ support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
1209
+ }
1210
+ div.style.backgroundClip = "content-box";
1211
+ div.cloneNode( true ).style.backgroundClip = "";
1212
+ support.clearCloneStyle = div.style.backgroundClip === "content-box";
1213
+ // Run tests that need a body at doc ready
1214
+ jQuery(function() {
1215
+ var container, marginDiv, tds,
1216
+ divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
1217
+ body = document.getElementsByTagName("body")[0];
1218
+ if ( !body ) {
1219
+ // Return for frameset docs that don't have a body
1220
+ return;
1221
+ }
1222
+ container = document.createElement("div");
1223
+ container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
1224
+ body.appendChild( container ).appendChild( div );
1225
+ // Support: IE8
1226
+ // Check if table cells still have offsetWidth/Height when they are set
1227
+ // to display:none and there are still other visible table cells in a
1228
+ // table row; if so, offsetWidth/Height are not reliable for use when
1229
+ // determining if an element has been hidden directly using
1230
+ // display:none (it is still safe to use offsets if a parent element is
1231
+ // hidden; don safety goggles and see bug #4512 for more information).
1232
+ div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
1233
+ tds = div.getElementsByTagName("td");
1234
+ tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
1235
+ isSupported = ( tds[ 0 ].offsetHeight === 0 );
1236
+ tds[ 0 ].style.display = "";
1237
+ tds[ 1 ].style.display = "none";
1238
+ // Support: IE8
1239
+ // Check if empty table cells still have offsetWidth/Height
1240
+ support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
1241
+ // Check box-sizing and margin behavior
1242
+ div.innerHTML = "";
1243
+ div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
1244
+ support.boxSizing = ( div.offsetWidth === 4 );
1245
+ support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
1246
+ // Use window.getComputedStyle because jsdom on node.js will break without it.
1247
+ if ( window.getComputedStyle ) {
1248
+ support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
1249
+ support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
1250
+ // Check if div with explicit width and no margin-right incorrectly
1251
+ // gets computed margin-right based on width of container. (#3333)
1252
+ // Fails in WebKit before Feb 2011 nightlies
1253
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
1254
+ marginDiv = div.appendChild( document.createElement("div") );
1255
+ marginDiv.style.cssText = div.style.cssText = divReset;
1256
+ marginDiv.style.marginRight = marginDiv.style.width = "0";
1257
+ div.style.width = "1px";
1258
+ support.reliableMarginRight =
1259
+ !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
1260
+ }
1261
+ if ( typeof div.style.zoom !== core_strundefined ) {
1262
+ // Support: IE<8
1263
+ // Check if natively block-level elements act like inline-block
1264
+ // elements when setting their display to 'inline' and giving
1265
+ // them layout
1266
+ div.innerHTML = "";
1267
+ div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
1268
+ support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
1269
+ // Support: IE6
1270
+ // Check if elements with layout shrink-wrap their children
1271
+ div.style.display = "block";
1272
+ div.innerHTML = "<div></div>";
1273
+ div.firstChild.style.width = "5px";
1274
+ support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
1275
+ if ( support.inlineBlockNeedsLayout ) {
1276
+ // Prevent IE 6 from affecting layout for positioned elements #11048
1277
+ // Prevent IE from shrinking the body in IE 7 mode #12869
1278
+ // Support: IE<8
1279
+ body.style.zoom = 1;
1280
+ }
1281
+ }
1282
+ body.removeChild( container );
1283
+ // Null elements to avoid leaks in IE
1284
+ container = div = tds = marginDiv = null;
1285
+ });
1286
+ // Null elements to avoid leaks in IE
1287
+ all = select = fragment = opt = a = input = null;
1288
+ return support;
1289
+ })();
1290
+ var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
1291
+ rmultiDash = /([A-Z])/g;
1292
+ function internalData( elem, name, data, pvt /* Internal Use Only */ ){
1293
+ if ( !jQuery.acceptData( elem ) ) {
1294
+ return;
1295
+ }
1296
+ var thisCache, ret,
1297
+ internalKey = jQuery.expando,
1298
+ getByName = typeof name === "string",
1299
+ // We have to handle DOM nodes and JS objects differently because IE6-7
1300
+ // can't GC object references properly across the DOM-JS boundary
1301
+ isNode = elem.nodeType,
1302
+ // Only DOM nodes need the global jQuery cache; JS object data is
1303
+ // attached directly to the object so GC can occur automatically
1304
+ cache = isNode ? jQuery.cache : elem,
1305
+ // Only defining an ID for JS objects if its cache already exists allows
1306
+ // the code to shortcut on the same path as a DOM node with no cache
1307
+ id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
1308
+ // Avoid doing any more work than we need to when trying to get data on an
1309
+ // object that has no data at all
1310
+ if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
1311
+ return;
1312
+ }
1313
+ if ( !id ) {
1314
+ // Only DOM nodes need a new unique ID for each element since their data
1315
+ // ends up in the global cache
1316
+ if ( isNode ) {
1317
+ elem[ internalKey ] = id = core_deletedIds.pop() || jQuery.guid++;
1318
+ } else {
1319
+ id = internalKey;
1320
+ }
1321
+ }
1322
+ if ( !cache[ id ] ) {
1323
+ cache[ id ] = {};
1324
+ // Avoids exposing jQuery metadata on plain JS objects when the object
1325
+ // is serialized using JSON.stringify
1326
+ if ( !isNode ) {
1327
+ cache[ id ].toJSON = jQuery.noop;
1328
+ }
1329
+ }
1330
+ // An object can be passed to jQuery.data instead of a key/value pair; this gets
1331
+ // shallow copied over onto the existing cache
1332
+ if ( typeof name === "object" || typeof name === "function" ) {
1333
+ if ( pvt ) {
1334
+ cache[ id ] = jQuery.extend( cache[ id ], name );
1335
+ } else {
1336
+ cache[ id ].data = jQuery.extend( cache[ id ].data, name );
1337
+ }
1338
+ }
1339
+ thisCache = cache[ id ];
1340
+ // jQuery data() is stored in a separate object inside the object's internal data
1341
+ // cache in order to avoid key collisions between internal data and user-defined
1342
+ // data.
1343
+ if ( !pvt ) {
1344
+ if ( !thisCache.data ) {
1345
+ thisCache.data = {};
1346
+ }
1347
+ thisCache = thisCache.data;
1348
+ }
1349
+ if ( data !== undefined ) {
1350
+ thisCache[ jQuery.camelCase( name ) ] = data;
1351
+ }
1352
+ // Check for both converted-to-camel and non-converted data property names
1353
+ // If a data property was specified
1354
+ if ( getByName ) {
1355
+ // First Try to find as-is property data
1356
+ ret = thisCache[ name ];
1357
+ // Test for null|undefined property data
1358
+ if ( ret == null ) {
1359
+ // Try to find the camelCased property
1360
+ ret = thisCache[ jQuery.camelCase( name ) ];
1361
+ }
1362
+ } else {
1363
+ ret = thisCache;
1364
+ }
1365
+ return ret;
1366
+ }
1367
+ function internalRemoveData( elem, name, pvt ) {
1368
+ if ( !jQuery.acceptData( elem ) ) {
1369
+ return;
1370
+ }
1371
+ var i, l, thisCache,
1372
+ isNode = elem.nodeType,
1373
+ // See jQuery.data for more information
1374
+ cache = isNode ? jQuery.cache : elem,
1375
+ id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
1376
+ // If there is already no cache entry for this object, there is no
1377
+ // purpose in continuing
1378
+ if ( !cache[ id ] ) {
1379
+ return;
1380
+ }
1381
+ if ( name ) {
1382
+ thisCache = pvt ? cache[ id ] : cache[ id ].data;
1383
+ if ( thisCache ) {
1384
+ // Support array or space separated string names for data keys
1385
+ if ( !jQuery.isArray( name ) ) {
1386
+ // try the string as a key before any manipulation
1387
+ if ( name in thisCache ) {
1388
+ name = [ name ];
1389
+ } else {
1390
+ // split the camel cased version by spaces unless a key with the spaces exists
1391
+ name = jQuery.camelCase( name );
1392
+ if ( name in thisCache ) {
1393
+ name = [ name ];
1394
+ } else {
1395
+ name = name.split(" ");
1396
+ }
1397
+ }
1398
+ } else {
1399
+ // If "name" is an array of keys...
1400
+ // When data is initially created, via ("key", "val") signature,
1401
+ // keys will be converted to camelCase.
1402
+ // Since there is no way to tell _how_ a key was added, remove
1403
+ // both plain key and camelCase key. #12786
1404
+ // This will only penalize the array argument path.
1405
+ name = name.concat( jQuery.map( name, jQuery.camelCase ) );
1406
+ }
1407
+ for ( i = 0, l = name.length; i < l; i++ ) {
1408
+ delete thisCache[ name[i] ];
1409
+ }
1410
+ // If there is no data left in the cache, we want to continue
1411
+ // and let the cache object itself get destroyed
1412
+ if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
1413
+ return;
1414
+ }
1415
+ }
1416
+ }
1417
+ // See jQuery.data for more information
1418
+ if ( !pvt ) {
1419
+ delete cache[ id ].data;
1420
+ // Don't destroy the parent cache unless the internal data object
1421
+ // had been the only thing left in it
1422
+ if ( !isEmptyDataObject( cache[ id ] ) ) {
1423
+ return;
1424
+ }
1425
+ }
1426
+ // Destroy the cache
1427
+ if ( isNode ) {
1428
+ jQuery.cleanData( [ elem ], true );
1429
+ // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
1430
+ } else if ( jQuery.support.deleteExpando || cache != cache.window ) {
1431
+ delete cache[ id ];
1432
+ // When all else fails, null
1433
+ } else {
1434
+ cache[ id ] = null;
1435
+ }
1436
+ }
1437
+ jQuery.extend({
1438
+ cache: {},
1439
+ // Unique for each copy of jQuery on the page
1440
+ // Non-digits removed to match rinlinejQuery
1441
+ expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
1442
+ // The following elements throw uncatchable exceptions if you
1443
+ // attempt to add expando properties to them.
1444
+ noData: {
1445
+ "embed": true,
1446
+ // Ban all objects except for Flash (which handle expandos)
1447
+ "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
1448
+ "applet": true
1449
+ },
1450
+ hasData: function( elem ) {
1451
+ elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
1452
+ return !!elem && !isEmptyDataObject( elem );
1453
+ },
1454
+ data: function( elem, name, data ) {
1455
+ return internalData( elem, name, data );
1456
+ },
1457
+ removeData: function( elem, name ) {
1458
+ return internalRemoveData( elem, name );
1459
+ },
1460
+ // For internal use only.
1461
+ _data: function( elem, name, data ) {
1462
+ return internalData( elem, name, data, true );
1463
+ },
1464
+ _removeData: function( elem, name ) {
1465
+ return internalRemoveData( elem, name, true );
1466
+ },
1467
+ // A method for determining if a DOM node can handle the data expando
1468
+ acceptData: function( elem ) {
1469
+ // Do not set data on non-element because it will not be cleared (#8335).
1470
+ if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {
1471
+ return false;
1472
+ }
1473
+ var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
1474
+ // nodes accept data unless otherwise specified; rejection can be conditional
1475
+ return !noData || noData !== true && elem.getAttribute("classid") === noData;
1476
+ }
1477
+ });
1478
+ jQuery.fn.extend({
1479
+ data: function( key, value ) {
1480
+ var attrs, name,
1481
+ elem = this[0],
1482
+ i = 0,
1483
+ data = null;
1484
+ // Gets all values
1485
+ if ( key === undefined ) {
1486
+ if ( this.length ) {
1487
+ data = jQuery.data( elem );
1488
+ if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
1489
+ attrs = elem.attributes;
1490
+ for ( ; i < attrs.length; i++ ) {
1491
+ name = attrs[i].name;
1492
+ if ( !name.indexOf( "data-" ) ) {
1493
+ name = jQuery.camelCase( name.slice(5) );
1494
+ dataAttr( elem, name, data[ name ] );
1495
+ }
1496
+ }
1497
+ jQuery._data( elem, "parsedAttrs", true );
1498
+ }
1499
+ }
1500
+ return data;
1501
+ }
1502
+ // Sets multiple values
1503
+ if ( typeof key === "object" ) {
1504
+ return this.each(function() {
1505
+ jQuery.data( this, key );
1506
+ });
1507
+ }
1508
+ return jQuery.access( this, function( value ) {
1509
+ if ( value === undefined ) {
1510
+ // Try to fetch any internally stored data first
1511
+ return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
1512
+ }
1513
+ this.each(function() {
1514
+ jQuery.data( this, key, value );
1515
+ });
1516
+ }, null, value, arguments.length > 1, null, true );
1517
+ },
1518
+ removeData: function( key ) {
1519
+ return this.each(function() {
1520
+ jQuery.removeData( this, key );
1521
+ });
1522
+ }
1523
+ });
1524
+ function dataAttr( elem, key, data ) {
1525
+ // If nothing was found internally, try to fetch any
1526
+ // data from the HTML5 data-* attribute
1527
+ if ( data === undefined && elem.nodeType === 1 ) {
1528
+ var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
1529
+ data = elem.getAttribute( name );
1530
+ if ( typeof data === "string" ) {
1531
+ try {
1532
+ data = data === "true" ? true :
1533
+ data === "false" ? false :
1534
+ data === "null" ? null :
1535
+ // Only convert to a number if it doesn't change the string
1536
+ +data + "" === data ? +data :
1537
+ rbrace.test( data ) ? jQuery.parseJSON( data ) :
1538
+ data;
1539
+ } catch( e ) {}
1540
+ // Make sure we set the data so it isn't changed later
1541
+ jQuery.data( elem, key, data );
1542
+ } else {
1543
+ data = undefined;
1544
+ }
1545
+ }
1546
+ return data;
1547
+ }
1548
+ // checks a cache object for emptiness
1549
+ function isEmptyDataObject( obj ) {
1550
+ var name;
1551
+ for ( name in obj ) {
1552
+ // if the public data object is empty, the private is still empty
1553
+ if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
1554
+ continue;
1555
+ }
1556
+ if ( name !== "toJSON" ) {
1557
+ return false;
1558
+ }
1559
+ }
1560
+ return true;
1561
+ }
1562
+ jQuery.extend({
1563
+ queue: function( elem, type, data ) {
1564
+ var queue;
1565
+ if ( elem ) {
1566
+ type = ( type || "fx" ) + "queue";
1567
+ queue = jQuery._data( elem, type );
1568
+ // Speed up dequeue by getting out quickly if this is just a lookup
1569
+ if ( data ) {
1570
+ if ( !queue || jQuery.isArray(data) ) {
1571
+ queue = jQuery._data( elem, type, jQuery.makeArray(data) );
1572
+ } else {
1573
+ queue.push( data );
1574
+ }
1575
+ }
1576
+ return queue || [];
1577
+ }
1578
+ },
1579
+ dequeue: function( elem, type ) {
1580
+ type = type || "fx";
1581
+ var queue = jQuery.queue( elem, type ),
1582
+ startLength = queue.length,
1583
+ fn = queue.shift(),
1584
+ hooks = jQuery._queueHooks( elem, type ),
1585
+ next = function() {
1586
+ jQuery.dequeue( elem, type );
1587
+ };
1588
+ // If the fx queue is dequeued, always remove the progress sentinel
1589
+ if ( fn === "inprogress" ) {
1590
+ fn = queue.shift();
1591
+ startLength--;
1592
+ }
1593
+ hooks.cur = fn;
1594
+ if ( fn ) {
1595
+ // Add a progress sentinel to prevent the fx queue from being
1596
+ // automatically dequeued
1597
+ if ( type === "fx" ) {
1598
+ queue.unshift( "inprogress" );
1599
+ }
1600
+ // clear up the last queue stop function
1601
+ delete hooks.stop;
1602
+ fn.call( elem, next, hooks );
1603
+ }
1604
+ if ( !startLength && hooks ) {
1605
+ hooks.empty.fire();
1606
+ }
1607
+ },
1608
+ // not intended for public consumption - generates a queueHooks object, or returns the current one
1609
+ _queueHooks: function( elem, type ) {
1610
+ var key = type + "queueHooks";
1611
+ return jQuery._data( elem, key ) || jQuery._data( elem, key, {
1612
+ empty: jQuery.Callbacks("once memory").add(function() {
1613
+ jQuery._removeData( elem, type + "queue" );
1614
+ jQuery._removeData( elem, key );
1615
+ })
1616
+ });
1617
+ }
1618
+ });
1619
+ jQuery.fn.extend({
1620
+ queue: function( type, data ) {
1621
+ var setter = 2;
1622
+ if ( typeof type !== "string" ) {
1623
+ data = type;
1624
+ type = "fx";
1625
+ setter--;
1626
+ }
1627
+ if ( arguments.length < setter ) {
1628
+ return jQuery.queue( this[0], type );
1629
+ }
1630
+ return data === undefined ?
1631
+ this :
1632
+ this.each(function() {
1633
+ var queue = jQuery.queue( this, type, data );
1634
+ // ensure a hooks for this queue
1635
+ jQuery._queueHooks( this, type );
1636
+ if ( type === "fx" && queue[0] !== "inprogress" ) {
1637
+ jQuery.dequeue( this, type );
1638
+ }
1639
+ });
1640
+ },
1641
+ dequeue: function( type ) {
1642
+ return this.each(function() {
1643
+ jQuery.dequeue( this, type );
1644
+ });
1645
+ },
1646
+ // Based off of the plugin by Clint Helfers, with permission.
1647
+ // http://blindsignals.com/index.php/2009/07/jquery-delay/
1648
+ delay: function( time, type ) {
1649
+ time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
1650
+ type = type || "fx";
1651
+ return this.queue( type, function( next, hooks ) {
1652
+ var timeout = setTimeout( next, time );
1653
+ hooks.stop = function() {
1654
+ clearTimeout( timeout );
1655
+ };
1656
+ });
1657
+ },
1658
+ clearQueue: function( type ) {
1659
+ return this.queue( type || "fx", [] );
1660
+ },
1661
+ // Get a promise resolved when queues of a certain type
1662
+ // are emptied (fx is the type by default)
1663
+ promise: function( type, obj ) {
1664
+ var tmp,
1665
+ count = 1,
1666
+ defer = jQuery.Deferred(),
1667
+ elements = this,
1668
+ i = this.length,
1669
+ resolve = function() {
1670
+ if ( !( --count ) ) {
1671
+ defer.resolveWith( elements, [ elements ] );
1672
+ }
1673
+ };
1674
+ if ( typeof type !== "string" ) {
1675
+ obj = type;
1676
+ type = undefined;
1677
+ }
1678
+ type = type || "fx";
1679
+ while( i-- ) {
1680
+ tmp = jQuery._data( elements[ i ], type + "queueHooks" );
1681
+ if ( tmp && tmp.empty ) {
1682
+ count++;
1683
+ tmp.empty.add( resolve );
1684
+ }
1685
+ }
1686
+ resolve();
1687
+ return defer.promise( obj );
1688
+ }
1689
+ });
1690
+ var nodeHook, boolHook,
1691
+ rclass = /[\t\r\n]/g,
1692
+ rreturn = /\r/g,
1693
+ rfocusable = /^(?:input|select|textarea|button|object)$/i,
1694
+ rclickable = /^(?:a|area)$/i,
1695
+ rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,
1696
+ ruseDefault = /^(?:checked|selected)$/i,
1697
+ getSetAttribute = jQuery.support.getSetAttribute,
1698
+ getSetInput = jQuery.support.input;
1699
+ jQuery.fn.extend({
1700
+ attr: function( name, value ) {
1701
+ return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
1702
+ },
1703
+ removeAttr: function( name ) {
1704
+ return this.each(function() {
1705
+ jQuery.removeAttr( this, name );
1706
+ });
1707
+ },
1708
+ prop: function( name, value ) {
1709
+ return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
1710
+ },
1711
+ removeProp: function( name ) {
1712
+ name = jQuery.propFix[ name ] || name;
1713
+ return this.each(function() {
1714
+ // try/catch handles cases where IE balks (such as removing a property on window)
1715
+ try {
1716
+ this[ name ] = undefined;
1717
+ delete this[ name ];
1718
+ } catch( e ) {}
1719
+ });
1720
+ },
1721
+ addClass: function( value ) {
1722
+ var classes, elem, cur, clazz, j,
1723
+ i = 0,
1724
+ len = this.length,
1725
+ proceed = typeof value === "string" && value;
1726
+ if ( jQuery.isFunction( value ) ) {
1727
+ return this.each(function( j ) {
1728
+ jQuery( this ).addClass( value.call( this, j, this.className ) );
1729
+ });
1730
+ }
1731
+ if ( proceed ) {
1732
+ // The disjunction here is for better compressibility (see removeClass)
1733
+ classes = ( value || "" ).match( core_rnotwhite ) || [];
1734
+ for ( ; i < len; i++ ) {
1735
+ elem = this[ i ];
1736
+ cur = elem.nodeType === 1 && ( elem.className ?
1737
+ ( " " + elem.className + " " ).replace( rclass, " " ) :
1738
+ " "
1739
+ );
1740
+ if ( cur ) {
1741
+ j = 0;
1742
+ while ( (clazz = classes[j++]) ) {
1743
+ if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
1744
+ cur += clazz + " ";
1745
+ }
1746
+ }
1747
+ elem.className = jQuery.trim( cur );
1748
+ }
1749
+ }
1750
+ }
1751
+ return this;
1752
+ },
1753
+ removeClass: function( value ) {
1754
+ var classes, elem, cur, clazz, j,
1755
+ i = 0,
1756
+ len = this.length,
1757
+ proceed = arguments.length === 0 || typeof value === "string" && value;
1758
+ if ( jQuery.isFunction( value ) ) {
1759
+ return this.each(function( j ) {
1760
+ jQuery( this ).removeClass( value.call( this, j, this.className ) );
1761
+ });
1762
+ }
1763
+ if ( proceed ) {
1764
+ classes = ( value || "" ).match( core_rnotwhite ) || [];
1765
+ for ( ; i < len; i++ ) {
1766
+ elem = this[ i ];
1767
+ // This expression is here for better compressibility (see addClass)
1768
+ cur = elem.nodeType === 1 && ( elem.className ?
1769
+ ( " " + elem.className + " " ).replace( rclass, " " ) :
1770
+ ""
1771
+ );
1772
+ if ( cur ) {
1773
+ j = 0;
1774
+ while ( (clazz = classes[j++]) ) {
1775
+ // Remove *all* instances
1776
+ while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
1777
+ cur = cur.replace( " " + clazz + " ", " " );
1778
+ }
1779
+ }
1780
+ elem.className = value ? jQuery.trim( cur ) : "";
1781
+ }
1782
+ }
1783
+ }
1784
+ return this;
1785
+ },
1786
+ toggleClass: function( value, stateVal ) {
1787
+ var type = typeof value,
1788
+ isBool = typeof stateVal === "boolean";
1789
+ if ( jQuery.isFunction( value ) ) {
1790
+ return this.each(function( i ) {
1791
+ jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
1792
+ });
1793
+ }
1794
+ return this.each(function() {
1795
+ if ( type === "string" ) {
1796
+ // toggle individual class names
1797
+ var className,
1798
+ i = 0,
1799
+ self = jQuery( this ),
1800
+ state = stateVal,
1801
+ classNames = value.match( core_rnotwhite ) || [];
1802
+ while ( (className = classNames[ i++ ]) ) {
1803
+ // check each className given, space separated list
1804
+ state = isBool ? state : !self.hasClass( className );
1805
+ self[ state ? "addClass" : "removeClass" ]( className );
1806
+ }
1807
+ // Toggle whole class name
1808
+ } else if ( type === core_strundefined || type === "boolean" ) {
1809
+ if ( this.className ) {
1810
+ // store className if set
1811
+ jQuery._data( this, "__className__", this.className );
1812
+ }
1813
+ // If the element has a class name or if we're passed "false",
1814
+ // then remove the whole classname (if there was one, the above saved it).
1815
+ // Otherwise bring back whatever was previously saved (if anything),
1816
+ // falling back to the empty string if nothing was stored.
1817
+ this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
1818
+ }
1819
+ });
1820
+ },
1821
+ hasClass: function( selector ) {
1822
+ var className = " " + selector + " ",
1823
+ i = 0,
1824
+ l = this.length;
1825
+ for ( ; i < l; i++ ) {
1826
+ if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
1827
+ return true;
1828
+ }
1829
+ }
1830
+ return false;
1831
+ },
1832
+ val: function( value ) {
1833
+ var ret, hooks, isFunction,
1834
+ elem = this[0];
1835
+ if ( !arguments.length ) {
1836
+ if ( elem ) {
1837
+ hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
1838
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
1839
+ return ret;
1840
+ }
1841
+ ret = elem.value;
1842
+ return typeof ret === "string" ?
1843
+ // handle most common string cases
1844
+ ret.replace(rreturn, "") :
1845
+ // handle cases where value is null/undef or number
1846
+ ret == null ? "" : ret;
1847
+ }
1848
+ return;
1849
+ }
1850
+ isFunction = jQuery.isFunction( value );
1851
+ return this.each(function( i ) {
1852
+ var val,
1853
+ self = jQuery(this);
1854
+ if ( this.nodeType !== 1 ) {
1855
+ return;
1856
+ }
1857
+ if ( isFunction ) {
1858
+ val = value.call( this, i, self.val() );
1859
+ } else {
1860
+ val = value;
1861
+ }
1862
+ // Treat null/undefined as ""; convert numbers to string
1863
+ if ( val == null ) {
1864
+ val = "";
1865
+ } else if ( typeof val === "number" ) {
1866
+ val += "";
1867
+ } else if ( jQuery.isArray( val ) ) {
1868
+ val = jQuery.map(val, function ( value ) {
1869
+ return value == null ? "" : value + "";
1870
+ });
1871
+ }
1872
+ hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
1873
+ // If set returns undefined, fall back to normal setting
1874
+ if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
1875
+ this.value = val;
1876
+ }
1877
+ });
1878
+ }
1879
+ });
1880
+ jQuery.extend({
1881
+ valHooks: {
1882
+ option: {
1883
+ get: function( elem ) {
1884
+ // attributes.value is undefined in Blackberry 4.7 but
1885
+ // uses .value. See #6932
1886
+ var val = elem.attributes.value;
1887
+ return !val || val.specified ? elem.value : elem.text;
1888
+ }
1889
+ },
1890
+ select: {
1891
+ get: function( elem ) {
1892
+ var value, option,
1893
+ options = elem.options,
1894
+ index = elem.selectedIndex,
1895
+ one = elem.type === "select-one" || index < 0,
1896
+ values = one ? null : [],
1897
+ max = one ? index + 1 : options.length,
1898
+ i = index < 0 ?
1899
+ max :
1900
+ one ? index : 0;
1901
+ // Loop through all the selected options
1902
+ for ( ; i < max; i++ ) {
1903
+ option = options[ i ];
1904
+ // oldIE doesn't update selected after form reset (#2551)
1905
+ if ( ( option.selected || i === index ) &&
1906
+ // Don't return options that are disabled or in a disabled optgroup
1907
+ ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
1908
+ ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
1909
+ // Get the specific value for the option
1910
+ value = jQuery( option ).val();
1911
+ // We don't need an array for one selects
1912
+ if ( one ) {
1913
+ return value;
1914
+ }
1915
+ // Multi-Selects return an array
1916
+ values.push( value );
1917
+ }
1918
+ }
1919
+ return values;
1920
+ },
1921
+ set: function( elem, value ) {
1922
+ var values = jQuery.makeArray( value );
1923
+ jQuery(elem).find("option").each(function() {
1924
+ this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
1925
+ });
1926
+ if ( !values.length ) {
1927
+ elem.selectedIndex = -1;
1928
+ }
1929
+ return values;
1930
+ }
1931
+ }
1932
+ },
1933
+ attr: function( elem, name, value ) {
1934
+ var hooks, notxml, ret,
1935
+ nType = elem.nodeType;
1936
+ // don't get/set attributes on text, comment and attribute nodes
1937
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
1938
+ return;
1939
+ }
1940
+ // Fallback to prop when attributes are not supported
1941
+ if ( typeof elem.getAttribute === core_strundefined ) {
1942
+ return jQuery.prop( elem, name, value );
1943
+ }
1944
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
1945
+ // All attributes are lowercase
1946
+ // Grab necessary hook if one is defined
1947
+ if ( notxml ) {
1948
+ name = name.toLowerCase();
1949
+ hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
1950
+ }
1951
+ if ( value !== undefined ) {
1952
+ if ( value === null ) {
1953
+ jQuery.removeAttr( elem, name );
1954
+ } else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
1955
+ return ret;
1956
+ } else {
1957
+ elem.setAttribute( name, value + "" );
1958
+ return value;
1959
+ }
1960
+ } else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
1961
+ return ret;
1962
+ } else {
1963
+ // In IE9+, Flash objects don't have .getAttribute (#12945)
1964
+ // Support: IE9+
1965
+ if ( typeof elem.getAttribute !== core_strundefined ) {
1966
+ ret = elem.getAttribute( name );
1967
+ }
1968
+ // Non-existent attributes return null, we normalize to undefined
1969
+ return ret == null ?
1970
+ undefined :
1971
+ ret;
1972
+ }
1973
+ },
1974
+ removeAttr: function( elem, value ) {
1975
+ var name, propName,
1976
+ i = 0,
1977
+ attrNames = value && value.match( core_rnotwhite );
1978
+ if ( attrNames && elem.nodeType === 1 ) {
1979
+ while ( (name = attrNames[i++]) ) {
1980
+ propName = jQuery.propFix[ name ] || name;
1981
+ // Boolean attributes get special treatment (#10870)
1982
+ if ( rboolean.test( name ) ) {
1983
+ // Set corresponding property to false for boolean attributes
1984
+ // Also clear defaultChecked/defaultSelected (if appropriate) for IE<8
1985
+ if ( !getSetAttribute && ruseDefault.test( name ) ) {
1986
+ elem[ jQuery.camelCase( "default-" + name ) ] =
1987
+ elem[ propName ] = false;
1988
+ } else {
1989
+ elem[ propName ] = false;
1990
+ }
1991
+ // See #9699 for explanation of this approach (setting first, then removal)
1992
+ } else {
1993
+ jQuery.attr( elem, name, "" );
1994
+ }
1995
+ elem.removeAttribute( getSetAttribute ? name : propName );
1996
+ }
1997
+ }
1998
+ },
1999
+ attrHooks: {
2000
+ type: {
2001
+ set: function( elem, value ) {
2002
+ if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
2003
+ // Setting the type on a radio button after the value resets the value in IE6-9
2004
+ // Reset value to default in case type is set after value during creation
2005
+ var val = elem.value;
2006
+ elem.setAttribute( "type", value );
2007
+ if ( val ) {
2008
+ elem.value = val;
2009
+ }
2010
+ return value;
2011
+ }
2012
+ }
2013
+ }
2014
+ },
2015
+ propFix: {
2016
+ tabindex: "tabIndex",
2017
+ readonly: "readOnly",
2018
+ "for": "htmlFor",
2019
+ "class": "className",
2020
+ maxlength: "maxLength",
2021
+ cellspacing: "cellSpacing",
2022
+ cellpadding: "cellPadding",
2023
+ rowspan: "rowSpan",
2024
+ colspan: "colSpan",
2025
+ usemap: "useMap",
2026
+ frameborder: "frameBorder",
2027
+ contenteditable: "contentEditable"
2028
+ },
2029
+ prop: function( elem, name, value ) {
2030
+ var ret, hooks, notxml,
2031
+ nType = elem.nodeType;
2032
+ // don't get/set properties on text, comment and attribute nodes
2033
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
2034
+ return;
2035
+ }
2036
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
2037
+ if ( notxml ) {
2038
+ // Fix name and attach hooks
2039
+ name = jQuery.propFix[ name ] || name;
2040
+ hooks = jQuery.propHooks[ name ];
2041
+ }
2042
+ if ( value !== undefined ) {
2043
+ if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
2044
+ return ret;
2045
+ } else {
2046
+ return ( elem[ name ] = value );
2047
+ }
2048
+ } else {
2049
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
2050
+ return ret;
2051
+ } else {
2052
+ return elem[ name ];
2053
+ }
2054
+ }
2055
+ },
2056
+ propHooks: {
2057
+ tabIndex: {
2058
+ get: function( elem ) {
2059
+ // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
2060
+ // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
2061
+ var attributeNode = elem.getAttributeNode("tabindex");
2062
+ return attributeNode && attributeNode.specified ?
2063
+ parseInt( attributeNode.value, 10 ) :
2064
+ rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
2065
+ 0 :
2066
+ undefined;
2067
+ }
2068
+ }
2069
+ }
2070
+ });
2071
+ // Hook for boolean attributes
2072
+ boolHook = {
2073
+ get: function( elem, name ) {
2074
+ var
2075
+ // Use .prop to determine if this attribute is understood as boolean
2076
+ prop = jQuery.prop( elem, name ),
2077
+ // Fetch it accordingly
2078
+ attr = typeof prop === "boolean" && elem.getAttribute( name ),
2079
+ detail = typeof prop === "boolean" ?
2080
+ getSetInput && getSetAttribute ?
2081
+ attr != null :
2082
+ // oldIE fabricates an empty string for missing boolean attributes
2083
+ // and conflates checked/selected into attroperties
2084
+ ruseDefault.test( name ) ?
2085
+ elem[ jQuery.camelCase( "default-" + name ) ] :
2086
+ !!attr :
2087
+ // fetch an attribute node for properties not recognized as boolean
2088
+ elem.getAttributeNode( name );
2089
+ return detail && detail.value !== false ?
2090
+ name.toLowerCase() :
2091
+ undefined;
2092
+ },
2093
+ set: function( elem, value, name ) {
2094
+ if ( value === false ) {
2095
+ // Remove boolean attributes when set to false
2096
+ jQuery.removeAttr( elem, name );
2097
+ } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
2098
+ // IE<8 needs the *property* name
2099
+ elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
2100
+ // Use defaultChecked and defaultSelected for oldIE
2101
+ } else {
2102
+ elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
2103
+ }
2104
+ return name;
2105
+ }
2106
+ };
2107
+ // fix oldIE value attroperty
2108
+ if ( !getSetInput || !getSetAttribute ) {
2109
+ jQuery.attrHooks.value = {
2110
+ get: function( elem, name ) {
2111
+ var ret = elem.getAttributeNode( name );
2112
+ return jQuery.nodeName( elem, "input" ) ?
2113
+ // Ignore the value *property* by using defaultValue
2114
+ elem.defaultValue :
2115
+ ret && ret.specified ? ret.value : undefined;
2116
+ },
2117
+ set: function( elem, value, name ) {
2118
+ if ( jQuery.nodeName( elem, "input" ) ) {
2119
+ // Does not return so that setAttribute is also used
2120
+ elem.defaultValue = value;
2121
+ } else {
2122
+ // Use nodeHook if defined (#1954); otherwise setAttribute is fine
2123
+ return nodeHook && nodeHook.set( elem, value, name );
2124
+ }
2125
+ }
2126
+ };
2127
+ }
2128
+ // IE6/7 do not support getting/setting some attributes with get/setAttribute
2129
+ if ( !getSetAttribute ) {
2130
+ // Use this for any attribute in IE6/7
2131
+ // This fixes almost every IE6/7 issue
2132
+ nodeHook = jQuery.valHooks.button = {
2133
+ get: function( elem, name ) {
2134
+ var ret = elem.getAttributeNode( name );
2135
+ return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ?
2136
+ ret.value :
2137
+ undefined;
2138
+ },
2139
+ set: function( elem, value, name ) {
2140
+ // Set the existing or create a new attribute node
2141
+ var ret = elem.getAttributeNode( name );
2142
+ if ( !ret ) {
2143
+ elem.setAttributeNode(
2144
+ (ret = elem.ownerDocument.createAttribute( name ))
2145
+ );
2146
+ }
2147
+ ret.value = value += "";
2148
+ // Break association with cloned elements by also using setAttribute (#9646)
2149
+ return name === "value" || value === elem.getAttribute( name ) ?
2150
+ value :
2151
+ undefined;
2152
+ }
2153
+ };
2154
+ // Set contenteditable to false on removals(#10429)
2155
+ // Setting to empty string throws an error as an invalid value
2156
+ jQuery.attrHooks.contenteditable = {
2157
+ get: nodeHook.get,
2158
+ set: function( elem, value, name ) {
2159
+ nodeHook.set( elem, value === "" ? false : value, name );
2160
+ }
2161
+ };
2162
+ // Set width and height to auto instead of 0 on empty string( Bug #8150 )
2163
+ // This is for removals
2164
+ jQuery.each([ "width", "height" ], function( i, name ) {
2165
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
2166
+ set: function( elem, value ) {
2167
+ if ( value === "" ) {
2168
+ elem.setAttribute( name, "auto" );
2169
+ return value;
2170
+ }
2171
+ }
2172
+ });
2173
+ });
2174
+ }
2175
+ // Some attributes require a special call on IE
2176
+ // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
2177
+ if ( !jQuery.support.hrefNormalized ) {
2178
+ jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
2179
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
2180
+ get: function( elem ) {
2181
+ var ret = elem.getAttribute( name, 2 );
2182
+ return ret == null ? undefined : ret;
2183
+ }
2184
+ });
2185
+ });
2186
+ // href/src property should get the full normalized URL (#10299/#12915)
2187
+ jQuery.each([ "href", "src" ], function( i, name ) {
2188
+ jQuery.propHooks[ name ] = {
2189
+ get: function( elem ) {
2190
+ return elem.getAttribute( name, 4 );
2191
+ }
2192
+ };
2193
+ });
2194
+ }
2195
+ if ( !jQuery.support.style ) {
2196
+ jQuery.attrHooks.style = {
2197
+ get: function( elem ) {
2198
+ // Return undefined in the case of empty string
2199
+ // Note: IE uppercases css property names, but if we were to .toLowerCase()
2200
+ // .cssText, that would destroy case senstitivity in URL's, like in "background"
2201
+ return elem.style.cssText || undefined;
2202
+ },
2203
+ set: function( elem, value ) {
2204
+ return ( elem.style.cssText = value + "" );
2205
+ }
2206
+ };
2207
+ }
2208
+ // Safari mis-reports the default selected property of an option
2209
+ // Accessing the parent's selectedIndex property fixes it
2210
+ if ( !jQuery.support.optSelected ) {
2211
+ jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
2212
+ get: function( elem ) {
2213
+ var parent = elem.parentNode;
2214
+ if ( parent ) {
2215
+ parent.selectedIndex;
2216
+ // Make sure that it also works with optgroups, see #5701
2217
+ if ( parent.parentNode ) {
2218
+ parent.parentNode.selectedIndex;
2219
+ }
2220
+ }
2221
+ return null;
2222
+ }
2223
+ });
2224
+ }
2225
+ // IE6/7 call enctype encoding
2226
+ if ( !jQuery.support.enctype ) {
2227
+ jQuery.propFix.enctype = "encoding";
2228
+ }
2229
+ // Radios and checkboxes getter/setter
2230
+ if ( !jQuery.support.checkOn ) {
2231
+ jQuery.each([ "radio", "checkbox" ], function() {
2232
+ jQuery.valHooks[ this ] = {
2233
+ get: function( elem ) {
2234
+ // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
2235
+ return elem.getAttribute("value") === null ? "on" : elem.value;
2236
+ }
2237
+ };
2238
+ });
2239
+ }
2240
+ jQuery.each([ "radio", "checkbox" ], function() {
2241
+ jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
2242
+ set: function( elem, value ) {
2243
+ if ( jQuery.isArray( value ) ) {
2244
+ return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
2245
+ }
2246
+ }
2247
+ });
2248
+ });
2249
+ var rformElems = /^(?:input|select|textarea)$/i,
2250
+ rkeyEvent = /^key/,
2251
+ rmouseEvent = /^(?:mouse|contextmenu)|click/,
2252
+ rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
2253
+ rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
2254
+ function returnTrue() {
2255
+ return true;
2256
+ }
2257
+ function returnFalse() {
2258
+ return false;
2259
+ }
2260
+ /*
2261
+ * Helper functions for managing events -- not part of the public interface.
2262
+ * Props to Dean Edwards' addEvent library for many of the ideas.
2263
+ */
2264
+ jQuery.event = {
2265
+ global: {},
2266
+ add: function( elem, types, handler, data, selector ) {
2267
+ var tmp, events, t, handleObjIn,
2268
+ special, eventHandle, handleObj,
2269
+ handlers, type, namespaces, origType,
2270
+ elemData = jQuery._data( elem );
2271
+ // Don't attach events to noData or text/comment nodes (but allow plain objects)
2272
+ if ( !elemData ) {
2273
+ return;
2274
+ }
2275
+ // Caller can pass in an object of custom data in lieu of the handler
2276
+ if ( handler.handler ) {
2277
+ handleObjIn = handler;
2278
+ handler = handleObjIn.handler;
2279
+ selector = handleObjIn.selector;
2280
+ }
2281
+ // Make sure that the handler has a unique ID, used to find/remove it later
2282
+ if ( !handler.guid ) {
2283
+ handler.guid = jQuery.guid++;
2284
+ }
2285
+ // Init the element's event structure and main handler, if this is the first
2286
+ if ( !(events = elemData.events) ) {
2287
+ events = elemData.events = {};
2288
+ }
2289
+ if ( !(eventHandle = elemData.handle) ) {
2290
+ eventHandle = elemData.handle = function( e ) {
2291
+ // Discard the second event of a jQuery.event.trigger() and
2292
+ // when an event is called after a page has unloaded
2293
+ return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ?
2294
+ jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
2295
+ undefined;
2296
+ };
2297
+ // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
2298
+ eventHandle.elem = elem;
2299
+ }
2300
+ // Handle multiple events separated by a space
2301
+ // jQuery(...).bind("mouseover mouseout", fn);
2302
+ types = ( types || "" ).match( core_rnotwhite ) || [""];
2303
+ t = types.length;
2304
+ while ( t-- ) {
2305
+ tmp = rtypenamespace.exec( types[t] ) || [];
2306
+ type = origType = tmp[1];
2307
+ namespaces = ( tmp[2] || "" ).split( "." ).sort();
2308
+ // If event changes its type, use the special event handlers for the changed type
2309
+ special = jQuery.event.special[ type ] || {};
2310
+ // If selector defined, determine special event api type, otherwise given type
2311
+ type = ( selector ? special.delegateType : special.bindType ) || type;
2312
+ // Update special based on newly reset type
2313
+ special = jQuery.event.special[ type ] || {};
2314
+ // handleObj is passed to all event handlers
2315
+ handleObj = jQuery.extend({
2316
+ type: type,
2317
+ origType: origType,
2318
+ data: data,
2319
+ handler: handler,
2320
+ guid: handler.guid,
2321
+ selector: selector,
2322
+ needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
2323
+ namespace: namespaces.join(".")
2324
+ }, handleObjIn );
2325
+ // Init the event handler queue if we're the first
2326
+ if ( !(handlers = events[ type ]) ) {
2327
+ handlers = events[ type ] = [];
2328
+ handlers.delegateCount = 0;
2329
+ // Only use addEventListener/attachEvent if the special events handler returns false
2330
+ if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
2331
+ // Bind the global event handler to the element
2332
+ if ( elem.addEventListener ) {
2333
+ elem.addEventListener( type, eventHandle, false );
2334
+ } else if ( elem.attachEvent ) {
2335
+ elem.attachEvent( "on" + type, eventHandle );
2336
+ }
2337
+ }
2338
+ }
2339
+ if ( special.add ) {
2340
+ special.add.call( elem, handleObj );
2341
+ if ( !handleObj.handler.guid ) {
2342
+ handleObj.handler.guid = handler.guid;
2343
+ }
2344
+ }
2345
+ // Add to the element's handler list, delegates in front
2346
+ if ( selector ) {
2347
+ handlers.splice( handlers.delegateCount++, 0, handleObj );
2348
+ } else {
2349
+ handlers.push( handleObj );
2350
+ }
2351
+ // Keep track of which events have ever been used, for event optimization
2352
+ jQuery.event.global[ type ] = true;
2353
+ }
2354
+ // Nullify elem to prevent memory leaks in IE
2355
+ elem = null;
2356
+ },
2357
+ // Detach an event or set of events from an element
2358
+ remove: function( elem, types, handler, selector, mappedTypes ) {
2359
+ var j, handleObj, tmp,
2360
+ origCount, t, events,
2361
+ special, handlers, type,
2362
+ namespaces, origType,
2363
+ elemData = jQuery.hasData( elem ) && jQuery._data( elem );
2364
+ if ( !elemData || !(events = elemData.events) ) {
2365
+ return;
2366
+ }
2367
+ // Once for each type.namespace in types; type may be omitted
2368
+ types = ( types || "" ).match( core_rnotwhite ) || [""];
2369
+ t = types.length;
2370
+ while ( t-- ) {
2371
+ tmp = rtypenamespace.exec( types[t] ) || [];
2372
+ type = origType = tmp[1];
2373
+ namespaces = ( tmp[2] || "" ).split( "." ).sort();
2374
+ // Unbind all events (on this namespace, if provided) for the element
2375
+ if ( !type ) {
2376
+ for ( type in events ) {
2377
+ jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
2378
+ }
2379
+ continue;
2380
+ }
2381
+ special = jQuery.event.special[ type ] || {};
2382
+ type = ( selector ? special.delegateType : special.bindType ) || type;
2383
+ handlers = events[ type ] || [];
2384
+ tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
2385
+ // Remove matching events
2386
+ origCount = j = handlers.length;
2387
+ while ( j-- ) {
2388
+ handleObj = handlers[ j ];
2389
+ if ( ( mappedTypes || origType === handleObj.origType ) &&
2390
+ ( !handler || handler.guid === handleObj.guid ) &&
2391
+ ( !tmp || tmp.test( handleObj.namespace ) ) &&
2392
+ ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
2393
+ handlers.splice( j, 1 );
2394
+ if ( handleObj.selector ) {
2395
+ handlers.delegateCount--;
2396
+ }
2397
+ if ( special.remove ) {
2398
+ special.remove.call( elem, handleObj );
2399
+ }
2400
+ }
2401
+ }
2402
+ // Remove generic event handler if we removed something and no more handlers exist
2403
+ // (avoids potential for endless recursion during removal of special event handlers)
2404
+ if ( origCount && !handlers.length ) {
2405
+ if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
2406
+ jQuery.removeEvent( elem, type, elemData.handle );
2407
+ }
2408
+ delete events[ type ];
2409
+ }
2410
+ }
2411
+ // Remove the expando if it's no longer used
2412
+ if ( jQuery.isEmptyObject( events ) ) {
2413
+ delete elemData.handle;
2414
+ // removeData also checks for emptiness and clears the expando if empty
2415
+ // so use it instead of delete
2416
+ jQuery._removeData( elem, "events" );
2417
+ }
2418
+ },
2419
+ trigger: function( event, data, elem, onlyHandlers ) {
2420
+ var handle, ontype, cur,
2421
+ bubbleType, special, tmp, i,
2422
+ eventPath = [ elem || document ],
2423
+ type = core_hasOwn.call( event, "type" ) ? event.type : event,
2424
+ namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
2425
+ cur = tmp = elem = elem || document;
2426
+ // Don't do events on text and comment nodes
2427
+ if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
2428
+ return;
2429
+ }
2430
+ // focus/blur morphs to focusin/out; ensure we're not firing them right now
2431
+ if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
2432
+ return;
2433
+ }
2434
+ if ( type.indexOf(".") >= 0 ) {
2435
+ // Namespaced trigger; create a regexp to match event type in handle()
2436
+ namespaces = type.split(".");
2437
+ type = namespaces.shift();
2438
+ namespaces.sort();
2439
+ }
2440
+ ontype = type.indexOf(":") < 0 && "on" + type;
2441
+ // Caller can pass in a jQuery.Event object, Object, or just an event type string
2442
+ event = event[ jQuery.expando ] ?
2443
+ event :
2444
+ new jQuery.Event( type, typeof event === "object" && event );
2445
+ event.isTrigger = true;
2446
+ event.namespace = namespaces.join(".");
2447
+ event.namespace_re = event.namespace ?
2448
+ new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
2449
+ null;
2450
+ // Clean up the event in case it is being reused
2451
+ event.result = undefined;
2452
+ if ( !event.target ) {
2453
+ event.target = elem;
2454
+ }
2455
+ // Clone any incoming data and prepend the event, creating the handler arg list
2456
+ data = data == null ?
2457
+ [ event ] :
2458
+ jQuery.makeArray( data, [ event ] );
2459
+ // Allow special events to draw outside the lines
2460
+ special = jQuery.event.special[ type ] || {};
2461
+ if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
2462
+ return;
2463
+ }
2464
+ // Determine event propagation path in advance, per W3C events spec (#9951)
2465
+ // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
2466
+ if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
2467
+ bubbleType = special.delegateType || type;
2468
+ if ( !rfocusMorph.test( bubbleType + type ) ) {
2469
+ cur = cur.parentNode;
2470
+ }
2471
+ for ( ; cur; cur = cur.parentNode ) {
2472
+ eventPath.push( cur );
2473
+ tmp = cur;
2474
+ }
2475
+ // Only add window if we got to document (e.g., not plain obj or detached DOM)
2476
+ if ( tmp === (elem.ownerDocument || document) ) {
2477
+ eventPath.push( tmp.defaultView || tmp.parentWindow || window );
2478
+ }
2479
+ }
2480
+ // Fire handlers on the event path
2481
+ i = 0;
2482
+ while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
2483
+ event.type = i > 1 ?
2484
+ bubbleType :
2485
+ special.bindType || type;
2486
+ // jQuery handler
2487
+ handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
2488
+ if ( handle ) {
2489
+ handle.apply( cur, data );
2490
+ }
2491
+ // Native handler
2492
+ handle = ontype && cur[ ontype ];
2493
+ if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
2494
+ event.preventDefault();
2495
+ }
2496
+ }
2497
+ event.type = type;
2498
+ // If nobody prevented the default action, do it now
2499
+ if ( !onlyHandlers && !event.isDefaultPrevented() ) {
2500
+ if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
2501
+ !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
2502
+ // Call a native DOM method on the target with the same name name as the event.
2503
+ // Can't use an .isFunction() check here because IE6/7 fails that test.
2504
+ // Don't do default actions on window, that's where global variables be (#6170)
2505
+ if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
2506
+ // Don't re-trigger an onFOO event when we call its FOO() method
2507
+ tmp = elem[ ontype ];
2508
+ if ( tmp ) {
2509
+ elem[ ontype ] = null;
2510
+ }
2511
+ // Prevent re-triggering of the same event, since we already bubbled it above
2512
+ jQuery.event.triggered = type;
2513
+ try {
2514
+ elem[ type ]();
2515
+ } catch ( e ) {
2516
+ // IE<9 dies on focus/blur to hidden element (#1486,#12518)
2517
+ // only reproducible on winXP IE8 native, not IE9 in IE8 mode
2518
+ }
2519
+ jQuery.event.triggered = undefined;
2520
+ if ( tmp ) {
2521
+ elem[ ontype ] = tmp;
2522
+ }
2523
+ }
2524
+ }
2525
+ }
2526
+ return event.result;
2527
+ },
2528
+ dispatch: function( event ) {
2529
+ // Make a writable jQuery.Event from the native event object
2530
+ event = jQuery.event.fix( event );
2531
+ var i, ret, handleObj, matched, j,
2532
+ handlerQueue = [],
2533
+ args = core_slice.call( arguments ),
2534
+ handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
2535
+ special = jQuery.event.special[ event.type ] || {};
2536
+ // Use the fix-ed jQuery.Event rather than the (read-only) native event
2537
+ args[0] = event;
2538
+ event.delegateTarget = this;
2539
+ // Call the preDispatch hook for the mapped type, and let it bail if desired
2540
+ if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
2541
+ return;
2542
+ }
2543
+ // Determine handlers
2544
+ handlerQueue = jQuery.event.handlers.call( this, event, handlers );
2545
+ // Run delegates first; they may want to stop propagation beneath us
2546
+ i = 0;
2547
+ while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
2548
+ event.currentTarget = matched.elem;
2549
+ j = 0;
2550
+ while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
2551
+ // Triggered event must either 1) have no namespace, or
2552
+ // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
2553
+ if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
2554
+ event.handleObj = handleObj;
2555
+ event.data = handleObj.data;
2556
+ ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
2557
+ .apply( matched.elem, args );
2558
+ if ( ret !== undefined ) {
2559
+ if ( (event.result = ret) === false ) {
2560
+ event.preventDefault();
2561
+ event.stopPropagation();
2562
+ }
2563
+ }
2564
+ }
2565
+ }
2566
+ }
2567
+ // Call the postDispatch hook for the mapped type
2568
+ if ( special.postDispatch ) {
2569
+ special.postDispatch.call( this, event );
2570
+ }
2571
+ return event.result;
2572
+ },
2573
+ handlers: function( event, handlers ) {
2574
+ var sel, handleObj, matches, i,
2575
+ handlerQueue = [],
2576
+ delegateCount = handlers.delegateCount,
2577
+ cur = event.target;
2578
+ // Find delegate handlers
2579
+ // Black-hole SVG <use> instance trees (#13180)
2580
+ // Avoid non-left-click bubbling in Firefox (#3861)
2581
+ if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
2582
+ for ( ; cur != this; cur = cur.parentNode || this ) {
2583
+ // Don't check non-elements (#13208)
2584
+ // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
2585
+ if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) {
2586
+ matches = [];
2587
+ for ( i = 0; i < delegateCount; i++ ) {
2588
+ handleObj = handlers[ i ];
2589
+ // Don't conflict with Object.prototype properties (#13203)
2590
+ sel = handleObj.selector + " ";
2591
+ if ( matches[ sel ] === undefined ) {
2592
+ matches[ sel ] = handleObj.needsContext ?
2593
+ jQuery( sel, this ).index( cur ) >= 0 :
2594
+ jQuery.find( sel, this, null, [ cur ] ).length;
2595
+ }
2596
+ if ( matches[ sel ] ) {
2597
+ matches.push( handleObj );
2598
+ }
2599
+ }
2600
+ if ( matches.length ) {
2601
+ handlerQueue.push({ elem: cur, handlers: matches });
2602
+ }
2603
+ }
2604
+ }
2605
+ }
2606
+ // Add the remaining (directly-bound) handlers
2607
+ if ( delegateCount < handlers.length ) {
2608
+ handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
2609
+ }
2610
+ return handlerQueue;
2611
+ },
2612
+ fix: function( event ) {
2613
+ if ( event[ jQuery.expando ] ) {
2614
+ return event;
2615
+ }
2616
+ // Create a writable copy of the event object and normalize some properties
2617
+ var i, prop, copy,
2618
+ type = event.type,
2619
+ originalEvent = event,
2620
+ fixHook = this.fixHooks[ type ];
2621
+ if ( !fixHook ) {
2622
+ this.fixHooks[ type ] = fixHook =
2623
+ rmouseEvent.test( type ) ? this.mouseHooks :
2624
+ rkeyEvent.test( type ) ? this.keyHooks :
2625
+ {};
2626
+ }
2627
+ copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
2628
+ event = new jQuery.Event( originalEvent );
2629
+ i = copy.length;
2630
+ while ( i-- ) {
2631
+ prop = copy[ i ];
2632
+ event[ prop ] = originalEvent[ prop ];
2633
+ }
2634
+ // Support: IE<9
2635
+ // Fix target property (#1925)
2636
+ if ( !event.target ) {
2637
+ event.target = originalEvent.srcElement || document;
2638
+ }
2639
+ // Support: Chrome 23+, Safari?
2640
+ // Target should not be a text node (#504, #13143)
2641
+ if ( event.target.nodeType === 3 ) {
2642
+ event.target = event.target.parentNode;
2643
+ }
2644
+ // Support: IE<9
2645
+ // For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
2646
+ event.metaKey = !!event.metaKey;
2647
+ return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
2648
+ },
2649
+ // Includes some event props shared by KeyEvent and MouseEvent
2650
+ props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
2651
+ fixHooks: {},
2652
+ keyHooks: {
2653
+ props: "char charCode key keyCode".split(" "),
2654
+ filter: function( event, original ) {
2655
+ // Add which for key events
2656
+ if ( event.which == null ) {
2657
+ event.which = original.charCode != null ? original.charCode : original.keyCode;
2658
+ }
2659
+ return event;
2660
+ }
2661
+ },
2662
+ mouseHooks: {
2663
+ props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
2664
+ filter: function( event, original ) {
2665
+ var body, eventDoc, doc,
2666
+ button = original.button,
2667
+ fromElement = original.fromElement;
2668
+ // Calculate pageX/Y if missing and clientX/Y available
2669
+ if ( event.pageX == null && original.clientX != null ) {
2670
+ eventDoc = event.target.ownerDocument || document;
2671
+ doc = eventDoc.documentElement;
2672
+ body = eventDoc.body;
2673
+ event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
2674
+ event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
2675
+ }
2676
+ // Add relatedTarget, if necessary
2677
+ if ( !event.relatedTarget && fromElement ) {
2678
+ event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
2679
+ }
2680
+ // Add which for click: 1 === left; 2 === middle; 3 === right
2681
+ // Note: button is not normalized, so don't use it
2682
+ if ( !event.which && button !== undefined ) {
2683
+ event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
2684
+ }
2685
+ return event;
2686
+ }
2687
+ },
2688
+ special: {
2689
+ load: {
2690
+ // Prevent triggered image.load events from bubbling to window.load
2691
+ noBubble: true
2692
+ },
2693
+ click: {
2694
+ // For checkbox, fire native event so checked state will be right
2695
+ trigger: function() {
2696
+ if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
2697
+ this.click();
2698
+ return false;
2699
+ }
2700
+ }
2701
+ },
2702
+ focus: {
2703
+ // Fire native event if possible so blur/focus sequence is correct
2704
+ trigger: function() {
2705
+ if ( this !== document.activeElement && this.focus ) {
2706
+ try {
2707
+ this.focus();
2708
+ return false;
2709
+ } catch ( e ) {
2710
+ // Support: IE<9
2711
+ // If we error on focus to hidden element (#1486, #12518),
2712
+ // let .trigger() run the handlers
2713
+ }
2714
+ }
2715
+ },
2716
+ delegateType: "focusin"
2717
+ },
2718
+ blur: {
2719
+ trigger: function() {
2720
+ if ( this === document.activeElement && this.blur ) {
2721
+ this.blur();
2722
+ return false;
2723
+ }
2724
+ },
2725
+ delegateType: "focusout"
2726
+ },
2727
+ beforeunload: {
2728
+ postDispatch: function( event ) {
2729
+ // Even when returnValue equals to undefined Firefox will still show alert
2730
+ if ( event.result !== undefined ) {
2731
+ event.originalEvent.returnValue = event.result;
2732
+ }
2733
+ }
2734
+ }
2735
+ },
2736
+ simulate: function( type, elem, event, bubble ) {
2737
+ // Piggyback on a donor event to simulate a different one.
2738
+ // Fake originalEvent to avoid donor's stopPropagation, but if the
2739
+ // simulated event prevents default then we do the same on the donor.
2740
+ var e = jQuery.extend(
2741
+ new jQuery.Event(),
2742
+ event,
2743
+ { type: type,
2744
+ isSimulated: true,
2745
+ originalEvent: {}
2746
+ }
2747
+ );
2748
+ if ( bubble ) {
2749
+ jQuery.event.trigger( e, null, elem );
2750
+ } else {
2751
+ jQuery.event.dispatch.call( elem, e );
2752
+ }
2753
+ if ( e.isDefaultPrevented() ) {
2754
+ event.preventDefault();
2755
+ }
2756
+ }
2757
+ };
2758
+ jQuery.removeEvent = document.removeEventListener ?
2759
+ function( elem, type, handle ) {
2760
+ if ( elem.removeEventListener ) {
2761
+ elem.removeEventListener( type, handle, false );
2762
+ }
2763
+ } :
2764
+ function( elem, type, handle ) {
2765
+ var name = "on" + type;
2766
+ if ( elem.detachEvent ) {
2767
+ // #8545, #7054, preventing memory leaks for custom events in IE6-8
2768
+ // detachEvent needed property on element, by name of that event, to properly expose it to GC
2769
+ if ( typeof elem[ name ] === core_strundefined ) {
2770
+ elem[ name ] = null;
2771
+ }
2772
+ elem.detachEvent( name, handle );
2773
+ }
2774
+ };
2775
+ jQuery.Event = function( src, props ) {
2776
+ // Allow instantiation without the 'new' keyword
2777
+ if ( !(this instanceof jQuery.Event) ) {
2778
+ return new jQuery.Event( src, props );
2779
+ }
2780
+ // Event object
2781
+ if ( src && src.type ) {
2782
+ this.originalEvent = src;
2783
+ this.type = src.type;
2784
+ // Events bubbling up the document may have been marked as prevented
2785
+ // by a handler lower down the tree; reflect the correct value.
2786
+ this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
2787
+ src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
2788
+ // Event type
2789
+ } else {
2790
+ this.type = src;
2791
+ }
2792
+ // Put explicitly provided properties onto the event object
2793
+ if ( props ) {
2794
+ jQuery.extend( this, props );
2795
+ }
2796
+ // Create a timestamp if incoming event doesn't have one
2797
+ this.timeStamp = src && src.timeStamp || jQuery.now();
2798
+ // Mark it as fixed
2799
+ this[ jQuery.expando ] = true;
2800
+ };
2801
+ // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
2802
+ // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
2803
+ jQuery.Event.prototype = {
2804
+ isDefaultPrevented: returnFalse,
2805
+ isPropagationStopped: returnFalse,
2806
+ isImmediatePropagationStopped: returnFalse,
2807
+ preventDefault: function() {
2808
+ var e = this.originalEvent;
2809
+ this.isDefaultPrevented = returnTrue;
2810
+ if ( !e ) {
2811
+ return;
2812
+ }
2813
+ // If preventDefault exists, run it on the original event
2814
+ if ( e.preventDefault ) {
2815
+ e.preventDefault();
2816
+ // Support: IE
2817
+ // Otherwise set the returnValue property of the original event to false
2818
+ } else {
2819
+ e.returnValue = false;
2820
+ }
2821
+ },
2822
+ stopPropagation: function() {
2823
+ var e = this.originalEvent;
2824
+ this.isPropagationStopped = returnTrue;
2825
+ if ( !e ) {
2826
+ return;
2827
+ }
2828
+ // If stopPropagation exists, run it on the original event
2829
+ if ( e.stopPropagation ) {
2830
+ e.stopPropagation();
2831
+ }
2832
+ // Support: IE
2833
+ // Set the cancelBubble property of the original event to true
2834
+ e.cancelBubble = true;
2835
+ },
2836
+ stopImmediatePropagation: function() {
2837
+ this.isImmediatePropagationStopped = returnTrue;
2838
+ this.stopPropagation();
2839
+ }
2840
+ };
2841
+ // Create mouseenter/leave events using mouseover/out and event-time checks
2842
+ jQuery.each({
2843
+ mouseenter: "mouseover",
2844
+ mouseleave: "mouseout"
2845
+ }, function( orig, fix ) {
2846
+ jQuery.event.special[ orig ] = {
2847
+ delegateType: fix,
2848
+ bindType: fix,
2849
+ handle: function( event ) {
2850
+ var ret,
2851
+ target = this,
2852
+ related = event.relatedTarget,
2853
+ handleObj = event.handleObj;
2854
+ // For mousenter/leave call the handler if related is outside the target.
2855
+ // NB: No relatedTarget if the mouse left/entered the browser window
2856
+ if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
2857
+ event.type = handleObj.origType;
2858
+ ret = handleObj.handler.apply( this, arguments );
2859
+ event.type = fix;
2860
+ }
2861
+ return ret;
2862
+ }
2863
+ };
2864
+ });
2865
+ // IE submit delegation
2866
+ if ( !jQuery.support.submitBubbles ) {
2867
+ jQuery.event.special.submit = {
2868
+ setup: function() {
2869
+ // Only need this for delegated form submit events
2870
+ if ( jQuery.nodeName( this, "form" ) ) {
2871
+ return false;
2872
+ }
2873
+ // Lazy-add a submit handler when a descendant form may potentially be submitted
2874
+ jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
2875
+ // Node name check avoids a VML-related crash in IE (#9807)
2876
+ var elem = e.target,
2877
+ form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
2878
+ if ( form && !jQuery._data( form, "submitBubbles" ) ) {
2879
+ jQuery.event.add( form, "submit._submit", function( event ) {
2880
+ event._submit_bubble = true;
2881
+ });
2882
+ jQuery._data( form, "submitBubbles", true );
2883
+ }
2884
+ });
2885
+ // return undefined since we don't need an event listener
2886
+ },
2887
+ postDispatch: function( event ) {
2888
+ // If form was submitted by the user, bubble the event up the tree
2889
+ if ( event._submit_bubble ) {
2890
+ delete event._submit_bubble;
2891
+ if ( this.parentNode && !event.isTrigger ) {
2892
+ jQuery.event.simulate( "submit", this.parentNode, event, true );
2893
+ }
2894
+ }
2895
+ },
2896
+ teardown: function() {
2897
+ // Only need this for delegated form submit events
2898
+ if ( jQuery.nodeName( this, "form" ) ) {
2899
+ return false;
2900
+ }
2901
+ // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
2902
+ jQuery.event.remove( this, "._submit" );
2903
+ }
2904
+ };
2905
+ }
2906
+ // IE change delegation and checkbox/radio fix
2907
+ if ( !jQuery.support.changeBubbles ) {
2908
+ jQuery.event.special.change = {
2909
+ setup: function() {
2910
+ if ( rformElems.test( this.nodeName ) ) {
2911
+ // IE doesn't fire change on a check/radio until blur; trigger it on click
2912
+ // after a propertychange. Eat the blur-change in special.change.handle.
2913
+ // This still fires onchange a second time for check/radio after blur.
2914
+ if ( this.type === "checkbox" || this.type === "radio" ) {
2915
+ jQuery.event.add( this, "propertychange._change", function( event ) {
2916
+ if ( event.originalEvent.propertyName === "checked" ) {
2917
+ this._just_changed = true;
2918
+ }
2919
+ });
2920
+ jQuery.event.add( this, "click._change", function( event ) {
2921
+ if ( this._just_changed && !event.isTrigger ) {
2922
+ this._just_changed = false;
2923
+ }
2924
+ // Allow triggered, simulated change events (#11500)
2925
+ jQuery.event.simulate( "change", this, event, true );
2926
+ });
2927
+ }
2928
+ return false;
2929
+ }
2930
+ // Delegated event; lazy-add a change handler on descendant inputs
2931
+ jQuery.event.add( this, "beforeactivate._change", function( e ) {
2932
+ var elem = e.target;
2933
+ if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) {
2934
+ jQuery.event.add( elem, "change._change", function( event ) {
2935
+ if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
2936
+ jQuery.event.simulate( "change", this.parentNode, event, true );
2937
+ }
2938
+ });
2939
+ jQuery._data( elem, "changeBubbles", true );
2940
+ }
2941
+ });
2942
+ },
2943
+ handle: function( event ) {
2944
+ var elem = event.target;
2945
+ // Swallow native change events from checkbox/radio, we already triggered them above
2946
+ if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
2947
+ return event.handleObj.handler.apply( this, arguments );
2948
+ }
2949
+ },
2950
+ teardown: function() {
2951
+ jQuery.event.remove( this, "._change" );
2952
+ return !rformElems.test( this.nodeName );
2953
+ }
2954
+ };
2955
+ }
2956
+ // Create "bubbling" focus and blur events
2957
+ if ( !jQuery.support.focusinBubbles ) {
2958
+ jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
2959
+ // Attach a single capturing handler while someone wants focusin/focusout
2960
+ var attaches = 0,
2961
+ handler = function( event ) {
2962
+ jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
2963
+ };
2964
+ jQuery.event.special[ fix ] = {
2965
+ setup: function() {
2966
+ if ( attaches++ === 0 ) {
2967
+ document.addEventListener( orig, handler, true );
2968
+ }
2969
+ },
2970
+ teardown: function() {
2971
+ if ( --attaches === 0 ) {
2972
+ document.removeEventListener( orig, handler, true );
2973
+ }
2974
+ }
2975
+ };
2976
+ });
2977
+ }
2978
+ jQuery.fn.extend({
2979
+ on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
2980
+ var type, origFn;
2981
+ // Types can be a map of types/handlers
2982
+ if ( typeof types === "object" ) {
2983
+ // ( types-Object, selector, data )
2984
+ if ( typeof selector !== "string" ) {
2985
+ // ( types-Object, data )
2986
+ data = data || selector;
2987
+ selector = undefined;
2988
+ }
2989
+ for ( type in types ) {
2990
+ this.on( type, selector, data, types[ type ], one );
2991
+ }
2992
+ return this;
2993
+ }
2994
+ if ( data == null && fn == null ) {
2995
+ // ( types, fn )
2996
+ fn = selector;
2997
+ data = selector = undefined;
2998
+ } else if ( fn == null ) {
2999
+ if ( typeof selector === "string" ) {
3000
+ // ( types, selector, fn )
3001
+ fn = data;
3002
+ data = undefined;
3003
+ } else {
3004
+ // ( types, data, fn )
3005
+ fn = data;
3006
+ data = selector;
3007
+ selector = undefined;
3008
+ }
3009
+ }
3010
+ if ( fn === false ) {
3011
+ fn = returnFalse;
3012
+ } else if ( !fn ) {
3013
+ return this;
3014
+ }
3015
+ if ( one === 1 ) {
3016
+ origFn = fn;
3017
+ fn = function( event ) {
3018
+ // Can use an empty set, since event contains the info
3019
+ jQuery().off( event );
3020
+ return origFn.apply( this, arguments );
3021
+ };
3022
+ // Use same guid so caller can remove using origFn
3023
+ fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
3024
+ }
3025
+ return this.each( function() {
3026
+ jQuery.event.add( this, types, fn, data, selector );
3027
+ });
3028
+ },
3029
+ one: function( types, selector, data, fn ) {
3030
+ return this.on( types, selector, data, fn, 1 );
3031
+ },
3032
+ off: function( types, selector, fn ) {
3033
+ var handleObj, type;
3034
+ if ( types && types.preventDefault && types.handleObj ) {
3035
+ // ( event ) dispatched jQuery.Event
3036
+ handleObj = types.handleObj;
3037
+ jQuery( types.delegateTarget ).off(
3038
+ handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
3039
+ handleObj.selector,
3040
+ handleObj.handler
3041
+ );
3042
+ return this;
3043
+ }
3044
+ if ( typeof types === "object" ) {
3045
+ // ( types-object [, selector] )
3046
+ for ( type in types ) {
3047
+ this.off( type, selector, types[ type ] );
3048
+ }
3049
+ return this;
3050
+ }
3051
+ if ( selector === false || typeof selector === "function" ) {
3052
+ // ( types [, fn] )
3053
+ fn = selector;
3054
+ selector = undefined;
3055
+ }
3056
+ if ( fn === false ) {
3057
+ fn = returnFalse;
3058
+ }
3059
+ return this.each(function() {
3060
+ jQuery.event.remove( this, types, fn, selector );
3061
+ });
3062
+ },
3063
+ bind: function( types, data, fn ) {
3064
+ return this.on( types, null, data, fn );
3065
+ },
3066
+ unbind: function( types, fn ) {
3067
+ return this.off( types, null, fn );
3068
+ },
3069
+ delegate: function( selector, types, data, fn ) {
3070
+ return this.on( types, selector, data, fn );
3071
+ },
3072
+ undelegate: function( selector, types, fn ) {
3073
+ // ( namespace ) or ( selector, types [, fn] )
3074
+ return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
3075
+ },
3076
+ trigger: function( type, data ) {
3077
+ return this.each(function() {
3078
+ jQuery.event.trigger( type, data, this );
3079
+ });
3080
+ },
3081
+ triggerHandler: function( type, data ) {
3082
+ var elem = this[0];
3083
+ if ( elem ) {
3084
+ return jQuery.event.trigger( type, data, elem, true );
3085
+ }
3086
+ }
3087
+ });
3088
+ /*!
3089
+ * Sizzle CSS Selector Engine
3090
+ * Copyright 2012 jQuery Foundation and other contributors
3091
+ * Released under the MIT license
3092
+ * http://sizzlejs.com/
3093
+ */
3094
+ (function( window, undefined ) {
3095
+ var i,
3096
+ cachedruns,
3097
+ Expr,
3098
+ getText,
3099
+ isXML,
3100
+ compile,
3101
+ hasDuplicate,
3102
+ outermostContext,
3103
+ // Local document vars
3104
+ setDocument,
3105
+ document,
3106
+ docElem,
3107
+ documentIsXML,
3108
+ rbuggyQSA,
3109
+ rbuggyMatches,
3110
+ matches,
3111
+ contains,
3112
+ sortOrder,
3113
+ // Instance-specific data
3114
+ expando = "sizzle" + -(new Date()),
3115
+ preferredDoc = window.document,
3116
+ support = {},
3117
+ dirruns = 0,
3118
+ done = 0,
3119
+ classCache = createCache(),
3120
+ tokenCache = createCache(),
3121
+ compilerCache = createCache(),
3122
+ // General-purpose constants
3123
+ strundefined = typeof undefined,
3124
+ MAX_NEGATIVE = 1 << 31,
3125
+ // Array methods
3126
+ arr = [],
3127
+ pop = arr.pop,
3128
+ push = arr.push,
3129
+ slice = arr.slice,
3130
+ // Use a stripped-down indexOf if we can't use a native one
3131
+ indexOf = arr.indexOf || function( elem ) {
3132
+ var i = 0,
3133
+ len = this.length;
3134
+ for ( ; i < len; i++ ) {
3135
+ if ( this[i] === elem ) {
3136
+ return i;
3137
+ }
3138
+ }
3139
+ return -1;
3140
+ },
3141
+ // Regular expressions
3142
+ // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
3143
+ whitespace = "[\\x20\\t\\r\\n\\f]",
3144
+ // http://www.w3.org/TR/css3-syntax/#characters
3145
+ characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
3146
+ // Loosely modeled on CSS identifier characters
3147
+ // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
3148
+ // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
3149
+ identifier = characterEncoding.replace( "w", "w#" ),
3150
+ // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
3151
+ operators = "([*^$|!~]?=)",
3152
+ attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
3153
+ "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
3154
+ // Prefer arguments quoted,
3155
+ // then not containing pseudos/brackets,
3156
+ // then attribute selectors/non-parenthetical expressions,
3157
+ // then anything else
3158
+ // These preferences are here to reduce the number of selectors
3159
+ // needing tokenize in the PSEUDO preFilter
3160
+ pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
3161
+ // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
3162
+ rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
3163
+ rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
3164
+ rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ),
3165
+ rpseudo = new RegExp( pseudos ),
3166
+ ridentifier = new RegExp( "^" + identifier + "$" ),
3167
+ matchExpr = {
3168
+ "ID": new RegExp( "^#(" + characterEncoding + ")" ),
3169
+ "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
3170
+ "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ),
3171
+ "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
3172
+ "ATTR": new RegExp( "^" + attributes ),
3173
+ "PSEUDO": new RegExp( "^" + pseudos ),
3174
+ "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
3175
+ "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
3176
+ "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
3177
+ // For use in libraries implementing .is()
3178
+ // We use this for POS matching in `select`
3179
+ "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
3180
+ whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
3181
+ },
3182
+ rsibling = /[\x20\t\r\n\f]*[+~]/,
3183
+ rnative = /^[^{]+\{\s*\[native code/,
3184
+ // Easily-parseable/retrievable ID or TAG or CLASS selectors
3185
+ rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
3186
+ rinputs = /^(?:input|select|textarea|button)$/i,
3187
+ rheader = /^h\d$/i,
3188
+ rescape = /'|\\/g,
3189
+ rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
3190
+ // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
3191
+ runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,
3192
+ funescape = function( _, escaped ) {
3193
+ var high = "0x" + escaped - 0x10000;
3194
+ // NaN means non-codepoint
3195
+ return high !== high ?
3196
+ escaped :
3197
+ // BMP codepoint
3198
+ high < 0 ?
3199
+ String.fromCharCode( high + 0x10000 ) :
3200
+ // Supplemental Plane codepoint (surrogate pair)
3201
+ String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
3202
+ };
3203
+ // Use a stripped-down slice if we can't use a native one
3204
+ try {
3205
+ slice.call( preferredDoc.documentElement.childNodes, 0 )[0].nodeType;
3206
+ } catch ( e ) {
3207
+ slice = function( i ) {
3208
+ var elem,
3209
+ results = [];
3210
+ while ( (elem = this[i++]) ) {
3211
+ results.push( elem );
3212
+ }
3213
+ return results;
3214
+ };
3215
+ }
3216
+ /**
3217
+ * For feature detection
3218
+ * @param {Function} fn The function to test for native support
3219
+ */
3220
+ function isNative( fn ) {
3221
+ return rnative.test( fn + "" );
3222
+ }
3223
+ /**
3224
+ * Create key-value caches of limited size
3225
+ * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
3226
+ * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
3227
+ * deleting the oldest entry
3228
+ */
3229
+ function createCache() {
3230
+ var cache,
3231
+ keys = [];
3232
+ return (cache = function( key, value ) {
3233
+ // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
3234
+ if ( keys.push( key += " " ) > Expr.cacheLength ) {
3235
+ // Only keep the most recent entries
3236
+ delete cache[ keys.shift() ];
3237
+ }
3238
+ return (cache[ key ] = value);
3239
+ });
3240
+ }
3241
+ /**
3242
+ * Mark a function for special use by Sizzle
3243
+ * @param {Function} fn The function to mark
3244
+ */
3245
+ function markFunction( fn ) {
3246
+ fn[ expando ] = true;
3247
+ return fn;
3248
+ }
3249
+ /**
3250
+ * Support testing using an element
3251
+ * @param {Function} fn Passed the created div and expects a boolean result
3252
+ */
3253
+ function assert( fn ) {
3254
+ var div = document.createElement("div");
3255
+ try {
3256
+ return fn( div );
3257
+ } catch (e) {
3258
+ return false;
3259
+ } finally {
3260
+ // release memory in IE
3261
+ div = null;
3262
+ }
3263
+ }
3264
+ function Sizzle( selector, context, results, seed ) {
3265
+ var match, elem, m, nodeType,
3266
+ // QSA vars
3267
+ i, groups, old, nid, newContext, newSelector;
3268
+ if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
3269
+ setDocument( context );
3270
+ }
3271
+ context = context || document;
3272
+ results = results || [];
3273
+ if ( !selector || typeof selector !== "string" ) {
3274
+ return results;
3275
+ }
3276
+ if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
3277
+ return [];
3278
+ }
3279
+ if ( !documentIsXML && !seed ) {
3280
+ // Shortcuts
3281
+ if ( (match = rquickExpr.exec( selector )) ) {
3282
+ // Speed-up: Sizzle("#ID")
3283
+ if ( (m = match[1]) ) {
3284
+ if ( nodeType === 9 ) {
3285
+ elem = context.getElementById( m );
3286
+ // Check parentNode to catch when Blackberry 4.6 returns
3287
+ // nodes that are no longer in the document #6963
3288
+ if ( elem && elem.parentNode ) {
3289
+ // Handle the case where IE, Opera, and Webkit return items
3290
+ // by name instead of ID
3291
+ if ( elem.id === m ) {
3292
+ results.push( elem );
3293
+ return results;
3294
+ }
3295
+ } else {
3296
+ return results;
3297
+ }
3298
+ } else {
3299
+ // Context is not a document
3300
+ if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
3301
+ contains( context, elem ) && elem.id === m ) {
3302
+ results.push( elem );
3303
+ return results;
3304
+ }
3305
+ }
3306
+ // Speed-up: Sizzle("TAG")
3307
+ } else if ( match[2] ) {
3308
+ push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
3309
+ return results;
3310
+ // Speed-up: Sizzle(".CLASS")
3311
+ } else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) {
3312
+ push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
3313
+ return results;
3314
+ }
3315
+ }
3316
+ // QSA path
3317
+ if ( support.qsa && !rbuggyQSA.test(selector) ) {
3318
+ old = true;
3319
+ nid = expando;
3320
+ newContext = context;
3321
+ newSelector = nodeType === 9 && selector;
3322
+ // qSA works strangely on Element-rooted queries
3323
+ // We can work around this by specifying an extra ID on the root
3324
+ // and working up from there (Thanks to Andrew Dupont for the technique)
3325
+ // IE 8 doesn't work on object elements
3326
+ if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
3327
+ groups = tokenize( selector );
3328
+ if ( (old = context.getAttribute("id")) ) {
3329
+ nid = old.replace( rescape, "\\$&" );
3330
+ } else {
3331
+ context.setAttribute( "id", nid );
3332
+ }
3333
+ nid = "[id='" + nid + "'] ";
3334
+ i = groups.length;
3335
+ while ( i-- ) {
3336
+ groups[i] = nid + toSelector( groups[i] );
3337
+ }
3338
+ newContext = rsibling.test( selector ) && context.parentNode || context;
3339
+ newSelector = groups.join(",");
3340
+ }
3341
+ if ( newSelector ) {
3342
+ try {
3343
+ push.apply( results, slice.call( newContext.querySelectorAll(
3344
+ newSelector
3345
+ ), 0 ) );
3346
+ return results;
3347
+ } catch(qsaError) {
3348
+ } finally {
3349
+ if ( !old ) {
3350
+ context.removeAttribute("id");
3351
+ }
3352
+ }
3353
+ }
3354
+ }
3355
+ }
3356
+ // All others
3357
+ return select( selector.replace( rtrim, "$1" ), context, results, seed );
3358
+ }
3359
+ /**
3360
+ * Detect xml
3361
+ * @param {Element|Object} elem An element or a document
3362
+ */
3363
+ isXML = Sizzle.isXML = function( elem ) {
3364
+ // documentElement is verified for cases where it doesn't yet exist
3365
+ // (such as loading iframes in IE - #4833)
3366
+ var documentElement = elem && (elem.ownerDocument || elem).documentElement;
3367
+ return documentElement ? documentElement.nodeName !== "HTML" : false;
3368
+ };
3369
+ /**
3370
+ * Sets document-related variables once based on the current document
3371
+ * @param {Element|Object} [doc] An element or document object to use to set the document
3372
+ * @returns {Object} Returns the current document
3373
+ */
3374
+ setDocument = Sizzle.setDocument = function( node ) {
3375
+ var doc = node ? node.ownerDocument || node : preferredDoc;
3376
+ // If no document and documentElement is available, return
3377
+ if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
3378
+ return document;
3379
+ }
3380
+ // Set our document
3381
+ document = doc;
3382
+ docElem = doc.documentElement;
3383
+ // Support tests
3384
+ documentIsXML = isXML( doc );
3385
+ // Check if getElementsByTagName("*") returns only elements
3386
+ support.tagNameNoComments = assert(function( div ) {
3387
+ div.appendChild( doc.createComment("") );
3388
+ return !div.getElementsByTagName("*").length;
3389
+ });
3390
+ // Check if attributes should be retrieved by attribute nodes
3391
+ support.attributes = assert(function( div ) {
3392
+ div.innerHTML = "<select></select>";
3393
+ var type = typeof div.lastChild.getAttribute("multiple");
3394
+ // IE8 returns a string for some attributes even when not present
3395
+ return type !== "boolean" && type !== "string";
3396
+ });
3397
+ // Check if getElementsByClassName can be trusted
3398
+ support.getByClassName = assert(function( div ) {
3399
+ // Opera can't find a second classname (in 9.6)
3400
+ div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>";
3401
+ if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) {
3402
+ return false;
3403
+ }
3404
+ // Safari 3.2 caches class attributes and doesn't catch changes
3405
+ div.lastChild.className = "e";
3406
+ return div.getElementsByClassName("e").length === 2;
3407
+ });
3408
+ // Check if getElementById returns elements by name
3409
+ // Check if getElementsByName privileges form controls or returns elements by ID
3410
+ support.getByName = assert(function( div ) {
3411
+ // Inject content
3412
+ div.id = expando + 0;
3413
+ div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";
3414
+ docElem.insertBefore( div, docElem.firstChild );
3415
+ // Test
3416
+ var pass = doc.getElementsByName &&
3417
+ // buggy browsers will return fewer than the correct 2
3418
+ doc.getElementsByName( expando ).length === 2 +
3419
+ // buggy browsers will return more than the correct 0
3420
+ doc.getElementsByName( expando + 0 ).length;
3421
+ support.getIdNotName = !doc.getElementById( expando );
3422
+ // Cleanup
3423
+ docElem.removeChild( div );
3424
+ return pass;
3425
+ });
3426
+ // IE6/7 return modified attributes
3427
+ Expr.attrHandle = assert(function( div ) {
3428
+ div.innerHTML = "<a href='#'></a>";
3429
+ return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&
3430
+ div.firstChild.getAttribute("href") === "#";
3431
+ }) ?
3432
+ {} :
3433
+ {
3434
+ "href": function( elem ) {
3435
+ return elem.getAttribute( "href", 2 );
3436
+ },
3437
+ "type": function( elem ) {
3438
+ return elem.getAttribute("type");
3439
+ }
3440
+ };
3441
+ // ID find and filter
3442
+ if ( support.getIdNotName ) {
3443
+ Expr.find["ID"] = function( id, context ) {
3444
+ if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
3445
+ var m = context.getElementById( id );
3446
+ // Check parentNode to catch when Blackberry 4.6 returns
3447
+ // nodes that are no longer in the document #6963
3448
+ return m && m.parentNode ? [m] : [];
3449
+ }
3450
+ };
3451
+ Expr.filter["ID"] = function( id ) {
3452
+ var attrId = id.replace( runescape, funescape );
3453
+ return function( elem ) {
3454
+ return elem.getAttribute("id") === attrId;
3455
+ };
3456
+ };
3457
+ } else {
3458
+ Expr.find["ID"] = function( id, context ) {
3459
+ if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
3460
+ var m = context.getElementById( id );
3461
+ return m ?
3462
+ m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
3463
+ [m] :
3464
+ undefined :
3465
+ [];
3466
+ }
3467
+ };
3468
+ Expr.filter["ID"] = function( id ) {
3469
+ var attrId = id.replace( runescape, funescape );
3470
+ return function( elem ) {
3471
+ var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
3472
+ return node && node.value === attrId;
3473
+ };
3474
+ };
3475
+ }
3476
+ // Tag
3477
+ Expr.find["TAG"] = support.tagNameNoComments ?
3478
+ function( tag, context ) {
3479
+ if ( typeof context.getElementsByTagName !== strundefined ) {
3480
+ return context.getElementsByTagName( tag );
3481
+ }
3482
+ } :
3483
+ function( tag, context ) {
3484
+ var elem,
3485
+ tmp = [],
3486
+ i = 0,
3487
+ results = context.getElementsByTagName( tag );
3488
+ // Filter out possible comments
3489
+ if ( tag === "*" ) {
3490
+ while ( (elem = results[i++]) ) {
3491
+ if ( elem.nodeType === 1 ) {
3492
+ tmp.push( elem );
3493
+ }
3494
+ }
3495
+ return tmp;
3496
+ }
3497
+ return results;
3498
+ };
3499
+ // Name
3500
+ Expr.find["NAME"] = support.getByName && function( tag, context ) {
3501
+ if ( typeof context.getElementsByName !== strundefined ) {
3502
+ return context.getElementsByName( name );
3503
+ }
3504
+ };
3505
+ // Class
3506
+ Expr.find["CLASS"] = support.getByClassName && function( className, context ) {
3507
+ if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) {
3508
+ return context.getElementsByClassName( className );
3509
+ }
3510
+ };
3511
+ // QSA and matchesSelector support
3512
+ // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
3513
+ rbuggyMatches = [];
3514
+ // qSa(:focus) reports false when true (Chrome 21),
3515
+ // no need to also add to buggyMatches since matches checks buggyQSA
3516
+ // A support test would require too much code (would include document ready)
3517
+ rbuggyQSA = [ ":focus" ];
3518
+ if ( (support.qsa = isNative(doc.querySelectorAll)) ) {
3519
+ // Build QSA regex
3520
+ // Regex strategy adopted from Diego Perini
3521
+ assert(function( div ) {
3522
+ // Select is set to empty string on purpose
3523
+ // This is to test IE's treatment of not explictly
3524
+ // setting a boolean content attribute,
3525
+ // since its presence should be enough
3526
+ // http://bugs.jquery.com/ticket/12359
3527
+ div.innerHTML = "<select><option selected=''></option></select>";
3528
+ // IE8 - Some boolean attributes are not treated correctly
3529
+ if ( !div.querySelectorAll("[selected]").length ) {
3530
+ rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
3531
+ }
3532
+ // Webkit/Opera - :checked should return selected option elements
3533
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
3534
+ // IE8 throws error here and will not see later tests
3535
+ if ( !div.querySelectorAll(":checked").length ) {
3536
+ rbuggyQSA.push(":checked");
3537
+ }
3538
+ });
3539
+ assert(function( div ) {
3540
+ // Opera 10-12/IE8 - ^= $= *= and empty values
3541
+ // Should not select anything
3542
+ div.innerHTML = "<input type='hidden' i=''/>";
3543
+ if ( div.querySelectorAll("[i^='']").length ) {
3544
+ rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
3545
+ }
3546
+ // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
3547
+ // IE8 throws error here and will not see later tests
3548
+ if ( !div.querySelectorAll(":enabled").length ) {
3549
+ rbuggyQSA.push( ":enabled", ":disabled" );
3550
+ }
3551
+ // Opera 10-11 does not throw on post-comma invalid pseudos
3552
+ div.querySelectorAll("*,:x");
3553
+ rbuggyQSA.push(",.*:");
3554
+ });
3555
+ }
3556
+ if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector ||
3557
+ docElem.mozMatchesSelector ||
3558
+ docElem.webkitMatchesSelector ||
3559
+ docElem.oMatchesSelector ||
3560
+ docElem.msMatchesSelector) )) ) {
3561
+ assert(function( div ) {
3562
+ // Check to see if it's possible to do matchesSelector
3563
+ // on a disconnected node (IE 9)
3564
+ support.disconnectedMatch = matches.call( div, "div" );
3565
+ // This should fail with an exception
3566
+ // Gecko does not error, returns false instead
3567
+ matches.call( div, "[s!='']:x" );
3568
+ rbuggyMatches.push( "!=", pseudos );
3569
+ });
3570
+ }
3571
+ rbuggyQSA = new RegExp( rbuggyQSA.join("|") );
3572
+ rbuggyMatches = new RegExp( rbuggyMatches.join("|") );
3573
+ // Element contains another
3574
+ // Purposefully does not implement inclusive descendent
3575
+ // As in, an element does not contain itself
3576
+ contains = isNative(docElem.contains) || docElem.compareDocumentPosition ?
3577
+ function( a, b ) {
3578
+ var adown = a.nodeType === 9 ? a.documentElement : a,
3579
+ bup = b && b.parentNode;
3580
+ return a === bup || !!( bup && bup.nodeType === 1 && (
3581
+ adown.contains ?
3582
+ adown.contains( bup ) :
3583
+ a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
3584
+ ));
3585
+ } :
3586
+ function( a, b ) {
3587
+ if ( b ) {
3588
+ while ( (b = b.parentNode) ) {
3589
+ if ( b === a ) {
3590
+ return true;
3591
+ }
3592
+ }
3593
+ }
3594
+ return false;
3595
+ };
3596
+ // Document order sorting
3597
+ sortOrder = docElem.compareDocumentPosition ?
3598
+ function( a, b ) {
3599
+ var compare;
3600
+ if ( a === b ) {
3601
+ hasDuplicate = true;
3602
+ return 0;
3603
+ }
3604
+ if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) {
3605
+ if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) {
3606
+ if ( a === doc || contains( preferredDoc, a ) ) {
3607
+ return -1;
3608
+ }
3609
+ if ( b === doc || contains( preferredDoc, b ) ) {
3610
+ return 1;
3611
+ }
3612
+ return 0;
3613
+ }
3614
+ return compare & 4 ? -1 : 1;
3615
+ }
3616
+ return a.compareDocumentPosition ? -1 : 1;
3617
+ } :
3618
+ function( a, b ) {
3619
+ var cur,
3620
+ i = 0,
3621
+ aup = a.parentNode,
3622
+ bup = b.parentNode,
3623
+ ap = [ a ],
3624
+ bp = [ b ];
3625
+ // Exit early if the nodes are identical
3626
+ if ( a === b ) {
3627
+ hasDuplicate = true;
3628
+ return 0;
3629
+ // Parentless nodes are either documents or disconnected
3630
+ } else if ( !aup || !bup ) {
3631
+ return a === doc ? -1 :
3632
+ b === doc ? 1 :
3633
+ aup ? -1 :
3634
+ bup ? 1 :
3635
+ 0;
3636
+ // If the nodes are siblings, we can do a quick check
3637
+ } else if ( aup === bup ) {
3638
+ return siblingCheck( a, b );
3639
+ }
3640
+ // Otherwise we need full lists of their ancestors for comparison
3641
+ cur = a;
3642
+ while ( (cur = cur.parentNode) ) {
3643
+ ap.unshift( cur );
3644
+ }
3645
+ cur = b;
3646
+ while ( (cur = cur.parentNode) ) {
3647
+ bp.unshift( cur );
3648
+ }
3649
+ // Walk down the tree looking for a discrepancy
3650
+ while ( ap[i] === bp[i] ) {
3651
+ i++;
3652
+ }
3653
+ return i ?
3654
+ // Do a sibling check if the nodes have a common ancestor
3655
+ siblingCheck( ap[i], bp[i] ) :
3656
+ // Otherwise nodes in our document sort first
3657
+ ap[i] === preferredDoc ? -1 :
3658
+ bp[i] === preferredDoc ? 1 :
3659
+ 0;
3660
+ };
3661
+ // Always assume the presence of duplicates if sort doesn't
3662
+ // pass them to our comparison function (as in Google Chrome).
3663
+ hasDuplicate = false;
3664
+ [0, 0].sort( sortOrder );
3665
+ support.detectDuplicates = hasDuplicate;
3666
+ return document;
3667
+ };
3668
+ Sizzle.matches = function( expr, elements ) {
3669
+ return Sizzle( expr, null, null, elements );
3670
+ };
3671
+ Sizzle.matchesSelector = function( elem, expr ) {
3672
+ // Set document vars if needed
3673
+ if ( ( elem.ownerDocument || elem ) !== document ) {
3674
+ setDocument( elem );
3675
+ }
3676
+ // Make sure that attribute selectors are quoted
3677
+ expr = expr.replace( rattributeQuotes, "='$1']" );
3678
+ // rbuggyQSA always contains :focus, so no need for an existence check
3679
+ if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) {
3680
+ try {
3681
+ var ret = matches.call( elem, expr );
3682
+ // IE 9's matchesSelector returns false on disconnected nodes
3683
+ if ( ret || support.disconnectedMatch ||
3684
+ // As well, disconnected nodes are said to be in a document
3685
+ // fragment in IE 9
3686
+ elem.document && elem.document.nodeType !== 11 ) {
3687
+ return ret;
3688
+ }
3689
+ } catch(e) {}
3690
+ }
3691
+ return Sizzle( expr, document, null, [elem] ).length > 0;
3692
+ };
3693
+ Sizzle.contains = function( context, elem ) {
3694
+ // Set document vars if needed
3695
+ if ( ( context.ownerDocument || context ) !== document ) {
3696
+ setDocument( context );
3697
+ }
3698
+ return contains( context, elem );
3699
+ };
3700
+ Sizzle.attr = function( elem, name ) {
3701
+ var val;
3702
+ // Set document vars if needed
3703
+ if ( ( elem.ownerDocument || elem ) !== document ) {
3704
+ setDocument( elem );
3705
+ }
3706
+ if ( !documentIsXML ) {
3707
+ name = name.toLowerCase();
3708
+ }
3709
+ if ( (val = Expr.attrHandle[ name ]) ) {
3710
+ return val( elem );
3711
+ }
3712
+ if ( documentIsXML || support.attributes ) {
3713
+ return elem.getAttribute( name );
3714
+ }
3715
+ return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ?
3716
+ name :
3717
+ val && val.specified ? val.value : null;
3718
+ };
3719
+ Sizzle.error = function( msg ) {
3720
+ throw new Error( "Syntax error, unrecognized expression: " + msg );
3721
+ };
3722
+ // Document sorting and removing duplicates
3723
+ Sizzle.uniqueSort = function( results ) {
3724
+ var elem,
3725
+ duplicates = [],
3726
+ i = 1,
3727
+ j = 0;
3728
+ // Unless we *know* we can detect duplicates, assume their presence
3729
+ hasDuplicate = !support.detectDuplicates;
3730
+ results.sort( sortOrder );
3731
+ if ( hasDuplicate ) {
3732
+ for ( ; (elem = results[i]); i++ ) {
3733
+ if ( elem === results[ i - 1 ] ) {
3734
+ j = duplicates.push( i );
3735
+ }
3736
+ }
3737
+ while ( j-- ) {
3738
+ results.splice( duplicates[ j ], 1 );
3739
+ }
3740
+ }
3741
+ return results;
3742
+ };
3743
+ function siblingCheck( a, b ) {
3744
+ var cur = b && a,
3745
+ diff = cur && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE );
3746
+ // Use IE sourceIndex if available on both nodes
3747
+ if ( diff ) {
3748
+ return diff;
3749
+ }
3750
+ // Check if b follows a
3751
+ if ( cur ) {
3752
+ while ( (cur = cur.nextSibling) ) {
3753
+ if ( cur === b ) {
3754
+ return -1;
3755
+ }
3756
+ }
3757
+ }
3758
+ return a ? 1 : -1;
3759
+ }
3760
+ // Returns a function to use in pseudos for input types
3761
+ function createInputPseudo( type ) {
3762
+ return function( elem ) {
3763
+ var name = elem.nodeName.toLowerCase();
3764
+ return name === "input" && elem.type === type;
3765
+ };
3766
+ }
3767
+ // Returns a function to use in pseudos for buttons
3768
+ function createButtonPseudo( type ) {
3769
+ return function( elem ) {
3770
+ var name = elem.nodeName.toLowerCase();
3771
+ return (name === "input" || name === "button") && elem.type === type;
3772
+ };
3773
+ }
3774
+ // Returns a function to use in pseudos for positionals
3775
+ function createPositionalPseudo( fn ) {
3776
+ return markFunction(function( argument ) {
3777
+ argument = +argument;
3778
+ return markFunction(function( seed, matches ) {
3779
+ var j,
3780
+ matchIndexes = fn( [], seed.length, argument ),
3781
+ i = matchIndexes.length;
3782
+ // Match elements found at the specified indexes
3783
+ while ( i-- ) {
3784
+ if ( seed[ (j = matchIndexes[i]) ] ) {
3785
+ seed[j] = !(matches[j] = seed[j]);
3786
+ }
3787
+ }
3788
+ });
3789
+ });
3790
+ }
3791
+ /**
3792
+ * Utility function for retrieving the text value of an array of DOM nodes
3793
+ * @param {Array|Element} elem
3794
+ */
3795
+ getText = Sizzle.getText = function( elem ) {
3796
+ var node,
3797
+ ret = "",
3798
+ i = 0,
3799
+ nodeType = elem.nodeType;
3800
+ if ( !nodeType ) {
3801
+ // If no nodeType, this is expected to be an array
3802
+ for ( ; (node = elem[i]); i++ ) {
3803
+ // Do not traverse comment nodes
3804
+ ret += getText( node );
3805
+ }
3806
+ } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
3807
+ // Use textContent for elements
3808
+ // innerText usage removed for consistency of new lines (see #11153)
3809
+ if ( typeof elem.textContent === "string" ) {
3810
+ return elem.textContent;
3811
+ } else {
3812
+ // Traverse its children
3813
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
3814
+ ret += getText( elem );
3815
+ }
3816
+ }
3817
+ } else if ( nodeType === 3 || nodeType === 4 ) {
3818
+ return elem.nodeValue;
3819
+ }
3820
+ // Do not include comment or processing instruction nodes
3821
+ return ret;
3822
+ };
3823
+ Expr = Sizzle.selectors = {
3824
+ // Can be adjusted by the user
3825
+ cacheLength: 50,
3826
+ createPseudo: markFunction,
3827
+ match: matchExpr,
3828
+ find: {},
3829
+ relative: {
3830
+ ">": { dir: "parentNode", first: true },
3831
+ " ": { dir: "parentNode" },
3832
+ "+": { dir: "previousSibling", first: true },
3833
+ "~": { dir: "previousSibling" }
3834
+ },
3835
+ preFilter: {
3836
+ "ATTR": function( match ) {
3837
+ match[1] = match[1].replace( runescape, funescape );
3838
+ // Move the given value to match[3] whether quoted or unquoted
3839
+ match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
3840
+ if ( match[2] === "~=" ) {
3841
+ match[3] = " " + match[3] + " ";
3842
+ }
3843
+ return match.slice( 0, 4 );
3844
+ },
3845
+ "CHILD": function( match ) {
3846
+ /* matches from matchExpr["CHILD"]
3847
+ 1 type (only|nth|...)
3848
+ 2 what (child|of-type)
3849
+ 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
3850
+ 4 xn-component of xn+y argument ([+-]?\d*n|)
3851
+ 5 sign of xn-component
3852
+ 6 x of xn-component
3853
+ 7 sign of y-component
3854
+ 8 y of y-component
3855
+ */
3856
+ match[1] = match[1].toLowerCase();
3857
+ if ( match[1].slice( 0, 3 ) === "nth" ) {
3858
+ // nth-* requires argument
3859
+ if ( !match[3] ) {
3860
+ Sizzle.error( match[0] );
3861
+ }
3862
+ // numeric x and y parameters for Expr.filter.CHILD
3863
+ // remember that false/true cast respectively to 0/1
3864
+ match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
3865
+ match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
3866
+ // other types prohibit arguments
3867
+ } else if ( match[3] ) {
3868
+ Sizzle.error( match[0] );
3869
+ }
3870
+ return match;
3871
+ },
3872
+ "PSEUDO": function( match ) {
3873
+ var excess,
3874
+ unquoted = !match[5] && match[2];
3875
+ if ( matchExpr["CHILD"].test( match[0] ) ) {
3876
+ return null;
3877
+ }
3878
+ // Accept quoted arguments as-is
3879
+ if ( match[4] ) {
3880
+ match[2] = match[4];
3881
+ // Strip excess characters from unquoted arguments
3882
+ } else if ( unquoted && rpseudo.test( unquoted ) &&
3883
+ // Get excess from tokenize (recursively)
3884
+ (excess = tokenize( unquoted, true )) &&
3885
+ // advance to the next closing parenthesis
3886
+ (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
3887
+ // excess is a negative index
3888
+ match[0] = match[0].slice( 0, excess );
3889
+ match[2] = unquoted.slice( 0, excess );
3890
+ }
3891
+ // Return only captures needed by the pseudo filter method (type and argument)
3892
+ return match.slice( 0, 3 );
3893
+ }
3894
+ },
3895
+ filter: {
3896
+ "TAG": function( nodeName ) {
3897
+ if ( nodeName === "*" ) {
3898
+ return function() { return true; };
3899
+ }
3900
+ nodeName = nodeName.replace( runescape, funescape ).toLowerCase();
3901
+ return function( elem ) {
3902
+ return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
3903
+ };
3904
+ },
3905
+ "CLASS": function( className ) {
3906
+ var pattern = classCache[ className + " " ];
3907
+ return pattern ||
3908
+ (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
3909
+ classCache( className, function( elem ) {
3910
+ return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
3911
+ });
3912
+ },
3913
+ "ATTR": function( name, operator, check ) {
3914
+ return function( elem ) {
3915
+ var result = Sizzle.attr( elem, name );
3916
+ if ( result == null ) {
3917
+ return operator === "!=";
3918
+ }
3919
+ if ( !operator ) {
3920
+ return true;
3921
+ }
3922
+ result += "";
3923
+ return operator === "=" ? result === check :
3924
+ operator === "!=" ? result !== check :
3925
+ operator === "^=" ? check && result.indexOf( check ) === 0 :
3926
+ operator === "*=" ? check && result.indexOf( check ) > -1 :
3927
+ operator === "$=" ? check && result.slice( -check.length ) === check :
3928
+ operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
3929
+ operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
3930
+ false;
3931
+ };
3932
+ },
3933
+ "CHILD": function( type, what, argument, first, last ) {
3934
+ var simple = type.slice( 0, 3 ) !== "nth",
3935
+ forward = type.slice( -4 ) !== "last",
3936
+ ofType = what === "of-type";
3937
+ return first === 1 && last === 0 ?
3938
+ // Shortcut for :nth-*(n)
3939
+ function( elem ) {
3940
+ return !!elem.parentNode;
3941
+ } :
3942
+ function( elem, context, xml ) {
3943
+ var cache, outerCache, node, diff, nodeIndex, start,
3944
+ dir = simple !== forward ? "nextSibling" : "previousSibling",
3945
+ parent = elem.parentNode,
3946
+ name = ofType && elem.nodeName.toLowerCase(),
3947
+ useCache = !xml && !ofType;
3948
+ if ( parent ) {
3949
+ // :(first|last|only)-(child|of-type)
3950
+ if ( simple ) {
3951
+ while ( dir ) {
3952
+ node = elem;
3953
+ while ( (node = node[ dir ]) ) {
3954
+ if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
3955
+ return false;
3956
+ }
3957
+ }
3958
+ // Reverse direction for :only-* (if we haven't yet done so)
3959
+ start = dir = type === "only" && !start && "nextSibling";
3960
+ }
3961
+ return true;
3962
+ }
3963
+ start = [ forward ? parent.firstChild : parent.lastChild ];
3964
+ // non-xml :nth-child(...) stores cache data on `parent`
3965
+ if ( forward && useCache ) {
3966
+ // Seek `elem` from a previously-cached index
3967
+ outerCache = parent[ expando ] || (parent[ expando ] = {});
3968
+ cache = outerCache[ type ] || [];
3969
+ nodeIndex = cache[0] === dirruns && cache[1];
3970
+ diff = cache[0] === dirruns && cache[2];
3971
+ node = nodeIndex && parent.childNodes[ nodeIndex ];
3972
+ while ( (node = ++nodeIndex && node && node[ dir ] ||
3973
+ // Fallback to seeking `elem` from the start
3974
+ (diff = nodeIndex = 0) || start.pop()) ) {
3975
+ // When found, cache indexes on `parent` and break
3976
+ if ( node.nodeType === 1 && ++diff && node === elem ) {
3977
+ outerCache[ type ] = [ dirruns, nodeIndex, diff ];
3978
+ break;
3979
+ }
3980
+ }
3981
+ // Use previously-cached element index if available
3982
+ } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
3983
+ diff = cache[1];
3984
+ // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
3985
+ } else {
3986
+ // Use the same loop as above to seek `elem` from the start
3987
+ while ( (node = ++nodeIndex && node && node[ dir ] ||
3988
+ (diff = nodeIndex = 0) || start.pop()) ) {
3989
+ if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
3990
+ // Cache the index of each encountered element
3991
+ if ( useCache ) {
3992
+ (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
3993
+ }
3994
+ if ( node === elem ) {
3995
+ break;
3996
+ }
3997
+ }
3998
+ }
3999
+ }
4000
+ // Incorporate the offset, then check against cycle size
4001
+ diff -= last;
4002
+ return diff === first || ( diff % first === 0 && diff / first >= 0 );
4003
+ }
4004
+ };
4005
+ },
4006
+ "PSEUDO": function( pseudo, argument ) {
4007
+ // pseudo-class names are case-insensitive
4008
+ // http://www.w3.org/TR/selectors/#pseudo-classes
4009
+ // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
4010
+ // Remember that setFilters inherits from pseudos
4011
+ var args,
4012
+ fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
4013
+ Sizzle.error( "unsupported pseudo: " + pseudo );
4014
+ // The user may use createPseudo to indicate that
4015
+ // arguments are needed to create the filter function
4016
+ // just as Sizzle does
4017
+ if ( fn[ expando ] ) {
4018
+ return fn( argument );
4019
+ }
4020
+ // But maintain support for old signatures
4021
+ if ( fn.length > 1 ) {
4022
+ args = [ pseudo, pseudo, "", argument ];
4023
+ return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
4024
+ markFunction(function( seed, matches ) {
4025
+ var idx,
4026
+ matched = fn( seed, argument ),
4027
+ i = matched.length;
4028
+ while ( i-- ) {
4029
+ idx = indexOf.call( seed, matched[i] );
4030
+ seed[ idx ] = !( matches[ idx ] = matched[i] );
4031
+ }
4032
+ }) :
4033
+ function( elem ) {
4034
+ return fn( elem, 0, args );
4035
+ };
4036
+ }
4037
+ return fn;
4038
+ }
4039
+ },
4040
+ pseudos: {
4041
+ // Potentially complex pseudos
4042
+ "not": markFunction(function( selector ) {
4043
+ // Trim the selector passed to compile
4044
+ // to avoid treating leading and trailing
4045
+ // spaces as combinators
4046
+ var input = [],
4047
+ results = [],
4048
+ matcher = compile( selector.replace( rtrim, "$1" ) );
4049
+ return matcher[ expando ] ?
4050
+ markFunction(function( seed, matches, context, xml ) {
4051
+ var elem,
4052
+ unmatched = matcher( seed, null, xml, [] ),
4053
+ i = seed.length;
4054
+ // Match elements unmatched by `matcher`
4055
+ while ( i-- ) {
4056
+ if ( (elem = unmatched[i]) ) {
4057
+ seed[i] = !(matches[i] = elem);
4058
+ }
4059
+ }
4060
+ }) :
4061
+ function( elem, context, xml ) {
4062
+ input[0] = elem;
4063
+ matcher( input, null, xml, results );
4064
+ return !results.pop();
4065
+ };
4066
+ }),
4067
+ "has": markFunction(function( selector ) {
4068
+ return function( elem ) {
4069
+ return Sizzle( selector, elem ).length > 0;
4070
+ };
4071
+ }),
4072
+ "contains": markFunction(function( text ) {
4073
+ return function( elem ) {
4074
+ return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
4075
+ };
4076
+ }),
4077
+ // "Whether an element is represented by a :lang() selector
4078
+ // is based solely on the element's language value
4079
+ // being equal to the identifier C,
4080
+ // or beginning with the identifier C immediately followed by "-".
4081
+ // The matching of C against the element's language value is performed case-insensitively.
4082
+ // The identifier C does not have to be a valid language name."
4083
+ // http://www.w3.org/TR/selectors/#lang-pseudo
4084
+ "lang": markFunction( function( lang ) {
4085
+ // lang value must be a valid identifider
4086
+ if ( !ridentifier.test(lang || "") ) {
4087
+ Sizzle.error( "unsupported lang: " + lang );
4088
+ }
4089
+ lang = lang.replace( runescape, funescape ).toLowerCase();
4090
+ return function( elem ) {
4091
+ var elemLang;
4092
+ do {
4093
+ if ( (elemLang = documentIsXML ?
4094
+ elem.getAttribute("xml:lang") || elem.getAttribute("lang") :
4095
+ elem.lang) ) {
4096
+ elemLang = elemLang.toLowerCase();
4097
+ return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
4098
+ }
4099
+ } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
4100
+ return false;
4101
+ };
4102
+ }),
4103
+ // Miscellaneous
4104
+ "target": function( elem ) {
4105
+ var hash = window.location && window.location.hash;
4106
+ return hash && hash.slice( 1 ) === elem.id;
4107
+ },
4108
+ "root": function( elem ) {
4109
+ return elem === docElem;
4110
+ },
4111
+ "focus": function( elem ) {
4112
+ return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
4113
+ },
4114
+ // Boolean properties
4115
+ "enabled": function( elem ) {
4116
+ return elem.disabled === false;
4117
+ },
4118
+ "disabled": function( elem ) {
4119
+ return elem.disabled === true;
4120
+ },
4121
+ "checked": function( elem ) {
4122
+ // In CSS3, :checked should return both checked and selected elements
4123
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
4124
+ var nodeName = elem.nodeName.toLowerCase();
4125
+ return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
4126
+ },
4127
+ "selected": function( elem ) {
4128
+ // Accessing this property makes selected-by-default
4129
+ // options in Safari work properly
4130
+ if ( elem.parentNode ) {
4131
+ elem.parentNode.selectedIndex;
4132
+ }
4133
+ return elem.selected === true;
4134
+ },
4135
+ // Contents
4136
+ "empty": function( elem ) {
4137
+ // http://www.w3.org/TR/selectors/#empty-pseudo
4138
+ // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
4139
+ // not comment, processing instructions, or others
4140
+ // Thanks to Diego Perini for the nodeName shortcut
4141
+ // Greater than "@" means alpha characters (specifically not starting with "#" or "?")
4142
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
4143
+ if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) {
4144
+ return false;
4145
+ }
4146
+ }
4147
+ return true;
4148
+ },
4149
+ "parent": function( elem ) {
4150
+ return !Expr.pseudos["empty"]( elem );
4151
+ },
4152
+ // Element/input types
4153
+ "header": function( elem ) {
4154
+ return rheader.test( elem.nodeName );
4155
+ },
4156
+ "input": function( elem ) {
4157
+ return rinputs.test( elem.nodeName );
4158
+ },
4159
+ "button": function( elem ) {
4160
+ var name = elem.nodeName.toLowerCase();
4161
+ return name === "input" && elem.type === "button" || name === "button";
4162
+ },
4163
+ "text": function( elem ) {
4164
+ var attr;
4165
+ // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
4166
+ // use getAttribute instead to test this case
4167
+ return elem.nodeName.toLowerCase() === "input" &&
4168
+ elem.type === "text" &&
4169
+ ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type );
4170
+ },
4171
+ // Position-in-collection
4172
+ "first": createPositionalPseudo(function() {
4173
+ return [ 0 ];
4174
+ }),
4175
+ "last": createPositionalPseudo(function( matchIndexes, length ) {
4176
+ return [ length - 1 ];
4177
+ }),
4178
+ "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
4179
+ return [ argument < 0 ? argument + length : argument ];
4180
+ }),
4181
+ "even": createPositionalPseudo(function( matchIndexes, length ) {
4182
+ var i = 0;
4183
+ for ( ; i < length; i += 2 ) {
4184
+ matchIndexes.push( i );
4185
+ }
4186
+ return matchIndexes;
4187
+ }),
4188
+ "odd": createPositionalPseudo(function( matchIndexes, length ) {
4189
+ var i = 1;
4190
+ for ( ; i < length; i += 2 ) {
4191
+ matchIndexes.push( i );
4192
+ }
4193
+ return matchIndexes;
4194
+ }),
4195
+ "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
4196
+ var i = argument < 0 ? argument + length : argument;
4197
+ for ( ; --i >= 0; ) {
4198
+ matchIndexes.push( i );
4199
+ }
4200
+ return matchIndexes;
4201
+ }),
4202
+ "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
4203
+ var i = argument < 0 ? argument + length : argument;
4204
+ for ( ; ++i < length; ) {
4205
+ matchIndexes.push( i );
4206
+ }
4207
+ return matchIndexes;
4208
+ })
4209
+ }
4210
+ };
4211
+ // Add button/input type pseudos
4212
+ for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
4213
+ Expr.pseudos[ i ] = createInputPseudo( i );
4214
+ }
4215
+ for ( i in { submit: true, reset: true } ) {
4216
+ Expr.pseudos[ i ] = createButtonPseudo( i );
4217
+ }
4218
+ function tokenize( selector, parseOnly ) {
4219
+ var matched, match, tokens, type,
4220
+ soFar, groups, preFilters,
4221
+ cached = tokenCache[ selector + " " ];
4222
+ if ( cached ) {
4223
+ return parseOnly ? 0 : cached.slice( 0 );
4224
+ }
4225
+ soFar = selector;
4226
+ groups = [];
4227
+ preFilters = Expr.preFilter;
4228
+ while ( soFar ) {
4229
+ // Comma and first run
4230
+ if ( !matched || (match = rcomma.exec( soFar )) ) {
4231
+ if ( match ) {
4232
+ // Don't consume trailing commas as valid
4233
+ soFar = soFar.slice( match[0].length ) || soFar;
4234
+ }
4235
+ groups.push( tokens = [] );
4236
+ }
4237
+ matched = false;
4238
+ // Combinators
4239
+ if ( (match = rcombinators.exec( soFar )) ) {
4240
+ matched = match.shift();
4241
+ tokens.push( {
4242
+ value: matched,
4243
+ // Cast descendant combinators to space
4244
+ type: match[0].replace( rtrim, " " )
4245
+ } );
4246
+ soFar = soFar.slice( matched.length );
4247
+ }
4248
+ // Filters
4249
+ for ( type in Expr.filter ) {
4250
+ if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
4251
+ (match = preFilters[ type ]( match ))) ) {
4252
+ matched = match.shift();
4253
+ tokens.push( {
4254
+ value: matched,
4255
+ type: type,
4256
+ matches: match
4257
+ } );
4258
+ soFar = soFar.slice( matched.length );
4259
+ }
4260
+ }
4261
+ if ( !matched ) {
4262
+ break;
4263
+ }
4264
+ }
4265
+ // Return the length of the invalid excess
4266
+ // if we're just parsing
4267
+ // Otherwise, throw an error or return tokens
4268
+ return parseOnly ?
4269
+ soFar.length :
4270
+ soFar ?
4271
+ Sizzle.error( selector ) :
4272
+ // Cache the tokens
4273
+ tokenCache( selector, groups ).slice( 0 );
4274
+ }
4275
+ function toSelector( tokens ) {
4276
+ var i = 0,
4277
+ len = tokens.length,
4278
+ selector = "";
4279
+ for ( ; i < len; i++ ) {
4280
+ selector += tokens[i].value;
4281
+ }
4282
+ return selector;
4283
+ }
4284
+ function addCombinator( matcher, combinator, base ) {
4285
+ var dir = combinator.dir,
4286
+ checkNonElements = base && dir === "parentNode",
4287
+ doneName = done++;
4288
+ return combinator.first ?
4289
+ // Check against closest ancestor/preceding element
4290
+ function( elem, context, xml ) {
4291
+ while ( (elem = elem[ dir ]) ) {
4292
+ if ( elem.nodeType === 1 || checkNonElements ) {
4293
+ return matcher( elem, context, xml );
4294
+ }
4295
+ }
4296
+ } :
4297
+ // Check against all ancestor/preceding elements
4298
+ function( elem, context, xml ) {
4299
+ var data, cache, outerCache,
4300
+ dirkey = dirruns + " " + doneName;
4301
+ // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
4302
+ if ( xml ) {
4303
+ while ( (elem = elem[ dir ]) ) {
4304
+ if ( elem.nodeType === 1 || checkNonElements ) {
4305
+ if ( matcher( elem, context, xml ) ) {
4306
+ return true;
4307
+ }
4308
+ }
4309
+ }
4310
+ } else {
4311
+ while ( (elem = elem[ dir ]) ) {
4312
+ if ( elem.nodeType === 1 || checkNonElements ) {
4313
+ outerCache = elem[ expando ] || (elem[ expando ] = {});
4314
+ if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {
4315
+ if ( (data = cache[1]) === true || data === cachedruns ) {
4316
+ return data === true;
4317
+ }
4318
+ } else {
4319
+ cache = outerCache[ dir ] = [ dirkey ];
4320
+ cache[1] = matcher( elem, context, xml ) || cachedruns;
4321
+ if ( cache[1] === true ) {
4322
+ return true;
4323
+ }
4324
+ }
4325
+ }
4326
+ }
4327
+ }
4328
+ };
4329
+ }
4330
+ function elementMatcher( matchers ) {
4331
+ return matchers.length > 1 ?
4332
+ function( elem, context, xml ) {
4333
+ var i = matchers.length;
4334
+ while ( i-- ) {
4335
+ if ( !matchers[i]( elem, context, xml ) ) {
4336
+ return false;
4337
+ }
4338
+ }
4339
+ return true;
4340
+ } :
4341
+ matchers[0];
4342
+ }
4343
+ function condense( unmatched, map, filter, context, xml ) {
4344
+ var elem,
4345
+ newUnmatched = [],
4346
+ i = 0,
4347
+ len = unmatched.length,
4348
+ mapped = map != null;
4349
+ for ( ; i < len; i++ ) {
4350
+ if ( (elem = unmatched[i]) ) {
4351
+ if ( !filter || filter( elem, context, xml ) ) {
4352
+ newUnmatched.push( elem );
4353
+ if ( mapped ) {
4354
+ map.push( i );
4355
+ }
4356
+ }
4357
+ }
4358
+ }
4359
+ return newUnmatched;
4360
+ }
4361
+ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
4362
+ if ( postFilter && !postFilter[ expando ] ) {
4363
+ postFilter = setMatcher( postFilter );
4364
+ }
4365
+ if ( postFinder && !postFinder[ expando ] ) {
4366
+ postFinder = setMatcher( postFinder, postSelector );
4367
+ }
4368
+ return markFunction(function( seed, results, context, xml ) {
4369
+ var temp, i, elem,
4370
+ preMap = [],
4371
+ postMap = [],
4372
+ preexisting = results.length,
4373
+ // Get initial elements from seed or context
4374
+ elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
4375
+ // Prefilter to get matcher input, preserving a map for seed-results synchronization
4376
+ matcherIn = preFilter && ( seed || !selector ) ?
4377
+ condense( elems, preMap, preFilter, context, xml ) :
4378
+ elems,
4379
+ matcherOut = matcher ?
4380
+ // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
4381
+ postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
4382
+ // ...intermediate processing is necessary
4383
+ [] :
4384
+ // ...otherwise use results directly
4385
+ results :
4386
+ matcherIn;
4387
+ // Find primary matches
4388
+ if ( matcher ) {
4389
+ matcher( matcherIn, matcherOut, context, xml );
4390
+ }
4391
+ // Apply postFilter
4392
+ if ( postFilter ) {
4393
+ temp = condense( matcherOut, postMap );
4394
+ postFilter( temp, [], context, xml );
4395
+ // Un-match failing elements by moving them back to matcherIn
4396
+ i = temp.length;
4397
+ while ( i-- ) {
4398
+ if ( (elem = temp[i]) ) {
4399
+ matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
4400
+ }
4401
+ }
4402
+ }
4403
+ if ( seed ) {
4404
+ if ( postFinder || preFilter ) {
4405
+ if ( postFinder ) {
4406
+ // Get the final matcherOut by condensing this intermediate into postFinder contexts
4407
+ temp = [];
4408
+ i = matcherOut.length;
4409
+ while ( i-- ) {
4410
+ if ( (elem = matcherOut[i]) ) {
4411
+ // Restore matcherIn since elem is not yet a final match
4412
+ temp.push( (matcherIn[i] = elem) );
4413
+ }
4414
+ }
4415
+ postFinder( null, (matcherOut = []), temp, xml );
4416
+ }
4417
+ // Move matched elements from seed to results to keep them synchronized
4418
+ i = matcherOut.length;
4419
+ while ( i-- ) {
4420
+ if ( (elem = matcherOut[i]) &&
4421
+ (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
4422
+ seed[temp] = !(results[temp] = elem);
4423
+ }
4424
+ }
4425
+ }
4426
+ // Add elements to results, through postFinder if defined
4427
+ } else {
4428
+ matcherOut = condense(
4429
+ matcherOut === results ?
4430
+ matcherOut.splice( preexisting, matcherOut.length ) :
4431
+ matcherOut
4432
+ );
4433
+ if ( postFinder ) {
4434
+ postFinder( null, results, matcherOut, xml );
4435
+ } else {
4436
+ push.apply( results, matcherOut );
4437
+ }
4438
+ }
4439
+ });
4440
+ }
4441
+ function matcherFromTokens( tokens ) {
4442
+ var checkContext, matcher, j,
4443
+ len = tokens.length,
4444
+ leadingRelative = Expr.relative[ tokens[0].type ],
4445
+ implicitRelative = leadingRelative || Expr.relative[" "],
4446
+ i = leadingRelative ? 1 : 0,
4447
+ // The foundational matcher ensures that elements are reachable from top-level context(s)
4448
+ matchContext = addCombinator( function( elem ) {
4449
+ return elem === checkContext;
4450
+ }, implicitRelative, true ),
4451
+ matchAnyContext = addCombinator( function( elem ) {
4452
+ return indexOf.call( checkContext, elem ) > -1;
4453
+ }, implicitRelative, true ),
4454
+ matchers = [ function( elem, context, xml ) {
4455
+ return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
4456
+ (checkContext = context).nodeType ?
4457
+ matchContext( elem, context, xml ) :
4458
+ matchAnyContext( elem, context, xml ) );
4459
+ } ];
4460
+ for ( ; i < len; i++ ) {
4461
+ if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
4462
+ matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
4463
+ } else {
4464
+ matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
4465
+ // Return special upon seeing a positional matcher
4466
+ if ( matcher[ expando ] ) {
4467
+ // Find the next relative operator (if any) for proper handling
4468
+ j = ++i;
4469
+ for ( ; j < len; j++ ) {
4470
+ if ( Expr.relative[ tokens[j].type ] ) {
4471
+ break;
4472
+ }
4473
+ }
4474
+ return setMatcher(
4475
+ i > 1 && elementMatcher( matchers ),
4476
+ i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ),
4477
+ matcher,
4478
+ i < j && matcherFromTokens( tokens.slice( i, j ) ),
4479
+ j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
4480
+ j < len && toSelector( tokens )
4481
+ );
4482
+ }
4483
+ matchers.push( matcher );
4484
+ }
4485
+ }
4486
+ return elementMatcher( matchers );
4487
+ }
4488
+ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
4489
+ // A counter to specify which element is currently being matched
4490
+ var matcherCachedRuns = 0,
4491
+ bySet = setMatchers.length > 0,
4492
+ byElement = elementMatchers.length > 0,
4493
+ superMatcher = function( seed, context, xml, results, expandContext ) {
4494
+ var elem, j, matcher,
4495
+ setMatched = [],
4496
+ matchedCount = 0,
4497
+ i = "0",
4498
+ unmatched = seed && [],
4499
+ outermost = expandContext != null,
4500
+ contextBackup = outermostContext,
4501
+ // We must always have either seed elements or context
4502
+ elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
4503
+ // Use integer dirruns iff this is the outermost matcher
4504
+ dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1);
4505
+ if ( outermost ) {
4506
+ outermostContext = context !== document && context;
4507
+ cachedruns = matcherCachedRuns;
4508
+ }
4509
+ // Add elements passing elementMatchers directly to results
4510
+ // Keep `i` a string if there are no elements so `matchedCount` will be "00" below
4511
+ for ( ; (elem = elems[i]) != null; i++ ) {
4512
+ if ( byElement && elem ) {
4513
+ j = 0;
4514
+ while ( (matcher = elementMatchers[j++]) ) {
4515
+ if ( matcher( elem, context, xml ) ) {
4516
+ results.push( elem );
4517
+ break;
4518
+ }
4519
+ }
4520
+ if ( outermost ) {
4521
+ dirruns = dirrunsUnique;
4522
+ cachedruns = ++matcherCachedRuns;
4523
+ }
4524
+ }
4525
+ // Track unmatched elements for set filters
4526
+ if ( bySet ) {
4527
+ // They will have gone through all possible matchers
4528
+ if ( (elem = !matcher && elem) ) {
4529
+ matchedCount--;
4530
+ }
4531
+ // Lengthen the array for every element, matched or not
4532
+ if ( seed ) {
4533
+ unmatched.push( elem );
4534
+ }
4535
+ }
4536
+ }
4537
+ // Apply set filters to unmatched elements
4538
+ matchedCount += i;
4539
+ if ( bySet && i !== matchedCount ) {
4540
+ j = 0;
4541
+ while ( (matcher = setMatchers[j++]) ) {
4542
+ matcher( unmatched, setMatched, context, xml );
4543
+ }
4544
+ if ( seed ) {
4545
+ // Reintegrate element matches to eliminate the need for sorting
4546
+ if ( matchedCount > 0 ) {
4547
+ while ( i-- ) {
4548
+ if ( !(unmatched[i] || setMatched[i]) ) {
4549
+ setMatched[i] = pop.call( results );
4550
+ }
4551
+ }
4552
+ }
4553
+ // Discard index placeholder values to get only actual matches
4554
+ setMatched = condense( setMatched );
4555
+ }
4556
+ // Add matches to results
4557
+ push.apply( results, setMatched );
4558
+ // Seedless set matches succeeding multiple successful matchers stipulate sorting
4559
+ if ( outermost && !seed && setMatched.length > 0 &&
4560
+ ( matchedCount + setMatchers.length ) > 1 ) {
4561
+ Sizzle.uniqueSort( results );
4562
+ }
4563
+ }
4564
+ // Override manipulation of globals by nested matchers
4565
+ if ( outermost ) {
4566
+ dirruns = dirrunsUnique;
4567
+ outermostContext = contextBackup;
4568
+ }
4569
+ return unmatched;
4570
+ };
4571
+ return bySet ?
4572
+ markFunction( superMatcher ) :
4573
+ superMatcher;
4574
+ }
4575
+ compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
4576
+ var i,
4577
+ setMatchers = [],
4578
+ elementMatchers = [],
4579
+ cached = compilerCache[ selector + " " ];
4580
+ if ( !cached ) {
4581
+ // Generate a function of recursive functions that can be used to check each element
4582
+ if ( !group ) {
4583
+ group = tokenize( selector );
4584
+ }
4585
+ i = group.length;
4586
+ while ( i-- ) {
4587
+ cached = matcherFromTokens( group[i] );
4588
+ if ( cached[ expando ] ) {
4589
+ setMatchers.push( cached );
4590
+ } else {
4591
+ elementMatchers.push( cached );
4592
+ }
4593
+ }
4594
+ // Cache the compiled function
4595
+ cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
4596
+ }
4597
+ return cached;
4598
+ };
4599
+ function multipleContexts( selector, contexts, results ) {
4600
+ var i = 0,
4601
+ len = contexts.length;
4602
+ for ( ; i < len; i++ ) {
4603
+ Sizzle( selector, contexts[i], results );
4604
+ }
4605
+ return results;
4606
+ }
4607
+ function select( selector, context, results, seed ) {
4608
+ var i, tokens, token, type, find,
4609
+ match = tokenize( selector );
4610
+ if ( !seed ) {
4611
+ // Try to minimize operations if there is only one group
4612
+ if ( match.length === 1 ) {
4613
+ // Take a shortcut and set the context if the root selector is an ID
4614
+ tokens = match[0] = match[0].slice( 0 );
4615
+ if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
4616
+ context.nodeType === 9 && !documentIsXML &&
4617
+ Expr.relative[ tokens[1].type ] ) {
4618
+ context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0];
4619
+ if ( !context ) {
4620
+ return results;
4621
+ }
4622
+ selector = selector.slice( tokens.shift().value.length );
4623
+ }
4624
+ // Fetch a seed set for right-to-left matching
4625
+ i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
4626
+ while ( i-- ) {
4627
+ token = tokens[i];
4628
+ // Abort if we hit a combinator
4629
+ if ( Expr.relative[ (type = token.type) ] ) {
4630
+ break;
4631
+ }
4632
+ if ( (find = Expr.find[ type ]) ) {
4633
+ // Search, expanding context for leading sibling combinators
4634
+ if ( (seed = find(
4635
+ token.matches[0].replace( runescape, funescape ),
4636
+ rsibling.test( tokens[0].type ) && context.parentNode || context
4637
+ )) ) {
4638
+ // If seed is empty or no tokens remain, we can return early
4639
+ tokens.splice( i, 1 );
4640
+ selector = seed.length && toSelector( tokens );
4641
+ if ( !selector ) {
4642
+ push.apply( results, slice.call( seed, 0 ) );
4643
+ return results;
4644
+ }
4645
+ break;
4646
+ }
4647
+ }
4648
+ }
4649
+ }
4650
+ }
4651
+ // Compile and execute a filtering function
4652
+ // Provide `match` to avoid retokenization if we modified the selector above
4653
+ compile( selector, match )(
4654
+ seed,
4655
+ context,
4656
+ documentIsXML,
4657
+ results,
4658
+ rsibling.test( selector )
4659
+ );
4660
+ return results;
4661
+ }
4662
+ // Deprecated
4663
+ Expr.pseudos["nth"] = Expr.pseudos["eq"];
4664
+ // Easy API for creating new setFilters
4665
+ function setFilters() {}
4666
+ Expr.filters = setFilters.prototype = Expr.pseudos;
4667
+ Expr.setFilters = new setFilters();
4668
+ // Initialize with the default document
4669
+ setDocument();
4670
+ // Override sizzle attribute retrieval
4671
+ Sizzle.attr = jQuery.attr;
4672
+ jQuery.find = Sizzle;
4673
+ jQuery.expr = Sizzle.selectors;
4674
+ jQuery.expr[":"] = jQuery.expr.pseudos;
4675
+ jQuery.unique = Sizzle.uniqueSort;
4676
+ jQuery.text = Sizzle.getText;
4677
+ jQuery.isXMLDoc = Sizzle.isXML;
4678
+ jQuery.contains = Sizzle.contains;
4679
+ })( window );
4680
+ var runtil = /Until$/,
4681
+ rparentsprev = /^(?:parents|prev(?:Until|All))/,
4682
+ isSimple = /^.[^:#\[\.,]*$/,
4683
+ rneedsContext = jQuery.expr.match.needsContext,
4684
+ // methods guaranteed to produce a unique set when starting from a unique set
4685
+ guaranteedUnique = {
4686
+ children: true,
4687
+ contents: true,
4688
+ next: true,
4689
+ prev: true
4690
+ };
4691
+ jQuery.fn.extend({
4692
+ find: function( selector ) {
4693
+ var i, ret, self,
4694
+ len = this.length;
4695
+ if ( typeof selector !== "string" ) {
4696
+ self = this;
4697
+ return this.pushStack( jQuery( selector ).filter(function() {
4698
+ for ( i = 0; i < len; i++ ) {
4699
+ if ( jQuery.contains( self[ i ], this ) ) {
4700
+ return true;
4701
+ }
4702
+ }
4703
+ }) );
4704
+ }
4705
+ ret = [];
4706
+ for ( i = 0; i < len; i++ ) {
4707
+ jQuery.find( selector, this[ i ], ret );
4708
+ }
4709
+ // Needed because $( selector, context ) becomes $( context ).find( selector )
4710
+ ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
4711
+ ret.selector = ( this.selector ? this.selector + " " : "" ) + selector;
4712
+ return ret;
4713
+ },
4714
+ has: function( target ) {
4715
+ var i,
4716
+ targets = jQuery( target, this ),
4717
+ len = targets.length;
4718
+ return this.filter(function() {
4719
+ for ( i = 0; i < len; i++ ) {
4720
+ if ( jQuery.contains( this, targets[i] ) ) {
4721
+ return true;
4722
+ }
4723
+ }
4724
+ });
4725
+ },
4726
+ not: function( selector ) {
4727
+ return this.pushStack( winnow(this, selector, false) );
4728
+ },
4729
+ filter: function( selector ) {
4730
+ return this.pushStack( winnow(this, selector, true) );
4731
+ },
4732
+ is: function( selector ) {
4733
+ return !!selector && (
4734
+ typeof selector === "string" ?
4735
+ // If this is a positional/relative selector, check membership in the returned set
4736
+ // so $("p:first").is("p:last") won't return true for a doc with two "p".
4737
+ rneedsContext.test( selector ) ?
4738
+ jQuery( selector, this.context ).index( this[0] ) >= 0 :
4739
+ jQuery.filter( selector, this ).length > 0 :
4740
+ this.filter( selector ).length > 0 );
4741
+ },
4742
+ closest: function( selectors, context ) {
4743
+ var cur,
4744
+ i = 0,
4745
+ l = this.length,
4746
+ ret = [],
4747
+ pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
4748
+ jQuery( selectors, context || this.context ) :
4749
+ 0;
4750
+ for ( ; i < l; i++ ) {
4751
+ cur = this[i];
4752
+ while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {
4753
+ if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
4754
+ ret.push( cur );
4755
+ break;
4756
+ }
4757
+ cur = cur.parentNode;
4758
+ }
4759
+ }
4760
+ return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret );
4761
+ },
4762
+ // Determine the position of an element within
4763
+ // the matched set of elements
4764
+ index: function( elem ) {
4765
+ // No argument, return index in parent
4766
+ if ( !elem ) {
4767
+ return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1;
4768
+ }
4769
+ // index in selector
4770
+ if ( typeof elem === "string" ) {
4771
+ return jQuery.inArray( this[0], jQuery( elem ) );
4772
+ }
4773
+ // Locate the position of the desired element
4774
+ return jQuery.inArray(
4775
+ // If it receives a jQuery object, the first element is used
4776
+ elem.jquery ? elem[0] : elem, this );
4777
+ },
4778
+ add: function( selector, context ) {
4779
+ var set = typeof selector === "string" ?
4780
+ jQuery( selector, context ) :
4781
+ jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
4782
+ all = jQuery.merge( this.get(), set );
4783
+ return this.pushStack( jQuery.unique(all) );
4784
+ },
4785
+ addBack: function( selector ) {
4786
+ return this.add( selector == null ?
4787
+ this.prevObject : this.prevObject.filter(selector)
4788
+ );
4789
+ }
4790
+ });
4791
+ jQuery.fn.andSelf = jQuery.fn.addBack;
4792
+ function sibling( cur, dir ) {
4793
+ do {
4794
+ cur = cur[ dir ];
4795
+ } while ( cur && cur.nodeType !== 1 );
4796
+ return cur;
4797
+ }
4798
+ jQuery.each({
4799
+ parent: function( elem ) {
4800
+ var parent = elem.parentNode;
4801
+ return parent && parent.nodeType !== 11 ? parent : null;
4802
+ },
4803
+ parents: function( elem ) {
4804
+ return jQuery.dir( elem, "parentNode" );
4805
+ },
4806
+ parentsUntil: function( elem, i, until ) {
4807
+ return jQuery.dir( elem, "parentNode", until );
4808
+ },
4809
+ next: function( elem ) {
4810
+ return sibling( elem, "nextSibling" );
4811
+ },
4812
+ prev: function( elem ) {
4813
+ return sibling( elem, "previousSibling" );
4814
+ },
4815
+ nextAll: function( elem ) {
4816
+ return jQuery.dir( elem, "nextSibling" );
4817
+ },
4818
+ prevAll: function( elem ) {
4819
+ return jQuery.dir( elem, "previousSibling" );
4820
+ },
4821
+ nextUntil: function( elem, i, until ) {
4822
+ return jQuery.dir( elem, "nextSibling", until );
4823
+ },
4824
+ prevUntil: function( elem, i, until ) {
4825
+ return jQuery.dir( elem, "previousSibling", until );
4826
+ },
4827
+ siblings: function( elem ) {
4828
+ return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
4829
+ },
4830
+ children: function( elem ) {
4831
+ return jQuery.sibling( elem.firstChild );
4832
+ },
4833
+ contents: function( elem ) {
4834
+ return jQuery.nodeName( elem, "iframe" ) ?
4835
+ elem.contentDocument || elem.contentWindow.document :
4836
+ jQuery.merge( [], elem.childNodes );
4837
+ }
4838
+ }, function( name, fn ) {
4839
+ jQuery.fn[ name ] = function( until, selector ) {
4840
+ var ret = jQuery.map( this, fn, until );
4841
+ if ( !runtil.test( name ) ) {
4842
+ selector = until;
4843
+ }
4844
+ if ( selector && typeof selector === "string" ) {
4845
+ ret = jQuery.filter( selector, ret );
4846
+ }
4847
+ ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
4848
+ if ( this.length > 1 && rparentsprev.test( name ) ) {
4849
+ ret = ret.reverse();
4850
+ }
4851
+ return this.pushStack( ret );
4852
+ };
4853
+ });
4854
+ jQuery.extend({
4855
+ filter: function( expr, elems, not ) {
4856
+ if ( not ) {
4857
+ expr = ":not(" + expr + ")";
4858
+ }
4859
+ return elems.length === 1 ?
4860
+ jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
4861
+ jQuery.find.matches(expr, elems);
4862
+ },
4863
+ dir: function( elem, dir, until ) {
4864
+ var matched = [],
4865
+ cur = elem[ dir ];
4866
+ while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
4867
+ if ( cur.nodeType === 1 ) {
4868
+ matched.push( cur );
4869
+ }
4870
+ cur = cur[dir];
4871
+ }
4872
+ return matched;
4873
+ },
4874
+ sibling: function( n, elem ) {
4875
+ var r = [];
4876
+ for ( ; n; n = n.nextSibling ) {
4877
+ if ( n.nodeType === 1 && n !== elem ) {
4878
+ r.push( n );
4879
+ }
4880
+ }
4881
+ return r;
4882
+ }
4883
+ });
4884
+ // Implement the identical functionality for filter and not
4885
+ function winnow( elements, qualifier, keep ) {
4886
+ // Can't pass null or undefined to indexOf in Firefox 4
4887
+ // Set to 0 to skip string check
4888
+ qualifier = qualifier || 0;
4889
+ if ( jQuery.isFunction( qualifier ) ) {
4890
+ return jQuery.grep(elements, function( elem, i ) {
4891
+ var retVal = !!qualifier.call( elem, i, elem );
4892
+ return retVal === keep;
4893
+ });
4894
+ } else if ( qualifier.nodeType ) {
4895
+ return jQuery.grep(elements, function( elem ) {
4896
+ return ( elem === qualifier ) === keep;
4897
+ });
4898
+ } else if ( typeof qualifier === "string" ) {
4899
+ var filtered = jQuery.grep(elements, function( elem ) {
4900
+ return elem.nodeType === 1;
4901
+ });
4902
+ if ( isSimple.test( qualifier ) ) {
4903
+ return jQuery.filter(qualifier, filtered, !keep);
4904
+ } else {
4905
+ qualifier = jQuery.filter( qualifier, filtered );
4906
+ }
4907
+ }
4908
+ return jQuery.grep(elements, function( elem ) {
4909
+ return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
4910
+ });
4911
+ }
4912
+ function createSafeFragment( document ) {
4913
+ var list = nodeNames.split( "|" ),
4914
+ safeFrag = document.createDocumentFragment();
4915
+ if ( safeFrag.createElement ) {
4916
+ while ( list.length ) {
4917
+ safeFrag.createElement(
4918
+ list.pop()
4919
+ );
4920
+ }
4921
+ }
4922
+ return safeFrag;
4923
+ }
4924
+ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
4925
+ "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
4926
+ rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
4927
+ rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
4928
+ rleadingWhitespace = /^\s+/,
4929
+ rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
4930
+ rtagName = /<([\w:]+)/,
4931
+ rtbody = /<tbody/i,
4932
+ rhtml = /<|&#?\w+;/,
4933
+ rnoInnerhtml = /<(?:script|style|link)/i,
4934
+ manipulation_rcheckableType = /^(?:checkbox|radio)$/i,
4935
+ // checked="checked" or checked
4936
+ rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
4937
+ rscriptType = /^$|\/(?:java|ecma)script/i,
4938
+ rscriptTypeMasked = /^true\/(.*)/,
4939
+ rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
4940
+ // We have to close these tags to support XHTML (#13200)
4941
+ wrapMap = {
4942
+ option: [ 1, "<select multiple='multiple'>", "</select>" ],
4943
+ legend: [ 1, "<fieldset>", "</fieldset>" ],
4944
+ area: [ 1, "<map>", "</map>" ],
4945
+ param: [ 1, "<object>", "</object>" ],
4946
+ thead: [ 1, "<table>", "</table>" ],
4947
+ tr: [ 2, "<table><tbody>", "</tbody></table>" ],
4948
+ col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
4949
+ td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
4950
+ // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
4951
+ // unless wrapped in a div with non-breaking characters in front of it.
4952
+ _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
4953
+ },
4954
+ safeFragment = createSafeFragment( document ),
4955
+ fragmentDiv = safeFragment.appendChild( document.createElement("div") );
4956
+ wrapMap.optgroup = wrapMap.option;
4957
+ wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
4958
+ wrapMap.th = wrapMap.td;
4959
+ jQuery.fn.extend({
4960
+ text: function( value ) {
4961
+ return jQuery.access( this, function( value ) {
4962
+ return value === undefined ?
4963
+ jQuery.text( this ) :
4964
+ this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
4965
+ }, null, value, arguments.length );
4966
+ },
4967
+ wrapAll: function( html ) {
4968
+ if ( jQuery.isFunction( html ) ) {
4969
+ return this.each(function(i) {
4970
+ jQuery(this).wrapAll( html.call(this, i) );
4971
+ });
4972
+ }
4973
+ if ( this[0] ) {
4974
+ // The elements to wrap the target around
4975
+ var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
4976
+ if ( this[0].parentNode ) {
4977
+ wrap.insertBefore( this[0] );
4978
+ }
4979
+ wrap.map(function() {
4980
+ var elem = this;
4981
+ while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
4982
+ elem = elem.firstChild;
4983
+ }
4984
+ return elem;
4985
+ }).append( this );
4986
+ }
4987
+ return this;
4988
+ },
4989
+ wrapInner: function( html ) {
4990
+ if ( jQuery.isFunction( html ) ) {
4991
+ return this.each(function(i) {
4992
+ jQuery(this).wrapInner( html.call(this, i) );
4993
+ });
4994
+ }
4995
+ return this.each(function() {
4996
+ var self = jQuery( this ),
4997
+ contents = self.contents();
4998
+ if ( contents.length ) {
4999
+ contents.wrapAll( html );
5000
+ } else {
5001
+ self.append( html );
5002
+ }
5003
+ });
5004
+ },
5005
+ wrap: function( html ) {
5006
+ var isFunction = jQuery.isFunction( html );
5007
+ return this.each(function(i) {
5008
+ jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
5009
+ });
5010
+ },
5011
+ unwrap: function() {
5012
+ return this.parent().each(function() {
5013
+ if ( !jQuery.nodeName( this, "body" ) ) {
5014
+ jQuery( this ).replaceWith( this.childNodes );
5015
+ }
5016
+ }).end();
5017
+ },
5018
+ append: function() {
5019
+ return this.domManip(arguments, true, function( elem ) {
5020
+ if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5021
+ this.appendChild( elem );
5022
+ }
5023
+ });
5024
+ },
5025
+ prepend: function() {
5026
+ return this.domManip(arguments, true, function( elem ) {
5027
+ if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5028
+ this.insertBefore( elem, this.firstChild );
5029
+ }
5030
+ });
5031
+ },
5032
+ before: function() {
5033
+ return this.domManip( arguments, false, function( elem ) {
5034
+ if ( this.parentNode ) {
5035
+ this.parentNode.insertBefore( elem, this );
5036
+ }
5037
+ });
5038
+ },
5039
+ after: function() {
5040
+ return this.domManip( arguments, false, function( elem ) {
5041
+ if ( this.parentNode ) {
5042
+ this.parentNode.insertBefore( elem, this.nextSibling );
5043
+ }
5044
+ });
5045
+ },
5046
+ // keepData is for internal use only--do not document
5047
+ remove: function( selector, keepData ) {
5048
+ var elem,
5049
+ i = 0;
5050
+ for ( ; (elem = this[i]) != null; i++ ) {
5051
+ if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) {
5052
+ if ( !keepData && elem.nodeType === 1 ) {
5053
+ jQuery.cleanData( getAll( elem ) );
5054
+ }
5055
+ if ( elem.parentNode ) {
5056
+ if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
5057
+ setGlobalEval( getAll( elem, "script" ) );
5058
+ }
5059
+ elem.parentNode.removeChild( elem );
5060
+ }
5061
+ }
5062
+ }
5063
+ return this;
5064
+ },
5065
+ empty: function() {
5066
+ var elem,
5067
+ i = 0;
5068
+ for ( ; (elem = this[i]) != null; i++ ) {
5069
+ // Remove element nodes and prevent memory leaks
5070
+ if ( elem.nodeType === 1 ) {
5071
+ jQuery.cleanData( getAll( elem, false ) );
5072
+ }
5073
+ // Remove any remaining nodes
5074
+ while ( elem.firstChild ) {
5075
+ elem.removeChild( elem.firstChild );
5076
+ }
5077
+ // If this is a select, ensure that it displays empty (#12336)
5078
+ // Support: IE<9
5079
+ if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
5080
+ elem.options.length = 0;
5081
+ }
5082
+ }
5083
+ return this;
5084
+ },
5085
+ clone: function( dataAndEvents, deepDataAndEvents ) {
5086
+ dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
5087
+ deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
5088
+ return this.map( function () {
5089
+ return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
5090
+ });
5091
+ },
5092
+ html: function( value ) {
5093
+ return jQuery.access( this, function( value ) {
5094
+ var elem = this[0] || {},
5095
+ i = 0,
5096
+ l = this.length;
5097
+ if ( value === undefined ) {
5098
+ return elem.nodeType === 1 ?
5099
+ elem.innerHTML.replace( rinlinejQuery, "" ) :
5100
+ undefined;
5101
+ }
5102
+ // See if we can take a shortcut and just use innerHTML
5103
+ if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
5104
+ ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
5105
+ ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
5106
+ !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
5107
+ value = value.replace( rxhtmlTag, "<$1></$2>" );
5108
+ try {
5109
+ for (; i < l; i++ ) {
5110
+ // Remove element nodes and prevent memory leaks
5111
+ elem = this[i] || {};
5112
+ if ( elem.nodeType === 1 ) {
5113
+ jQuery.cleanData( getAll( elem, false ) );
5114
+ elem.innerHTML = value;
5115
+ }
5116
+ }
5117
+ elem = 0;
5118
+ // If using innerHTML throws an exception, use the fallback method
5119
+ } catch(e) {}
5120
+ }
5121
+ if ( elem ) {
5122
+ this.empty().append( value );
5123
+ }
5124
+ }, null, value, arguments.length );
5125
+ },
5126
+ replaceWith: function( value ) {
5127
+ var isFunc = jQuery.isFunction( value );
5128
+ // Make sure that the elements are removed from the DOM before they are inserted
5129
+ // this can help fix replacing a parent with child elements
5130
+ if ( !isFunc && typeof value !== "string" ) {
5131
+ value = jQuery( value ).not( this ).detach();
5132
+ }
5133
+ return this.domManip( [ value ], true, function( elem ) {
5134
+ var next = this.nextSibling,
5135
+ parent = this.parentNode;
5136
+ if ( parent ) {
5137
+ jQuery( this ).remove();
5138
+ parent.insertBefore( elem, next );
5139
+ }
5140
+ });
5141
+ },
5142
+ detach: function( selector ) {
5143
+ return this.remove( selector, true );
5144
+ },
5145
+ domManip: function( args, table, callback ) {
5146
+ // Flatten any nested arrays
5147
+ args = core_concat.apply( [], args );
5148
+ var first, node, hasScripts,
5149
+ scripts, doc, fragment,
5150
+ i = 0,
5151
+ l = this.length,
5152
+ set = this,
5153
+ iNoClone = l - 1,
5154
+ value = args[0],
5155
+ isFunction = jQuery.isFunction( value );
5156
+ // We can't cloneNode fragments that contain checked, in WebKit
5157
+ if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {
5158
+ return this.each(function( index ) {
5159
+ var self = set.eq( index );
5160
+ if ( isFunction ) {
5161
+ args[0] = value.call( this, index, table ? self.html() : undefined );
5162
+ }
5163
+ self.domManip( args, table, callback );
5164
+ });
5165
+ }
5166
+ if ( l ) {
5167
+ fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
5168
+ first = fragment.firstChild;
5169
+ if ( fragment.childNodes.length === 1 ) {
5170
+ fragment = first;
5171
+ }
5172
+ if ( first ) {
5173
+ table = table && jQuery.nodeName( first, "tr" );
5174
+ scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
5175
+ hasScripts = scripts.length;
5176
+ // Use the original fragment for the last item instead of the first because it can end up
5177
+ // being emptied incorrectly in certain situations (#8070).
5178
+ for ( ; i < l; i++ ) {
5179
+ node = fragment;
5180
+ if ( i !== iNoClone ) {
5181
+ node = jQuery.clone( node, true, true );
5182
+ // Keep references to cloned scripts for later restoration
5183
+ if ( hasScripts ) {
5184
+ jQuery.merge( scripts, getAll( node, "script" ) );
5185
+ }
5186
+ }
5187
+ callback.call(
5188
+ table && jQuery.nodeName( this[i], "table" ) ?
5189
+ findOrAppend( this[i], "tbody" ) :
5190
+ this[i],
5191
+ node,
5192
+ i
5193
+ );
5194
+ }
5195
+ if ( hasScripts ) {
5196
+ doc = scripts[ scripts.length - 1 ].ownerDocument;
5197
+ // Reenable scripts
5198
+ jQuery.map( scripts, restoreScript );
5199
+ // Evaluate executable scripts on first document insertion
5200
+ for ( i = 0; i < hasScripts; i++ ) {
5201
+ node = scripts[ i ];
5202
+ if ( rscriptType.test( node.type || "" ) &&
5203
+ !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
5204
+ if ( node.src ) {
5205
+ // Hope ajax is available...
5206
+ jQuery.ajax({
5207
+ url: node.src,
5208
+ type: "GET",
5209
+ dataType: "script",
5210
+ async: false,
5211
+ global: false,
5212
+ "throws": true
5213
+ });
5214
+ } else {
5215
+ jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );
5216
+ }
5217
+ }
5218
+ }
5219
+ }
5220
+ // Fix #11809: Avoid leaking memory
5221
+ fragment = first = null;
5222
+ }
5223
+ }
5224
+ return this;
5225
+ }
5226
+ });
5227
+ function findOrAppend( elem, tag ) {
5228
+ return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
5229
+ }
5230
+ // Replace/restore the type attribute of script elements for safe DOM manipulation
5231
+ function disableScript( elem ) {
5232
+ var attr = elem.getAttributeNode("type");
5233
+ elem.type = ( attr && attr.specified ) + "/" + elem.type;
5234
+ return elem;
5235
+ }
5236
+ function restoreScript( elem ) {
5237
+ var match = rscriptTypeMasked.exec( elem.type );
5238
+ if ( match ) {
5239
+ elem.type = match[1];
5240
+ } else {
5241
+ elem.removeAttribute("type");
5242
+ }
5243
+ return elem;
5244
+ }
5245
+ // Mark scripts as having already been evaluated
5246
+ function setGlobalEval( elems, refElements ) {
5247
+ var elem,
5248
+ i = 0;
5249
+ for ( ; (elem = elems[i]) != null; i++ ) {
5250
+ jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
5251
+ }
5252
+ }
5253
+ function cloneCopyEvent( src, dest ) {
5254
+ if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
5255
+ return;
5256
+ }
5257
+ var type, i, l,
5258
+ oldData = jQuery._data( src ),
5259
+ curData = jQuery._data( dest, oldData ),
5260
+ events = oldData.events;
5261
+ if ( events ) {
5262
+ delete curData.handle;
5263
+ curData.events = {};
5264
+ for ( type in events ) {
5265
+ for ( i = 0, l = events[ type ].length; i < l; i++ ) {
5266
+ jQuery.event.add( dest, type, events[ type ][ i ] );
5267
+ }
5268
+ }
5269
+ }
5270
+ // make the cloned public data object a copy from the original
5271
+ if ( curData.data ) {
5272
+ curData.data = jQuery.extend( {}, curData.data );
5273
+ }
5274
+ }
5275
+ function fixCloneNodeIssues( src, dest ) {
5276
+ var nodeName, e, data;
5277
+ // We do not need to do anything for non-Elements
5278
+ if ( dest.nodeType !== 1 ) {
5279
+ return;
5280
+ }
5281
+ nodeName = dest.nodeName.toLowerCase();
5282
+ // IE6-8 copies events bound via attachEvent when using cloneNode.
5283
+ if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) {
5284
+ data = jQuery._data( dest );
5285
+ for ( e in data.events ) {
5286
+ jQuery.removeEvent( dest, e, data.handle );
5287
+ }
5288
+ // Event data gets referenced instead of copied if the expando gets copied too
5289
+ dest.removeAttribute( jQuery.expando );
5290
+ }
5291
+ // IE blanks contents when cloning scripts, and tries to evaluate newly-set text
5292
+ if ( nodeName === "script" && dest.text !== src.text ) {
5293
+ disableScript( dest ).text = src.text;
5294
+ restoreScript( dest );
5295
+ // IE6-10 improperly clones children of object elements using classid.
5296
+ // IE10 throws NoModificationAllowedError if parent is null, #12132.
5297
+ } else if ( nodeName === "object" ) {
5298
+ if ( dest.parentNode ) {
5299
+ dest.outerHTML = src.outerHTML;
5300
+ }
5301
+ // This path appears unavoidable for IE9. When cloning an object
5302
+ // element in IE9, the outerHTML strategy above is not sufficient.
5303
+ // If the src has innerHTML and the destination does not,
5304
+ // copy the src.innerHTML into the dest.innerHTML. #10324
5305
+ if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
5306
+ dest.innerHTML = src.innerHTML;
5307
+ }
5308
+ } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
5309
+ // IE6-8 fails to persist the checked state of a cloned checkbox
5310
+ // or radio button. Worse, IE6-7 fail to give the cloned element
5311
+ // a checked appearance if the defaultChecked value isn't also set
5312
+ dest.defaultChecked = dest.checked = src.checked;
5313
+ // IE6-7 get confused and end up setting the value of a cloned
5314
+ // checkbox/radio button to an empty string instead of "on"
5315
+ if ( dest.value !== src.value ) {
5316
+ dest.value = src.value;
5317
+ }
5318
+ // IE6-8 fails to return the selected option to the default selected
5319
+ // state when cloning options
5320
+ } else if ( nodeName === "option" ) {
5321
+ dest.defaultSelected = dest.selected = src.defaultSelected;
5322
+ // IE6-8 fails to set the defaultValue to the correct value when
5323
+ // cloning other types of input fields
5324
+ } else if ( nodeName === "input" || nodeName === "textarea" ) {
5325
+ dest.defaultValue = src.defaultValue;
5326
+ }
5327
+ }
5328
+ jQuery.each({
5329
+ appendTo: "append",
5330
+ prependTo: "prepend",
5331
+ insertBefore: "before",
5332
+ insertAfter: "after",
5333
+ replaceAll: "replaceWith"
5334
+ }, function( name, original ) {
5335
+ jQuery.fn[ name ] = function( selector ) {
5336
+ var elems,
5337
+ i = 0,
5338
+ ret = [],
5339
+ insert = jQuery( selector ),
5340
+ last = insert.length - 1;
5341
+ for ( ; i <= last; i++ ) {
5342
+ elems = i === last ? this : this.clone(true);
5343
+ jQuery( insert[i] )[ original ]( elems );
5344
+ // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
5345
+ core_push.apply( ret, elems.get() );
5346
+ }
5347
+ return this.pushStack( ret );
5348
+ };
5349
+ });
5350
+ function getAll( context, tag ) {
5351
+ var elems, elem,
5352
+ i = 0,
5353
+ found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) :
5354
+ typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) :
5355
+ undefined;
5356
+ if ( !found ) {
5357
+ for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
5358
+ if ( !tag || jQuery.nodeName( elem, tag ) ) {
5359
+ found.push( elem );
5360
+ } else {
5361
+ jQuery.merge( found, getAll( elem, tag ) );
5362
+ }
5363
+ }
5364
+ }
5365
+ return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
5366
+ jQuery.merge( [ context ], found ) :
5367
+ found;
5368
+ }
5369
+ // Used in buildFragment, fixes the defaultChecked property
5370
+ function fixDefaultChecked( elem ) {
5371
+ if ( manipulation_rcheckableType.test( elem.type ) ) {
5372
+ elem.defaultChecked = elem.checked;
5373
+ }
5374
+ }
5375
+ jQuery.extend({
5376
+ clone: function( elem, dataAndEvents, deepDataAndEvents ) {
5377
+ var destElements, node, clone, i, srcElements,
5378
+ inPage = jQuery.contains( elem.ownerDocument, elem );
5379
+ if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
5380
+ clone = elem.cloneNode( true );
5381
+ // IE<=8 does not properly clone detached, unknown element nodes
5382
+ } else {
5383
+ fragmentDiv.innerHTML = elem.outerHTML;
5384
+ fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
5385
+ }
5386
+ if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
5387
+ (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
5388
+ // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
5389
+ destElements = getAll( clone );
5390
+ srcElements = getAll( elem );
5391
+ // Fix all IE cloning issues
5392
+ for ( i = 0; (node = srcElements[i]) != null; ++i ) {
5393
+ // Ensure that the destination node is not null; Fixes #9587
5394
+ if ( destElements[i] ) {
5395
+ fixCloneNodeIssues( node, destElements[i] );
5396
+ }
5397
+ }
5398
+ }
5399
+ // Copy the events from the original to the clone
5400
+ if ( dataAndEvents ) {
5401
+ if ( deepDataAndEvents ) {
5402
+ srcElements = srcElements || getAll( elem );
5403
+ destElements = destElements || getAll( clone );
5404
+ for ( i = 0; (node = srcElements[i]) != null; i++ ) {
5405
+ cloneCopyEvent( node, destElements[i] );
5406
+ }
5407
+ } else {
5408
+ cloneCopyEvent( elem, clone );
5409
+ }
5410
+ }
5411
+ // Preserve script evaluation history
5412
+ destElements = getAll( clone, "script" );
5413
+ if ( destElements.length > 0 ) {
5414
+ setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
5415
+ }
5416
+ destElements = srcElements = node = null;
5417
+ // Return the cloned set
5418
+ return clone;
5419
+ },
5420
+ buildFragment: function( elems, context, scripts, selection ) {
5421
+ var j, elem, contains,
5422
+ tmp, tag, tbody, wrap,
5423
+ l = elems.length,
5424
+ // Ensure a safe fragment
5425
+ safe = createSafeFragment( context ),
5426
+ nodes = [],
5427
+ i = 0;
5428
+ for ( ; i < l; i++ ) {
5429
+ elem = elems[ i ];
5430
+ if ( elem || elem === 0 ) {
5431
+ // Add nodes directly
5432
+ if ( jQuery.type( elem ) === "object" ) {
5433
+ jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
5434
+ // Convert non-html into a text node
5435
+ } else if ( !rhtml.test( elem ) ) {
5436
+ nodes.push( context.createTextNode( elem ) );
5437
+ // Convert html into DOM nodes
5438
+ } else {
5439
+ tmp = tmp || safe.appendChild( context.createElement("div") );
5440
+ // Deserialize a standard representation
5441
+ tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
5442
+ wrap = wrapMap[ tag ] || wrapMap._default;
5443
+ tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
5444
+ // Descend through wrappers to the right content
5445
+ j = wrap[0];
5446
+ while ( j-- ) {
5447
+ tmp = tmp.lastChild;
5448
+ }
5449
+ // Manually add leading whitespace removed by IE
5450
+ if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
5451
+ nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
5452
+ }
5453
+ // Remove IE's autoinserted <tbody> from table fragments
5454
+ if ( !jQuery.support.tbody ) {
5455
+ // String was a <table>, *may* have spurious <tbody>
5456
+ elem = tag === "table" && !rtbody.test( elem ) ?
5457
+ tmp.firstChild :
5458
+ // String was a bare <thead> or <tfoot>
5459
+ wrap[1] === "<table>" && !rtbody.test( elem ) ?
5460
+ tmp :
5461
+ 0;
5462
+ j = elem && elem.childNodes.length;
5463
+ while ( j-- ) {
5464
+ if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
5465
+ elem.removeChild( tbody );
5466
+ }
5467
+ }
5468
+ }
5469
+ jQuery.merge( nodes, tmp.childNodes );
5470
+ // Fix #12392 for WebKit and IE > 9
5471
+ tmp.textContent = "";
5472
+ // Fix #12392 for oldIE
5473
+ while ( tmp.firstChild ) {
5474
+ tmp.removeChild( tmp.firstChild );
5475
+ }
5476
+ // Remember the top-level container for proper cleanup
5477
+ tmp = safe.lastChild;
5478
+ }
5479
+ }
5480
+ }
5481
+ // Fix #11356: Clear elements from fragment
5482
+ if ( tmp ) {
5483
+ safe.removeChild( tmp );
5484
+ }
5485
+ // Reset defaultChecked for any radios and checkboxes
5486
+ // about to be appended to the DOM in IE 6/7 (#8060)
5487
+ if ( !jQuery.support.appendChecked ) {
5488
+ jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
5489
+ }
5490
+ i = 0;
5491
+ while ( (elem = nodes[ i++ ]) ) {
5492
+ // #4087 - If origin and destination elements are the same, and this is
5493
+ // that element, do not do anything
5494
+ if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
5495
+ continue;
5496
+ }
5497
+ contains = jQuery.contains( elem.ownerDocument, elem );
5498
+ // Append to fragment
5499
+ tmp = getAll( safe.appendChild( elem ), "script" );
5500
+ // Preserve script evaluation history
5501
+ if ( contains ) {
5502
+ setGlobalEval( tmp );
5503
+ }
5504
+ // Capture executables
5505
+ if ( scripts ) {
5506
+ j = 0;
5507
+ while ( (elem = tmp[ j++ ]) ) {
5508
+ if ( rscriptType.test( elem.type || "" ) ) {
5509
+ scripts.push( elem );
5510
+ }
5511
+ }
5512
+ }
5513
+ }
5514
+ tmp = null;
5515
+ return safe;
5516
+ },
5517
+ cleanData: function( elems, /* internal */ acceptData ) {
5518
+ var elem, type, id, data,
5519
+ i = 0,
5520
+ internalKey = jQuery.expando,
5521
+ cache = jQuery.cache,
5522
+ deleteExpando = jQuery.support.deleteExpando,
5523
+ special = jQuery.event.special;
5524
+ for ( ; (elem = elems[i]) != null; i++ ) {
5525
+ if ( acceptData || jQuery.acceptData( elem ) ) {
5526
+ id = elem[ internalKey ];
5527
+ data = id && cache[ id ];
5528
+ if ( data ) {
5529
+ if ( data.events ) {
5530
+ for ( type in data.events ) {
5531
+ if ( special[ type ] ) {
5532
+ jQuery.event.remove( elem, type );
5533
+ // This is a shortcut to avoid jQuery.event.remove's overhead
5534
+ } else {
5535
+ jQuery.removeEvent( elem, type, data.handle );
5536
+ }
5537
+ }
5538
+ }
5539
+ // Remove cache only if it was not already removed by jQuery.event.remove
5540
+ if ( cache[ id ] ) {
5541
+ delete cache[ id ];
5542
+ // IE does not allow us to delete expando properties from nodes,
5543
+ // nor does it have a removeAttribute function on Document nodes;
5544
+ // we must handle all of these cases
5545
+ if ( deleteExpando ) {
5546
+ delete elem[ internalKey ];
5547
+ } else if ( typeof elem.removeAttribute !== core_strundefined ) {
5548
+ elem.removeAttribute( internalKey );
5549
+ } else {
5550
+ elem[ internalKey ] = null;
5551
+ }
5552
+ core_deletedIds.push( id );
5553
+ }
5554
+ }
5555
+ }
5556
+ }
5557
+ }
5558
+ });
5559
+ var iframe, getStyles, curCSS,
5560
+ ralpha = /alpha\([^)]*\)/i,
5561
+ ropacity = /opacity\s*=\s*([^)]*)/,
5562
+ rposition = /^(top|right|bottom|left)$/,
5563
+ // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
5564
+ // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
5565
+ rdisplayswap = /^(none|table(?!-c[ea]).+)/,
5566
+ rmargin = /^margin/,
5567
+ rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
5568
+ rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
5569
+ rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ),
5570
+ elemdisplay = { BODY: "block" },
5571
+ cssShow = { position: "absolute", visibility: "hidden", display: "block" },
5572
+ cssNormalTransform = {
5573
+ letterSpacing: 0,
5574
+ fontWeight: 400
5575
+ },
5576
+ cssExpand = [ "Top", "Right", "Bottom", "Left" ],
5577
+ cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
5578
+ // return a css property mapped to a potentially vendor prefixed property
5579
+ function vendorPropName( style, name ) {
5580
+ // shortcut for names that are not vendor prefixed
5581
+ if ( name in style ) {
5582
+ return name;
5583
+ }
5584
+ // check for vendor prefixed names
5585
+ var capName = name.charAt(0).toUpperCase() + name.slice(1),
5586
+ origName = name,
5587
+ i = cssPrefixes.length;
5588
+ while ( i-- ) {
5589
+ name = cssPrefixes[ i ] + capName;
5590
+ if ( name in style ) {
5591
+ return name;
5592
+ }
5593
+ }
5594
+ return origName;
5595
+ }
5596
+ function isHidden( elem, el ) {
5597
+ // isHidden might be called from jQuery#filter function;
5598
+ // in that case, element will be second argument
5599
+ elem = el || elem;
5600
+ return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
5601
+ }
5602
+ function showHide( elements, show ) {
5603
+ var display, elem, hidden,
5604
+ values = [],
5605
+ index = 0,
5606
+ length = elements.length;
5607
+ for ( ; index < length; index++ ) {
5608
+ elem = elements[ index ];
5609
+ if ( !elem.style ) {
5610
+ continue;
5611
+ }
5612
+ values[ index ] = jQuery._data( elem, "olddisplay" );
5613
+ display = elem.style.display;
5614
+ if ( show ) {
5615
+ // Reset the inline display of this element to learn if it is
5616
+ // being hidden by cascaded rules or not
5617
+ if ( !values[ index ] && display === "none" ) {
5618
+ elem.style.display = "";
5619
+ }
5620
+ // Set elements which have been overridden with display: none
5621
+ // in a stylesheet to whatever the default browser style is
5622
+ // for such an element
5623
+ if ( elem.style.display === "" && isHidden( elem ) ) {
5624
+ values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
5625
+ }
5626
+ } else {
5627
+ if ( !values[ index ] ) {
5628
+ hidden = isHidden( elem );
5629
+ if ( display && display !== "none" || !hidden ) {
5630
+ jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
5631
+ }
5632
+ }
5633
+ }
5634
+ }
5635
+ // Set the display of most of the elements in a second loop
5636
+ // to avoid the constant reflow
5637
+ for ( index = 0; index < length; index++ ) {
5638
+ elem = elements[ index ];
5639
+ if ( !elem.style ) {
5640
+ continue;
5641
+ }
5642
+ if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
5643
+ elem.style.display = show ? values[ index ] || "" : "none";
5644
+ }
5645
+ }
5646
+ return elements;
5647
+ }
5648
+ jQuery.fn.extend({
5649
+ css: function( name, value ) {
5650
+ return jQuery.access( this, function( elem, name, value ) {
5651
+ var len, styles,
5652
+ map = {},
5653
+ i = 0;
5654
+ if ( jQuery.isArray( name ) ) {
5655
+ styles = getStyles( elem );
5656
+ len = name.length;
5657
+ for ( ; i < len; i++ ) {
5658
+ map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
5659
+ }
5660
+ return map;
5661
+ }
5662
+ return value !== undefined ?
5663
+ jQuery.style( elem, name, value ) :
5664
+ jQuery.css( elem, name );
5665
+ }, name, value, arguments.length > 1 );
5666
+ },
5667
+ show: function() {
5668
+ return showHide( this, true );
5669
+ },
5670
+ hide: function() {
5671
+ return showHide( this );
5672
+ },
5673
+ toggle: function( state ) {
5674
+ var bool = typeof state === "boolean";
5675
+ return this.each(function() {
5676
+ if ( bool ? state : isHidden( this ) ) {
5677
+ jQuery( this ).show();
5678
+ } else {
5679
+ jQuery( this ).hide();
5680
+ }
5681
+ });
5682
+ }
5683
+ });
5684
+ jQuery.extend({
5685
+ // Add in style property hooks for overriding the default
5686
+ // behavior of getting and setting a style property
5687
+ cssHooks: {
5688
+ opacity: {
5689
+ get: function( elem, computed ) {
5690
+ if ( computed ) {
5691
+ // We should always get a number back from opacity
5692
+ var ret = curCSS( elem, "opacity" );
5693
+ return ret === "" ? "1" : ret;
5694
+ }
5695
+ }
5696
+ }
5697
+ },
5698
+ // Exclude the following css properties to add px
5699
+ cssNumber: {
5700
+ "columnCount": true,
5701
+ "fillOpacity": true,
5702
+ "fontWeight": true,
5703
+ "lineHeight": true,
5704
+ "opacity": true,
5705
+ "orphans": true,
5706
+ "widows": true,
5707
+ "zIndex": true,
5708
+ "zoom": true
5709
+ },
5710
+ // Add in properties whose names you wish to fix before
5711
+ // setting or getting the value
5712
+ cssProps: {
5713
+ // normalize float css property
5714
+ "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
5715
+ },
5716
+ // Get and set the style property on a DOM Node
5717
+ style: function( elem, name, value, extra ) {
5718
+ // Don't set styles on text and comment nodes
5719
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
5720
+ return;
5721
+ }
5722
+ // Make sure that we're working with the right name
5723
+ var ret, type, hooks,
5724
+ origName = jQuery.camelCase( name ),
5725
+ style = elem.style;
5726
+ name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
5727
+ // gets hook for the prefixed version
5728
+ // followed by the unprefixed version
5729
+ hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
5730
+ // Check if we're setting a value
5731
+ if ( value !== undefined ) {
5732
+ type = typeof value;
5733
+ // convert relative number strings (+= or -=) to relative numbers. #7345
5734
+ if ( type === "string" && (ret = rrelNum.exec( value )) ) {
5735
+ value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
5736
+ // Fixes bug #9237
5737
+ type = "number";
5738
+ }
5739
+ // Make sure that NaN and null values aren't set. See: #7116
5740
+ if ( value == null || type === "number" && isNaN( value ) ) {
5741
+ return;
5742
+ }
5743
+ // If a number was passed in, add 'px' to the (except for certain CSS properties)
5744
+ if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
5745
+ value += "px";
5746
+ }
5747
+ // Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
5748
+ // but it would mean to define eight (for every problematic property) identical functions
5749
+ if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
5750
+ style[ name ] = "inherit";
5751
+ }
5752
+ // If a hook was provided, use that value, otherwise just set the specified value
5753
+ if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
5754
+ // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
5755
+ // Fixes bug #5509
5756
+ try {
5757
+ style[ name ] = value;
5758
+ } catch(e) {}
5759
+ }
5760
+ } else {
5761
+ // If a hook was provided get the non-computed value from there
5762
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
5763
+ return ret;
5764
+ }
5765
+ // Otherwise just get the value from the style object
5766
+ return style[ name ];
5767
+ }
5768
+ },
5769
+ css: function( elem, name, extra, styles ) {
5770
+ var num, val, hooks,
5771
+ origName = jQuery.camelCase( name );
5772
+ // Make sure that we're working with the right name
5773
+ name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
5774
+ // gets hook for the prefixed version
5775
+ // followed by the unprefixed version
5776
+ hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
5777
+ // If a hook was provided get the computed value from there
5778
+ if ( hooks && "get" in hooks ) {
5779
+ val = hooks.get( elem, true, extra );
5780
+ }
5781
+ // Otherwise, if a way to get the computed value exists, use that
5782
+ if ( val === undefined ) {
5783
+ val = curCSS( elem, name, styles );
5784
+ }
5785
+ //convert "normal" to computed value
5786
+ if ( val === "normal" && name in cssNormalTransform ) {
5787
+ val = cssNormalTransform[ name ];
5788
+ }
5789
+ // Return, converting to number if forced or a qualifier was provided and val looks numeric
5790
+ if ( extra === "" || extra ) {
5791
+ num = parseFloat( val );
5792
+ return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
5793
+ }
5794
+ return val;
5795
+ },
5796
+ // A method for quickly swapping in/out CSS properties to get correct calculations
5797
+ swap: function( elem, options, callback, args ) {
5798
+ var ret, name,
5799
+ old = {};
5800
+ // Remember the old values, and insert the new ones
5801
+ for ( name in options ) {
5802
+ old[ name ] = elem.style[ name ];
5803
+ elem.style[ name ] = options[ name ];
5804
+ }
5805
+ ret = callback.apply( elem, args || [] );
5806
+ // Revert the old values
5807
+ for ( name in options ) {
5808
+ elem.style[ name ] = old[ name ];
5809
+ }
5810
+ return ret;
5811
+ }
5812
+ });
5813
+ // NOTE: we've included the "window" in window.getComputedStyle
5814
+ // because jsdom on node.js will break without it.
5815
+ if ( window.getComputedStyle ) {
5816
+ getStyles = function( elem ) {
5817
+ return window.getComputedStyle( elem, null );
5818
+ };
5819
+ curCSS = function( elem, name, _computed ) {
5820
+ var width, minWidth, maxWidth,
5821
+ computed = _computed || getStyles( elem ),
5822
+ // getPropertyValue is only needed for .css('filter') in IE9, see #12537
5823
+ ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined,
5824
+ style = elem.style;
5825
+ if ( computed ) {
5826
+ if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
5827
+ ret = jQuery.style( elem, name );
5828
+ }
5829
+ // A tribute to the "awesome hack by Dean Edwards"
5830
+ // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
5831
+ // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
5832
+ // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
5833
+ if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
5834
+ // Remember the original values
5835
+ width = style.width;
5836
+ minWidth = style.minWidth;
5837
+ maxWidth = style.maxWidth;
5838
+ // Put in the new values to get a computed value out
5839
+ style.minWidth = style.maxWidth = style.width = ret;
5840
+ ret = computed.width;
5841
+ // Revert the changed values
5842
+ style.width = width;
5843
+ style.minWidth = minWidth;
5844
+ style.maxWidth = maxWidth;
5845
+ }
5846
+ }
5847
+ return ret;
5848
+ };
5849
+ } else if ( document.documentElement.currentStyle ) {
5850
+ getStyles = function( elem ) {
5851
+ return elem.currentStyle;
5852
+ };
5853
+ curCSS = function( elem, name, _computed ) {
5854
+ var left, rs, rsLeft,
5855
+ computed = _computed || getStyles( elem ),
5856
+ ret = computed ? computed[ name ] : undefined,
5857
+ style = elem.style;
5858
+ // Avoid setting ret to empty string here
5859
+ // so we don't default to auto
5860
+ if ( ret == null && style && style[ name ] ) {
5861
+ ret = style[ name ];
5862
+ }
5863
+ // From the awesome hack by Dean Edwards
5864
+ // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
5865
+ // If we're not dealing with a regular pixel number
5866
+ // but a number that has a weird ending, we need to convert it to pixels
5867
+ // but not position css attributes, as those are proportional to the parent element instead
5868
+ // and we can't measure the parent instead because it might trigger a "stacking dolls" problem
5869
+ if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
5870
+ // Remember the original values
5871
+ left = style.left;
5872
+ rs = elem.runtimeStyle;
5873
+ rsLeft = rs && rs.left;
5874
+ // Put in the new values to get a computed value out
5875
+ if ( rsLeft ) {
5876
+ rs.left = elem.currentStyle.left;
5877
+ }
5878
+ style.left = name === "fontSize" ? "1em" : ret;
5879
+ ret = style.pixelLeft + "px";
5880
+ // Revert the changed values
5881
+ style.left = left;
5882
+ if ( rsLeft ) {
5883
+ rs.left = rsLeft;
5884
+ }
5885
+ }
5886
+ return ret === "" ? "auto" : ret;
5887
+ };
5888
+ }
5889
+ function setPositiveNumber( elem, value, subtract ) {
5890
+ var matches = rnumsplit.exec( value );
5891
+ return matches ?
5892
+ // Guard against undefined "subtract", e.g., when used as in cssHooks
5893
+ Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
5894
+ value;
5895
+ }
5896
+ function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
5897
+ var i = extra === ( isBorderBox ? "border" : "content" ) ?
5898
+ // If we already have the right measurement, avoid augmentation
5899
+ 4 :
5900
+ // Otherwise initialize for horizontal or vertical properties
5901
+ name === "width" ? 1 : 0,
5902
+ val = 0;
5903
+ for ( ; i < 4; i += 2 ) {
5904
+ // both box models exclude margin, so add it if we want it
5905
+ if ( extra === "margin" ) {
5906
+ val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
5907
+ }
5908
+ if ( isBorderBox ) {
5909
+ // border-box includes padding, so remove it if we want content
5910
+ if ( extra === "content" ) {
5911
+ val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
5912
+ }
5913
+ // at this point, extra isn't border nor margin, so remove border
5914
+ if ( extra !== "margin" ) {
5915
+ val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
5916
+ }
5917
+ } else {
5918
+ // at this point, extra isn't content, so add padding
5919
+ val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
5920
+ // at this point, extra isn't content nor padding, so add border
5921
+ if ( extra !== "padding" ) {
5922
+ val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
5923
+ }
5924
+ }
5925
+ }
5926
+ return val;
5927
+ }
5928
+ function getWidthOrHeight( elem, name, extra ) {
5929
+ // Start with offset property, which is equivalent to the border-box value
5930
+ var valueIsBorderBox = true,
5931
+ val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
5932
+ styles = getStyles( elem ),
5933
+ isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
5934
+ // some non-html elements return undefined for offsetWidth, so check for null/undefined
5935
+ // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
5936
+ // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
5937
+ if ( val <= 0 || val == null ) {
5938
+ // Fall back to computed then uncomputed css if necessary
5939
+ val = curCSS( elem, name, styles );
5940
+ if ( val < 0 || val == null ) {
5941
+ val = elem.style[ name ];
5942
+ }
5943
+ // Computed unit is not pixels. Stop here and return.
5944
+ if ( rnumnonpx.test(val) ) {
5945
+ return val;
5946
+ }
5947
+ // we need the check for style in case a browser which returns unreliable values
5948
+ // for getComputedStyle silently falls back to the reliable elem.style
5949
+ valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
5950
+ // Normalize "", auto, and prepare for extra
5951
+ val = parseFloat( val ) || 0;
5952
+ }
5953
+ // use the active box-sizing model to add/subtract irrelevant styles
5954
+ return ( val +
5955
+ augmentWidthOrHeight(
5956
+ elem,
5957
+ name,
5958
+ extra || ( isBorderBox ? "border" : "content" ),
5959
+ valueIsBorderBox,
5960
+ styles
5961
+ )
5962
+ ) + "px";
5963
+ }
5964
+ // Try to determine the default display value of an element
5965
+ function css_defaultDisplay( nodeName ) {
5966
+ var doc = document,
5967
+ display = elemdisplay[ nodeName ];
5968
+ if ( !display ) {
5969
+ display = actualDisplay( nodeName, doc );
5970
+ // If the simple way fails, read from inside an iframe
5971
+ if ( display === "none" || !display ) {
5972
+ // Use the already-created iframe if possible
5973
+ iframe = ( iframe ||
5974
+ jQuery("<iframe frameborder='0' width='0' height='0'/>")
5975
+ .css( "cssText", "display:block !important" )
5976
+ ).appendTo( doc.documentElement );
5977
+ // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
5978
+ doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
5979
+ doc.write("<!doctype html><html><body>");
5980
+ doc.close();
5981
+ display = actualDisplay( nodeName, doc );
5982
+ iframe.detach();
5983
+ }
5984
+ // Store the correct default display
5985
+ elemdisplay[ nodeName ] = display;
5986
+ }
5987
+ return display;
5988
+ }
5989
+ // Called ONLY from within css_defaultDisplay
5990
+ function actualDisplay( name, doc ) {
5991
+ var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
5992
+ display = jQuery.css( elem[0], "display" );
5993
+ elem.remove();
5994
+ return display;
5995
+ }
5996
+ jQuery.each([ "height", "width" ], function( i, name ) {
5997
+ jQuery.cssHooks[ name ] = {
5998
+ get: function( elem, computed, extra ) {
5999
+ if ( computed ) {
6000
+ // certain elements can have dimension info if we invisibly show them
6001
+ // however, it must have a current display style that would benefit from this
6002
+ return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ?
6003
+ jQuery.swap( elem, cssShow, function() {
6004
+ return getWidthOrHeight( elem, name, extra );
6005
+ }) :
6006
+ getWidthOrHeight( elem, name, extra );
6007
+ }
6008
+ },
6009
+ set: function( elem, value, extra ) {
6010
+ var styles = extra && getStyles( elem );
6011
+ return setPositiveNumber( elem, value, extra ?
6012
+ augmentWidthOrHeight(
6013
+ elem,
6014
+ name,
6015
+ extra,
6016
+ jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6017
+ styles
6018
+ ) : 0
6019
+ );
6020
+ }
6021
+ };
6022
+ });
6023
+ if ( !jQuery.support.opacity ) {
6024
+ jQuery.cssHooks.opacity = {
6025
+ get: function( elem, computed ) {
6026
+ // IE uses filters for opacity
6027
+ return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
6028
+ ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
6029
+ computed ? "1" : "";
6030
+ },
6031
+ set: function( elem, value ) {
6032
+ var style = elem.style,
6033
+ currentStyle = elem.currentStyle,
6034
+ opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
6035
+ filter = currentStyle && currentStyle.filter || style.filter || "";
6036
+ // IE has trouble with opacity if it does not have layout
6037
+ // Force it by setting the zoom level
6038
+ style.zoom = 1;
6039
+ // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
6040
+ // if value === "", then remove inline opacity #12685
6041
+ if ( ( value >= 1 || value === "" ) &&
6042
+ jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
6043
+ style.removeAttribute ) {
6044
+ // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
6045
+ // if "filter:" is present at all, clearType is disabled, we want to avoid this
6046
+ // style.removeAttribute is IE Only, but so apparently is this code path...
6047
+ style.removeAttribute( "filter" );
6048
+ // if there is no filter style applied in a css rule or unset inline opacity, we are done
6049
+ if ( value === "" || currentStyle && !currentStyle.filter ) {
6050
+ return;
6051
+ }
6052
+ }
6053
+ // otherwise, set new filter values
6054
+ style.filter = ralpha.test( filter ) ?
6055
+ filter.replace( ralpha, opacity ) :
6056
+ filter + " " + opacity;
6057
+ }
6058
+ };
6059
+ }
6060
+ // These hooks cannot be added until DOM ready because the support test
6061
+ // for it is not run until after DOM ready
6062
+ jQuery(function() {
6063
+ if ( !jQuery.support.reliableMarginRight ) {
6064
+ jQuery.cssHooks.marginRight = {
6065
+ get: function( elem, computed ) {
6066
+ if ( computed ) {
6067
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
6068
+ // Work around by temporarily setting element display to inline-block
6069
+ return jQuery.swap( elem, { "display": "inline-block" },
6070
+ curCSS, [ elem, "marginRight" ] );
6071
+ }
6072
+ }
6073
+ };
6074
+ }
6075
+ // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
6076
+ // getComputedStyle returns percent when specified for top/left/bottom/right
6077
+ // rather than make the css module depend on the offset module, we just check for it here
6078
+ if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
6079
+ jQuery.each( [ "top", "left" ], function( i, prop ) {
6080
+ jQuery.cssHooks[ prop ] = {
6081
+ get: function( elem, computed ) {
6082
+ if ( computed ) {
6083
+ computed = curCSS( elem, prop );
6084
+ // if curCSS returns percentage, fallback to offset
6085
+ return rnumnonpx.test( computed ) ?
6086
+ jQuery( elem ).position()[ prop ] + "px" :
6087
+ computed;
6088
+ }
6089
+ }
6090
+ };
6091
+ });
6092
+ }
6093
+ });
6094
+ if ( jQuery.expr && jQuery.expr.filters ) {
6095
+ jQuery.expr.filters.hidden = function( elem ) {
6096
+ // Support: Opera <= 12.12
6097
+ // Opera reports offsetWidths and offsetHeights less than zero on some elements
6098
+ return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 ||
6099
+ (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
6100
+ };
6101
+ jQuery.expr.filters.visible = function( elem ) {
6102
+ return !jQuery.expr.filters.hidden( elem );
6103
+ };
6104
+ }
6105
+ // These hooks are used by animate to expand properties
6106
+ jQuery.each({
6107
+ margin: "",
6108
+ padding: "",
6109
+ border: "Width"
6110
+ }, function( prefix, suffix ) {
6111
+ jQuery.cssHooks[ prefix + suffix ] = {
6112
+ expand: function( value ) {
6113
+ var i = 0,
6114
+ expanded = {},
6115
+ // assumes a single number if not a string
6116
+ parts = typeof value === "string" ? value.split(" ") : [ value ];
6117
+ for ( ; i < 4; i++ ) {
6118
+ expanded[ prefix + cssExpand[ i ] + suffix ] =
6119
+ parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
6120
+ }
6121
+ return expanded;
6122
+ }
6123
+ };
6124
+ if ( !rmargin.test( prefix ) ) {
6125
+ jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
6126
+ }
6127
+ });
6128
+ var r20 = /%20/g,
6129
+ rbracket = /\[\]$/,
6130
+ rCRLF = /\r?\n/g,
6131
+ rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
6132
+ rsubmittable = /^(?:input|select|textarea|keygen)/i;
6133
+ jQuery.fn.extend({
6134
+ serialize: function() {
6135
+ return jQuery.param( this.serializeArray() );
6136
+ },
6137
+ serializeArray: function() {
6138
+ return this.map(function(){
6139
+ // Can add propHook for "elements" to filter or add form elements
6140
+ var elements = jQuery.prop( this, "elements" );
6141
+ return elements ? jQuery.makeArray( elements ) : this;
6142
+ })
6143
+ .filter(function(){
6144
+ var type = this.type;
6145
+ // Use .is(":disabled") so that fieldset[disabled] works
6146
+ return this.name && !jQuery( this ).is( ":disabled" ) &&
6147
+ rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
6148
+ ( this.checked || !manipulation_rcheckableType.test( type ) );
6149
+ })
6150
+ .map(function( i, elem ){
6151
+ var val = jQuery( this ).val();
6152
+ return val == null ?
6153
+ null :
6154
+ jQuery.isArray( val ) ?
6155
+ jQuery.map( val, function( val ){
6156
+ return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
6157
+ }) :
6158
+ { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
6159
+ }).get();
6160
+ }
6161
+ });
6162
+ //Serialize an array of form elements or a set of
6163
+ //key/values into a query string
6164
+ jQuery.param = function( a, traditional ) {
6165
+ var prefix,
6166
+ s = [],
6167
+ add = function( key, value ) {
6168
+ // If value is a function, invoke it and return its value
6169
+ value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
6170
+ s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
6171
+ };
6172
+ // Set traditional to true for jQuery <= 1.3.2 behavior.
6173
+ if ( traditional === undefined ) {
6174
+ traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
6175
+ }
6176
+ // If an array was passed in, assume that it is an array of form elements.
6177
+ if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
6178
+ // Serialize the form elements
6179
+ jQuery.each( a, function() {
6180
+ add( this.name, this.value );
6181
+ });
6182
+ } else {
6183
+ // If traditional, encode the "old" way (the way 1.3.2 or older
6184
+ // did it), otherwise encode params recursively.
6185
+ for ( prefix in a ) {
6186
+ buildParams( prefix, a[ prefix ], traditional, add );
6187
+ }
6188
+ }
6189
+ // Return the resulting serialization
6190
+ return s.join( "&" ).replace( r20, "+" );
6191
+ };
6192
+ function buildParams( prefix, obj, traditional, add ) {
6193
+ var name;
6194
+ if ( jQuery.isArray( obj ) ) {
6195
+ // Serialize array item.
6196
+ jQuery.each( obj, function( i, v ) {
6197
+ if ( traditional || rbracket.test( prefix ) ) {
6198
+ // Treat each array item as a scalar.
6199
+ add( prefix, v );
6200
+ } else {
6201
+ // Item is non-scalar (array or object), encode its numeric index.
6202
+ buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
6203
+ }
6204
+ });
6205
+ } else if ( !traditional && jQuery.type( obj ) === "object" ) {
6206
+ // Serialize object item.
6207
+ for ( name in obj ) {
6208
+ buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
6209
+ }
6210
+ } else {
6211
+ // Serialize scalar item.
6212
+ add( prefix, obj );
6213
+ }
6214
+ }
6215
+ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
6216
+ "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
6217
+ "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
6218
+ // Handle event binding
6219
+ jQuery.fn[ name ] = function( data, fn ) {
6220
+ return arguments.length > 0 ?
6221
+ this.on( name, null, data, fn ) :
6222
+ this.trigger( name );
6223
+ };
6224
+ });
6225
+ jQuery.fn.hover = function( fnOver, fnOut ) {
6226
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
6227
+ };
6228
+ var
6229
+ // Document location
6230
+ ajaxLocParts,
6231
+ ajaxLocation,
6232
+ ajax_nonce = jQuery.now(),
6233
+ ajax_rquery = /\?/,
6234
+ rhash = /#.*$/,
6235
+ rts = /([?&])_=[^&]*/,
6236
+ rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
6237
+ // #7653, #8125, #8152: local protocol detection
6238
+ rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
6239
+ rnoContent = /^(?:GET|HEAD)$/,
6240
+ rprotocol = /^\/\//,
6241
+ rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
6242
+ // Keep a copy of the old load method
6243
+ _load = jQuery.fn.load,
6244
+ /* Prefilters
6245
+ * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
6246
+ * 2) These are called:
6247
+ * - BEFORE asking for a transport
6248
+ * - AFTER param serialization (s.data is a string if s.processData is true)
6249
+ * 3) key is the dataType
6250
+ * 4) the catchall symbol "*" can be used
6251
+ * 5) execution will start with transport dataType and THEN continue down to "*" if needed
6252
+ */
6253
+ prefilters = {},
6254
+ /* Transports bindings
6255
+ * 1) key is the dataType
6256
+ * 2) the catchall symbol "*" can be used
6257
+ * 3) selection will start with transport dataType and THEN go to "*" if needed
6258
+ */
6259
+ transports = {},
6260
+ // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
6261
+ allTypes = "*/".concat("*");
6262
+ // #8138, IE may throw an exception when accessing
6263
+ // a field from window.location if document.domain has been set
6264
+ try {
6265
+ ajaxLocation = location.href;
6266
+ } catch( e ) {
6267
+ // Use the href attribute of an A element
6268
+ // since IE will modify it given document.location
6269
+ ajaxLocation = document.createElement( "a" );
6270
+ ajaxLocation.href = "";
6271
+ ajaxLocation = ajaxLocation.href;
6272
+ }
6273
+ // Segment location into parts
6274
+ ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
6275
+ // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
6276
+ function addToPrefiltersOrTransports( structure ) {
6277
+ // dataTypeExpression is optional and defaults to "*"
6278
+ return function( dataTypeExpression, func ) {
6279
+ if ( typeof dataTypeExpression !== "string" ) {
6280
+ func = dataTypeExpression;
6281
+ dataTypeExpression = "*";
6282
+ }
6283
+ var dataType,
6284
+ i = 0,
6285
+ dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
6286
+ if ( jQuery.isFunction( func ) ) {
6287
+ // For each dataType in the dataTypeExpression
6288
+ while ( (dataType = dataTypes[i++]) ) {
6289
+ // Prepend if requested
6290
+ if ( dataType[0] === "+" ) {
6291
+ dataType = dataType.slice( 1 ) || "*";
6292
+ (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
6293
+ // Otherwise append
6294
+ } else {
6295
+ (structure[ dataType ] = structure[ dataType ] || []).push( func );
6296
+ }
6297
+ }
6298
+ }
6299
+ };
6300
+ }
6301
+ // Base inspection function for prefilters and transports
6302
+ function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
6303
+ var inspected = {},
6304
+ seekingTransport = ( structure === transports );
6305
+ function inspect( dataType ) {
6306
+ var selected;
6307
+ inspected[ dataType ] = true;
6308
+ jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
6309
+ var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
6310
+ if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
6311
+ options.dataTypes.unshift( dataTypeOrTransport );
6312
+ inspect( dataTypeOrTransport );
6313
+ return false;
6314
+ } else if ( seekingTransport ) {
6315
+ return !( selected = dataTypeOrTransport );
6316
+ }
6317
+ });
6318
+ return selected;
6319
+ }
6320
+ return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
6321
+ }
6322
+ // A special extend for ajax options
6323
+ // that takes "flat" options (not to be deep extended)
6324
+ // Fixes #9887
6325
+ function ajaxExtend( target, src ) {
6326
+ var deep, key,
6327
+ flatOptions = jQuery.ajaxSettings.flatOptions || {};
6328
+ for ( key in src ) {
6329
+ if ( src[ key ] !== undefined ) {
6330
+ ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
6331
+ }
6332
+ }
6333
+ if ( deep ) {
6334
+ jQuery.extend( true, target, deep );
6335
+ }
6336
+ return target;
6337
+ }
6338
+ jQuery.fn.load = function( url, params, callback ) {
6339
+ if ( typeof url !== "string" && _load ) {
6340
+ return _load.apply( this, arguments );
6341
+ }
6342
+ var selector, response, type,
6343
+ self = this,
6344
+ off = url.indexOf(" ");
6345
+ if ( off >= 0 ) {
6346
+ selector = url.slice( off, url.length );
6347
+ url = url.slice( 0, off );
6348
+ }
6349
+ // If it's a function
6350
+ if ( jQuery.isFunction( params ) ) {
6351
+ // We assume that it's the callback
6352
+ callback = params;
6353
+ params = undefined;
6354
+ // Otherwise, build a param string
6355
+ } else if ( params && typeof params === "object" ) {
6356
+ type = "POST";
6357
+ }
6358
+ // If we have elements to modify, make the request
6359
+ if ( self.length > 0 ) {
6360
+ jQuery.ajax({
6361
+ url: url,
6362
+ // if "type" variable is undefined, then "GET" method will be used
6363
+ type: type,
6364
+ dataType: "html",
6365
+ data: params
6366
+ }).done(function( responseText ) {
6367
+ // Save response for use in complete callback
6368
+ response = arguments;
6369
+ self.html( selector ?
6370
+ // If a selector was specified, locate the right elements in a dummy div
6371
+ // Exclude scripts to avoid IE 'Permission Denied' errors
6372
+ jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
6373
+ // Otherwise use the full result
6374
+ responseText );
6375
+ }).complete( callback && function( jqXHR, status ) {
6376
+ self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
6377
+ });
6378
+ }
6379
+ return this;
6380
+ };
6381
+ // Attach a bunch of functions for handling common AJAX events
6382
+ jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
6383
+ jQuery.fn[ type ] = function( fn ){
6384
+ return this.on( type, fn );
6385
+ };
6386
+ });
6387
+ jQuery.each( [ "get", "post" ], function( i, method ) {
6388
+ jQuery[ method ] = function( url, data, callback, type ) {
6389
+ // shift arguments if data argument was omitted
6390
+ if ( jQuery.isFunction( data ) ) {
6391
+ type = type || callback;
6392
+ callback = data;
6393
+ data = undefined;
6394
+ }
6395
+ return jQuery.ajax({
6396
+ url: url,
6397
+ type: method,
6398
+ dataType: type,
6399
+ data: data,
6400
+ success: callback
6401
+ });
6402
+ };
6403
+ });
6404
+ jQuery.extend({
6405
+ // Counter for holding the number of active queries
6406
+ active: 0,
6407
+ // Last-Modified header cache for next request
6408
+ lastModified: {},
6409
+ etag: {},
6410
+ ajaxSettings: {
6411
+ url: ajaxLocation,
6412
+ type: "GET",
6413
+ isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
6414
+ global: true,
6415
+ processData: true,
6416
+ async: true,
6417
+ contentType: "application/x-www-form-urlencoded; charset=UTF-8",
6418
+ /*
6419
+ timeout: 0,
6420
+ data: null,
6421
+ dataType: null,
6422
+ username: null,
6423
+ password: null,
6424
+ cache: null,
6425
+ throws: false,
6426
+ traditional: false,
6427
+ headers: {},
6428
+ */
6429
+ accepts: {
6430
+ "*": allTypes,
6431
+ text: "text/plain",
6432
+ html: "text/html",
6433
+ xml: "application/xml, text/xml",
6434
+ json: "application/json, text/javascript"
6435
+ },
6436
+ contents: {
6437
+ xml: /xml/,
6438
+ html: /html/,
6439
+ json: /json/
6440
+ },
6441
+ responseFields: {
6442
+ xml: "responseXML",
6443
+ text: "responseText"
6444
+ },
6445
+ // Data converters
6446
+ // Keys separate source (or catchall "*") and destination types with a single space
6447
+ converters: {
6448
+ // Convert anything to text
6449
+ "* text": window.String,
6450
+ // Text to html (true = no transformation)
6451
+ "text html": true,
6452
+ // Evaluate text as a json expression
6453
+ "text json": jQuery.parseJSON,
6454
+ // Parse text as xml
6455
+ "text xml": jQuery.parseXML
6456
+ },
6457
+ // For options that shouldn't be deep extended:
6458
+ // you can add your own custom options here if
6459
+ // and when you create one that shouldn't be
6460
+ // deep extended (see ajaxExtend)
6461
+ flatOptions: {
6462
+ url: true,
6463
+ context: true
6464
+ }
6465
+ },
6466
+ // Creates a full fledged settings object into target
6467
+ // with both ajaxSettings and settings fields.
6468
+ // If target is omitted, writes into ajaxSettings.
6469
+ ajaxSetup: function( target, settings ) {
6470
+ return settings ?
6471
+ // Building a settings object
6472
+ ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
6473
+ // Extending ajaxSettings
6474
+ ajaxExtend( jQuery.ajaxSettings, target );
6475
+ },
6476
+ ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
6477
+ ajaxTransport: addToPrefiltersOrTransports( transports ),
6478
+ // Main method
6479
+ ajax: function( url, options ) {
6480
+ // If url is an object, simulate pre-1.5 signature
6481
+ if ( typeof url === "object" ) {
6482
+ options = url;
6483
+ url = undefined;
6484
+ }
6485
+ // Force options to be an object
6486
+ options = options || {};
6487
+ var // Cross-domain detection vars
6488
+ parts,
6489
+ // Loop variable
6490
+ i,
6491
+ // URL without anti-cache param
6492
+ cacheURL,
6493
+ // Response headers as string
6494
+ responseHeadersString,
6495
+ // timeout handle
6496
+ timeoutTimer,
6497
+ // To know if global events are to be dispatched
6498
+ fireGlobals,
6499
+ transport,
6500
+ // Response headers
6501
+ responseHeaders,
6502
+ // Create the final options object
6503
+ s = jQuery.ajaxSetup( {}, options ),
6504
+ // Callbacks context
6505
+ callbackContext = s.context || s,
6506
+ // Context for global events is callbackContext if it is a DOM node or jQuery collection
6507
+ globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
6508
+ jQuery( callbackContext ) :
6509
+ jQuery.event,
6510
+ // Deferreds
6511
+ deferred = jQuery.Deferred(),
6512
+ completeDeferred = jQuery.Callbacks("once memory"),
6513
+ // Status-dependent callbacks
6514
+ statusCode = s.statusCode || {},
6515
+ // Headers (they are sent all at once)
6516
+ requestHeaders = {},
6517
+ requestHeadersNames = {},
6518
+ // The jqXHR state
6519
+ state = 0,
6520
+ // Default abort message
6521
+ strAbort = "canceled",
6522
+ // Fake xhr
6523
+ jqXHR = {
6524
+ readyState: 0,
6525
+ // Builds headers hashtable if needed
6526
+ getResponseHeader: function( key ) {
6527
+ var match;
6528
+ if ( state === 2 ) {
6529
+ if ( !responseHeaders ) {
6530
+ responseHeaders = {};
6531
+ while ( (match = rheaders.exec( responseHeadersString )) ) {
6532
+ responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
6533
+ }
6534
+ }
6535
+ match = responseHeaders[ key.toLowerCase() ];
6536
+ }
6537
+ return match == null ? null : match;
6538
+ },
6539
+ // Raw string
6540
+ getAllResponseHeaders: function() {
6541
+ return state === 2 ? responseHeadersString : null;
6542
+ },
6543
+ // Caches the header
6544
+ setRequestHeader: function( name, value ) {
6545
+ var lname = name.toLowerCase();
6546
+ if ( !state ) {
6547
+ name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
6548
+ requestHeaders[ name ] = value;
6549
+ }
6550
+ return this;
6551
+ },
6552
+ // Overrides response content-type header
6553
+ overrideMimeType: function( type ) {
6554
+ if ( !state ) {
6555
+ s.mimeType = type;
6556
+ }
6557
+ return this;
6558
+ },
6559
+ // Status-dependent callbacks
6560
+ statusCode: function( map ) {
6561
+ var code;
6562
+ if ( map ) {
6563
+ if ( state < 2 ) {
6564
+ for ( code in map ) {
6565
+ // Lazy-add the new callback in a way that preserves old ones
6566
+ statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
6567
+ }
6568
+ } else {
6569
+ // Execute the appropriate callbacks
6570
+ jqXHR.always( map[ jqXHR.status ] );
6571
+ }
6572
+ }
6573
+ return this;
6574
+ },
6575
+ // Cancel the request
6576
+ abort: function( statusText ) {
6577
+ var finalText = statusText || strAbort;
6578
+ if ( transport ) {
6579
+ transport.abort( finalText );
6580
+ }
6581
+ done( 0, finalText );
6582
+ return this;
6583
+ }
6584
+ };
6585
+ // Attach deferreds
6586
+ deferred.promise( jqXHR ).complete = completeDeferred.add;
6587
+ jqXHR.success = jqXHR.done;
6588
+ jqXHR.error = jqXHR.fail;
6589
+ // Remove hash character (#7531: and string promotion)
6590
+ // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
6591
+ // Handle falsy url in the settings object (#10093: consistency with old signature)
6592
+ // We also use the url parameter if available
6593
+ s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
6594
+ // Alias method option to type as per ticket #12004
6595
+ s.type = options.method || options.type || s.method || s.type;
6596
+ // Extract dataTypes list
6597
+ s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
6598
+ // A cross-domain request is in order when we have a protocol:host:port mismatch
6599
+ if ( s.crossDomain == null ) {
6600
+ parts = rurl.exec( s.url.toLowerCase() );
6601
+ s.crossDomain = !!( parts &&
6602
+ ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
6603
+ ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
6604
+ ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
6605
+ );
6606
+ }
6607
+ // Convert data if not already a string
6608
+ if ( s.data && s.processData && typeof s.data !== "string" ) {
6609
+ s.data = jQuery.param( s.data, s.traditional );
6610
+ }
6611
+ // Apply prefilters
6612
+ inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
6613
+ // If request was aborted inside a prefilter, stop there
6614
+ if ( state === 2 ) {
6615
+ return jqXHR;
6616
+ }
6617
+ // We can fire global events as of now if asked to
6618
+ fireGlobals = s.global;
6619
+ // Watch for a new set of requests
6620
+ if ( fireGlobals && jQuery.active++ === 0 ) {
6621
+ jQuery.event.trigger("ajaxStart");
6622
+ }
6623
+ // Uppercase the type
6624
+ s.type = s.type.toUpperCase();
6625
+ // Determine if request has content
6626
+ s.hasContent = !rnoContent.test( s.type );
6627
+ // Save the URL in case we're toying with the If-Modified-Since
6628
+ // and/or If-None-Match header later on
6629
+ cacheURL = s.url;
6630
+ // More options handling for requests with no content
6631
+ if ( !s.hasContent ) {
6632
+ // If data is available, append data to url
6633
+ if ( s.data ) {
6634
+ cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
6635
+ // #9682: remove data so that it's not used in an eventual retry
6636
+ delete s.data;
6637
+ }
6638
+ // Add anti-cache in url if needed
6639
+ if ( s.cache === false ) {
6640
+ s.url = rts.test( cacheURL ) ?
6641
+ // If there is already a '_' parameter, set its value
6642
+ cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) :
6643
+ // Otherwise add one to the end
6644
+ cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++;
6645
+ }
6646
+ }
6647
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
6648
+ if ( s.ifModified ) {
6649
+ if ( jQuery.lastModified[ cacheURL ] ) {
6650
+ jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
6651
+ }
6652
+ if ( jQuery.etag[ cacheURL ] ) {
6653
+ jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
6654
+ }
6655
+ }
6656
+ // Set the correct header, if data is being sent
6657
+ if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
6658
+ jqXHR.setRequestHeader( "Content-Type", s.contentType );
6659
+ }
6660
+ // Set the Accepts header for the server, depending on the dataType
6661
+ jqXHR.setRequestHeader(
6662
+ "Accept",
6663
+ s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
6664
+ s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
6665
+ s.accepts[ "*" ]
6666
+ );
6667
+ // Check for headers option
6668
+ for ( i in s.headers ) {
6669
+ jqXHR.setRequestHeader( i, s.headers[ i ] );
6670
+ }
6671
+ // Allow custom headers/mimetypes and early abort
6672
+ if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
6673
+ // Abort if not done already and return
6674
+ return jqXHR.abort();
6675
+ }
6676
+ // aborting is no longer a cancellation
6677
+ strAbort = "abort";
6678
+ // Install callbacks on deferreds
6679
+ for ( i in { success: 1, error: 1, complete: 1 } ) {
6680
+ jqXHR[ i ]( s[ i ] );
6681
+ }
6682
+ // Get transport
6683
+ transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
6684
+ // If no transport, we auto-abort
6685
+ if ( !transport ) {
6686
+ done( -1, "No Transport" );
6687
+ } else {
6688
+ jqXHR.readyState = 1;
6689
+ // Send global event
6690
+ if ( fireGlobals ) {
6691
+ globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
6692
+ }
6693
+ // Timeout
6694
+ if ( s.async && s.timeout > 0 ) {
6695
+ timeoutTimer = setTimeout(function() {
6696
+ jqXHR.abort("timeout");
6697
+ }, s.timeout );
6698
+ }
6699
+ try {
6700
+ state = 1;
6701
+ transport.send( requestHeaders, done );
6702
+ } catch ( e ) {
6703
+ // Propagate exception as error if not done
6704
+ if ( state < 2 ) {
6705
+ done( -1, e );
6706
+ // Simply rethrow otherwise
6707
+ } else {
6708
+ throw e;
6709
+ }
6710
+ }
6711
+ }
6712
+ // Callback for when everything is done
6713
+ function done( status, nativeStatusText, responses, headers ) {
6714
+ var isSuccess, success, error, response, modified,
6715
+ statusText = nativeStatusText;
6716
+ // Called once
6717
+ if ( state === 2 ) {
6718
+ return;
6719
+ }
6720
+ // State is "done" now
6721
+ state = 2;
6722
+ // Clear timeout if it exists
6723
+ if ( timeoutTimer ) {
6724
+ clearTimeout( timeoutTimer );
6725
+ }
6726
+ // Dereference transport for early garbage collection
6727
+ // (no matter how long the jqXHR object will be used)
6728
+ transport = undefined;
6729
+ // Cache response headers
6730
+ responseHeadersString = headers || "";
6731
+ // Set readyState
6732
+ jqXHR.readyState = status > 0 ? 4 : 0;
6733
+ // Get response data
6734
+ if ( responses ) {
6735
+ response = ajaxHandleResponses( s, jqXHR, responses );
6736
+ }
6737
+ // If successful, handle type chaining
6738
+ if ( status >= 200 && status < 300 || status === 304 ) {
6739
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
6740
+ if ( s.ifModified ) {
6741
+ modified = jqXHR.getResponseHeader("Last-Modified");
6742
+ if ( modified ) {
6743
+ jQuery.lastModified[ cacheURL ] = modified;
6744
+ }
6745
+ modified = jqXHR.getResponseHeader("etag");
6746
+ if ( modified ) {
6747
+ jQuery.etag[ cacheURL ] = modified;
6748
+ }
6749
+ }
6750
+ // if no content
6751
+ if ( status === 204 ) {
6752
+ isSuccess = true;
6753
+ statusText = "nocontent";
6754
+ // if not modified
6755
+ } else if ( status === 304 ) {
6756
+ isSuccess = true;
6757
+ statusText = "notmodified";
6758
+ // If we have data, let's convert it
6759
+ } else {
6760
+ isSuccess = ajaxConvert( s, response );
6761
+ statusText = isSuccess.state;
6762
+ success = isSuccess.data;
6763
+ error = isSuccess.error;
6764
+ isSuccess = !error;
6765
+ }
6766
+ } else {
6767
+ // We extract error from statusText
6768
+ // then normalize statusText and status for non-aborts
6769
+ error = statusText;
6770
+ if ( status || !statusText ) {
6771
+ statusText = "error";
6772
+ if ( status < 0 ) {
6773
+ status = 0;
6774
+ }
6775
+ }
6776
+ }
6777
+ // Set data for the fake xhr object
6778
+ jqXHR.status = status;
6779
+ jqXHR.statusText = ( nativeStatusText || statusText ) + "";
6780
+ // Success/Error
6781
+ if ( isSuccess ) {
6782
+ deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
6783
+ } else {
6784
+ deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
6785
+ }
6786
+ // Status-dependent callbacks
6787
+ jqXHR.statusCode( statusCode );
6788
+ statusCode = undefined;
6789
+ if ( fireGlobals ) {
6790
+ globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
6791
+ [ jqXHR, s, isSuccess ? success : error ] );
6792
+ }
6793
+ // Complete
6794
+ completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
6795
+ if ( fireGlobals ) {
6796
+ globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
6797
+ // Handle the global AJAX counter
6798
+ if ( !( --jQuery.active ) ) {
6799
+ jQuery.event.trigger("ajaxStop");
6800
+ }
6801
+ }
6802
+ }
6803
+ return jqXHR;
6804
+ },
6805
+ getScript: function( url, callback ) {
6806
+ return jQuery.get( url, undefined, callback, "script" );
6807
+ },
6808
+ getJSON: function( url, data, callback ) {
6809
+ return jQuery.get( url, data, callback, "json" );
6810
+ }
6811
+ });
6812
+ /* Handles responses to an ajax request:
6813
+ * - sets all responseXXX fields accordingly
6814
+ * - finds the right dataType (mediates between content-type and expected dataType)
6815
+ * - returns the corresponding response
6816
+ */
6817
+ function ajaxHandleResponses( s, jqXHR, responses ) {
6818
+ var firstDataType, ct, finalDataType, type,
6819
+ contents = s.contents,
6820
+ dataTypes = s.dataTypes,
6821
+ responseFields = s.responseFields;
6822
+ // Fill responseXXX fields
6823
+ for ( type in responseFields ) {
6824
+ if ( type in responses ) {
6825
+ jqXHR[ responseFields[type] ] = responses[ type ];
6826
+ }
6827
+ }
6828
+ // Remove auto dataType and get content-type in the process
6829
+ while( dataTypes[ 0 ] === "*" ) {
6830
+ dataTypes.shift();
6831
+ if ( ct === undefined ) {
6832
+ ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
6833
+ }
6834
+ }
6835
+ // Check if we're dealing with a known content-type
6836
+ if ( ct ) {
6837
+ for ( type in contents ) {
6838
+ if ( contents[ type ] && contents[ type ].test( ct ) ) {
6839
+ dataTypes.unshift( type );
6840
+ break;
6841
+ }
6842
+ }
6843
+ }
6844
+ // Check to see if we have a response for the expected dataType
6845
+ if ( dataTypes[ 0 ] in responses ) {
6846
+ finalDataType = dataTypes[ 0 ];
6847
+ } else {
6848
+ // Try convertible dataTypes
6849
+ for ( type in responses ) {
6850
+ if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
6851
+ finalDataType = type;
6852
+ break;
6853
+ }
6854
+ if ( !firstDataType ) {
6855
+ firstDataType = type;
6856
+ }
6857
+ }
6858
+ // Or just use first one
6859
+ finalDataType = finalDataType || firstDataType;
6860
+ }
6861
+ // If we found a dataType
6862
+ // We add the dataType to the list if needed
6863
+ // and return the corresponding response
6864
+ if ( finalDataType ) {
6865
+ if ( finalDataType !== dataTypes[ 0 ] ) {
6866
+ dataTypes.unshift( finalDataType );
6867
+ }
6868
+ return responses[ finalDataType ];
6869
+ }
6870
+ }
6871
+ // Chain conversions given the request and the original response
6872
+ function ajaxConvert( s, response ) {
6873
+ var conv2, current, conv, tmp,
6874
+ converters = {},
6875
+ i = 0,
6876
+ // Work with a copy of dataTypes in case we need to modify it for conversion
6877
+ dataTypes = s.dataTypes.slice(),
6878
+ prev = dataTypes[ 0 ];
6879
+ // Apply the dataFilter if provided
6880
+ if ( s.dataFilter ) {
6881
+ response = s.dataFilter( response, s.dataType );
6882
+ }
6883
+ // Create converters map with lowercased keys
6884
+ if ( dataTypes[ 1 ] ) {
6885
+ for ( conv in s.converters ) {
6886
+ converters[ conv.toLowerCase() ] = s.converters[ conv ];
6887
+ }
6888
+ }
6889
+ // Convert to each sequential dataType, tolerating list modification
6890
+ for ( ; (current = dataTypes[++i]); ) {
6891
+ // There's only work to do if current dataType is non-auto
6892
+ if ( current !== "*" ) {
6893
+ // Convert response if prev dataType is non-auto and differs from current
6894
+ if ( prev !== "*" && prev !== current ) {
6895
+ // Seek a direct converter
6896
+ conv = converters[ prev + " " + current ] || converters[ "* " + current ];
6897
+ // If none found, seek a pair
6898
+ if ( !conv ) {
6899
+ for ( conv2 in converters ) {
6900
+ // If conv2 outputs current
6901
+ tmp = conv2.split(" ");
6902
+ if ( tmp[ 1 ] === current ) {
6903
+ // If prev can be converted to accepted input
6904
+ conv = converters[ prev + " " + tmp[ 0 ] ] ||
6905
+ converters[ "* " + tmp[ 0 ] ];
6906
+ if ( conv ) {
6907
+ // Condense equivalence converters
6908
+ if ( conv === true ) {
6909
+ conv = converters[ conv2 ];
6910
+ // Otherwise, insert the intermediate dataType
6911
+ } else if ( converters[ conv2 ] !== true ) {
6912
+ current = tmp[ 0 ];
6913
+ dataTypes.splice( i--, 0, current );
6914
+ }
6915
+ break;
6916
+ }
6917
+ }
6918
+ }
6919
+ }
6920
+ // Apply converter (if not an equivalence)
6921
+ if ( conv !== true ) {
6922
+ // Unless errors are allowed to bubble, catch and return them
6923
+ if ( conv && s["throws"] ) {
6924
+ response = conv( response );
6925
+ } else {
6926
+ try {
6927
+ response = conv( response );
6928
+ } catch ( e ) {
6929
+ return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
6930
+ }
6931
+ }
6932
+ }
6933
+ }
6934
+ // Update prev for next iteration
6935
+ prev = current;
6936
+ }
6937
+ }
6938
+ return { state: "success", data: response };
6939
+ }
6940
+ // Install script dataType
6941
+ jQuery.ajaxSetup({
6942
+ accepts: {
6943
+ script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
6944
+ },
6945
+ contents: {
6946
+ script: /(?:java|ecma)script/
6947
+ },
6948
+ converters: {
6949
+ "text script": function( text ) {
6950
+ jQuery.globalEval( text );
6951
+ return text;
6952
+ }
6953
+ }
6954
+ });
6955
+ // Handle cache's special case and global
6956
+ jQuery.ajaxPrefilter( "script", function( s ) {
6957
+ if ( s.cache === undefined ) {
6958
+ s.cache = false;
6959
+ }
6960
+ if ( s.crossDomain ) {
6961
+ s.type = "GET";
6962
+ s.global = false;
6963
+ }
6964
+ });
6965
+ // Bind script tag hack transport
6966
+ jQuery.ajaxTransport( "script", function(s) {
6967
+ // This transport only deals with cross domain requests
6968
+ if ( s.crossDomain ) {
6969
+ var script,
6970
+ head = document.head || jQuery("head")[0] || document.documentElement;
6971
+ return {
6972
+ send: function( _, callback ) {
6973
+ script = document.createElement("script");
6974
+ script.async = true;
6975
+ if ( s.scriptCharset ) {
6976
+ script.charset = s.scriptCharset;
6977
+ }
6978
+ script.src = s.url;
6979
+ // Attach handlers for all browsers
6980
+ script.onload = script.onreadystatechange = function( _, isAbort ) {
6981
+ if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
6982
+ // Handle memory leak in IE
6983
+ script.onload = script.onreadystatechange = null;
6984
+ // Remove the script
6985
+ if ( script.parentNode ) {
6986
+ script.parentNode.removeChild( script );
6987
+ }
6988
+ // Dereference the script
6989
+ script = null;
6990
+ // Callback if not abort
6991
+ if ( !isAbort ) {
6992
+ callback( 200, "success" );
6993
+ }
6994
+ }
6995
+ };
6996
+ // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
6997
+ // Use native DOM manipulation to avoid our domManip AJAX trickery
6998
+ head.insertBefore( script, head.firstChild );
6999
+ },
7000
+ abort: function() {
7001
+ if ( script ) {
7002
+ script.onload( undefined, true );
7003
+ }
7004
+ }
7005
+ };
7006
+ }
7007
+ });
7008
+ var oldCallbacks = [],
7009
+ rjsonp = /(=)\?(?=&|$)|\?\?/;
7010
+ // Default jsonp settings
7011
+ jQuery.ajaxSetup({
7012
+ jsonp: "callback",
7013
+ jsonpCallback: function() {
7014
+ var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );
7015
+ this[ callback ] = true;
7016
+ return callback;
7017
+ }
7018
+ });
7019
+ // Detect, normalize options and install callbacks for jsonp requests
7020
+ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
7021
+ var callbackName, overwritten, responseContainer,
7022
+ jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
7023
+ "url" :
7024
+ typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
7025
+ );
7026
+ // Handle iff the expected data type is "jsonp" or we have a parameter to set
7027
+ if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
7028
+ // Get callback name, remembering preexisting value associated with it
7029
+ callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
7030
+ s.jsonpCallback() :
7031
+ s.jsonpCallback;
7032
+ // Insert callback into url or form data
7033
+ if ( jsonProp ) {
7034
+ s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
7035
+ } else if ( s.jsonp !== false ) {
7036
+ s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
7037
+ }
7038
+ // Use data converter to retrieve json after script execution
7039
+ s.converters["script json"] = function() {
7040
+ if ( !responseContainer ) {
7041
+ jQuery.error( callbackName + " was not called" );
7042
+ }
7043
+ return responseContainer[ 0 ];
7044
+ };
7045
+ // force json dataType
7046
+ s.dataTypes[ 0 ] = "json";
7047
+ // Install callback
7048
+ overwritten = window[ callbackName ];
7049
+ window[ callbackName ] = function() {
7050
+ responseContainer = arguments;
7051
+ };
7052
+ // Clean-up function (fires after converters)
7053
+ jqXHR.always(function() {
7054
+ // Restore preexisting value
7055
+ window[ callbackName ] = overwritten;
7056
+ // Save back as free
7057
+ if ( s[ callbackName ] ) {
7058
+ // make sure that re-using the options doesn't screw things around
7059
+ s.jsonpCallback = originalSettings.jsonpCallback;
7060
+ // save the callback name for future use
7061
+ oldCallbacks.push( callbackName );
7062
+ }
7063
+ // Call if it was a function and we have a response
7064
+ if ( responseContainer && jQuery.isFunction( overwritten ) ) {
7065
+ overwritten( responseContainer[ 0 ] );
7066
+ }
7067
+ responseContainer = overwritten = undefined;
7068
+ });
7069
+ // Delegate to script
7070
+ return "script";
7071
+ }
7072
+ });
7073
+ var xhrCallbacks, xhrSupported,
7074
+ xhrId = 0,
7075
+ // #5280: Internet Explorer will keep connections alive if we don't abort on unload
7076
+ xhrOnUnloadAbort = window.ActiveXObject && function() {
7077
+ // Abort all pending requests
7078
+ var key;
7079
+ for ( key in xhrCallbacks ) {
7080
+ xhrCallbacks[ key ]( undefined, true );
7081
+ }
7082
+ };
7083
+ // Functions to create xhrs
7084
+ function createStandardXHR() {
7085
+ try {
7086
+ return new window.XMLHttpRequest();
7087
+ } catch( e ) {}
7088
+ }
7089
+ function createActiveXHR() {
7090
+ try {
7091
+ return new window.ActiveXObject("Microsoft.XMLHTTP");
7092
+ } catch( e ) {}
7093
+ }
7094
+ // Create the request object
7095
+ // (This is still attached to ajaxSettings for backward compatibility)
7096
+ jQuery.ajaxSettings.xhr = window.ActiveXObject ?
7097
+ /* Microsoft failed to properly
7098
+ * implement the XMLHttpRequest in IE7 (can't request local files),
7099
+ * so we use the ActiveXObject when it is available
7100
+ * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
7101
+ * we need a fallback.
7102
+ */
7103
+ function() {
7104
+ return !this.isLocal && createStandardXHR() || createActiveXHR();
7105
+ } :
7106
+ // For all other browsers, use the standard XMLHttpRequest object
7107
+ createStandardXHR;
7108
+ // Determine support properties
7109
+ xhrSupported = jQuery.ajaxSettings.xhr();
7110
+ jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
7111
+ xhrSupported = jQuery.support.ajax = !!xhrSupported;
7112
+ // Create transport if the browser can provide an xhr
7113
+ if ( xhrSupported ) {
7114
+ jQuery.ajaxTransport(function( s ) {
7115
+ // Cross domain only allowed if supported through XMLHttpRequest
7116
+ if ( !s.crossDomain || jQuery.support.cors ) {
7117
+ var callback;
7118
+ return {
7119
+ send: function( headers, complete ) {
7120
+ // Get a new xhr
7121
+ var handle, i,
7122
+ xhr = s.xhr();
7123
+ // Open the socket
7124
+ // Passing null username, generates a login popup on Opera (#2865)
7125
+ if ( s.username ) {
7126
+ xhr.open( s.type, s.url, s.async, s.username, s.password );
7127
+ } else {
7128
+ xhr.open( s.type, s.url, s.async );
7129
+ }
7130
+ // Apply custom fields if provided
7131
+ if ( s.xhrFields ) {
7132
+ for ( i in s.xhrFields ) {
7133
+ xhr[ i ] = s.xhrFields[ i ];
7134
+ }
7135
+ }
7136
+ // Override mime type if needed
7137
+ if ( s.mimeType && xhr.overrideMimeType ) {
7138
+ xhr.overrideMimeType( s.mimeType );
7139
+ }
7140
+ // X-Requested-With header
7141
+ // For cross-domain requests, seeing as conditions for a preflight are
7142
+ // akin to a jigsaw puzzle, we simply never set it to be sure.
7143
+ // (it can always be set on a per-request basis or even using ajaxSetup)
7144
+ // For same-domain requests, won't change header if already provided.
7145
+ if ( !s.crossDomain && !headers["X-Requested-With"] ) {
7146
+ headers["X-Requested-With"] = "XMLHttpRequest";
7147
+ }
7148
+ // Need an extra try/catch for cross domain requests in Firefox 3
7149
+ try {
7150
+ for ( i in headers ) {
7151
+ xhr.setRequestHeader( i, headers[ i ] );
7152
+ }
7153
+ } catch( err ) {}
7154
+ // Do send the request
7155
+ // This may raise an exception which is actually
7156
+ // handled in jQuery.ajax (so no try/catch here)
7157
+ xhr.send( ( s.hasContent && s.data ) || null );
7158
+ // Listener
7159
+ callback = function( _, isAbort ) {
7160
+ var status, responseHeaders, statusText, responses;
7161
+ // Firefox throws exceptions when accessing properties
7162
+ // of an xhr when a network error occurred
7163
+ // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
7164
+ try {
7165
+ // Was never called and is aborted or complete
7166
+ if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
7167
+ // Only called once
7168
+ callback = undefined;
7169
+ // Do not keep as active anymore
7170
+ if ( handle ) {
7171
+ xhr.onreadystatechange = jQuery.noop;
7172
+ if ( xhrOnUnloadAbort ) {
7173
+ delete xhrCallbacks[ handle ];
7174
+ }
7175
+ }
7176
+ // If it's an abort
7177
+ if ( isAbort ) {
7178
+ // Abort it manually if needed
7179
+ if ( xhr.readyState !== 4 ) {
7180
+ xhr.abort();
7181
+ }
7182
+ } else {
7183
+ responses = {};
7184
+ status = xhr.status;
7185
+ responseHeaders = xhr.getAllResponseHeaders();
7186
+ // When requesting binary data, IE6-9 will throw an exception
7187
+ // on any attempt to access responseText (#11426)
7188
+ if ( typeof xhr.responseText === "string" ) {
7189
+ responses.text = xhr.responseText;
7190
+ }
7191
+ // Firefox throws an exception when accessing
7192
+ // statusText for faulty cross-domain requests
7193
+ try {
7194
+ statusText = xhr.statusText;
7195
+ } catch( e ) {
7196
+ // We normalize with Webkit giving an empty statusText
7197
+ statusText = "";
7198
+ }
7199
+ // Filter status for non standard behaviors
7200
+ // If the request is local and we have data: assume a success
7201
+ // (success with no data won't get notified, that's the best we
7202
+ // can do given current implementations)
7203
+ if ( !status && s.isLocal && !s.crossDomain ) {
7204
+ status = responses.text ? 200 : 404;
7205
+ // IE - #1450: sometimes returns 1223 when it should be 204
7206
+ } else if ( status === 1223 ) {
7207
+ status = 204;
7208
+ }
7209
+ }
7210
+ }
7211
+ } catch( firefoxAccessException ) {
7212
+ if ( !isAbort ) {
7213
+ complete( -1, firefoxAccessException );
7214
+ }
7215
+ }
7216
+ // Call complete if needed
7217
+ if ( responses ) {
7218
+ complete( status, statusText, responses, responseHeaders );
7219
+ }
7220
+ };
7221
+ if ( !s.async ) {
7222
+ // if we're in sync mode we fire the callback
7223
+ callback();
7224
+ } else if ( xhr.readyState === 4 ) {
7225
+ // (IE6 & IE7) if it's in cache and has been
7226
+ // retrieved directly we need to fire the callback
7227
+ setTimeout( callback );
7228
+ } else {
7229
+ handle = ++xhrId;
7230
+ if ( xhrOnUnloadAbort ) {
7231
+ // Create the active xhrs callbacks list if needed
7232
+ // and attach the unload handler
7233
+ if ( !xhrCallbacks ) {
7234
+ xhrCallbacks = {};
7235
+ jQuery( window ).unload( xhrOnUnloadAbort );
7236
+ }
7237
+ // Add to list of active xhrs callbacks
7238
+ xhrCallbacks[ handle ] = callback;
7239
+ }
7240
+ xhr.onreadystatechange = callback;
7241
+ }
7242
+ },
7243
+ abort: function() {
7244
+ if ( callback ) {
7245
+ callback( undefined, true );
7246
+ }
7247
+ }
7248
+ };
7249
+ }
7250
+ });
7251
+ }
7252
+ var fxNow, timerId,
7253
+ rfxtypes = /^(?:toggle|show|hide)$/,
7254
+ rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
7255
+ rrun = /queueHooks$/,
7256
+ animationPrefilters = [ defaultPrefilter ],
7257
+ tweeners = {
7258
+ "*": [function( prop, value ) {
7259
+ var end, unit,
7260
+ tween = this.createTween( prop, value ),
7261
+ parts = rfxnum.exec( value ),
7262
+ target = tween.cur(),
7263
+ start = +target || 0,
7264
+ scale = 1,
7265
+ maxIterations = 20;
7266
+ if ( parts ) {
7267
+ end = +parts[2];
7268
+ unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" );
7269
+ // We need to compute starting value
7270
+ if ( unit !== "px" && start ) {
7271
+ // Iteratively approximate from a nonzero starting point
7272
+ // Prefer the current property, because this process will be trivial if it uses the same units
7273
+ // Fallback to end or a simple constant
7274
+ start = jQuery.css( tween.elem, prop, true ) || end || 1;
7275
+ do {
7276
+ // If previous iteration zeroed out, double until we get *something*
7277
+ // Use a string for doubling factor so we don't accidentally see scale as unchanged below
7278
+ scale = scale || ".5";
7279
+ // Adjust and apply
7280
+ start = start / scale;
7281
+ jQuery.style( tween.elem, prop, start + unit );
7282
+ // Update scale, tolerating zero or NaN from tween.cur()
7283
+ // And breaking the loop if scale is unchanged or perfect, or if we've just had enough
7284
+ } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
7285
+ }
7286
+ tween.unit = unit;
7287
+ tween.start = start;
7288
+ // If a +=/-= token was provided, we're doing a relative animation
7289
+ tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end;
7290
+ }
7291
+ return tween;
7292
+ }]
7293
+ };
7294
+ // Animations created synchronously will run synchronously
7295
+ function createFxNow() {
7296
+ setTimeout(function() {
7297
+ fxNow = undefined;
7298
+ });
7299
+ return ( fxNow = jQuery.now() );
7300
+ }
7301
+ function createTweens( animation, props ) {
7302
+ jQuery.each( props, function( prop, value ) {
7303
+ var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
7304
+ index = 0,
7305
+ length = collection.length;
7306
+ for ( ; index < length; index++ ) {
7307
+ if ( collection[ index ].call( animation, prop, value ) ) {
7308
+ // we're done with this property
7309
+ return;
7310
+ }
7311
+ }
7312
+ });
7313
+ }
7314
+ function Animation( elem, properties, options ) {
7315
+ var result,
7316
+ stopped,
7317
+ index = 0,
7318
+ length = animationPrefilters.length,
7319
+ deferred = jQuery.Deferred().always( function() {
7320
+ // don't match elem in the :animated selector
7321
+ delete tick.elem;
7322
+ }),
7323
+ tick = function() {
7324
+ if ( stopped ) {
7325
+ return false;
7326
+ }
7327
+ var currentTime = fxNow || createFxNow(),
7328
+ remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
7329
+ // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
7330
+ temp = remaining / animation.duration || 0,
7331
+ percent = 1 - temp,
7332
+ index = 0,
7333
+ length = animation.tweens.length;
7334
+ for ( ; index < length ; index++ ) {
7335
+ animation.tweens[ index ].run( percent );
7336
+ }
7337
+ deferred.notifyWith( elem, [ animation, percent, remaining ]);
7338
+ if ( percent < 1 && length ) {
7339
+ return remaining;
7340
+ } else {
7341
+ deferred.resolveWith( elem, [ animation ] );
7342
+ return false;
7343
+ }
7344
+ },
7345
+ animation = deferred.promise({
7346
+ elem: elem,
7347
+ props: jQuery.extend( {}, properties ),
7348
+ opts: jQuery.extend( true, { specialEasing: {} }, options ),
7349
+ originalProperties: properties,
7350
+ originalOptions: options,
7351
+ startTime: fxNow || createFxNow(),
7352
+ duration: options.duration,
7353
+ tweens: [],
7354
+ createTween: function( prop, end ) {
7355
+ var tween = jQuery.Tween( elem, animation.opts, prop, end,
7356
+ animation.opts.specialEasing[ prop ] || animation.opts.easing );
7357
+ animation.tweens.push( tween );
7358
+ return tween;
7359
+ },
7360
+ stop: function( gotoEnd ) {
7361
+ var index = 0,
7362
+ // if we are going to the end, we want to run all the tweens
7363
+ // otherwise we skip this part
7364
+ length = gotoEnd ? animation.tweens.length : 0;
7365
+ if ( stopped ) {
7366
+ return this;
7367
+ }
7368
+ stopped = true;
7369
+ for ( ; index < length ; index++ ) {
7370
+ animation.tweens[ index ].run( 1 );
7371
+ }
7372
+ // resolve when we played the last frame
7373
+ // otherwise, reject
7374
+ if ( gotoEnd ) {
7375
+ deferred.resolveWith( elem, [ animation, gotoEnd ] );
7376
+ } else {
7377
+ deferred.rejectWith( elem, [ animation, gotoEnd ] );
7378
+ }
7379
+ return this;
7380
+ }
7381
+ }),
7382
+ props = animation.props;
7383
+ propFilter( props, animation.opts.specialEasing );
7384
+ for ( ; index < length ; index++ ) {
7385
+ result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
7386
+ if ( result ) {
7387
+ return result;
7388
+ }
7389
+ }
7390
+ createTweens( animation, props );
7391
+ if ( jQuery.isFunction( animation.opts.start ) ) {
7392
+ animation.opts.start.call( elem, animation );
7393
+ }
7394
+ jQuery.fx.timer(
7395
+ jQuery.extend( tick, {
7396
+ elem: elem,
7397
+ anim: animation,
7398
+ queue: animation.opts.queue
7399
+ })
7400
+ );
7401
+ // attach callbacks from options
7402
+ return animation.progress( animation.opts.progress )
7403
+ .done( animation.opts.done, animation.opts.complete )
7404
+ .fail( animation.opts.fail )
7405
+ .always( animation.opts.always );
7406
+ }
7407
+ function propFilter( props, specialEasing ) {
7408
+ var value, name, index, easing, hooks;
7409
+ // camelCase, specialEasing and expand cssHook pass
7410
+ for ( index in props ) {
7411
+ name = jQuery.camelCase( index );
7412
+ easing = specialEasing[ name ];
7413
+ value = props[ index ];
7414
+ if ( jQuery.isArray( value ) ) {
7415
+ easing = value[ 1 ];
7416
+ value = props[ index ] = value[ 0 ];
7417
+ }
7418
+ if ( index !== name ) {
7419
+ props[ name ] = value;
7420
+ delete props[ index ];
7421
+ }
7422
+ hooks = jQuery.cssHooks[ name ];
7423
+ if ( hooks && "expand" in hooks ) {
7424
+ value = hooks.expand( value );
7425
+ delete props[ name ];
7426
+ // not quite $.extend, this wont overwrite keys already present.
7427
+ // also - reusing 'index' from above because we have the correct "name"
7428
+ for ( index in value ) {
7429
+ if ( !( index in props ) ) {
7430
+ props[ index ] = value[ index ];
7431
+ specialEasing[ index ] = easing;
7432
+ }
7433
+ }
7434
+ } else {
7435
+ specialEasing[ name ] = easing;
7436
+ }
7437
+ }
7438
+ }
7439
+ jQuery.Animation = jQuery.extend( Animation, {
7440
+ tweener: function( props, callback ) {
7441
+ if ( jQuery.isFunction( props ) ) {
7442
+ callback = props;
7443
+ props = [ "*" ];
7444
+ } else {
7445
+ props = props.split(" ");
7446
+ }
7447
+ var prop,
7448
+ index = 0,
7449
+ length = props.length;
7450
+ for ( ; index < length ; index++ ) {
7451
+ prop = props[ index ];
7452
+ tweeners[ prop ] = tweeners[ prop ] || [];
7453
+ tweeners[ prop ].unshift( callback );
7454
+ }
7455
+ },
7456
+ prefilter: function( callback, prepend ) {
7457
+ if ( prepend ) {
7458
+ animationPrefilters.unshift( callback );
7459
+ } else {
7460
+ animationPrefilters.push( callback );
7461
+ }
7462
+ }
7463
+ });
7464
+ function defaultPrefilter( elem, props, opts ) {
7465
+ /*jshint validthis:true */
7466
+ var prop, index, length,
7467
+ value, dataShow, toggle,
7468
+ tween, hooks, oldfire,
7469
+ anim = this,
7470
+ style = elem.style,
7471
+ orig = {},
7472
+ handled = [],
7473
+ hidden = elem.nodeType && isHidden( elem );
7474
+ // handle queue: false promises
7475
+ if ( !opts.queue ) {
7476
+ hooks = jQuery._queueHooks( elem, "fx" );
7477
+ if ( hooks.unqueued == null ) {
7478
+ hooks.unqueued = 0;
7479
+ oldfire = hooks.empty.fire;
7480
+ hooks.empty.fire = function() {
7481
+ if ( !hooks.unqueued ) {
7482
+ oldfire();
7483
+ }
7484
+ };
7485
+ }
7486
+ hooks.unqueued++;
7487
+ anim.always(function() {
7488
+ // doing this makes sure that the complete handler will be called
7489
+ // before this completes
7490
+ anim.always(function() {
7491
+ hooks.unqueued--;
7492
+ if ( !jQuery.queue( elem, "fx" ).length ) {
7493
+ hooks.empty.fire();
7494
+ }
7495
+ });
7496
+ });
7497
+ }
7498
+ // height/width overflow pass
7499
+ if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
7500
+ // Make sure that nothing sneaks out
7501
+ // Record all 3 overflow attributes because IE does not
7502
+ // change the overflow attribute when overflowX and
7503
+ // overflowY are set to the same value
7504
+ opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
7505
+ // Set display property to inline-block for height/width
7506
+ // animations on inline elements that are having width/height animated
7507
+ if ( jQuery.css( elem, "display" ) === "inline" &&
7508
+ jQuery.css( elem, "float" ) === "none" ) {
7509
+ // inline-level elements accept inline-block;
7510
+ // block-level elements need to be inline with layout
7511
+ if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
7512
+ style.display = "inline-block";
7513
+ } else {
7514
+ style.zoom = 1;
7515
+ }
7516
+ }
7517
+ }
7518
+ if ( opts.overflow ) {
7519
+ style.overflow = "hidden";
7520
+ if ( !jQuery.support.shrinkWrapBlocks ) {
7521
+ anim.always(function() {
7522
+ style.overflow = opts.overflow[ 0 ];
7523
+ style.overflowX = opts.overflow[ 1 ];
7524
+ style.overflowY = opts.overflow[ 2 ];
7525
+ });
7526
+ }
7527
+ }
7528
+ // show/hide pass
7529
+ for ( index in props ) {
7530
+ value = props[ index ];
7531
+ if ( rfxtypes.exec( value ) ) {
7532
+ delete props[ index ];
7533
+ toggle = toggle || value === "toggle";
7534
+ if ( value === ( hidden ? "hide" : "show" ) ) {
7535
+ continue;
7536
+ }
7537
+ handled.push( index );
7538
+ }
7539
+ }
7540
+ length = handled.length;
7541
+ if ( length ) {
7542
+ dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
7543
+ if ( "hidden" in dataShow ) {
7544
+ hidden = dataShow.hidden;
7545
+ }
7546
+ // store state if its toggle - enables .stop().toggle() to "reverse"
7547
+ if ( toggle ) {
7548
+ dataShow.hidden = !hidden;
7549
+ }
7550
+ if ( hidden ) {
7551
+ jQuery( elem ).show();
7552
+ } else {
7553
+ anim.done(function() {
7554
+ jQuery( elem ).hide();
7555
+ });
7556
+ }
7557
+ anim.done(function() {
7558
+ var prop;
7559
+ jQuery._removeData( elem, "fxshow" );
7560
+ for ( prop in orig ) {
7561
+ jQuery.style( elem, prop, orig[ prop ] );
7562
+ }
7563
+ });
7564
+ for ( index = 0 ; index < length ; index++ ) {
7565
+ prop = handled[ index ];
7566
+ tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );
7567
+ orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop );
7568
+ if ( !( prop in dataShow ) ) {
7569
+ dataShow[ prop ] = tween.start;
7570
+ if ( hidden ) {
7571
+ tween.end = tween.start;
7572
+ tween.start = prop === "width" || prop === "height" ? 1 : 0;
7573
+ }
7574
+ }
7575
+ }
7576
+ }
7577
+ }
7578
+ function Tween( elem, options, prop, end, easing ) {
7579
+ return new Tween.prototype.init( elem, options, prop, end, easing );
7580
+ }
7581
+ jQuery.Tween = Tween;
7582
+ Tween.prototype = {
7583
+ constructor: Tween,
7584
+ init: function( elem, options, prop, end, easing, unit ) {
7585
+ this.elem = elem;
7586
+ this.prop = prop;
7587
+ this.easing = easing || "swing";
7588
+ this.options = options;
7589
+ this.start = this.now = this.cur();
7590
+ this.end = end;
7591
+ this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
7592
+ },
7593
+ cur: function() {
7594
+ var hooks = Tween.propHooks[ this.prop ];
7595
+ return hooks && hooks.get ?
7596
+ hooks.get( this ) :
7597
+ Tween.propHooks._default.get( this );
7598
+ },
7599
+ run: function( percent ) {
7600
+ var eased,
7601
+ hooks = Tween.propHooks[ this.prop ];
7602
+ if ( this.options.duration ) {
7603
+ this.pos = eased = jQuery.easing[ this.easing ](
7604
+ percent, this.options.duration * percent, 0, 1, this.options.duration
7605
+ );
7606
+ } else {
7607
+ this.pos = eased = percent;
7608
+ }
7609
+ this.now = ( this.end - this.start ) * eased + this.start;
7610
+ if ( this.options.step ) {
7611
+ this.options.step.call( this.elem, this.now, this );
7612
+ }
7613
+ if ( hooks && hooks.set ) {
7614
+ hooks.set( this );
7615
+ } else {
7616
+ Tween.propHooks._default.set( this );
7617
+ }
7618
+ return this;
7619
+ }
7620
+ };
7621
+ Tween.prototype.init.prototype = Tween.prototype;
7622
+ Tween.propHooks = {
7623
+ _default: {
7624
+ get: function( tween ) {
7625
+ var result;
7626
+ if ( tween.elem[ tween.prop ] != null &&
7627
+ (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
7628
+ return tween.elem[ tween.prop ];
7629
+ }
7630
+ // passing an empty string as a 3rd parameter to .css will automatically
7631
+ // attempt a parseFloat and fallback to a string if the parse fails
7632
+ // so, simple values such as "10px" are parsed to Float.
7633
+ // complex values such as "rotate(1rad)" are returned as is.
7634
+ result = jQuery.css( tween.elem, tween.prop, "" );
7635
+ // Empty strings, null, undefined and "auto" are converted to 0.
7636
+ return !result || result === "auto" ? 0 : result;
7637
+ },
7638
+ set: function( tween ) {
7639
+ // use step hook for back compat - use cssHook if its there - use .style if its
7640
+ // available and use plain properties where available
7641
+ if ( jQuery.fx.step[ tween.prop ] ) {
7642
+ jQuery.fx.step[ tween.prop ]( tween );
7643
+ } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
7644
+ jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
7645
+ } else {
7646
+ tween.elem[ tween.prop ] = tween.now;
7647
+ }
7648
+ }
7649
+ }
7650
+ };
7651
+ // Remove in 2.0 - this supports IE8's panic based approach
7652
+ // to setting things on disconnected nodes
7653
+ Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
7654
+ set: function( tween ) {
7655
+ if ( tween.elem.nodeType && tween.elem.parentNode ) {
7656
+ tween.elem[ tween.prop ] = tween.now;
7657
+ }
7658
+ }
7659
+ };
7660
+ jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
7661
+ var cssFn = jQuery.fn[ name ];
7662
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
7663
+ return speed == null || typeof speed === "boolean" ?
7664
+ cssFn.apply( this, arguments ) :
7665
+ this.animate( genFx( name, true ), speed, easing, callback );
7666
+ };
7667
+ });
7668
+ jQuery.fn.extend({
7669
+ fadeTo: function( speed, to, easing, callback ) {
7670
+ // show any hidden elements after setting opacity to 0
7671
+ return this.filter( isHidden ).css( "opacity", 0 ).show()
7672
+ // animate to the value specified
7673
+ .end().animate({ opacity: to }, speed, easing, callback );
7674
+ },
7675
+ animate: function( prop, speed, easing, callback ) {
7676
+ var empty = jQuery.isEmptyObject( prop ),
7677
+ optall = jQuery.speed( speed, easing, callback ),
7678
+ doAnimation = function() {
7679
+ // Operate on a copy of prop so per-property easing won't be lost
7680
+ var anim = Animation( this, jQuery.extend( {}, prop ), optall );
7681
+ doAnimation.finish = function() {
7682
+ anim.stop( true );
7683
+ };
7684
+ // Empty animations, or finishing resolves immediately
7685
+ if ( empty || jQuery._data( this, "finish" ) ) {
7686
+ anim.stop( true );
7687
+ }
7688
+ };
7689
+ doAnimation.finish = doAnimation;
7690
+ return empty || optall.queue === false ?
7691
+ this.each( doAnimation ) :
7692
+ this.queue( optall.queue, doAnimation );
7693
+ },
7694
+ stop: function( type, clearQueue, gotoEnd ) {
7695
+ var stopQueue = function( hooks ) {
7696
+ var stop = hooks.stop;
7697
+ delete hooks.stop;
7698
+ stop( gotoEnd );
7699
+ };
7700
+ if ( typeof type !== "string" ) {
7701
+ gotoEnd = clearQueue;
7702
+ clearQueue = type;
7703
+ type = undefined;
7704
+ }
7705
+ if ( clearQueue && type !== false ) {
7706
+ this.queue( type || "fx", [] );
7707
+ }
7708
+ return this.each(function() {
7709
+ var dequeue = true,
7710
+ index = type != null && type + "queueHooks",
7711
+ timers = jQuery.timers,
7712
+ data = jQuery._data( this );
7713
+ if ( index ) {
7714
+ if ( data[ index ] && data[ index ].stop ) {
7715
+ stopQueue( data[ index ] );
7716
+ }
7717
+ } else {
7718
+ for ( index in data ) {
7719
+ if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
7720
+ stopQueue( data[ index ] );
7721
+ }
7722
+ }
7723
+ }
7724
+ for ( index = timers.length; index--; ) {
7725
+ if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
7726
+ timers[ index ].anim.stop( gotoEnd );
7727
+ dequeue = false;
7728
+ timers.splice( index, 1 );
7729
+ }
7730
+ }
7731
+ // start the next in the queue if the last step wasn't forced
7732
+ // timers currently will call their complete callbacks, which will dequeue
7733
+ // but only if they were gotoEnd
7734
+ if ( dequeue || !gotoEnd ) {
7735
+ jQuery.dequeue( this, type );
7736
+ }
7737
+ });
7738
+ },
7739
+ finish: function( type ) {
7740
+ if ( type !== false ) {
7741
+ type = type || "fx";
7742
+ }
7743
+ return this.each(function() {
7744
+ var index,
7745
+ data = jQuery._data( this ),
7746
+ queue = data[ type + "queue" ],
7747
+ hooks = data[ type + "queueHooks" ],
7748
+ timers = jQuery.timers,
7749
+ length = queue ? queue.length : 0;
7750
+ // enable finishing flag on private data
7751
+ data.finish = true;
7752
+ // empty the queue first
7753
+ jQuery.queue( this, type, [] );
7754
+ if ( hooks && hooks.cur && hooks.cur.finish ) {
7755
+ hooks.cur.finish.call( this );
7756
+ }
7757
+ // look for any active animations, and finish them
7758
+ for ( index = timers.length; index--; ) {
7759
+ if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
7760
+ timers[ index ].anim.stop( true );
7761
+ timers.splice( index, 1 );
7762
+ }
7763
+ }
7764
+ // look for any animations in the old queue and finish them
7765
+ for ( index = 0; index < length; index++ ) {
7766
+ if ( queue[ index ] && queue[ index ].finish ) {
7767
+ queue[ index ].finish.call( this );
7768
+ }
7769
+ }
7770
+ // turn off finishing flag
7771
+ delete data.finish;
7772
+ });
7773
+ }
7774
+ });
7775
+ // Generate parameters to create a standard animation
7776
+ function genFx( type, includeWidth ) {
7777
+ var which,
7778
+ attrs = { height: type },
7779
+ i = 0;
7780
+ // if we include width, step value is 1 to do all cssExpand values,
7781
+ // if we don't include width, step value is 2 to skip over Left and Right
7782
+ includeWidth = includeWidth? 1 : 0;
7783
+ for( ; i < 4 ; i += 2 - includeWidth ) {
7784
+ which = cssExpand[ i ];
7785
+ attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
7786
+ }
7787
+ if ( includeWidth ) {
7788
+ attrs.opacity = attrs.width = type;
7789
+ }
7790
+ return attrs;
7791
+ }
7792
+ // Generate shortcuts for custom animations
7793
+ jQuery.each({
7794
+ slideDown: genFx("show"),
7795
+ slideUp: genFx("hide"),
7796
+ slideToggle: genFx("toggle"),
7797
+ fadeIn: { opacity: "show" },
7798
+ fadeOut: { opacity: "hide" },
7799
+ fadeToggle: { opacity: "toggle" }
7800
+ }, function( name, props ) {
7801
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
7802
+ return this.animate( props, speed, easing, callback );
7803
+ };
7804
+ });
7805
+ jQuery.speed = function( speed, easing, fn ) {
7806
+ var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
7807
+ complete: fn || !fn && easing ||
7808
+ jQuery.isFunction( speed ) && speed,
7809
+ duration: speed,
7810
+ easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
7811
+ };
7812
+ opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
7813
+ opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
7814
+ // normalize opt.queue - true/undefined/null -> "fx"
7815
+ if ( opt.queue == null || opt.queue === true ) {
7816
+ opt.queue = "fx";
7817
+ }
7818
+ // Queueing
7819
+ opt.old = opt.complete;
7820
+ opt.complete = function() {
7821
+ if ( jQuery.isFunction( opt.old ) ) {
7822
+ opt.old.call( this );
7823
+ }
7824
+ if ( opt.queue ) {
7825
+ jQuery.dequeue( this, opt.queue );
7826
+ }
7827
+ };
7828
+ return opt;
7829
+ };
7830
+ jQuery.easing = {
7831
+ linear: function( p ) {
7832
+ return p;
7833
+ },
7834
+ swing: function( p ) {
7835
+ return 0.5 - Math.cos( p*Math.PI ) / 2;
7836
+ }
7837
+ };
7838
+ jQuery.timers = [];
7839
+ jQuery.fx = Tween.prototype.init;
7840
+ jQuery.fx.tick = function() {
7841
+ var timer,
7842
+ timers = jQuery.timers,
7843
+ i = 0;
7844
+ fxNow = jQuery.now();
7845
+ for ( ; i < timers.length; i++ ) {
7846
+ timer = timers[ i ];
7847
+ // Checks the timer has not already been removed
7848
+ if ( !timer() && timers[ i ] === timer ) {
7849
+ timers.splice( i--, 1 );
7850
+ }
7851
+ }
7852
+ if ( !timers.length ) {
7853
+ jQuery.fx.stop();
7854
+ }
7855
+ fxNow = undefined;
7856
+ };
7857
+ jQuery.fx.timer = function( timer ) {
7858
+ if ( timer() && jQuery.timers.push( timer ) ) {
7859
+ jQuery.fx.start();
7860
+ }
7861
+ };
7862
+ jQuery.fx.interval = 13;
7863
+ jQuery.fx.start = function() {
7864
+ if ( !timerId ) {
7865
+ timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
7866
+ }
7867
+ };
7868
+ jQuery.fx.stop = function() {
7869
+ clearInterval( timerId );
7870
+ timerId = null;
7871
+ };
7872
+ jQuery.fx.speeds = {
7873
+ slow: 600,
7874
+ fast: 200,
7875
+ // Default speed
7876
+ _default: 400
7877
+ };
7878
+ // Back Compat <1.8 extension point
7879
+ jQuery.fx.step = {};
7880
+ if ( jQuery.expr && jQuery.expr.filters ) {
7881
+ jQuery.expr.filters.animated = function( elem ) {
7882
+ return jQuery.grep(jQuery.timers, function( fn ) {
7883
+ return elem === fn.elem;
7884
+ }).length;
7885
+ };
7886
+ }
7887
+ jQuery.fn.offset = function( options ) {
7888
+ if ( arguments.length ) {
7889
+ return options === undefined ?
7890
+ this :
7891
+ this.each(function( i ) {
7892
+ jQuery.offset.setOffset( this, options, i );
7893
+ });
7894
+ }
7895
+ var docElem, win,
7896
+ box = { top: 0, left: 0 },
7897
+ elem = this[ 0 ],
7898
+ doc = elem && elem.ownerDocument;
7899
+ if ( !doc ) {
7900
+ return;
7901
+ }
7902
+ docElem = doc.documentElement;
7903
+ // Make sure it's not a disconnected DOM node
7904
+ if ( !jQuery.contains( docElem, elem ) ) {
7905
+ return box;
7906
+ }
7907
+ // If we don't have gBCR, just use 0,0 rather than error
7908
+ // BlackBerry 5, iOS 3 (original iPhone)
7909
+ if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
7910
+ box = elem.getBoundingClientRect();
7911
+ }
7912
+ win = getWindow( doc );
7913
+ return {
7914
+ top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
7915
+ left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
7916
+ };
7917
+ };
7918
+ jQuery.offset = {
7919
+ setOffset: function( elem, options, i ) {
7920
+ var position = jQuery.css( elem, "position" );
7921
+ // set position first, in-case top/left are set even on static elem
7922
+ if ( position === "static" ) {
7923
+ elem.style.position = "relative";
7924
+ }
7925
+ var curElem = jQuery( elem ),
7926
+ curOffset = curElem.offset(),
7927
+ curCSSTop = jQuery.css( elem, "top" ),
7928
+ curCSSLeft = jQuery.css( elem, "left" ),
7929
+ calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
7930
+ props = {}, curPosition = {}, curTop, curLeft;
7931
+ // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
7932
+ if ( calculatePosition ) {
7933
+ curPosition = curElem.position();
7934
+ curTop = curPosition.top;
7935
+ curLeft = curPosition.left;
7936
+ } else {
7937
+ curTop = parseFloat( curCSSTop ) || 0;
7938
+ curLeft = parseFloat( curCSSLeft ) || 0;
7939
+ }
7940
+ if ( jQuery.isFunction( options ) ) {
7941
+ options = options.call( elem, i, curOffset );
7942
+ }
7943
+ if ( options.top != null ) {
7944
+ props.top = ( options.top - curOffset.top ) + curTop;
7945
+ }
7946
+ if ( options.left != null ) {
7947
+ props.left = ( options.left - curOffset.left ) + curLeft;
7948
+ }
7949
+ if ( "using" in options ) {
7950
+ options.using.call( elem, props );
7951
+ } else {
7952
+ curElem.css( props );
7953
+ }
7954
+ }
7955
+ };
7956
+ jQuery.fn.extend({
7957
+ position: function() {
7958
+ if ( !this[ 0 ] ) {
7959
+ return;
7960
+ }
7961
+ var offsetParent, offset,
7962
+ parentOffset = { top: 0, left: 0 },
7963
+ elem = this[ 0 ];
7964
+ // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent
7965
+ if ( jQuery.css( elem, "position" ) === "fixed" ) {
7966
+ // we assume that getBoundingClientRect is available when computed position is fixed
7967
+ offset = elem.getBoundingClientRect();
7968
+ } else {
7969
+ // Get *real* offsetParent
7970
+ offsetParent = this.offsetParent();
7971
+ // Get correct offsets
7972
+ offset = this.offset();
7973
+ if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
7974
+ parentOffset = offsetParent.offset();
7975
+ }
7976
+ // Add offsetParent borders
7977
+ parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
7978
+ parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
7979
+ }
7980
+ // Subtract parent offsets and element margins
7981
+ // note: when an element has margin: auto the offsetLeft and marginLeft
7982
+ // are the same in Safari causing offset.left to incorrectly be 0
7983
+ return {
7984
+ top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
7985
+ left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
7986
+ };
7987
+ },
7988
+ offsetParent: function() {
7989
+ return this.map(function() {
7990
+ var offsetParent = this.offsetParent || document.documentElement;
7991
+ while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) {
7992
+ offsetParent = offsetParent.offsetParent;
7993
+ }
7994
+ return offsetParent || document.documentElement;
7995
+ });
7996
+ }
7997
+ });
7998
+ // Create scrollLeft and scrollTop methods
7999
+ jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
8000
+ var top = /Y/.test( prop );
8001
+ jQuery.fn[ method ] = function( val ) {
8002
+ return jQuery.access( this, function( elem, method, val ) {
8003
+ var win = getWindow( elem );
8004
+ if ( val === undefined ) {
8005
+ return win ? (prop in win) ? win[ prop ] :
8006
+ win.document.documentElement[ method ] :
8007
+ elem[ method ];
8008
+ }
8009
+ if ( win ) {
8010
+ win.scrollTo(
8011
+ !top ? val : jQuery( win ).scrollLeft(),
8012
+ top ? val : jQuery( win ).scrollTop()
8013
+ );
8014
+ } else {
8015
+ elem[ method ] = val;
8016
+ }
8017
+ }, method, val, arguments.length, null );
8018
+ };
8019
+ });
8020
+ function getWindow( elem ) {
8021
+ return jQuery.isWindow( elem ) ?
8022
+ elem :
8023
+ elem.nodeType === 9 ?
8024
+ elem.defaultView || elem.parentWindow :
8025
+ false;
8026
+ }
8027
+ // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
8028
+ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
8029
+ jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
8030
+ // margin is only for outerHeight, outerWidth
8031
+ jQuery.fn[ funcName ] = function( margin, value ) {
8032
+ var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
8033
+ extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
8034
+ return jQuery.access( this, function( elem, type, value ) {
8035
+ var doc;
8036
+ if ( jQuery.isWindow( elem ) ) {
8037
+ // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
8038
+ // isn't a whole lot we can do. See pull request at this URL for discussion:
8039
+ // https://github.com/jquery/jquery/pull/764
8040
+ return elem.document.documentElement[ "client" + name ];
8041
+ }
8042
+ // Get document width or height
8043
+ if ( elem.nodeType === 9 ) {
8044
+ doc = elem.documentElement;
8045
+ // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
8046
+ // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
8047
+ return Math.max(
8048
+ elem.body[ "scroll" + name ], doc[ "scroll" + name ],
8049
+ elem.body[ "offset" + name ], doc[ "offset" + name ],
8050
+ doc[ "client" + name ]
8051
+ );
8052
+ }
8053
+ return value === undefined ?
8054
+ // Get width or height on the element, requesting but not forcing parseFloat
8055
+ jQuery.css( elem, type, extra ) :
8056
+ // Set width or height on the element
8057
+ jQuery.style( elem, type, value, extra );
8058
+ }, type, chainable ? margin : undefined, chainable, null );
8059
+ };
8060
+ });
8061
+ });
8062
+ // Limit scope pollution from any deprecated API
8063
+ // (function() {
8064
+ // })();
8065
+ // Expose jQuery to the global object
8066
+ window.jQuery = window.$ = jQuery;
8067
+ // Expose jQuery as an AMD module, but only for AMD loaders that
8068
+ // understand the issues with loading multiple versions of jQuery
8069
+ // in a page that all might call define(). The loader will indicate
8070
+ // they have special allowances for multiple jQuery versions by
8071
+ // specifying define.amd.jQuery = true. Register as a named module,
8072
+ // since jQuery can be concatenated with other files that may use define,
8073
+ // but not use a proper concatenation script that understands anonymous
8074
+ // AMD modules. A named AMD is safest and most robust way to register.
8075
+ // Lowercase jquery is used because AMD module names are derived from
8076
+ // file names, and jQuery is normally delivered in a lowercase file name.
8077
+ // Do this after creating the global so that if an AMD module wants to call
8078
+ // noConflict to hide this version of jQuery, it will work.
8079
+ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
8080
+ define( "jquery", [], function () { return jQuery; } );
8081
+ }
8082
+ })( window );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/media.js ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($){
2
+ var _custom_media = true,
3
+ _orig_send_attachment = wp.media.editor.send.attachment;
4
+
5
+ $('.bsf_upload_button').click(function(e) {
6
+ var send_attachment_bkp = wp.media.editor.send.attachment;
7
+ var button = $(this);
8
+ var id = 'bsf_upload_file'; //button.attr('id').replace('_button', '');
9
+ _custom_media = true;
10
+ wp.media.editor.send.attachment = function(props, attachment){
11
+ if ( _custom_media ) {
12
+ $("."+id).val(attachment.url);
13
+ $(".bsf_media_status").html('<img src="'+ attachment.url +'" />');
14
+ } else {
15
+ return _orig_send_attachment.apply( this, [props, attachment] );
16
+ };
17
+ }
18
+
19
+ wp.media.editor.open(button);
20
+ return false;
21
+ });
22
+
23
+ $('.add_media').on('click', function(){
24
+ _custom_media = false;
25
+ });
26
+ });
js/retina.js CHANGED
@@ -1,3 +1,3 @@
1
- // retina.js, a high-resolution image swapper (http://retinajs.com), v0.0.2
2
-
3
  (function(){function t(e){this.path=e;var t=this.path.split("."),n=t.slice(0,t.length-1).join("."),r=t[t.length-1];this.at_2x_path=n+"@2x."+r}function n(e){this.el=e,this.path=new t(this.el.getAttribute("src"));var n=this;this.path.check_2x_variant(function(e){e&&n.swap()})}var e=typeof exports=="undefined"?window:exports;e.RetinaImagePath=t,t.confirmed_paths=[],t.prototype.is_external=function(){return!!this.path.match(/^https?\:/i)&&!this.path.match("//"+document.domain)},t.prototype.check_2x_variant=function(e){var n,r=this;if(this.is_external())return e(!1);if(this.at_2x_path in t.confirmed_paths)return e(!0);n=new XMLHttpRequest,n.open("HEAD",this.at_2x_path),n.onreadystatechange=function(){return n.readyState!=4?e(!1):n.status>=200&&n.status<=399?(t.confirmed_paths.push(r.at_2x_path),e(!0)):e(!1)},n.send()},e.RetinaImage=n,n.prototype.swap=function(e){function n(){t.el.complete?(t.el.setAttribute("width",t.el.offsetWidth),t.el.setAttribute("height",t.el.offsetHeight),t.el.setAttribute("src",e)):setTimeout(n,5)}typeof e=="undefined"&&(e=this.path.at_2x_path);var t=this;n()},e.devicePixelRatio>1&&(window.onload=function(){var e=document.getElementsByTagName("img"),t=[],r,i;for(r=0;r<e.length;r++)i=e[r],t.push(new n(i))})})();
1
+ // retina.js, a high-resolution image swapper (http://retinajs.com), v0.0.2
2
+
3
  (function(){function t(e){this.path=e;var t=this.path.split("."),n=t.slice(0,t.length-1).join("."),r=t[t.length-1];this.at_2x_path=n+"@2x."+r}function n(e){this.el=e,this.path=new t(this.el.getAttribute("src"));var n=this;this.path.check_2x_variant(function(e){e&&n.swap()})}var e=typeof exports=="undefined"?window:exports;e.RetinaImagePath=t,t.confirmed_paths=[],t.prototype.is_external=function(){return!!this.path.match(/^https?\:/i)&&!this.path.match("//"+document.domain)},t.prototype.check_2x_variant=function(e){var n,r=this;if(this.is_external())return e(!1);if(this.at_2x_path in t.confirmed_paths)return e(!0);n=new XMLHttpRequest,n.open("HEAD",this.at_2x_path),n.onreadystatechange=function(){return n.readyState!=4?e(!1):n.status>=200&&n.status<=399?(t.confirmed_paths.push(r.at_2x_path),e(!0)):e(!1)},n.send()},e.RetinaImage=n,n.prototype.swap=function(e){function n(){t.el.complete?(t.el.setAttribute("width",t.el.offsetWidth),t.el.setAttribute("height",t.el.offsetHeight),t.el.setAttribute("src",e)):setTimeout(n,5)}typeof e=="undefined"&&(e=this.path.at_2x_path);var t=this;n()},e.devicePixelRatio>1&&(window.onload=function(){var e=document.getElementsByTagName("img"),t=[],r,i;for(r=0;r<e.length;r++)i=e[r],t.push(new n(i))})})();
js/toggle.js CHANGED
@@ -1,100 +1,108 @@
1
- jQuery(document).ready(function() {
2
- var selected = jQuery("#_bsf_post_type").val();
3
- if(selected == "0")
4
- hidden();
5
- else
6
- expand_default(selected);
7
- //Function to hide all the snippet blocks
8
- function hidden() {
9
- jQuery(".review").hide();
10
- jQuery(".events").hide();
11
- jQuery(".music").hide();
12
- jQuery(".organization").hide();
13
- jQuery(".people").hide();
14
- jQuery(".product").hide();
15
- jQuery(".recipes").hide();
16
- jQuery(".software").hide();
17
- jQuery(".video").hide();
18
- }
19
- //Function to expand the updated snippet block
20
- function expand_default(selected) {
21
- hidden();
22
- if(selected == '1')
23
- {
24
- jQuery(".review").show(500);
25
- }
26
- else if(selected == '2')
27
- {
28
- jQuery(".events").show(500);
29
- }
30
- else if(selected == '3')
31
- {
32
- jQuery(".music").show(500);
33
- }
34
- else if(selected == '4')
35
- {
36
- jQuery(".organization").show(500);
37
- }
38
- else if(selected == '5')
39
- {
40
- jQuery(".people").show(500);
41
- }
42
- else if(selected == '6')
43
- {
44
- jQuery(".product").show(500);
45
- }
46
- else if(selected == '7')
47
- {
48
- jQuery(".recipes").show(500);
49
- }
50
- else if(selected == '8')
51
- {
52
- jQuery(".software").show(500);
53
- }
54
- else if(selected == '9')
55
- {
56
- jQuery(".video").show(500);
57
- }
58
- }
59
-
60
- jQuery("#_bsf_post_type").change(function() {
61
- hidden();
62
- var type=jQuery(this).val();
63
- if(type == '1')
64
- {
65
- jQuery(".review").show(500);
66
- }
67
- else if(type == '2')
68
- {
69
- jQuery(".events").show(500);
70
- }
71
- else if(type == '3')
72
- {
73
- jQuery(".music").show(500);
74
- }
75
- else if(type == '4')
76
- {
77
- jQuery(".organization").show(500);
78
- }
79
- else if(type == '5')
80
- {
81
- jQuery(".people").show(500);
82
- }
83
- else if(type == '6')
84
- {
85
- jQuery(".product").show(500);
86
- }
87
- else if(type == '7')
88
- {
89
- jQuery(".recipes").show(500);
90
- }
91
- else if(type == '8')
92
- {
93
- jQuery(".software").show(500);
94
- }
95
- else if(type == '9')
96
- {
97
- jQuery(".video").show(500);
98
- }
99
- });
 
 
 
 
 
 
 
 
100
  });
1
+ jQuery(document).ready(function() {
2
+ var selected = jQuery("#_bsf_post_type").val();
3
+ if(selected == "0")
4
+ hidden();
5
+ else
6
+ expand_default(selected);
7
+ //Function to hide all the snippet blocks
8
+ function hidden() {
9
+ jQuery(".review").hide();
10
+ jQuery(".events").hide();
11
+ jQuery(".music").hide();
12
+ jQuery(".organization").hide();
13
+ jQuery(".people").hide();
14
+ jQuery(".product").hide();
15
+ jQuery(".recipes").hide();
16
+ jQuery(".software").hide();
17
+ jQuery(".video").hide();
18
+ jQuery(".article").hide();
19
+ }
20
+ //Function to expand the updated snippet block
21
+ function expand_default(selected) {
22
+ hidden();
23
+ if(selected == '1')
24
+ {
25
+ jQuery(".review").show(500);
26
+ }
27
+ else if(selected == '2')
28
+ {
29
+ jQuery(".events").show(500);
30
+ }
31
+ else if(selected == '3')
32
+ {
33
+ jQuery(".music").show(500);
34
+ }
35
+ else if(selected == '4')
36
+ {
37
+ jQuery(".organization").show(500);
38
+ }
39
+ else if(selected == '5')
40
+ {
41
+ jQuery(".people").show(500);
42
+ }
43
+ else if(selected == '6')
44
+ {
45
+ jQuery(".product").show(500);
46
+ }
47
+ else if(selected == '7')
48
+ {
49
+ jQuery(".recipes").show(500);
50
+ }
51
+ else if(selected == '8')
52
+ {
53
+ jQuery(".software").show(500);
54
+ }
55
+ else if(selected == '9')
56
+ {
57
+ jQuery(".video").show(500);
58
+ }
59
+ else if(selected == '10')
60
+ {
61
+ jQuery(".article").show(500);
62
+ }
63
+ }
64
+ jQuery("#_bsf_post_type").change(function() {
65
+ hidden();
66
+ var type=jQuery(this).val();
67
+ if(type == '1')
68
+ {
69
+ jQuery(".review").show(500);
70
+ }
71
+ else if(type == '2')
72
+ {
73
+ jQuery(".events").show(500);
74
+ }
75
+ else if(type == '3')
76
+ {
77
+ jQuery(".music").show(500);
78
+ }
79
+ else if(type == '4')
80
+ {
81
+ jQuery(".organization").show(500);
82
+ }
83
+ else if(type == '5')
84
+ {
85
+ jQuery(".people").show(500);
86
+ }
87
+ else if(type == '6')
88
+ {
89
+ jQuery(".product").show(500);
90
+ }
91
+ else if(type == '7')
92
+ {
93
+ jQuery(".recipes").show(500);
94
+ }
95
+ else if(type == '8')
96
+ {
97
+ jQuery(".software").show(500);
98
+ }
99
+ else if(type == '9')
100
+ {
101
+ jQuery(".video").show(500);
102
+ }
103
+ else if(type == '10')
104
+ {
105
+ jQuery(".article").show(500);
106
+ }
107
+ });
108
  });
meta-boxes.php CHANGED
@@ -1,577 +1,611 @@
1
- <?php
2
- // Metabox for review
3
- function bsf_metaboxes( array $meta_boxes ) {
4
-
5
- // Start with an underscore to hide fields from custom fields list
6
- $prefix = '_bsf_';
7
- $post_types=get_post_types('','names');
8
-
9
- $meta_boxes[] = array(
10
- 'id' => 'review_metabox',
11
- 'title' => __('Configure Rich Snippet','rich-snippets'),
12
- 'pages' => $post_types, //array( 'post','page' ), // Custom Post types
13
- 'context' => 'normal',
14
- 'priority' => 'high',
15
- 'show_names' => true, // Show field names on the left
16
- 'fields' => array(
17
- array(
18
- 'name' => __('','rich-snippets'),
19
- 'desc' => __('','rich-snippets'),
20
- 'id' => $prefix . 'post_type',
21
- 'class' => 'snippet-type',
22
- 'type' => 'select',
23
- 'options' => array(
24
- array( 'name' => __('Select what this post is about','rich-snippets'), 'value' => '0', ),
25
- array( 'name' => __('Item Review','rich-snippets'), 'value' => '1', ),
26
- array( 'name' => __('Event','rich-snippets'), 'value' => '2', ),
27
- // array( 'name' => __('Music','rich-snippets'), 'value' => '3', ),
28
- // array( 'name' => __('Organization','rich-snippets'), 'value' => '4', ),
29
- array( 'name' => __('People','rich-snippets'), 'value' => '5', ),
30
- array( 'name' => __('Product','rich-snippets'), 'value' => '6', ),
31
- array( 'name' => __('Recipe','rich-snippets'), 'value' => '7', ),
32
- array( 'name' => __('Software Application','rich-snippets'), 'value' => '8', ),
33
- array( 'name' => __('Video','rich-snippets'), 'value' => '9', ),
34
- ),
35
- ),
36
- // Meta Settings for Item Review
37
- array(
38
- 'name' => __('Rich Snippets - Item Review','rich-snippets'),
39
- 'desc' => __('Please provide the following information.','rich-snippets'),
40
- 'id' => $prefix . 'review_title',
41
- 'class' => 'review',
42
- 'type' => 'title',
43
- ),
44
- array(
45
- 'name' => __('Reviewer&rsquo;s Name ','rich-snippets'),
46
- 'desc' => __('Enter the name of Item Reviewer or The Post Author.','rich-snippets'),
47
- 'id' => $prefix . 'item_reviewer',
48
- 'class' => 'review',
49
- 'type' => 'text_medium',
50
- ),
51
- array(
52
- 'name' => __('Item to be reviewed','rich-snippets'),
53
- 'desc' => __('Enter the name of the item, you are writing review about.','rich-snippets'),
54
- 'id' => $prefix . 'item_name',
55
- 'class' => 'review',
56
- 'type' => 'text',
57
- ),
58
- array(
59
- 'name' => __('Your Rating','rich-snippets'),
60
- 'desc' => __('&nbsp;&nbsp;Rate this item (1-5)','rich-snippets'),
61
- 'id' => $prefix . 'rating',
62
- 'class' => 'star review',
63
- 'type' => 'radio',
64
- 'options' => array(
65
- array( 'name' => __('','rich-snippets'), 'value' => '1', ),
66
- array( 'name' => __('','rich-snippets'), 'value' => '2', ),
67
- array( 'name' => __('','rich-snippets'), 'value' => '3', ),
68
- array( 'name' => __('','rich-snippets'), 'value' => '4', ),
69
- array( 'name' => __('','rich-snippets'), 'value' => '5', ),
70
- ),
71
- ),
72
- /* array(
73
- 'name' => __('','rich-snippets'),
74
- 'desc' => __('Enter the item description here','rich-snippets'),
75
- 'id' => $prefix . 'item_desc',
76
- 'class' => 'review',
77
- 'type' => 'textarea_small1',
78
- ),*/
79
- // Meta Settings for Events
80
- array(
81
- 'name' => __('Rich Snippets - Events','rich-snippets'),
82
- 'desc' => __('Please provide the following information.','rich-snippets'),
83
- 'id' => $prefix . 'events',
84
- 'class' => 'events',
85
- 'type' => 'title',
86
- ),
87
- array(
88
- 'name' => __('Event Title ','rich-snippets'),
89
- 'desc' => __('What would be the name of the event?','rich-snippets'),
90
- 'id' => $prefix . 'event_title',
91
- 'class' => 'events',
92
- 'type' => 'text',
93
- ),
94
- array(
95
- 'name' => __('Location ','rich-snippets'),
96
- 'desc' => __('Organization Name Here','rich-snippets'),
97
- 'id' => $prefix . 'event_organization',
98
- 'class' => 'events',
99
- 'type' => 'text_medium',
100
- ),
101
- array(
102
- 'name' => __('','rich-snippets'),
103
- 'desc' => __('Street Address','rich-snippets'),
104
- 'id' => $prefix . 'event_street',
105
- 'class' => 'events',
106
- 'type' => 'text_medium',
107
- ),
108
- array(
109
- 'name' => __('','rich-snippets'),
110
- 'desc' => __('Locality','rich-snippets'),
111
- 'id' => $prefix . 'event_local',
112
- 'class' => 'events',
113
- 'type' => 'text_medium',
114
- ),
115
- array(
116
- 'name' => __('','rich-snippets'),
117
- 'desc' => __('Region','rich-snippets'),
118
- 'id' => $prefix . 'event_region',
119
- 'class' => 'events',
120
- 'type' => 'text_medium',
121
- ),
122
- /* array(
123
- 'name' => __('Description ','rich-snippets'),
124
- 'desc' => __('Describe the event in short.','rich-snippets'),
125
- 'id' => $prefix . 'event_desc',
126
- 'class' => 'events',
127
- 'type' => 'textarea_small',
128
- ),*/
129
- array(
130
- 'name' => __('Start Date ','rich-snippets'),
131
- 'desc' => __('Provide the Event Start Date.','rich-snippets'),
132
- 'id' => $prefix . 'event_start_date',
133
- 'class' => 'events',
134
- 'type' => 'text_date',
135
- ),
136
- array(
137
- 'name' => __('End Date ','rich-snippets'),
138
- 'desc' => __('Provide the Event End Date.','rich-snippets'),
139
- 'id' => $prefix . 'event_end_date',
140
- 'class' => 'events',
141
- 'type' => 'text_date',
142
- ),
143
- array(
144
- 'name' => __('GEO Location ','rich-snippets'),
145
- 'desc' => __('Enter Latitude. <a href="http://universimmedia.pagesperso-orange.fr/geo/loc.htm" target="_blank">Find Here.</a>','rich-snippets'),
146
- 'id' => $prefix . 'event_geo_latitude',
147
- 'class' => 'events',
148
- 'type' => 'text_medium',
149
- ),
150
- array(
151
- 'name' => __('','rich-snippets'),
152
- 'desc' => __('Enter Longitude','rich-snippets'),
153
- 'id' => $prefix . 'event_geo_longitude',
154
- 'class' => 'events',
155
- 'type' => 'text_medium',
156
- ),
157
- array(
158
- 'name' => __('Event Photo ','rich-snippets'),
159
- 'desc' => __('Upload or Select from media gallery. Medium size is recommended (300px X 300px)','rich-snippets'),
160
- 'id' => $prefix . 'event_photo',
161
- 'class' => 'events',
162
- 'type' => 'file',
163
- ),
164
- // Meta Settings for Music
165
- array(
166
- 'name' => __('Rich Snippets - Music','rich-snippets'),
167
- 'desc' => __('Please provide the following information.','rich-snippets'),
168
- 'id' => $prefix . 'music',
169
- 'class' => 'music',
170
- 'type' => 'title',
171
- ),
172
- // Meta Settings for Organization
173
- array(
174
- 'name' => __('Rich Snippets - Organization','rich-snippets'),
175
- 'desc' => __('Please provide the following information.','rich-snippets'),
176
- 'id' => $prefix . 'organization',
177
- 'class' => 'organization',
178
- 'type' => 'title',
179
- ),
180
- array(
181
- 'name' => __('Organization Name ','rich-snippets'),
182
- 'desc' => __('Enter the Company or Organization Name.','rich-snippets'),
183
- 'id' => $prefix . 'organization_name',
184
- 'class' => 'organization',
185
- 'type' => 'text',
186
- ),
187
- array(
188
- 'name' => __('Website URL ','rich-snippets'),
189
- 'desc' => __('Enter the Organization homepage url.','rich-snippets'),
190
- 'id' => $prefix . 'organization_url',
191
- 'class' => 'organization',
192
- 'type' => 'text_medium',
193
- ),
194
- array(
195
- 'name' => __('Contact No. ','rich-snippets'),
196
- 'desc' => __('Enter the Telephone No.','rich-snippets'),
197
- 'id' => $prefix . 'organization_tel',
198
- 'class' => 'organization',
199
- 'type' => 'text_medium',
200
- ),
201
- array(
202
- 'name' => __('Address ','rich-snippets'),
203
- 'desc' => __('Street Name.','rich-snippets'),
204
- 'id' => $prefix . 'organization_street',
205
- 'class' => 'organization',
206
- 'type' => 'text_medium',
207
- ),
208
- array(
209
- 'name' => __('','rich-snippets'),
210
- 'desc' => __('Locality.','rich-snippets'),
211
- 'id' => $prefix . 'organization_local',
212
- 'class' => 'organization',
213
- 'type' => 'text_medium',
214
- ),
215
- array(
216
- 'name' => __('','rich-snippets'),
217
- 'desc' => __('Region.','rich-snippets'),
218
- 'id' => $prefix . 'organization_region',
219
- 'class' => 'organization',
220
- 'type' => 'text_medium',
221
- ),
222
- array(
223
- 'name' => __('','rich-snippets'),
224
- 'desc' => __('Postal Code','rich-snippets'),
225
- 'id' => $prefix . 'organization_zip',
226
- 'class' => 'organization',
227
- 'type' => 'text_medium',
228
- ),
229
- array(
230
- 'name' => __('','rich-snippets'),
231
- 'desc' => __('Country Name','rich-snippets'),
232
- 'id' => $prefix . 'organization_country',
233
- 'class' => 'organization',
234
- 'type' => 'text_medium',
235
- ),
236
- array(
237
- 'name' => __('GEO Location','rich-snippets'),
238
- 'desc' => __('Latitude. <a href="http://universimmedia.pagesperso-orange.fr/geo/loc.htm" target="_blank">Find Here.</a>','rich-snippets'),
239
- 'id' => $prefix . 'organization_latitide',
240
- 'class' => 'organization',
241
- 'type' => 'text_medium',
242
- ),
243
- array(
244
- 'name' => __('','rich-snippets'),
245
- 'desc' => __('Longitude.','rich-snippets'),
246
- 'id' => $prefix . 'organization_longitude',
247
- 'class' => 'organization',
248
- 'type' => 'text_medium',
249
- ),
250
- // Meta Settings for People
251
- array(
252
- 'name' => __('Rich Snippets - People','rich-snippets'),
253
- 'desc' => __('Please provide the following information.','rich-snippets'),
254
- 'id' => $prefix . 'people',
255
- 'class' => 'people',
256
- 'type' => 'title',
257
- ),
258
- array(
259
- 'name' => __('Person&lsquo;s Name','rich-snippets'),
260
- 'desc' => __('Enter the relative person&lsquo;s name.','rich-snippets'),
261
- 'id' => $prefix . 'people_fn',
262
- 'class' => 'people',
263
- 'type' => 'text_medium',
264
- ),
265
- array(
266
- 'name' => __('Nickname','rich-snippets'),
267
- 'desc' => __('Enter the nickname (if any).','rich-snippets'),
268
- 'id' => $prefix . 'people_nickname',
269
- 'class' => 'people',
270
- 'type' => 'text_medium',
271
- ),
272
- array(
273
- 'name' => __('Photograph','rich-snippets'),
274
- 'desc' => __('Upload the photo or select from media library. Medium size is recommended (300px X 300px)','rich-snippets'),
275
- 'id' => $prefix . 'people_photo',
276
- 'class' => 'people',
277
- 'type' => 'file',
278
- ),
279
- array(
280
- 'name' => __('Job Title ','rich-snippets'),
281
- 'desc' => __('Enter job title.','rich-snippets'),
282
- 'id' => $prefix . 'people_job_title',
283
- 'class' => 'people',
284
- 'type' => 'text_medium',
285
- ),
286
- array(
287
- 'name' => __('Homepage URL','rich-snippets'),
288
- 'desc' => __('Enter homepage URL(if any).','rich-snippets'),
289
- 'id' => $prefix . 'people_website',
290
- 'class' => 'people',
291
- 'type' => 'text_medium',
292
- ),
293
- array(
294
- 'name' => __('Company / Organization','rich-snippets'),
295
- 'desc' => __('Enter Company or Organization name in affiliation.','rich-snippets'),
296
- 'id' => $prefix . 'people_company',
297
- 'class' => 'people',
298
- 'type' => 'text_medium',
299
- ),
300
- array(
301
- 'name' => __('Address','rich-snippets'),
302
- 'desc' => __('Enter Locality','rich-snippets'),
303
- 'id' => $prefix . 'people_local',
304
- 'class' => 'people',
305
- 'type' => 'text_medium',
306
- ),
307
- array(
308
- 'name' => __('','rich-snippets'),
309
- 'desc' => __('Region','rich-snippets'),
310
- 'id' => $prefix . 'people_region',
311
- 'class' => 'people',
312
- 'type' => 'text_medium',
313
- ),
314
- // Meta Settings for Products
315
- array(
316
- 'name' => __('Rich Snippets - Products','rich-snippets'),
317
- 'desc' => __('Please provide the following information.','rich-snippets'),
318
- 'id' => $prefix . 'product',
319
- 'class' => 'product',
320
- 'type' => 'title',
321
- ),
322
- array(
323
- 'name' => __('Your Rating','rich-snippets'),
324
- 'desc' => __('Rate this product or aggregate rating.','rich-snippets'),
325
- 'id' => $prefix . 'product_rating',
326
- 'class' => 'star product',
327
- 'type' => 'radio',
328
- 'options' => array(
329
- array( 'name' => __('','rich-snippets'), 'value' => '1', ),
330
- array( 'name' => __('','rich-snippets'), 'value' => '2', ),
331
- array( 'name' => __('','rich-snippets'), 'value' => '3', ),
332
- array( 'name' => __('','rich-snippets'), 'value' => '4', ),
333
- array( 'name' => __('','rich-snippets'), 'value' => '5', ),
334
- ),
335
- ),
336
- array(
337
- 'name' => __('Brand Name','rich-snippets'),
338
- 'desc' => __('Enter the products brand name','rich-snippets'),
339
- 'id' => $prefix . 'product_brand',
340
- 'class' => 'product',
341
- 'type' => 'text_medium',
342
- ),
343
- array(
344
- 'name' => __('Product Name','rich-snippets'),
345
- 'desc' => __('Enter the product name.','rich-snippets'),
346
- 'id' => $prefix . 'product_name',
347
- 'class' => 'product',
348
- 'type' => 'text_medium',
349
- ),
350
- array(
351
- 'name' => __('Product Image','rich-snippets'),
352
- 'desc' => __('Upload the product image or select from library. Medium size is recommended (300px X 300px)','rich-snippets'),
353
- 'id' => $prefix . 'product_image',
354
- 'class' => 'product',
355
- 'type' => 'file',
356
- ),
357
- /* array(
358
- 'name' => __('Product Category','rich-snippets'),
359
- 'desc' => __('Select the product category.','rich-snippets'),
360
- 'id' => $prefix . 'product_cat',
361
- 'class' => 'product',
362
- 'type' => 'text_medium',
363
- ),*/
364
- array(
365
- 'name' => __('Product Price','rich-snippets'),
366
- 'desc' => __('Enter the product Price.','rich-snippets'),
367
- 'id' => $prefix . 'product_price',
368
- 'class' => 'product',
369
- 'type' => 'text_small',
370
- ),
371
- array(
372
- 'name' => __('Currency ','rich-snippets'),
373
- 'desc' => __('Enter the Currency Code(e.g USD, INR, AUD, EUR, GBP). <a href="http://www.science.co.il/International/Currency-Codes.asp" target="_blank"> Know you currency code</a>','rich-snippets'),
374
- 'id' => $prefix . 'product_cur',
375
- 'class' => 'product',
376
- 'type' => 'text_small',
377
- ),
378
- array(
379
- 'name' => __('Availability','rich-snippets'),
380
- 'desc' => __('Select the products availability.','rich-snippets'),
381
- 'id' => $prefix . 'product_status',
382
- 'class' => 'product',
383
- 'type' => 'select',
384
- 'options' => array(
385
- array('name' => __('__ Please Select __','rich-snippets'), 'value' => ''),
386
- array('name' => __('Out of Stock','rich-snippets'), 'value' => 'out_of_stock'),
387
- array('name' => __('In Stock','rich-snippets'), 'value' => 'in_stock'),
388
- array('name' => __('In Store Only','rich-snippets'), 'value' => 'instore_only'),
389
- array('name' => __('Pre-Order','rich-snippets'), 'value' => 'preorder'),
390
- ),
391
- ),
392
- // Meta Settings for Recipes
393
- array(
394
- 'name' => __('Rich Snippets - Recipes','rich-snippets'),
395
- 'desc' => __('Please provide the following information.','rich-snippets'),
396
- 'id' => $prefix . 'recipes',
397
- 'class' => 'recipes',
398
- 'type' => 'title',
399
- ),
400
- array(
401
- 'name' => __('Recipe Name ','rich-snippets'),
402
- 'desc' => __('Enter the recipe name.','rich-snippets'),
403
- 'id' => $prefix . 'recipes_name',
404
- 'class' => 'recipes',
405
- 'type' => 'text_medium',
406
- ),
407
- array(
408
- 'name' => __('Time Required ','rich-snippets'),
409
- 'desc' => __('Preperation time (Format: 1H30M. H - Hours, M - Minutes )','rich-snippets'),
410
- 'id' => $prefix . 'recipes_preptime',
411
- 'class' => 'recipes',
412
- 'type' => 'text_small',
413
- ),
414
- array(
415
- 'name' => __('','rich-snippets'),
416
- 'desc' => __('Cook Time. (Format: 1H30M. H - Hours, M - Minutes )','rich-snippets'),
417
- 'id' => $prefix . 'recipes_cooktime',
418
- 'class' => 'recipes',
419
- 'type' => 'text_small',
420
- ),
421
- array(
422
- 'name' => __('','rich-snippets'),
423
- 'desc' => __('Total Time (Format: 1H30M. H - Hours, M - Minutes )','rich-snippets'),
424
- 'id' => $prefix . 'recipes_totaltime',
425
- 'class' => 'recipes',
426
- 'type' => 'text_small',
427
- ),
428
- array(
429
- 'name' => __('Recipe Photo','rich-snippets'),
430
- 'desc' => __('Upload or Select recipe photo. Medium size is recommended (300px X 300px)','rich-snippets'),
431
- 'id' => $prefix . 'recipes_photo',
432
- 'class' => 'recipes',
433
- 'type' => 'file',
434
- ),
435
- /* array(
436
- 'name' => __('','rich-snippets'),
437
- 'desc' => __('Enter the ingredients used','rich-snippets'),
438
- 'id' => $prefix . 'recipes_ingredient',
439
- 'class' => 'recipes',
440
- 'type' => 'textarea_small1',
441
- ),
442
- array(
443
- 'name' => __('','rich-snippets'),
444
- 'desc' => __('Describe the recipe in short.','rich-snippets'),
445
- 'id' => $prefix . 'recipes_desc',
446
- 'class' => 'recipes',
447
- 'type' => 'textarea_small1',
448
- ),*/
449
- // Meta Settings for Software Application
450
- array(
451
- 'name' => __('Rich Snippets - Software Application','rich-snippets'),
452
- 'desc' => __('Please provide the following information.','rich-snippets'),
453
- 'id' => $prefix . 'software',
454
- 'class' => 'software',
455
- 'type' => 'title',
456
- ),
457
- array(
458
- 'name' => __('Software Rating','rich-snippets'),
459
- 'desc' => __('Rate this software.','rich-snippets'),
460
- 'id' => $prefix . 'software_rating',
461
- 'class' => 'star software',
462
- 'type' => 'radio',
463
- 'options' => array(
464
- array( 'name' => __('','rich-snippets'), 'value' => '1', ),
465
- array( 'name' => __('','rich-snippets'), 'value' => '2', ),
466
- array( 'name' => __('','rich-snippets'), 'value' => '3', ),
467
- array( 'name' => __('','rich-snippets'), 'value' => '4', ),
468
- array( 'name' => __('','rich-snippets'), 'value' => '5', ),
469
- ),
470
- ),
471
- array(
472
- 'name' => __('Price','rich-snippets'),
473
- 'desc' => __('Enter the Price of Software','rich-snippets'),
474
- 'id' => $prefix . 'software_price',
475
- 'class' => 'software',
476
- 'type' => 'text_small',
477
- ),
478
- array(
479
- 'name' => __('Currency','rich-snippets'),
480
- 'desc' => __('Enter the Currency Code(e.g USD, INR, AUD, EUR, GBP). <a href="http://www.science.co.il/International/Currency-Codes.asp" target="_blank"> Know you currency code</a>','rich-snippets'),
481
- 'id' => $prefix . 'software_cur',
482
- 'class'=> 'software',
483
- 'type' => 'text_small',
484
- ),
485
- array(
486
- 'name' => __('Software Name ','rich-snippets'),
487
- 'desc' => __('Enter the Software Name.','rich-snippets'),
488
- 'id' => $prefix . 'software_name',
489
- 'class' => 'software',
490
- 'type' => 'text_medium',
491
- ),
492
- array(
493
- 'name' => __('Operating System','rich-snippets'),
494
- 'desc' => __('Enter the software Operating System.','rich-snippets'),
495
- 'id' => $prefix . 'software_os',
496
- 'class' => 'software',
497
- 'type' => 'text_medium',
498
- ),
499
- array(
500
- 'name' => __('Software Image','rich-snippets'),
501
- 'desc' => __('Upload or select image of software. Medium size is recommended (300px X 300px)','rich-snippets'),
502
- 'id' => $prefix . 'software_image',
503
- 'class' => 'software',
504
- 'type' => 'file',
505
- ),
506
- array(
507
- 'name' => __('Landing Page','rich-snippets'),
508
- 'desc' => __('Enter the landing page url for software','rich-snippets'),
509
- 'id' => $prefix . 'software_landing',
510
- 'class' => 'software',
511
- 'type' => 'text',
512
- ),
513
- /*array(
514
- 'name' => __('Software Description','rich-snippets'),
515
- 'desc' => __('Enter the software description.','rich-snippets'),
516
- 'id' => $prefix . 'software_desc',
517
- 'class' => 'software',
518
- 'type' => 'textarea_small',
519
- ),*/
520
- // Meta Settings for Video
521
- array(
522
- 'name' => __('Rich Snippets - Videos','rich-snippets'),
523
- 'desc' => __('Please provide the following information.','rich-snippets'),
524
- 'id' => $prefix . 'video',
525
- 'class' => 'video',
526
- 'type' => 'title',
527
- ),
528
- array(
529
- 'name' => __('Video Title','rich-snippets'),
530
- 'desc' => __('Enter the title for this video','rich-snippets'),
531
- 'id' => $prefix . 'video_title',
532
- 'class' => 'video',
533
- 'type' => 'text',
534
- ),
535
- array(
536
- 'name' => __('Video Description','rich-snippets'),
537
- 'desc' => __('Enter the brief description for this video','rich-snippets'),
538
- 'id' => $prefix . 'video_desc',
539
- 'class' => 'video',
540
- 'type' => 'textarea_small',
541
- ),
542
- array(
543
- 'name' => __('Video Thumbnail','rich-snippets'),
544
- 'desc' => __('Upload or select video thumbnail from gallery. Medium size is recommended (300px X 300px)','rich-snippets'),
545
- 'id' => $prefix . 'video_thumb',
546
- 'class' => 'video',
547
- 'type' => 'file',
548
- ),
549
- array(
550
- 'name' => __('Video','rich-snippets'),
551
- 'desc' => __('Upload Video or enter the video file url','rich-snippets'),
552
- 'id' => $prefix . 'video_url',
553
- 'class' => 'video',
554
- 'type' => 'file',
555
- ),
556
- array(
557
- 'name' => __('Video Duration','rich-snippets'),
558
- 'desc' => __('Enter the duration for this video','rich-snippets'),
559
- 'id' => $prefix . 'video_duration',
560
- 'class' => 'video',
561
- 'type' => 'text_small',
562
- ),
563
- array(
564
- 'name' => __('Upload Date','rich-snippets'),
565
- 'desc' => __('Provide the date when the video is uploaded','rich-snippets'),
566
- 'id' => $prefix . 'video_date',
567
- 'class' => 'video',
568
- 'type' => 'text_date',
569
- ),
570
- ),
571
- );
572
-
573
- // Add other metaboxes as needed
574
-
575
- return $meta_boxes;
576
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
577
  ?>
1
+ <?php
2
+ // Metabox for review
3
+ function bsf_metaboxes( array $meta_boxes ) {
4
+ // Start with an underscore to hide fields from custom fields list
5
+ $prefix = '_bsf_';
6
+ $post_types=get_post_types('','names');
7
+
8
+ $meta_boxes[] = array(
9
+ 'id' => 'review_metabox',
10
+ 'title' => __('Configure Rich Snippet','rich-snippets'),
11
+ 'pages' => $post_types, //array( 'post','page' ), // Custom Post types
12
+ 'context' => 'normal',
13
+ 'priority' => 'high',
14
+ 'show_names' => true, // Show field names on the left
15
+ 'fields' => array(
16
+ array(
17
+ 'name' => __('','rich-snippets'),
18
+ 'desc' => __('','rich-snippets'),
19
+ 'id' => $prefix . 'post_type',
20
+ 'class' => 'snippet-type',
21
+ 'type' => 'select',
22
+ 'options' => array(
23
+ array( 'name' => __('Select what this post is about','rich-snippets'), 'value' => '0', ),
24
+ array( 'name' => __('Item Review','rich-snippets'), 'value' => '1', ),
25
+ array( 'name' => __('Event','rich-snippets'), 'value' => '2', ),
26
+ // array( 'name' => __('Music','rich-snippets'), 'value' => '3', ),
27
+ // array( 'name' => __('Organization','rich-snippets'), 'value' => '4', ),
28
+ array( 'name' => __('People','rich-snippets'), 'value' => '5', ),
29
+ array( 'name' => __('Product','rich-snippets'), 'value' => '6', ),
30
+ array( 'name' => __('Recipe','rich-snippets'), 'value' => '7', ),
31
+ array( 'name' => __('Software Application','rich-snippets'), 'value' => '8', ),
32
+ array( 'name' => __('Video','rich-snippets'), 'value' => '9', ),
33
+ array( 'name' => __('Article','rich-snippets'), 'value' => '10', ),
34
+ ),
35
+ ),
36
+ // Meta Settings for Item Review
37
+ array(
38
+ 'name' => __('Rich Snippets - Item Review','rich-snippets'),
39
+ 'desc' => __('Please provide the following information.','rich-snippets'),
40
+ 'id' => $prefix . 'review_title',
41
+ 'class' => 'review',
42
+ 'type' => 'title',
43
+ ),
44
+ array(
45
+ 'name' => __('Reviewer&rsquo;s Name ','rich-snippets'),
46
+ 'desc' => __('Enter the name of Item Reviewer or The Post Author.','rich-snippets'),
47
+ 'id' => $prefix . 'item_reviewer',
48
+ 'class' => 'review',
49
+ 'type' => 'text_medium',
50
+ ),
51
+ array(
52
+ 'name' => __('Item to be reviewed','rich-snippets'),
53
+ 'desc' => __('Enter the name of the item, you are writing review about.','rich-snippets'),
54
+ 'id' => $prefix . 'item_name',
55
+ 'class' => 'review',
56
+ 'type' => 'text',
57
+ ),
58
+ array(
59
+ 'name' => __('Your Rating','rich-snippets'),
60
+ 'desc' => __('&nbsp;&nbsp;Rate this item (1-5)','rich-snippets'),
61
+ 'id' => $prefix . 'rating',
62
+ 'class' => 'star review',
63
+ 'type' => 'radio',
64
+ 'options' => array(
65
+ array( 'name' => __('','rich-snippets'), 'value' => '1', ),
66
+ array( 'name' => __('','rich-snippets'), 'value' => '2', ),
67
+ array( 'name' => __('','rich-snippets'), 'value' => '3', ),
68
+ array( 'name' => __('','rich-snippets'), 'value' => '4', ),
69
+ array( 'name' => __('','rich-snippets'), 'value' => '5', ),
70
+ ),
71
+ ),
72
+ /* array(
73
+ 'name' => __('','rich-snippets'),
74
+ 'desc' => __('Enter the item description here','rich-snippets'),
75
+ 'id' => $prefix . 'item_desc',
76
+ 'class' => 'review',
77
+ 'type' => 'textarea_small1',
78
+ ),*/
79
+ // Meta Settings for Events
80
+ array(
81
+ 'name' => __('Rich Snippets - Events','rich-snippets'),
82
+ 'desc' => __('Please provide the following information.','rich-snippets'),
83
+ 'id' => $prefix . 'events',
84
+ 'class' => 'events',
85
+ 'type' => 'title',
86
+ ),
87
+ array(
88
+ 'name' => __('Event Title ','rich-snippets'),
89
+ 'desc' => __('What would be the name of the event?','rich-snippets'),
90
+ 'id' => $prefix . 'event_title',
91
+ 'class' => 'events',
92
+ 'type' => 'text',
93
+ ),
94
+ array(
95
+ 'name' => __('Location ','rich-snippets'),
96
+ 'desc' => __('Organization Name Here','rich-snippets'),
97
+ 'id' => $prefix . 'event_organization',
98
+ 'class' => 'events',
99
+ 'type' => 'text_medium',
100
+ ),
101
+ array(
102
+ 'name' => __('','rich-snippets'),
103
+ 'desc' => __('Street Address','rich-snippets'),
104
+ 'id' => $prefix . 'event_street',
105
+ 'class' => 'events',
106
+ 'type' => 'text_medium',
107
+ ),
108
+ array(
109
+ 'name' => __('','rich-snippets'),
110
+ 'desc' => __('Locality','rich-snippets'),
111
+ 'id' => $prefix . 'event_local',
112
+ 'class' => 'events',
113
+ 'type' => 'text_medium',
114
+ ),
115
+ array(
116
+ 'name' => __('','rich-snippets'),
117
+ 'desc' => __('Region','rich-snippets'),
118
+ 'id' => $prefix . 'event_region',
119
+ 'class' => 'events',
120
+ 'type' => 'text_medium',
121
+ ),
122
+ /* array(
123
+ 'name' => __('Description ','rich-snippets'),
124
+ 'desc' => __('Describe the event in short.','rich-snippets'),
125
+ 'id' => $prefix . 'event_desc',
126
+ 'class' => 'events',
127
+ 'type' => 'textarea_small',
128
+ ),*/
129
+ array(
130
+ 'name' => __('Start Date ','rich-snippets'),
131
+ 'desc' => __('Provide the Event Start Date.','rich-snippets'),
132
+ 'id' => $prefix . 'event_start_date',
133
+ 'class' => 'events',
134
+ 'type' => 'text_date',
135
+ ),
136
+ array(
137
+ 'name' => __('End Date ','rich-snippets'),
138
+ 'desc' => __('Provide the Event End Date.','rich-snippets'),
139
+ 'id' => $prefix . 'event_end_date',
140
+ 'class' => 'events',
141
+ 'type' => 'text_date',
142
+ ),
143
+ array(
144
+ 'name' => __('GEO Location ','rich-snippets'),
145
+ 'desc' => __('Enter Latitude. <a href="http://universimmedia.pagesperso-orange.fr/geo/loc.htm" target="_blank">Find Here.</a>','rich-snippets'),
146
+ 'id' => $prefix . 'event_geo_latitude',
147
+ 'class' => 'events',
148
+ 'type' => 'text_medium',
149
+ ),
150
+ array(
151
+ 'name' => __('','rich-snippets'),
152
+ 'desc' => __('Enter Longitude','rich-snippets'),
153
+ 'id' => $prefix . 'event_geo_longitude',
154
+ 'class' => 'events',
155
+ 'type' => 'text_medium',
156
+ ),
157
+ array(
158
+ 'name' => __('Event Photo ','rich-snippets'),
159
+ 'desc' => __('Upload or Select from media gallery. Medium size is recommended (300px X 300px)','rich-snippets'),
160
+ 'id' => $prefix . 'event_photo',
161
+ 'class' => 'events',
162
+ 'type' => 'file',
163
+ ),
164
+ // Meta Settings for Music
165
+ array(
166
+ 'name' => __('Rich Snippets - Music','rich-snippets'),
167
+ 'desc' => __('Please provide the following information.','rich-snippets'),
168
+ 'id' => $prefix . 'music',
169
+ 'class' => 'music',
170
+ 'type' => 'title',
171
+ ),
172
+ // Meta Settings for Organization
173
+ array(
174
+ 'name' => __('Rich Snippets - Organization','rich-snippets'),
175
+ 'desc' => __('Please provide the following information.','rich-snippets'),
176
+ 'id' => $prefix . 'organization',
177
+ 'class' => 'organization',
178
+ 'type' => 'title',
179
+ ),
180
+ array(
181
+ 'name' => __('Organization Name ','rich-snippets'),
182
+ 'desc' => __('Enter the Company or Organization Name.','rich-snippets'),
183
+ 'id' => $prefix . 'organization_name',
184
+ 'class' => 'organization',
185
+ 'type' => 'text',
186
+ ),
187
+ array(
188
+ 'name' => __('Website URL ','rich-snippets'),
189
+ 'desc' => __('Enter the Organization homepage url.','rich-snippets'),
190
+ 'id' => $prefix . 'organization_url',
191
+ 'class' => 'organization',
192
+ 'type' => 'text_medium',
193
+ ),
194
+ array(
195
+ 'name' => __('Contact No. ','rich-snippets'),
196
+ 'desc' => __('Enter the Telephone No.','rich-snippets'),
197
+ 'id' => $prefix . 'organization_tel',
198
+ 'class' => 'organization',
199
+ 'type' => 'text_medium',
200
+ ),
201
+ array(
202
+ 'name' => __('Address ','rich-snippets'),
203
+ 'desc' => __('Street Name.','rich-snippets'),
204
+ 'id' => $prefix . 'organization_street',
205
+ 'class' => 'organization',
206
+ 'type' => 'text_medium',
207
+ ),
208
+ array(
209
+ 'name' => __('','rich-snippets'),
210
+ 'desc' => __('Locality.','rich-snippets'),
211
+ 'id' => $prefix . 'organization_local',
212
+ 'class' => 'organization',
213
+ 'type' => 'text_medium',
214
+ ),
215
+ array(
216
+ 'name' => __('','rich-snippets'),
217
+ 'desc' => __('Region.','rich-snippets'),
218
+ 'id' => $prefix . 'organization_region',
219
+ 'class' => 'organization',
220
+ 'type' => 'text_medium',
221
+ ),
222
+ array(
223
+ 'name' => __('','rich-snippets'),
224
+ 'desc' => __('Postal Code','rich-snippets'),
225
+ 'id' => $prefix . 'organization_zip',
226
+ 'class' => 'organization',
227
+ 'type' => 'text_medium',
228
+ ),
229
+ array(
230
+ 'name' => __('','rich-snippets'),
231
+ 'desc' => __('Country Name','rich-snippets'),
232
+ 'id' => $prefix . 'organization_country',
233
+ 'class' => 'organization',
234
+ 'type' => 'text_medium',
235
+ ),
236
+ array(
237
+ 'name' => __('GEO Location','rich-snippets'),
238
+ 'desc' => __('Latitude. <a href="http://universimmedia.pagesperso-orange.fr/geo/loc.htm" target="_blank">Find Here.</a>','rich-snippets'),
239
+ 'id' => $prefix . 'organization_latitide',
240
+ 'class' => 'organization',
241
+ 'type' => 'text_medium',
242
+ ),
243
+ array(
244
+ 'name' => __('','rich-snippets'),
245
+ 'desc' => __('Longitude.','rich-snippets'),
246
+ 'id' => $prefix . 'organization_longitude',
247
+ 'class' => 'organization',
248
+ 'type' => 'text_medium',
249
+ ),
250
+ // Meta Settings for People
251
+ array(
252
+ 'name' => __('Rich Snippets - People','rich-snippets'),
253
+ 'desc' => __('Please provide the following information.','rich-snippets'),
254
+ 'id' => $prefix . 'people',
255
+ 'class' => 'people',
256
+ 'type' => 'title',
257
+ ),
258
+ array(
259
+ 'name' => __('Person&lsquo;s Name','rich-snippets'),
260
+ 'desc' => __('Enter the relative person&lsquo;s name.','rich-snippets'),
261
+ 'id' => $prefix . 'people_fn',
262
+ 'class' => 'people',
263
+ 'type' => 'text_medium',
264
+ ),
265
+ array(
266
+ 'name' => __('Nickname','rich-snippets'),
267
+ 'desc' => __('Enter the nickname (if any).','rich-snippets'),
268
+ 'id' => $prefix . 'people_nickname',
269
+ 'class' => 'people',
270
+ 'type' => 'text_medium',
271
+ ),
272
+ array(
273
+ 'name' => __('Photograph','rich-snippets'),
274
+ 'desc' => __('Upload the photo or select from media library. Medium size is recommended (300px X 300px)','rich-snippets'),
275
+ 'id' => $prefix . 'people_photo',
276
+ 'class' => 'people',
277
+ 'type' => 'file',
278
+ ),
279
+ array(
280
+ 'name' => __('Job Title ','rich-snippets'),
281
+ 'desc' => __('Enter job title.','rich-snippets'),
282
+ 'id' => $prefix . 'people_job_title',
283
+ 'class' => 'people',
284
+ 'type' => 'text_medium',
285
+ ),
286
+ array(
287
+ 'name' => __('Homepage URL','rich-snippets'),
288
+ 'desc' => __('Enter homepage URL(if any).','rich-snippets'),
289
+ 'id' => $prefix . 'people_website',
290
+ 'class' => 'people',
291
+ 'type' => 'text_medium',
292
+ ),
293
+ array(
294
+ 'name' => __('Company / Organization','rich-snippets'),
295
+ 'desc' => __('Enter Company or Organization name in affiliation.','rich-snippets'),
296
+ 'id' => $prefix . 'people_company',
297
+ 'class' => 'people',
298
+ 'type' => 'text_medium',
299
+ ),
300
+ array(
301
+ 'name' => __('Address','rich-snippets'),
302
+ 'desc' => __('Enter Locality','rich-snippets'),
303
+ 'id' => $prefix . 'people_local',
304
+ 'class' => 'people',
305
+ 'type' => 'text_medium',
306
+ ),
307
+ array(
308
+ 'name' => __('','rich-snippets'),
309
+ 'desc' => __('Region','rich-snippets'),
310
+ 'id' => $prefix . 'people_region',
311
+ 'class' => 'people',
312
+ 'type' => 'text_medium',
313
+ ),
314
+ // Meta Settings for Products
315
+ array(
316
+ 'name' => __('Rich Snippets - Products','rich-snippets'),
317
+ 'desc' => __('Please provide the following information.','rich-snippets'),
318
+ 'id' => $prefix . 'product',
319
+ 'class' => 'product',
320
+ 'type' => 'title',
321
+ ),
322
+ array(
323
+ 'name' => __('Your Rating','rich-snippets'),
324
+ 'desc' => __('Rate this product or aggregate rating.','rich-snippets'),
325
+ 'id' => $prefix . 'product_rating',
326
+ 'class' => 'star product',
327
+ 'type' => 'radio',
328
+ 'options' => array(
329
+ array( 'name' => __('','rich-snippets'), 'value' => '1', ),
330
+ array( 'name' => __('','rich-snippets'), 'value' => '2', ),
331
+ array( 'name' => __('','rich-snippets'), 'value' => '3', ),
332
+ array( 'name' => __('','rich-snippets'), 'value' => '4', ),
333
+ array( 'name' => __('','rich-snippets'), 'value' => '5', ),
334
+ ),
335
+ ),
336
+ array(
337
+ 'name' => __('Brand Name','rich-snippets'),
338
+ 'desc' => __('Enter the products brand name','rich-snippets'),
339
+ 'id' => $prefix . 'product_brand',
340
+ 'class' => 'product',
341
+ 'type' => 'text_medium',
342
+ ),
343
+ array(
344
+ 'name' => __('Product Name','rich-snippets'),
345
+ 'desc' => __('Enter the product name.','rich-snippets'),
346
+ 'id' => $prefix . 'product_name',
347
+ 'class' => 'product',
348
+ 'type' => 'text_medium',
349
+ ),
350
+ array(
351
+ 'name' => __('Product Image','rich-snippets'),
352
+ 'desc' => __('Upload the product image or select from library. Medium size is recommended (300px X 300px)','rich-snippets'),
353
+ 'id' => $prefix . 'product_image',
354
+ 'class' => 'product',
355
+ 'type' => 'file',
356
+ ),
357
+ /* array(
358
+ 'name' => __('Product Category','rich-snippets'),
359
+ 'desc' => __('Select the product category.','rich-snippets'),
360
+ 'id' => $prefix . 'product_cat',
361
+ 'class' => 'product',
362
+ 'type' => 'text_medium',
363
+ ),*/
364
+ array(
365
+ 'name' => __('Product Price','rich-snippets'),
366
+ 'desc' => __('Enter the product Price.','rich-snippets'),
367
+ 'id' => $prefix . 'product_price',
368
+ 'class' => 'product',
369
+ 'type' => 'text_small',
370
+ ),
371
+ array(
372
+ 'name' => __('Currency ','rich-snippets'),
373
+ 'desc' => __('Enter the Currency Code(e.g USD, INR, AUD, EUR, GBP). <a href="http://www.science.co.il/International/Currency-Codes.asp" target="_blank"> Know you currency code</a>','rich-snippets'),
374
+ 'id' => $prefix . 'product_cur',
375
+ 'class' => 'product',
376
+ 'type' => 'text_small',
377
+ ),
378
+ array(
379
+ 'name' => __('Availability','rich-snippets'),
380
+ 'desc' => __('Select the products availability.','rich-snippets'),
381
+ 'id' => $prefix . 'product_status',
382
+ 'class' => 'product',
383
+ 'type' => 'select',
384
+ 'options' => array(
385
+ array('name' => __('__ Please Select __','rich-snippets'), 'value' => ''),
386
+ array('name' => __('Out of Stock','rich-snippets'), 'value' => 'out_of_stock'),
387
+ array('name' => __('In Stock','rich-snippets'), 'value' => 'in_stock'),
388
+ array('name' => __('In Store Only','rich-snippets'), 'value' => 'instore_only'),
389
+ array('name' => __('Pre-Order','rich-snippets'), 'value' => 'preorder'),
390
+ ),
391
+ ),
392
+ // Meta Settings for Recipes
393
+ array(
394
+ 'name' => __('Rich Snippets - Recipes','rich-snippets'),
395
+ 'desc' => __('Please provide the following information.','rich-snippets'),
396
+ 'id' => $prefix . 'recipes',
397
+ 'class' => 'recipes',
398
+ 'type' => 'title',
399
+ ),
400
+ array(
401
+ 'name' => __('Recipe Name ','rich-snippets'),
402
+ 'desc' => __('Enter the recipe name.','rich-snippets'),
403
+ 'id' => $prefix . 'recipes_name',
404
+ 'class' => 'recipes',
405
+ 'type' => 'text_medium',
406
+ ),
407
+ array(
408
+ 'name' => __('Time Required ','rich-snippets'),
409
+ 'desc' => __('Preperation time (Format: 1H30M. H - Hours, M - Minutes )','rich-snippets'),
410
+ 'id' => $prefix . 'recipes_preptime',
411
+ 'class' => 'recipes',
412
+ 'type' => 'text_small',
413
+ ),
414
+ array(
415
+ 'name' => __('','rich-snippets'),
416
+ 'desc' => __('Cook Time. (Format: 1H30M. H - Hours, M - Minutes )','rich-snippets'),
417
+ 'id' => $prefix . 'recipes_cooktime',
418
+ 'class' => 'recipes',
419
+ 'type' => 'text_small',
420
+ ),
421
+ array(
422
+ 'name' => __('','rich-snippets'),
423
+ 'desc' => __('Total Time (Format: 1H30M. H - Hours, M - Minutes )','rich-snippets'),
424
+ 'id' => $prefix . 'recipes_totaltime',
425
+ 'class' => 'recipes',
426
+ 'type' => 'text_small',
427
+ ),
428
+ array(
429
+ 'name' => __('Recipe Photo','rich-snippets'),
430
+ 'desc' => __('Upload or Select recipe photo. Medium size is recommended (300px X 300px)','rich-snippets'),
431
+ 'id' => $prefix . 'recipes_photo',
432
+ 'class' => 'recipes',
433
+ 'type' => 'file',
434
+ ),
435
+ /* array(
436
+ 'name' => __('','rich-snippets'),
437
+ 'desc' => __('Enter the ingredients used','rich-snippets'),
438
+ 'id' => $prefix . 'recipes_ingredient',
439
+ 'class' => 'recipes',
440
+ 'type' => 'textarea_small1',
441
+ ),
442
+ array(
443
+ 'name' => __('','rich-snippets'),
444
+ 'desc' => __('Describe the recipe in short.','rich-snippets'),
445
+ 'id' => $prefix . 'recipes_desc',
446
+ 'class' => 'recipes',
447
+ 'type' => 'textarea_small1',
448
+ ),*/
449
+ // Meta Settings for Software Application
450
+ array(
451
+ 'name' => __('Rich Snippets - Software Application','rich-snippets'),
452
+ 'desc' => __('Please provide the following information.','rich-snippets'),
453
+ 'id' => $prefix . 'software',
454
+ 'class' => 'software',
455
+ 'type' => 'title',
456
+ ),
457
+ array(
458
+ 'name' => __('Software Rating','rich-snippets'),
459
+ 'desc' => __('Rate this software.','rich-snippets'),
460
+ 'id' => $prefix . 'software_rating',
461
+ 'class' => 'star software',
462
+ 'type' => 'radio',
463
+ 'options' => array(
464
+ array( 'name' => __('','rich-snippets'), 'value' => '1', ),
465
+ array( 'name' => __('','rich-snippets'), 'value' => '2', ),
466
+ array( 'name' => __('','rich-snippets'), 'value' => '3', ),
467
+ array( 'name' => __('','rich-snippets'), 'value' => '4', ),
468
+ array( 'name' => __('','rich-snippets'), 'value' => '5', ),
469
+ ),
470
+ ),
471
+ array(
472
+ 'name' => __('Price','rich-snippets'),
473
+ 'desc' => __('Enter the Price of Software','rich-snippets'),
474
+ 'id' => $prefix . 'software_price',
475
+ 'class' => 'software',
476
+ 'type' => 'text_small',
477
+ ),
478
+ array(
479
+ 'name' => __('Currency','rich-snippets'),
480
+ 'desc' => __('Enter the Currency Code(e.g USD, INR, AUD, EUR, GBP). <a href="http://www.science.co.il/International/Currency-Codes.asp" target="_blank"> Know you currency code</a>','rich-snippets'),
481
+ 'id' => $prefix . 'software_cur',
482
+ 'class'=> 'software',
483
+ 'type' => 'text_small',
484
+ ),
485
+ array(
486
+ 'name' => __('Software Name ','rich-snippets'),
487
+ 'desc' => __('Enter the Software Name.','rich-snippets'),
488
+ 'id' => $prefix . 'software_name',
489
+ 'class' => 'software',
490
+ 'type' => 'text_medium',
491
+ ),
492
+ array(
493
+ 'name' => __('Operating System','rich-snippets'),
494
+ 'desc' => __('Enter the software Operating System.','rich-snippets'),
495
+ 'id' => $prefix . 'software_os',
496
+ 'class' => 'software',
497
+ 'type' => 'text_medium',
498
+ ),
499
+ array(
500
+ 'name' => __('Software Image','rich-snippets'),
501
+ 'desc' => __('Upload or select image of software. Medium size is recommended (300px X 300px)','rich-snippets'),
502
+ 'id' => $prefix . 'software_image',
503
+ 'class' => 'software',
504
+ 'type' => 'file',
505
+ ),
506
+ array(
507
+ 'name' => __('Landing Page','rich-snippets'),
508
+ 'desc' => __('Enter the landing page url for software','rich-snippets'),
509
+ 'id' => $prefix . 'software_landing',
510
+ 'class' => 'software',
511
+ 'type' => 'text',
512
+ ),
513
+ /*array(
514
+ 'name' => __('Software Description','rich-snippets'),
515
+ 'desc' => __('Enter the software description.','rich-snippets'),
516
+ 'id' => $prefix . 'software_desc',
517
+ 'class' => 'software',
518
+ 'type' => 'textarea_small',
519
+ ),*/
520
+ // Meta Settings for Video
521
+ array(
522
+ 'name' => __('Rich Snippets - Videos','rich-snippets'),
523
+ 'desc' => __('Please provide the following information.','rich-snippets'),
524
+ 'id' => $prefix . 'video',
525
+ 'class' => 'video',
526
+ 'type' => 'title',
527
+ ),
528
+ array(
529
+ 'name' => __('Video Title','rich-snippets'),
530
+ 'desc' => __('Enter the title for this video','rich-snippets'),
531
+ 'id' => $prefix . 'video_title',
532
+ 'class' => 'video',
533
+ 'type' => 'text',
534
+ ),
535
+ array(
536
+ 'name' => __('Video Description','rich-snippets'),
537
+ 'desc' => __('Enter the brief description for this video','rich-snippets'),
538
+ 'id' => $prefix . 'video_desc',
539
+ 'class' => 'video',
540
+ 'type' => 'textarea_small',
541
+ ),
542
+ array(
543
+ 'name' => __('Video Thumbnail','rich-snippets'),
544
+ 'desc' => __('Upload or select video thumbnail from gallery. Medium size is recommended (300px X 300px)','rich-snippets'),
545
+ 'id' => $prefix . 'video_thumb',
546
+ 'class' => 'video',
547
+ 'type' => 'file',
548
+ ),
549
+ array(
550
+ 'name' => __('Video','rich-snippets'),
551
+ 'desc' => __('Upload Video or enter the video file url','rich-snippets'),
552
+ 'id' => $prefix . 'video_url',
553
+ 'class' => 'video',
554
+ 'type' => 'file',
555
+ ),
556
+ array(
557
+ 'name' => __('Video Duration','rich-snippets'),
558
+ 'desc' => __('Enter the duration for this video','rich-snippets'),
559
+ 'id' => $prefix . 'video_duration',
560
+ 'class' => 'video',
561
+ 'type' => 'text_small',
562
+ ),
563
+ array(
564
+ 'name' => __('Upload Date','rich-snippets'),
565
+ 'desc' => __('Provide the date when the video is uploaded','rich-snippets'),
566
+ 'id' => $prefix . 'video_date',
567
+ 'class' => 'video',
568
+ 'type' => 'text_date',
569
+ ),
570
+ // Meta Settings for Article
571
+ array(
572
+ 'name' => __('Rich Snippets - Article','rich-snippets'),
573
+ 'desc' => __('Please provide the following information.','rich-snippets'),
574
+ 'id' => $prefix . 'article',
575
+ 'class' => 'article',
576
+ 'type' => 'title',
577
+ ),
578
+ array(
579
+ 'name' => __('Article Name','rich-snippets'),
580
+ 'desc' => __('Enter the name for this article','rich-snippets'),
581
+ 'id' => $prefix . 'article_name',
582
+ 'class' => 'article',
583
+ 'type' => 'text',
584
+ ),
585
+ array(
586
+ 'name' => __('Author','rich-snippets'),
587
+ 'desc' => __('Enter the author name for this article','rich-snippets'),
588
+ 'id' => $prefix . 'article_author',
589
+ 'class' => 'article',
590
+ 'type' => 'text',
591
+ ),
592
+ array(
593
+ 'name' => __('Short Description','rich-snippets'),
594
+ 'desc' => __('Enter the brief description about this article (About 30 Words)','rich-snippets'),
595
+ 'id' => $prefix . 'article_desc',
596
+ 'class' => 'article',
597
+ 'type' => 'textarea_small',
598
+ ),
599
+ array(
600
+ 'name' => __('Article Image','rich-snippets'),
601
+ 'desc' => __('Upload or select image from gallery. Medium size is recommended (300px X 300px)','rich-snippets'),
602
+ 'id' => $prefix . 'article_image',
603
+ 'class' => 'article',
604
+ 'type' => 'file',
605
+ ),
606
+ ),
607
+ );
608
+ // Add other metaboxes as needed
609
+ return $meta_boxes;
610
+ }
611
  ?>
readme.txt CHANGED
@@ -1 +1 @@
1
- === All In One Schema.org Rich Snippets ===
2
- It gives search engines only the important & precise information to display in search result snippets.
3
- Rich Snippets are very interactive (photos, star ratings, price, author, etc.) to let you stand out from competition
4
- [See what difference it makes](http://dashburst.com/google-search-what-are-rich-snippets/ "See the difference") in CTR (Click Through Rate)
5
- Helps you rank higher in search results
6
- Helps Facebook display proper information when users share your links on Facebook
7
- Even simpler, shorter, typographic and more beautiful design of MicroData box. May be like this https://moqups.com/brainstormforce/5P0EaLtt
8
- Redesigned admin panel
9
- Refined MicroData input options
10
- Support for more post types (Local Business, etc)
11
- It gives search engines only the important & precise information to display in search result snippets.
12
- Rich Snippets are very interactive (photos, star ratings, price, author, etc.) to let you stand out from competition
13
- [See what difference it makes](http://dashburst.com/google-search-what-are-rich-snippets/ "See the difference") in CTR (Click Through Rate)
14
- Helps you rank higher in search results
15
- Helps Facebook display proper information when users share your links on Facebook
16
- It gives search engines only the important & precise information to display in search result snippets.
17
- Rich Snippets are very interactive (photos, star ratings, price, author, etc.) to let you stand out from competition
18
- [See what difference it makes](http://dashburst.com/google-search-what-are-rich-snippets/ "See the difference") in CTR (Click Through Rate)
19
- Helps you rank higher in search results
20
- Helps Facebook display proper information when users share your links on Facebook
21
- Even simpler, shorter, typographic and more beautiful design of MicroData box. May be like this https://moqups.com/brainstormforce/5P0EaLtt
22
- Redesigned admin panel
23
- Refined MicroData input options
24
- Support for more post types (Local Business, etc)
25
- It gives search engines only the important & precise information to display in search result snippets.
26
- Rich Snippets are very interactive (photos, star ratings, price, author, etc.) to let you stand out from competition
27
- [See what difference it makes](http://dashburst.com/google-search-what-are-rich-snippets/ "See the difference") in CTR (Click Through Rate)
28
- Helps you rank higher in search results
29
- Helps Facebook display proper information when users share your links on Facebook
1
+ === All In One Schema.org Rich Snippets ===
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
settings.php CHANGED
@@ -1,112 +1,124 @@
1
- <?php
2
- // Function to add review option for settings
3
- function add_review_option()
4
- {
5
- $review_opt = array(
6
- 'review_title' => __('Summary','rich-snippets'),
7
- 'item_reviewer' => __('Reviewer','rich-snippets'),
8
- 'review_date' => __('Review Date','rich-snippets'),
9
- 'item_name' => __('Reviewed Item','rich-snippets'),
10
- // 'item_description' => __('Description','rich-snippets'),
11
- 'item_rating' => __('Author Rating','rich-snippets')
12
- );
13
- add_option('bsf_review',$review_opt);
14
- }
15
- // Function to add event option for settings
16
- function add_event_option()
17
- {
18
- $event_opt = array(
19
- 'snippet_title' => __('Summary','rich-snippets'),
20
- 'event_title' => __('Event','rich-snippets'),
21
- 'event_location' => __('Location','rich-snippets'),
22
- // 'event_desc' => __('Description','rich-snippets'),
23
- 'start_time' => __('Starting on','rich-snippets'),
24
- 'end_time' => __('Ending on','rich-snippets')
25
- // 'geo_location' => __('GEO Location','rich-snippets')
26
- );
27
- add_option('bsf_event',$event_opt);
28
- }
29
- // Function to add person option for settings
30
- function add_person_option()
31
- {
32
- $person_opt = array(
33
- 'snippet_title' => __('Summary','rich-snippets'),
34
- 'person_name' => __('Name','rich-snippets'),
35
- 'person_nickname' => __('Nickname','rich-snippets'),
36
- 'person_job_title' => __('Job Title','rich-snippets'),
37
- 'person_website' => __('Website','rich-snippets'),
38
- 'person_company' => __('Company','rich-snippets'),
39
- 'person_address' => __('Address','rich-snippets')
40
- );
41
- add_option('bsf_person',$person_opt);
42
- }
43
- // Function to add product option for settings
44
- function add_product_option()
45
- {
46
- $product_opt = array(
47
- 'snippet_title' => __('Summary','rich-snippets'),
48
- 'product_rating' => __('Author Rating','rich-snippets'),
49
- 'product_brand' => __('Brand Name','rich-snippets'),
50
- 'product_name' => __('Product Name','rich-snippets'),
51
- 'product_agr' => __('Aggregate Rating','rich-snippets'),
52
- 'product_price' => __('Price','rich-snippets'),
53
- 'product_avail' => __('Product Availability','rich-snippets')
54
- );
55
- add_option('bsf_product',$product_opt);
56
- }
57
- // Function to add recipe option for settings
58
- function add_recipe_option()
59
- {
60
- $recipe_opt = array(
61
- 'snippet_title' => __('Summary','rich-snippets'),
62
- 'recipe_name' => __('Recipe Name','rich-snippets'),
63
- 'recipe_pub' => __('Published On','rich-snippets'),
64
- 'recipe_prep' => __('Preparation Time','rich-snippets'),
65
- 'recipe_cook' => __('Cook Time','rich-snippets'),
66
- 'recipe_time' => __('Total Time','rich-snippets'),
67
- // 'recipe_ingred' => __('Ingredients','rich-snippets'),
68
- // 'recipe_summary' => __('Brief Summary','rich-snippets'),
69
- 'recipe_rating' => __('Average Rating','rich-snippets')
70
- );
71
- add_option('bsf_recipe',$recipe_opt);
72
- }
73
- // Function to add software option for settings
74
- function add_software_option()
75
- {
76
- $software_opt = array(
77
- 'snippet_title' => __('Summary','rich-snippets'),
78
- 'software_rating' => __('Author Rating','rich-snippets'),
79
- 'software_price' => __('Price','rich-snippets'),
80
- 'software_name' => __('Software Name','rich-snippets'),
81
- 'software_os' => __('Operating System','rich-snippets'),
82
- 'software_website' => __('Landing Page','rich-snippets')
83
- // 'software_desc' => __('Brief Description','rich-snippets')
84
- );
85
- add_option('bsf_software',$software_opt);
86
- }
87
- // Function to add video option for settings
88
- function add_video_option()
89
- {
90
- $video_opt = array(
91
- 'snippet_title' => __('Summary','rich-snippets'),
92
- 'video_title' => __('Title','rich-snippets'),
93
- 'video_desc' => __('Description','rich-snippets'),
94
- 'video_time' => __('Duration','rich-snippets'),
95
- 'video_date' => __('Upload Date','rich-snippets')
96
- );
97
- add_option('bsf_video',$video_opt);
98
- }
99
- // Function for customization
100
- function add_color_option()
101
- {
102
- $color_opt = array(
103
- 'snippet_box_bg' => '#F5F5F5',
104
- 'snippet_title_bg' => '#E4E4E4',
105
- 'snippet_border' => '#ACACAC',
106
- 'snippet_title_color' => '#333333',
107
- 'snippet_box_color' => '#333333',
108
- );
109
- add_option('bsf_custom',$color_opt);
110
- }
111
-
 
 
 
 
 
 
 
 
 
 
 
 
112
  ?>
1
+ <?php
2
+ // Function to add review option for settings
3
+ function add_review_option()
4
+ {
5
+ $review_opt = array(
6
+ 'review_title' => __('Summary','rich-snippets'),
7
+ 'item_reviewer' => __('Reviewer','rich-snippets'),
8
+ 'review_date' => __('Review Date','rich-snippets'),
9
+ 'item_name' => __('Reviewed Item','rich-snippets'),
10
+ // 'item_description' => __('Description','rich-snippets'),
11
+ 'item_rating' => __('Author Rating','rich-snippets')
12
+ );
13
+ add_option('bsf_review',$review_opt);
14
+ }
15
+ // Function to add event option for settings
16
+ function add_event_option()
17
+ {
18
+ $event_opt = array(
19
+ 'snippet_title' => __('Summary','rich-snippets'),
20
+ 'event_title' => __('Event','rich-snippets'),
21
+ 'event_location' => __('Location','rich-snippets'),
22
+ // 'event_desc' => __('Description','rich-snippets'),
23
+ 'start_time' => __('Starting on','rich-snippets'),
24
+ 'end_time' => __('Ending on','rich-snippets')
25
+
26
+ // 'geo_location' => __('GEO Location','rich-snippets')
27
+ );
28
+ add_option('bsf_event',$event_opt);
29
+ }
30
+ // Function to add person option for settings
31
+ function add_person_option()
32
+ {
33
+ $person_opt = array(
34
+ 'snippet_title' => __('Summary','rich-snippets'),
35
+ 'person_name' => __('Name','rich-snippets'),
36
+ 'person_nickname' => __('Nickname','rich-snippets'),
37
+ 'person_job_title' => __('Job Title','rich-snippets'),
38
+ 'person_website' => __('Website','rich-snippets'),
39
+ 'person_company' => __('Company','rich-snippets'),
40
+ 'person_address' => __('Address','rich-snippets')
41
+ );
42
+ add_option('bsf_person',$person_opt);
43
+ }
44
+ // Function to add product option for settings
45
+ function add_product_option()
46
+ {
47
+ $product_opt = array(
48
+ 'snippet_title' => __('Summary','rich-snippets'),
49
+ 'product_rating' => __('Author Rating','rich-snippets'),
50
+ 'product_brand' => __('Brand Name','rich-snippets'),
51
+ 'product_name' => __('Product Name','rich-snippets'),
52
+ 'product_agr' => __('Aggregate Rating','rich-snippets'),
53
+ 'product_price' => __('Price','rich-snippets'),
54
+ 'product_avail' => __('Product Availability','rich-snippets')
55
+ );
56
+ add_option('bsf_product',$product_opt);
57
+ }
58
+ // Function to add recipe option for settings
59
+ function add_recipe_option()
60
+ {
61
+ $recipe_opt = array(
62
+ 'snippet_title' => __('Summary','rich-snippets'),
63
+ 'recipe_name' => __('Recipe Name','rich-snippets'),
64
+ 'recipe_pub' => __('Published On','rich-snippets'),
65
+ 'recipe_prep' => __('Preparation Time','rich-snippets'),
66
+ 'recipe_cook' => __('Cook Time','rich-snippets'),
67
+ 'recipe_time' => __('Total Time','rich-snippets'),
68
+ // 'recipe_ingred' => __('Ingredients','rich-snippets'),
69
+ // 'recipe_summary' => __('Brief Summary','rich-snippets'),
70
+ 'recipe_rating' => __('Average Rating','rich-snippets')
71
+ );
72
+ add_option('bsf_recipe',$recipe_opt);
73
+ }
74
+ // Function to add software option for settings
75
+ function add_software_option()
76
+ {
77
+ $software_opt = array(
78
+ 'snippet_title' => __('Summary','rich-snippets'),
79
+ 'software_rating' => __('Author Rating','rich-snippets'),
80
+ 'software_price' => __('Price','rich-snippets'),
81
+ 'software_name' => __('Software Name','rich-snippets'),
82
+ 'software_os' => __('Operating System','rich-snippets'),
83
+ 'software_website' => __('Landing Page','rich-snippets')
84
+ // 'software_desc' => __('Brief Description','rich-snippets')
85
+ );
86
+ add_option('bsf_software',$software_opt);
87
+ }
88
+ // Function to add video option for settings
89
+ function add_video_option()
90
+ {
91
+ $video_opt = array(
92
+ 'snippet_title' => __('Summary','rich-snippets'),
93
+ 'video_title' => __('Title','rich-snippets'),
94
+ 'video_desc' => __('Description','rich-snippets'),
95
+ 'video_time' => __('Duration','rich-snippets'),
96
+ 'video_date' => __('Upload Date','rich-snippets')
97
+ );
98
+ add_option('bsf_video',$video_opt);
99
+ }
100
+ // Function to add article option for settings
101
+ function add_article_option()
102
+ {
103
+ $article_opt = array(
104
+ 'snippet_title' => __('Summary','rich-snippets'),
105
+ 'article_name' => __('Article Name','rich-snippets'),
106
+ 'article_author' => __('Author','rich-snippets'),
107
+ 'article_desc' => __('Description','rich-snippets'),
108
+ 'article_image' => __('Image','rich-snippets')
109
+ );
110
+ add_option('bsf_article',$article_opt);
111
+ }
112
+ // Function for customization
113
+ function add_color_option()
114
+ {
115
+ $color_opt = array(
116
+ 'snippet_box_bg' => '#F5F5F5',
117
+ 'snippet_title_bg' => '#E4E4E4',
118
+ 'snippet_border' => '#ACACAC',
119
+ 'snippet_title_color' => '#333333',
120
+ 'snippet_box_color' => '#333333',
121
+ );
122
+ add_option('bsf_custom',$color_opt);
123
+ }
124
  ?>