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