webshims-rails 1.12.5 → 1.12.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/webshims-rails/version.rb +2 -2
- data/vendor/assets/javascripts/webshims/polyfiller.js +111 -132
- data/vendor/assets/javascripts/webshims/shims/combos/1.js +40 -37
- data/vendor/assets/javascripts/webshims/shims/combos/10.js +217 -36
- data/vendor/assets/javascripts/webshims/shims/combos/11.js +151 -29
- data/vendor/assets/javascripts/webshims/shims/combos/12.js +70 -93
- data/vendor/assets/javascripts/webshims/shims/combos/13.js +70 -93
- data/vendor/assets/javascripts/webshims/shims/combos/14.js +90 -13
- data/vendor/assets/javascripts/webshims/shims/combos/15.js +202 -59
- data/vendor/assets/javascripts/webshims/shims/combos/16.js +208 -70
- data/vendor/assets/javascripts/webshims/shims/combos/17.js +151 -29
- data/vendor/assets/javascripts/webshims/shims/combos/18.js +155 -30
- data/vendor/assets/javascripts/webshims/shims/combos/19.js +79 -20
- data/vendor/assets/javascripts/webshims/shims/combos/2.js +109 -47
- data/vendor/assets/javascripts/webshims/shims/combos/20.js +79 -20
- data/vendor/assets/javascripts/webshims/shims/combos/21.js +80 -87
- data/vendor/assets/javascripts/webshims/shims/combos/22.js +66 -83
- data/vendor/assets/javascripts/webshims/shims/combos/23.js +4 -10
- data/vendor/assets/javascripts/webshims/shims/combos/25.js +79 -20
- data/vendor/assets/javascripts/webshims/shims/combos/26.js +66 -7
- data/vendor/assets/javascripts/webshims/shims/combos/28.js +100 -25
- data/vendor/assets/javascripts/webshims/shims/combos/3.js +192 -47
- data/vendor/assets/javascripts/webshims/shims/combos/30.js +193 -49
- data/vendor/assets/javascripts/webshims/shims/combos/31.js +103 -36
- data/vendor/assets/javascripts/webshims/shims/combos/32.js +5 -3
- data/vendor/assets/javascripts/webshims/shims/combos/33.js +1 -2
- data/vendor/assets/javascripts/webshims/shims/combos/34.js +2048 -0
- data/vendor/assets/javascripts/webshims/shims/combos/4.js +156 -20
- data/vendor/assets/javascripts/webshims/shims/combos/5.js +151 -29
- data/vendor/assets/javascripts/webshims/shims/combos/6.js +152 -31
- data/vendor/assets/javascripts/webshims/shims/combos/7.js +199 -60
- data/vendor/assets/javascripts/webshims/shims/combos/8.js +197 -58
- data/vendor/assets/javascripts/webshims/shims/combos/9.js +218 -38
- data/vendor/assets/javascripts/webshims/shims/combos/97.js +1004 -0
- data/vendor/assets/javascripts/webshims/shims/combos/98.js +1283 -0
- data/vendor/assets/javascripts/webshims/shims/combos/99.js +204 -1248
- data/vendor/assets/javascripts/webshims/shims/dom-extend.js +66 -7
- data/vendor/assets/javascripts/webshims/shims/es5.js +4 -1
- data/vendor/assets/javascripts/webshims/shims/form-combat.js +3 -3
- data/vendor/assets/javascripts/webshims/shims/form-core.js +36 -27
- data/vendor/assets/javascripts/webshims/shims/form-datalist.js +1 -2
- data/vendor/assets/javascripts/webshims/shims/form-fixrangechange.js +137 -0
- data/vendor/assets/javascripts/webshims/shims/form-message.js +90 -13
- data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +129 -15
- data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +9 -10
- data/vendor/assets/javascripts/webshims/shims/form-shim-extend2.js +886 -985
- data/vendor/assets/javascripts/webshims/shims/form-validation.js +78 -174
- data/vendor/assets/javascripts/webshims/shims/form-validators.js +39 -26
- data/vendor/assets/javascripts/webshims/shims/forms-picker.js +45 -17
- data/vendor/assets/javascripts/webshims/shims/geolocation.js +10 -3
- data/vendor/assets/javascripts/webshims/shims/jme/b.js +71 -246
- data/vendor/assets/javascripts/webshims/shims/jme/c.js +133 -1002
- data/vendor/assets/javascripts/webshims/shims/jme/controls.css +62 -23
- data/vendor/assets/javascripts/webshims/shims/jme/controls.scss +73 -10
- data/vendor/assets/javascripts/webshims/shims/jme/mediacontrols-lazy.js +1117 -0
- data/vendor/assets/javascripts/webshims/shims/jme/p.js +603 -0
- data/vendor/assets/javascripts/webshims/shims/jpicker/jpicker.css +5 -2
- data/vendor/assets/javascripts/webshims/shims/mediaelement-core.js +4 -10
- data/vendor/assets/javascripts/webshims/shims/mediaelement-jaris.js +4 -1
- data/vendor/assets/javascripts/webshims/shims/range-ui.js +22 -14
- data/vendor/assets/javascripts/webshims/shims/styles/forms-ext.css +29 -344
- data/vendor/assets/javascripts/webshims/shims/styles/forms-picker.css +362 -0
- data/vendor/assets/javascripts/webshims/shims/styles/scss/forms-ext.scss +6 -483
- data/vendor/assets/javascripts/webshims/shims/styles/scss/forms-picker.scss +488 -0
- data/vendor/assets/javascripts/webshims/shims/styles/scss/shim-ext.scss +2 -0
- data/vendor/assets/javascripts/webshims/shims/styles/scss/shim.scss +10 -2
- data/vendor/assets/javascripts/webshims/shims/styles/shim.css +6 -2
- data/vendor/assets/javascripts/webshims/shims/swf/JarisFLVPlayer.swf +0 -0
- data/vendor/assets/javascripts/webshims/shims/track-ui.js +8 -1
- data/vendor/assets/javascripts/webshims/shims/track.js +66 -83
- metadata +12 -5
- data/vendor/assets/javascripts/webshims/shims/$ajax.js +0 -862
- data/vendor/assets/javascripts/webshims/shims/combos/24.js +0 -2087
@@ -1,862 +0,0 @@
|
|
1
|
-
(function(){
|
2
|
-
var jQuery = window.webshims && webshims.$ || window.jQuery;
|
3
|
-
var core_rnotwhite = /\S+/g;
|
4
|
-
|
5
|
-
var
|
6
|
-
// Document location
|
7
|
-
ajaxLocParts,
|
8
|
-
ajaxLocation,
|
9
|
-
ajax_nonce = jQuery.now(),
|
10
|
-
|
11
|
-
ajax_rquery = /\?/,
|
12
|
-
rhash = /#.*$/,
|
13
|
-
rts = /([?&])_=[^&]*/,
|
14
|
-
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
|
15
|
-
// #7653, #8125, #8152: local protocol detection
|
16
|
-
rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
|
17
|
-
rnoContent = /^(?:GET|HEAD)$/,
|
18
|
-
rprotocol = /^\/\//,
|
19
|
-
rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
|
20
|
-
|
21
|
-
// Keep a copy of the old load method
|
22
|
-
_load = jQuery.fn.load,
|
23
|
-
|
24
|
-
/* Prefilters
|
25
|
-
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
|
26
|
-
* 2) These are called:
|
27
|
-
* - BEFORE asking for a transport
|
28
|
-
* - AFTER param serialization (s.data is a string if s.processData is true)
|
29
|
-
* 3) key is the dataType
|
30
|
-
* 4) the catchall symbol "*" can be used
|
31
|
-
* 5) execution will start with transport dataType and THEN continue down to "*" if needed
|
32
|
-
*/
|
33
|
-
prefilters = {},
|
34
|
-
|
35
|
-
/* Transports bindings
|
36
|
-
* 1) key is the dataType
|
37
|
-
* 2) the catchall symbol "*" can be used
|
38
|
-
* 3) selection will start with transport dataType and THEN go to "*" if needed
|
39
|
-
*/
|
40
|
-
transports = {},
|
41
|
-
|
42
|
-
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
|
43
|
-
allTypes = "*/".concat("*");
|
44
|
-
|
45
|
-
// #8138, IE may throw an exception when accessing
|
46
|
-
// a field from window.location if document.domain has been set
|
47
|
-
try {
|
48
|
-
ajaxLocation = location.href;
|
49
|
-
} catch( e ) {
|
50
|
-
// Use the href attribute of an A element
|
51
|
-
// since IE will modify it given document.location
|
52
|
-
ajaxLocation = document.createElement( "a" );
|
53
|
-
ajaxLocation.href = "";
|
54
|
-
ajaxLocation = ajaxLocation.href;
|
55
|
-
}
|
56
|
-
|
57
|
-
// Segment location into parts
|
58
|
-
ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
|
59
|
-
|
60
|
-
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
|
61
|
-
function addToPrefiltersOrTransports( structure ) {
|
62
|
-
|
63
|
-
// dataTypeExpression is optional and defaults to "*"
|
64
|
-
return function( dataTypeExpression, func ) {
|
65
|
-
|
66
|
-
if ( typeof dataTypeExpression !== "string" ) {
|
67
|
-
func = dataTypeExpression;
|
68
|
-
dataTypeExpression = "*";
|
69
|
-
}
|
70
|
-
|
71
|
-
var dataType,
|
72
|
-
i = 0,
|
73
|
-
dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
|
74
|
-
|
75
|
-
if ( jQuery.isFunction( func ) ) {
|
76
|
-
// For each dataType in the dataTypeExpression
|
77
|
-
while ( (dataType = dataTypes[i++]) ) {
|
78
|
-
// Prepend if requested
|
79
|
-
if ( dataType[0] === "+" ) {
|
80
|
-
dataType = dataType.slice( 1 ) || "*";
|
81
|
-
(structure[ dataType ] = structure[ dataType ] || []).unshift( func );
|
82
|
-
|
83
|
-
// Otherwise append
|
84
|
-
} else {
|
85
|
-
(structure[ dataType ] = structure[ dataType ] || []).push( func );
|
86
|
-
}
|
87
|
-
}
|
88
|
-
}
|
89
|
-
};
|
90
|
-
}
|
91
|
-
|
92
|
-
// Base inspection function for prefilters and transports
|
93
|
-
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
|
94
|
-
|
95
|
-
var inspected = {},
|
96
|
-
seekingTransport = ( structure === transports );
|
97
|
-
|
98
|
-
function inspect( dataType ) {
|
99
|
-
var selected;
|
100
|
-
inspected[ dataType ] = true;
|
101
|
-
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
|
102
|
-
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
|
103
|
-
if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
|
104
|
-
options.dataTypes.unshift( dataTypeOrTransport );
|
105
|
-
inspect( dataTypeOrTransport );
|
106
|
-
return false;
|
107
|
-
} else if ( seekingTransport ) {
|
108
|
-
return !( selected = dataTypeOrTransport );
|
109
|
-
}
|
110
|
-
});
|
111
|
-
return selected;
|
112
|
-
}
|
113
|
-
|
114
|
-
return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
|
115
|
-
}
|
116
|
-
|
117
|
-
// A special extend for ajax options
|
118
|
-
// that takes "flat" options (not to be deep extended)
|
119
|
-
// Fixes #9887
|
120
|
-
function ajaxExtend( target, src ) {
|
121
|
-
var deep, key,
|
122
|
-
flatOptions = jQuery.ajaxSettings.flatOptions || {};
|
123
|
-
|
124
|
-
for ( key in src ) {
|
125
|
-
if ( src[ key ] !== undefined ) {
|
126
|
-
( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
|
127
|
-
}
|
128
|
-
}
|
129
|
-
if ( deep ) {
|
130
|
-
jQuery.extend( true, target, deep );
|
131
|
-
}
|
132
|
-
|
133
|
-
return target;
|
134
|
-
}
|
135
|
-
|
136
|
-
jQuery.fn.load = function( url, params, callback ) {
|
137
|
-
if ( typeof url !== "string" && _load ) {
|
138
|
-
return _load.apply( this, arguments );
|
139
|
-
}
|
140
|
-
|
141
|
-
var selector, response, type,
|
142
|
-
self = this,
|
143
|
-
off = url.indexOf(" ");
|
144
|
-
|
145
|
-
if ( off >= 0 ) {
|
146
|
-
selector = url.slice( off, url.length );
|
147
|
-
url = url.slice( 0, off );
|
148
|
-
}
|
149
|
-
|
150
|
-
// If it's a function
|
151
|
-
if ( jQuery.isFunction( params ) ) {
|
152
|
-
|
153
|
-
// We assume that it's the callback
|
154
|
-
callback = params;
|
155
|
-
params = undefined;
|
156
|
-
|
157
|
-
// Otherwise, build a param string
|
158
|
-
} else if ( params && typeof params === "object" ) {
|
159
|
-
type = "POST";
|
160
|
-
}
|
161
|
-
|
162
|
-
// If we have elements to modify, make the request
|
163
|
-
if ( self.length > 0 ) {
|
164
|
-
jQuery.ajax({
|
165
|
-
url: url,
|
166
|
-
|
167
|
-
// if "type" variable is undefined, then "GET" method will be used
|
168
|
-
type: type,
|
169
|
-
dataType: "html",
|
170
|
-
data: params
|
171
|
-
}).done(function( responseText ) {
|
172
|
-
|
173
|
-
// Save response for use in complete callback
|
174
|
-
response = arguments;
|
175
|
-
|
176
|
-
self.html( selector ?
|
177
|
-
|
178
|
-
// If a selector was specified, locate the right elements in a dummy div
|
179
|
-
// Exclude scripts to avoid IE 'Permission Denied' errors
|
180
|
-
jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
|
181
|
-
|
182
|
-
// Otherwise use the full result
|
183
|
-
responseText );
|
184
|
-
|
185
|
-
}).complete( callback && function( jqXHR, status ) {
|
186
|
-
self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
|
187
|
-
});
|
188
|
-
}
|
189
|
-
|
190
|
-
return this;
|
191
|
-
};
|
192
|
-
|
193
|
-
// Attach a bunch of functions for handling common AJAX events
|
194
|
-
jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
|
195
|
-
jQuery.fn[ type ] = function( fn ){
|
196
|
-
return this.on( type, fn );
|
197
|
-
};
|
198
|
-
});
|
199
|
-
|
200
|
-
jQuery.extend({
|
201
|
-
|
202
|
-
// Counter for holding the number of active queries
|
203
|
-
active: 0,
|
204
|
-
|
205
|
-
// Last-Modified header cache for next request
|
206
|
-
lastModified: {},
|
207
|
-
etag: {},
|
208
|
-
|
209
|
-
ajaxSettings: {
|
210
|
-
url: ajaxLocation,
|
211
|
-
type: "GET",
|
212
|
-
isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
|
213
|
-
global: true,
|
214
|
-
processData: true,
|
215
|
-
async: true,
|
216
|
-
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
|
217
|
-
/*
|
218
|
-
timeout: 0,
|
219
|
-
data: null,
|
220
|
-
dataType: null,
|
221
|
-
username: null,
|
222
|
-
password: null,
|
223
|
-
cache: null,
|
224
|
-
throws: false,
|
225
|
-
traditional: false,
|
226
|
-
headers: {},
|
227
|
-
*/
|
228
|
-
|
229
|
-
accepts: {
|
230
|
-
"*": allTypes,
|
231
|
-
text: "text/plain",
|
232
|
-
html: "text/html",
|
233
|
-
xml: "application/xml, text/xml",
|
234
|
-
json: "application/json, text/javascript"
|
235
|
-
},
|
236
|
-
|
237
|
-
contents: {
|
238
|
-
xml: /xml/,
|
239
|
-
html: /html/,
|
240
|
-
json: /json/
|
241
|
-
},
|
242
|
-
|
243
|
-
responseFields: {
|
244
|
-
xml: "responseXML",
|
245
|
-
text: "responseText",
|
246
|
-
json: "responseJSON"
|
247
|
-
},
|
248
|
-
|
249
|
-
// Data converters
|
250
|
-
// Keys separate source (or catchall "*") and destination types with a single space
|
251
|
-
converters: {
|
252
|
-
|
253
|
-
// Convert anything to text
|
254
|
-
"* text": String,
|
255
|
-
|
256
|
-
// Text to html (true = no transformation)
|
257
|
-
"text html": true,
|
258
|
-
|
259
|
-
// Evaluate text as a json expression
|
260
|
-
"text json": jQuery.parseJSON,
|
261
|
-
|
262
|
-
// Parse text as xml
|
263
|
-
"text xml": jQuery.parseXML
|
264
|
-
},
|
265
|
-
|
266
|
-
// For options that shouldn't be deep extended:
|
267
|
-
// you can add your own custom options here if
|
268
|
-
// and when you create one that shouldn't be
|
269
|
-
// deep extended (see ajaxExtend)
|
270
|
-
flatOptions: {
|
271
|
-
url: true,
|
272
|
-
context: true
|
273
|
-
}
|
274
|
-
},
|
275
|
-
|
276
|
-
// Creates a full fledged settings object into target
|
277
|
-
// with both ajaxSettings and settings fields.
|
278
|
-
// If target is omitted, writes into ajaxSettings.
|
279
|
-
ajaxSetup: function( target, settings ) {
|
280
|
-
return settings ?
|
281
|
-
|
282
|
-
// Building a settings object
|
283
|
-
ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
|
284
|
-
|
285
|
-
// Extending ajaxSettings
|
286
|
-
ajaxExtend( jQuery.ajaxSettings, target );
|
287
|
-
},
|
288
|
-
|
289
|
-
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
|
290
|
-
ajaxTransport: addToPrefiltersOrTransports( transports ),
|
291
|
-
|
292
|
-
// Main method
|
293
|
-
ajax: function( url, options ) {
|
294
|
-
|
295
|
-
// If url is an object, simulate pre-1.5 signature
|
296
|
-
if ( typeof url === "object" ) {
|
297
|
-
options = url;
|
298
|
-
url = undefined;
|
299
|
-
}
|
300
|
-
|
301
|
-
// Force options to be an object
|
302
|
-
options = options || {};
|
303
|
-
|
304
|
-
var // Cross-domain detection vars
|
305
|
-
parts,
|
306
|
-
// Loop variable
|
307
|
-
i,
|
308
|
-
// URL without anti-cache param
|
309
|
-
cacheURL,
|
310
|
-
// Response headers as string
|
311
|
-
responseHeadersString,
|
312
|
-
// timeout handle
|
313
|
-
timeoutTimer,
|
314
|
-
|
315
|
-
// To know if global events are to be dispatched
|
316
|
-
fireGlobals,
|
317
|
-
|
318
|
-
transport,
|
319
|
-
// Response headers
|
320
|
-
responseHeaders,
|
321
|
-
// Create the final options object
|
322
|
-
s = jQuery.ajaxSetup( {}, options ),
|
323
|
-
// Callbacks context
|
324
|
-
callbackContext = s.context || s,
|
325
|
-
// Context for global events is callbackContext if it is a DOM node or jQuery collection
|
326
|
-
globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
|
327
|
-
jQuery( callbackContext ) :
|
328
|
-
jQuery.event,
|
329
|
-
// Deferreds
|
330
|
-
deferred = jQuery.Deferred(),
|
331
|
-
completeDeferred = jQuery.Callbacks("once memory"),
|
332
|
-
// Status-dependent callbacks
|
333
|
-
statusCode = s.statusCode || {},
|
334
|
-
// Headers (they are sent all at once)
|
335
|
-
requestHeaders = {},
|
336
|
-
requestHeadersNames = {},
|
337
|
-
// The jqXHR state
|
338
|
-
state = 0,
|
339
|
-
// Default abort message
|
340
|
-
strAbort = "canceled",
|
341
|
-
// Fake xhr
|
342
|
-
jqXHR = {
|
343
|
-
readyState: 0,
|
344
|
-
|
345
|
-
// Builds headers hashtable if needed
|
346
|
-
getResponseHeader: function( key ) {
|
347
|
-
var match;
|
348
|
-
if ( state === 2 ) {
|
349
|
-
if ( !responseHeaders ) {
|
350
|
-
responseHeaders = {};
|
351
|
-
while ( (match = rheaders.exec( responseHeadersString )) ) {
|
352
|
-
responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
|
353
|
-
}
|
354
|
-
}
|
355
|
-
match = responseHeaders[ key.toLowerCase() ];
|
356
|
-
}
|
357
|
-
return match == null ? null : match;
|
358
|
-
},
|
359
|
-
|
360
|
-
// Raw string
|
361
|
-
getAllResponseHeaders: function() {
|
362
|
-
return state === 2 ? responseHeadersString : null;
|
363
|
-
},
|
364
|
-
|
365
|
-
// Caches the header
|
366
|
-
setRequestHeader: function( name, value ) {
|
367
|
-
var lname = name.toLowerCase();
|
368
|
-
if ( !state ) {
|
369
|
-
name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
|
370
|
-
requestHeaders[ name ] = value;
|
371
|
-
}
|
372
|
-
return this;
|
373
|
-
},
|
374
|
-
|
375
|
-
// Overrides response content-type header
|
376
|
-
overrideMimeType: function( type ) {
|
377
|
-
if ( !state ) {
|
378
|
-
s.mimeType = type;
|
379
|
-
}
|
380
|
-
return this;
|
381
|
-
},
|
382
|
-
|
383
|
-
// Status-dependent callbacks
|
384
|
-
statusCode: function( map ) {
|
385
|
-
var code;
|
386
|
-
if ( map ) {
|
387
|
-
if ( state < 2 ) {
|
388
|
-
for ( code in map ) {
|
389
|
-
// Lazy-add the new callback in a way that preserves old ones
|
390
|
-
statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
|
391
|
-
}
|
392
|
-
} else {
|
393
|
-
// Execute the appropriate callbacks
|
394
|
-
jqXHR.always( map[ jqXHR.status ] );
|
395
|
-
}
|
396
|
-
}
|
397
|
-
return this;
|
398
|
-
},
|
399
|
-
|
400
|
-
// Cancel the request
|
401
|
-
abort: function( statusText ) {
|
402
|
-
var finalText = statusText || strAbort;
|
403
|
-
if ( transport ) {
|
404
|
-
transport.abort( finalText );
|
405
|
-
}
|
406
|
-
done( 0, finalText );
|
407
|
-
return this;
|
408
|
-
}
|
409
|
-
};
|
410
|
-
|
411
|
-
// Attach deferreds
|
412
|
-
deferred.promise( jqXHR ).complete = completeDeferred.add;
|
413
|
-
jqXHR.success = jqXHR.done;
|
414
|
-
jqXHR.error = jqXHR.fail;
|
415
|
-
|
416
|
-
// Remove hash character (#7531: and string promotion)
|
417
|
-
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
|
418
|
-
// Handle falsy url in the settings object (#10093: consistency with old signature)
|
419
|
-
// We also use the url parameter if available
|
420
|
-
s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
|
421
|
-
|
422
|
-
// Alias method option to type as per ticket #12004
|
423
|
-
s.type = options.method || options.type || s.method || s.type;
|
424
|
-
|
425
|
-
// Extract dataTypes list
|
426
|
-
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
|
427
|
-
|
428
|
-
// A cross-domain request is in order when we have a protocol:host:port mismatch
|
429
|
-
if ( s.crossDomain == null ) {
|
430
|
-
parts = rurl.exec( s.url.toLowerCase() );
|
431
|
-
s.crossDomain = !!( parts &&
|
432
|
-
( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
|
433
|
-
( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
|
434
|
-
( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
|
435
|
-
);
|
436
|
-
}
|
437
|
-
|
438
|
-
// Convert data if not already a string
|
439
|
-
if ( s.data && s.processData && typeof s.data !== "string" ) {
|
440
|
-
s.data = jQuery.param( s.data, s.traditional );
|
441
|
-
}
|
442
|
-
|
443
|
-
// Apply prefilters
|
444
|
-
inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
|
445
|
-
|
446
|
-
// If request was aborted inside a prefilter, stop there
|
447
|
-
if ( state === 2 ) {
|
448
|
-
return jqXHR;
|
449
|
-
}
|
450
|
-
|
451
|
-
// We can fire global events as of now if asked to
|
452
|
-
fireGlobals = s.global;
|
453
|
-
|
454
|
-
// Watch for a new set of requests
|
455
|
-
if ( fireGlobals && jQuery.active++ === 0 ) {
|
456
|
-
jQuery.event.trigger("ajaxStart");
|
457
|
-
}
|
458
|
-
|
459
|
-
// Uppercase the type
|
460
|
-
s.type = s.type.toUpperCase();
|
461
|
-
|
462
|
-
// Determine if request has content
|
463
|
-
s.hasContent = !rnoContent.test( s.type );
|
464
|
-
|
465
|
-
// Save the URL in case we're toying with the If-Modified-Since
|
466
|
-
// and/or If-None-Match header later on
|
467
|
-
cacheURL = s.url;
|
468
|
-
|
469
|
-
// More options handling for requests with no content
|
470
|
-
if ( !s.hasContent ) {
|
471
|
-
|
472
|
-
// If data is available, append data to url
|
473
|
-
if ( s.data ) {
|
474
|
-
cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
|
475
|
-
// #9682: remove data so that it's not used in an eventual retry
|
476
|
-
delete s.data;
|
477
|
-
}
|
478
|
-
|
479
|
-
// Add anti-cache in url if needed
|
480
|
-
if ( s.cache === false ) {
|
481
|
-
s.url = rts.test( cacheURL ) ?
|
482
|
-
|
483
|
-
// If there is already a '_' parameter, set its value
|
484
|
-
cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) :
|
485
|
-
|
486
|
-
// Otherwise add one to the end
|
487
|
-
cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++;
|
488
|
-
}
|
489
|
-
}
|
490
|
-
|
491
|
-
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
|
492
|
-
if ( s.ifModified ) {
|
493
|
-
if ( jQuery.lastModified[ cacheURL ] ) {
|
494
|
-
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
|
495
|
-
}
|
496
|
-
if ( jQuery.etag[ cacheURL ] ) {
|
497
|
-
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
|
498
|
-
}
|
499
|
-
}
|
500
|
-
|
501
|
-
// Set the correct header, if data is being sent
|
502
|
-
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
|
503
|
-
jqXHR.setRequestHeader( "Content-Type", s.contentType );
|
504
|
-
}
|
505
|
-
|
506
|
-
// Set the Accepts header for the server, depending on the dataType
|
507
|
-
jqXHR.setRequestHeader(
|
508
|
-
"Accept",
|
509
|
-
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
|
510
|
-
s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
|
511
|
-
s.accepts[ "*" ]
|
512
|
-
);
|
513
|
-
|
514
|
-
// Check for headers option
|
515
|
-
for ( i in s.headers ) {
|
516
|
-
jqXHR.setRequestHeader( i, s.headers[ i ] );
|
517
|
-
}
|
518
|
-
|
519
|
-
// Allow custom headers/mimetypes and early abort
|
520
|
-
if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
|
521
|
-
// Abort if not done already and return
|
522
|
-
return jqXHR.abort();
|
523
|
-
}
|
524
|
-
|
525
|
-
// aborting is no longer a cancellation
|
526
|
-
strAbort = "abort";
|
527
|
-
|
528
|
-
// Install callbacks on deferreds
|
529
|
-
for ( i in { success: 1, error: 1, complete: 1 } ) {
|
530
|
-
jqXHR[ i ]( s[ i ] );
|
531
|
-
}
|
532
|
-
|
533
|
-
// Get transport
|
534
|
-
transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
|
535
|
-
|
536
|
-
// If no transport, we auto-abort
|
537
|
-
if ( !transport ) {
|
538
|
-
done( -1, "No Transport" );
|
539
|
-
} else {
|
540
|
-
jqXHR.readyState = 1;
|
541
|
-
|
542
|
-
// Send global event
|
543
|
-
if ( fireGlobals ) {
|
544
|
-
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
|
545
|
-
}
|
546
|
-
// Timeout
|
547
|
-
if ( s.async && s.timeout > 0 ) {
|
548
|
-
timeoutTimer = setTimeout(function() {
|
549
|
-
jqXHR.abort("timeout");
|
550
|
-
}, s.timeout );
|
551
|
-
}
|
552
|
-
|
553
|
-
try {
|
554
|
-
state = 1;
|
555
|
-
transport.send( requestHeaders, done );
|
556
|
-
} catch ( e ) {
|
557
|
-
// Propagate exception as error if not done
|
558
|
-
if ( state < 2 ) {
|
559
|
-
done( -1, e );
|
560
|
-
// Simply rethrow otherwise
|
561
|
-
} else {
|
562
|
-
throw e;
|
563
|
-
}
|
564
|
-
}
|
565
|
-
}
|
566
|
-
|
567
|
-
// Callback for when everything is done
|
568
|
-
function done( status, nativeStatusText, responses, headers ) {
|
569
|
-
var isSuccess, success, error, response, modified,
|
570
|
-
statusText = nativeStatusText;
|
571
|
-
|
572
|
-
// Called once
|
573
|
-
if ( state === 2 ) {
|
574
|
-
return;
|
575
|
-
}
|
576
|
-
|
577
|
-
// State is "done" now
|
578
|
-
state = 2;
|
579
|
-
|
580
|
-
// Clear timeout if it exists
|
581
|
-
if ( timeoutTimer ) {
|
582
|
-
clearTimeout( timeoutTimer );
|
583
|
-
}
|
584
|
-
|
585
|
-
// Dereference transport for early garbage collection
|
586
|
-
// (no matter how long the jqXHR object will be used)
|
587
|
-
transport = undefined;
|
588
|
-
|
589
|
-
// Cache response headers
|
590
|
-
responseHeadersString = headers || "";
|
591
|
-
|
592
|
-
// Set readyState
|
593
|
-
jqXHR.readyState = status > 0 ? 4 : 0;
|
594
|
-
|
595
|
-
// Determine if successful
|
596
|
-
isSuccess = status >= 200 && status < 300 || status === 304;
|
597
|
-
|
598
|
-
// Get response data
|
599
|
-
if ( responses ) {
|
600
|
-
response = ajaxHandleResponses( s, jqXHR, responses );
|
601
|
-
}
|
602
|
-
|
603
|
-
// Convert no matter what (that way responseXXX fields are always set)
|
604
|
-
response = ajaxConvert( s, response, jqXHR, isSuccess );
|
605
|
-
|
606
|
-
// If successful, handle type chaining
|
607
|
-
if ( isSuccess ) {
|
608
|
-
|
609
|
-
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
|
610
|
-
if ( s.ifModified ) {
|
611
|
-
modified = jqXHR.getResponseHeader("Last-Modified");
|
612
|
-
if ( modified ) {
|
613
|
-
jQuery.lastModified[ cacheURL ] = modified;
|
614
|
-
}
|
615
|
-
modified = jqXHR.getResponseHeader("etag");
|
616
|
-
if ( modified ) {
|
617
|
-
jQuery.etag[ cacheURL ] = modified;
|
618
|
-
}
|
619
|
-
}
|
620
|
-
|
621
|
-
// if no content
|
622
|
-
if ( status === 204 || s.type === "HEAD" ) {
|
623
|
-
statusText = "nocontent";
|
624
|
-
|
625
|
-
// if not modified
|
626
|
-
} else if ( status === 304 ) {
|
627
|
-
statusText = "notmodified";
|
628
|
-
|
629
|
-
// If we have data, let's convert it
|
630
|
-
} else {
|
631
|
-
statusText = response.state;
|
632
|
-
success = response.data;
|
633
|
-
error = response.error;
|
634
|
-
isSuccess = !error;
|
635
|
-
}
|
636
|
-
} else {
|
637
|
-
// We extract error from statusText
|
638
|
-
// then normalize statusText and status for non-aborts
|
639
|
-
error = statusText;
|
640
|
-
if ( status || !statusText ) {
|
641
|
-
statusText = "error";
|
642
|
-
if ( status < 0 ) {
|
643
|
-
status = 0;
|
644
|
-
}
|
645
|
-
}
|
646
|
-
}
|
647
|
-
|
648
|
-
// Set data for the fake xhr object
|
649
|
-
jqXHR.status = status;
|
650
|
-
jqXHR.statusText = ( nativeStatusText || statusText ) + "";
|
651
|
-
|
652
|
-
// Success/Error
|
653
|
-
if ( isSuccess ) {
|
654
|
-
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
|
655
|
-
} else {
|
656
|
-
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
|
657
|
-
}
|
658
|
-
|
659
|
-
// Status-dependent callbacks
|
660
|
-
jqXHR.statusCode( statusCode );
|
661
|
-
statusCode = undefined;
|
662
|
-
|
663
|
-
if ( fireGlobals ) {
|
664
|
-
globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
|
665
|
-
[ jqXHR, s, isSuccess ? success : error ] );
|
666
|
-
}
|
667
|
-
|
668
|
-
// Complete
|
669
|
-
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
|
670
|
-
|
671
|
-
if ( fireGlobals ) {
|
672
|
-
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
|
673
|
-
// Handle the global AJAX counter
|
674
|
-
if ( !( --jQuery.active ) ) {
|
675
|
-
jQuery.event.trigger("ajaxStop");
|
676
|
-
}
|
677
|
-
}
|
678
|
-
}
|
679
|
-
|
680
|
-
return jqXHR;
|
681
|
-
},
|
682
|
-
|
683
|
-
getJSON: function( url, data, callback ) {
|
684
|
-
return jQuery.get( url, data, callback, "json" );
|
685
|
-
},
|
686
|
-
|
687
|
-
getScript: function( url, callback ) {
|
688
|
-
return jQuery.get( url, undefined, callback, "script" );
|
689
|
-
}
|
690
|
-
});
|
691
|
-
|
692
|
-
jQuery.each( [ "get", "post" ], function( i, method ) {
|
693
|
-
jQuery[ method ] = function( url, data, callback, type ) {
|
694
|
-
// shift arguments if data argument was omitted
|
695
|
-
if ( jQuery.isFunction( data ) ) {
|
696
|
-
type = type || callback;
|
697
|
-
callback = data;
|
698
|
-
data = undefined;
|
699
|
-
}
|
700
|
-
|
701
|
-
return jQuery.ajax({
|
702
|
-
url: url,
|
703
|
-
type: method,
|
704
|
-
dataType: type,
|
705
|
-
data: data,
|
706
|
-
success: callback
|
707
|
-
});
|
708
|
-
};
|
709
|
-
});
|
710
|
-
|
711
|
-
/* Handles responses to an ajax request:
|
712
|
-
* - finds the right dataType (mediates between content-type and expected dataType)
|
713
|
-
* - returns the corresponding response
|
714
|
-
*/
|
715
|
-
function ajaxHandleResponses( s, jqXHR, responses ) {
|
716
|
-
var firstDataType, ct, finalDataType, type,
|
717
|
-
contents = s.contents,
|
718
|
-
dataTypes = s.dataTypes;
|
719
|
-
|
720
|
-
// Remove auto dataType and get content-type in the process
|
721
|
-
while( dataTypes[ 0 ] === "*" ) {
|
722
|
-
dataTypes.shift();
|
723
|
-
if ( ct === undefined ) {
|
724
|
-
ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
|
725
|
-
}
|
726
|
-
}
|
727
|
-
|
728
|
-
// Check if we're dealing with a known content-type
|
729
|
-
if ( ct ) {
|
730
|
-
for ( type in contents ) {
|
731
|
-
if ( contents[ type ] && contents[ type ].test( ct ) ) {
|
732
|
-
dataTypes.unshift( type );
|
733
|
-
break;
|
734
|
-
}
|
735
|
-
}
|
736
|
-
}
|
737
|
-
|
738
|
-
// Check to see if we have a response for the expected dataType
|
739
|
-
if ( dataTypes[ 0 ] in responses ) {
|
740
|
-
finalDataType = dataTypes[ 0 ];
|
741
|
-
} else {
|
742
|
-
// Try convertible dataTypes
|
743
|
-
for ( type in responses ) {
|
744
|
-
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
|
745
|
-
finalDataType = type;
|
746
|
-
break;
|
747
|
-
}
|
748
|
-
if ( !firstDataType ) {
|
749
|
-
firstDataType = type;
|
750
|
-
}
|
751
|
-
}
|
752
|
-
// Or just use first one
|
753
|
-
finalDataType = finalDataType || firstDataType;
|
754
|
-
}
|
755
|
-
|
756
|
-
// If we found a dataType
|
757
|
-
// We add the dataType to the list if needed
|
758
|
-
// and return the corresponding response
|
759
|
-
if ( finalDataType ) {
|
760
|
-
if ( finalDataType !== dataTypes[ 0 ] ) {
|
761
|
-
dataTypes.unshift( finalDataType );
|
762
|
-
}
|
763
|
-
return responses[ finalDataType ];
|
764
|
-
}
|
765
|
-
}
|
766
|
-
|
767
|
-
/* Chain conversions given the request and the original response
|
768
|
-
* Also sets the responseXXX fields on the jqXHR instance
|
769
|
-
*/
|
770
|
-
function ajaxConvert( s, response, jqXHR, isSuccess ) {
|
771
|
-
var conv2, current, conv, tmp, prev,
|
772
|
-
converters = {},
|
773
|
-
// Work with a copy of dataTypes in case we need to modify it for conversion
|
774
|
-
dataTypes = s.dataTypes.slice();
|
775
|
-
|
776
|
-
// Create converters map with lowercased keys
|
777
|
-
if ( dataTypes[ 1 ] ) {
|
778
|
-
for ( conv in s.converters ) {
|
779
|
-
converters[ conv.toLowerCase() ] = s.converters[ conv ];
|
780
|
-
}
|
781
|
-
}
|
782
|
-
|
783
|
-
current = dataTypes.shift();
|
784
|
-
|
785
|
-
// Convert to each sequential dataType
|
786
|
-
while ( current ) {
|
787
|
-
|
788
|
-
if ( s.responseFields[ current ] ) {
|
789
|
-
jqXHR[ s.responseFields[ current ] ] = response;
|
790
|
-
}
|
791
|
-
|
792
|
-
// Apply the dataFilter if provided
|
793
|
-
if ( !prev && isSuccess && s.dataFilter ) {
|
794
|
-
response = s.dataFilter( response, s.dataType );
|
795
|
-
}
|
796
|
-
|
797
|
-
prev = current;
|
798
|
-
current = dataTypes.shift();
|
799
|
-
|
800
|
-
if ( current ) {
|
801
|
-
|
802
|
-
// There's only work to do if current dataType is non-auto
|
803
|
-
if ( current === "*" ) {
|
804
|
-
|
805
|
-
current = prev;
|
806
|
-
|
807
|
-
// Convert response if prev dataType is non-auto and differs from current
|
808
|
-
} else if ( prev !== "*" && prev !== current ) {
|
809
|
-
|
810
|
-
// Seek a direct converter
|
811
|
-
conv = converters[ prev + " " + current ] || converters[ "* " + current ];
|
812
|
-
|
813
|
-
// If none found, seek a pair
|
814
|
-
if ( !conv ) {
|
815
|
-
for ( conv2 in converters ) {
|
816
|
-
|
817
|
-
// If conv2 outputs current
|
818
|
-
tmp = conv2.split( " " );
|
819
|
-
if ( tmp[ 1 ] === current ) {
|
820
|
-
|
821
|
-
// If prev can be converted to accepted input
|
822
|
-
conv = converters[ prev + " " + tmp[ 0 ] ] ||
|
823
|
-
converters[ "* " + tmp[ 0 ] ];
|
824
|
-
if ( conv ) {
|
825
|
-
// Condense equivalence converters
|
826
|
-
if ( conv === true ) {
|
827
|
-
conv = converters[ conv2 ];
|
828
|
-
|
829
|
-
// Otherwise, insert the intermediate dataType
|
830
|
-
} else if ( converters[ conv2 ] !== true ) {
|
831
|
-
current = tmp[ 0 ];
|
832
|
-
dataTypes.unshift( tmp[ 1 ] );
|
833
|
-
}
|
834
|
-
break;
|
835
|
-
}
|
836
|
-
}
|
837
|
-
}
|
838
|
-
}
|
839
|
-
|
840
|
-
// Apply converter (if not an equivalence)
|
841
|
-
if ( conv !== true ) {
|
842
|
-
|
843
|
-
// Unless errors are allowed to bubble, catch and return them
|
844
|
-
if ( conv && s[ "throws" ] ) {
|
845
|
-
response = conv( response );
|
846
|
-
} else {
|
847
|
-
try {
|
848
|
-
response = conv( response );
|
849
|
-
} catch ( e ) {
|
850
|
-
return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
|
851
|
-
}
|
852
|
-
}
|
853
|
-
}
|
854
|
-
}
|
855
|
-
}
|
856
|
-
}
|
857
|
-
|
858
|
-
return { state: "success", data: response };
|
859
|
-
}
|
860
|
-
|
861
|
-
|
862
|
-
})();
|