webshims-rails 1.14.6 → 1.15.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/lib/webshims-rails/version.rb +2 -2
  3. data/vendor/assets/javascripts/webshims/polyfiller.js +145 -139
  4. data/vendor/assets/javascripts/webshims/shims/canvas-blob.js +97 -0
  5. data/vendor/assets/javascripts/webshims/shims/combos/1.js +13 -15
  6. data/vendor/assets/javascripts/webshims/shims/combos/10.js +29 -28
  7. data/vendor/assets/javascripts/webshims/shims/combos/11.js +2 -1
  8. data/vendor/assets/javascripts/webshims/shims/combos/12.js +22 -10
  9. data/vendor/assets/javascripts/webshims/shims/combos/13.js +22 -10
  10. data/vendor/assets/javascripts/webshims/shims/combos/15.js +28 -43
  11. data/vendor/assets/javascripts/webshims/shims/combos/16.js +41 -44
  12. data/vendor/assets/javascripts/webshims/shims/combos/17.js +2 -1
  13. data/vendor/assets/javascripts/webshims/shims/combos/2.js +40 -42
  14. data/vendor/assets/javascripts/webshims/shims/combos/21.js +98 -71
  15. data/vendor/assets/javascripts/webshims/shims/combos/22.js +9 -9
  16. data/vendor/assets/javascripts/webshims/shims/combos/23.js +13 -1
  17. data/vendor/assets/javascripts/webshims/shims/combos/25.js +141 -51
  18. data/vendor/assets/javascripts/webshims/shims/combos/27.js +66 -12
  19. data/vendor/assets/javascripts/webshims/shims/combos/28.js +1 -2
  20. data/vendor/assets/javascripts/webshims/shims/combos/3.js +27 -41
  21. data/vendor/assets/javascripts/webshims/shims/combos/30.js +27 -41
  22. data/vendor/assets/javascripts/webshims/shims/combos/31.js +27 -41
  23. data/vendor/assets/javascripts/webshims/shims/combos/34.js +36 -36
  24. data/vendor/assets/javascripts/webshims/shims/combos/4.js +27 -27
  25. data/vendor/assets/javascripts/webshims/shims/combos/5.js +2 -1
  26. data/vendor/assets/javascripts/webshims/shims/combos/6.js +2 -1
  27. data/vendor/assets/javascripts/webshims/shims/combos/7.js +40 -42
  28. data/vendor/assets/javascripts/webshims/shims/combos/8.js +40 -42
  29. data/vendor/assets/javascripts/webshims/shims/combos/9.js +29 -28
  30. data/vendor/assets/javascripts/webshims/shims/combos/98.js +4 -2
  31. data/vendor/assets/javascripts/webshims/shims/combos/99.js +4 -2
  32. data/vendor/assets/javascripts/webshims/shims/dom-extend.js +27 -27
  33. data/vendor/assets/javascripts/webshims/shims/es6.js +23 -29
  34. data/vendor/assets/javascripts/webshims/shims/{filereader.js → filereader-xhr.js} +66 -12
  35. data/vendor/assets/javascripts/webshims/shims/form-core.js +0 -14
  36. data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +2 -1
  37. data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +1 -2
  38. data/vendor/assets/javascripts/webshims/shims/form-validation.js +18 -5
  39. data/vendor/assets/javascripts/webshims/shims/form-validators.js +15 -14
  40. data/vendor/assets/javascripts/webshims/shims/geolocation.js +41 -50
  41. data/vendor/assets/javascripts/webshims/shims/jme/controls.css +4 -4
  42. data/vendor/assets/javascripts/webshims/shims/jme/controls.scss +2 -1
  43. data/vendor/assets/javascripts/webshims/shims/jme/mediacontrols.js +4 -2
  44. data/vendor/assets/javascripts/webshims/shims/mediacapture-picker.js +42 -0
  45. data/vendor/assets/javascripts/webshims/shims/mediacapture.js +159 -0
  46. data/vendor/assets/javascripts/webshims/shims/mediaelement-core.js +13 -1
  47. data/vendor/assets/javascripts/webshims/shims/mediaelement-jaris.js +48 -12
  48. data/vendor/assets/javascripts/webshims/shims/mediaelement-yt.js +20 -8
  49. data/vendor/assets/javascripts/webshims/shims/{combos/26.js → moxie/js/moxie-html4.js} +2121 -1257
  50. data/vendor/assets/javascripts/webshims/shims/moxie/js/{moxie.js → moxie-swf.js} +1125 -1741
  51. data/vendor/assets/javascripts/webshims/shims/sticky.js +585 -0
  52. data/vendor/assets/javascripts/webshims/shims/styles/forms-picker.css +20 -0
  53. data/vendor/assets/javascripts/webshims/shims/styles/scss/forms-picker.scss +23 -0
  54. data/vendor/assets/javascripts/webshims/shims/styles/scss/shim.scss +74 -34
  55. data/vendor/assets/javascripts/webshims/shims/styles/shim-ext.css +78 -31
  56. data/vendor/assets/javascripts/webshims/shims/styles/shim.css +78 -31
  57. data/vendor/assets/javascripts/webshims/shims/swf/JarisFLVPlayer.swf +0 -0
  58. data/vendor/assets/javascripts/webshims/shims/track-ui.js +214 -111
  59. data/vendor/assets/javascripts/webshims/shims/track.js +9 -9
  60. data/vendor/assets/javascripts/webshims/shims/usermedia-core.js +27 -0
  61. data/vendor/assets/javascripts/webshims/shims/usermedia-shim.js +34 -37
  62. metadata +9 -8
  63. data/vendor/assets/javascripts/webshims/shims/jajax.js +0 -1262
  64. data/vendor/assets/javascripts/webshims/shims/moxie/silverlight/Moxie.cdn.xap +0 -0
  65. data/vendor/assets/javascripts/webshims/shims/moxie/silverlight/Moxie.min.xap +0 -0
@@ -1,18 +1,15 @@
1
1
  webshim.register('usermedia-shim', function($, webshim, window, document, undefined, options){
2
2
  "use strict";
3
3
  var addMediaAPI;
4
- var streamUrlPrefix = 'webshimstream';
5
4
  var id = 0;
6
- var streams = {};
7
5
  var streamCb = {};
8
6
  var hasSwf = swfmini.hasFlashPlayerVersion('11.3');
9
- var mediaOptions = webshim.cfg.mediaelement;
10
7
  var mediaelement = webshim.mediaelement;
11
8
  var flashEvents = {
12
- NOT_SUPPORTED_ERROR: 1,
13
- PERMISSION_DENIED: 1,
9
+ NotSupportedError: 1,
10
+ PermissionDeniedError: 1,
14
11
  //not implemented yet
15
- MANDATORY_UNSATISFIED_ERROR: 1,
12
+ ConstraintNotSatisfiedError: 1,
16
13
  onUserSuccess: 1
17
14
  };
18
15
  var noSource = function(){
@@ -51,6 +48,13 @@ webshim.register('usermedia-shim', function($, webshim, window, document, undefi
51
48
  };
52
49
 
53
50
  addMediaAPI();
51
+ /*
52
+ { width: 650 },
53
+ { width: { min: 650 }},
54
+ { frameRate: 60 },
55
+ { width: { max: 800 }},
56
+ { facingMode: "user" }
57
+ */
54
58
  mediaelement.createSWF(media, {srcProp: src, streamrequest: true, type: 'jarisplayer/stream'});
55
59
  }
56
60
 
@@ -73,6 +77,8 @@ webshim.register('usermedia-shim', function($, webshim, window, document, undefi
73
77
 
74
78
 
75
79
  function LocalMediaStream(data, api, id){
80
+ data._cTNow = Date.now();
81
+ data._cTID = false;
76
82
  webshim.defineProperties(this, {
77
83
  _swf: {
78
84
  value: api,
@@ -92,20 +98,34 @@ webshim.register('usermedia-shim', function($, webshim, window, document, undefi
92
98
 
93
99
 
94
100
  LocalMediaStream.prototype = {
95
- currentTime: 0,
96
101
  stop: function(){
102
+ if(this._data._cTID){
103
+ clearInterval(this._data._cTID);
104
+ }
97
105
  mediaelement.queueSwfMethod(this._data._elem, 'api_detach', [], this._data);
98
- },
99
- getAudioTracks: $.noop,
100
- getVideoTracks: $.noop
106
+ this._data.ended = true;
107
+ $(this._data._elem).trigger('ended');
108
+ }
101
109
  };
102
110
 
103
111
 
104
112
  webshim.usermedia = {
105
113
  attach: function(elem, canPlaySrc, data){
114
+ var $media;
106
115
  if(data._usermedia == canPlaySrc.srcProp){
107
116
  mediaelement.queueSwfMethod(data._elem, 'api_attach', [], data);
108
- $(data._elem).trigger('loadstart');
117
+ $media = $(data._elem).trigger('loadstart');
118
+ data._cTID = setInterval(function(){
119
+ if(data.ended){
120
+ clearInterval(data._cTID);
121
+ } else if(!data.paused){
122
+ data.currentTime = (Date.now() - data._cTNow) / 1000;
123
+ $media.triggerHandler('timeupdate');
124
+ }
125
+ }, 250);
126
+ if(!data.paused){
127
+ mediaelement.queueSwfMethod(data._elem, 'api_play', [], data);
128
+ }
109
129
  } else {
110
130
  webshim.error('something went wrong');
111
131
  }
@@ -120,30 +140,7 @@ webshim.register('usermedia-shim', function($, webshim, window, document, undefi
120
140
  }
121
141
  };
122
142
 
123
- URL._nativeCreateObjectURL = URL.createObjectURL;
124
- URL._nativeRevokeObjectURL = URL.revokeObjectURL;
125
-
126
- URL.createObjectURL = function(stream){
127
143
 
128
- var url = '';
129
- if(URL._nativeCreateObjectURL && !stream._wsStreamId){
130
- url = URL._nativeCreateObjectURL(stream);
131
- } else if(stream._wsStreamId) {
132
- url = stream._wsStreamId;
133
- streams[url] = stream;
134
- }
135
- return url;
136
- };
137
-
138
- URL.revokeObjectURL = function(url){
139
- if(streams[url]){
140
- delete streams[url];
141
- }
142
- if(URL._nativeRevokeObjectURL){
143
- return URL._nativeRevokeObjectURL(url);
144
- }
145
- };
146
- webshim.usermediastreams = streams;
147
144
 
148
145
  addMediaAPI = function(){
149
146
  if(!webshim.mediaelement.createSWF){return;}
@@ -161,10 +158,10 @@ webshim.register('usermedia-shim', function($, webshim, window, document, undefi
161
158
  streamCb[data._usermedia].fail({name: jaris.type});
162
159
  };
163
160
  $.extend(mediaelement.onEvent, {
164
- NOT_SUPPORTED_ERROR: fail,
165
- PERMISSION_DENIED: fail,
161
+ NotSupportedError: fail,
162
+ PermissionDeniedError: fail,
166
163
  //not implemented yet
167
- MANDATORY_UNSATISFIED_ERROR: fail,
164
+ ConstraintNotSatisfiedError: fail,
168
165
  onUserSuccess: function(jaris, data){
169
166
  revert(data);
170
167
  streamCb[data._usermedia].success(new LocalMediaStream(data, data.api, data._usermedia));
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webshims-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.6
4
+ version: 1.15.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Reese
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-31 00:00:00.000000000 Z
11
+ date: 2014-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -52,6 +52,7 @@ files:
52
52
  - vendor/assets/javascripts/webshims/shims/FlashCanvasPro/flashcanvas.js
53
53
  - vendor/assets/javascripts/webshims/shims/FlashCanvasPro/proxy.php
54
54
  - vendor/assets/javascripts/webshims/shims/FlashCanvasPro/save.php
55
+ - vendor/assets/javascripts/webshims/shims/canvas-blob.js
55
56
  - vendor/assets/javascripts/webshims/shims/color-picker.js
56
57
  - vendor/assets/javascripts/webshims/shims/combos/1.js
57
58
  - vendor/assets/javascripts/webshims/shims/combos/10.js
@@ -68,7 +69,6 @@ files:
68
69
  - vendor/assets/javascripts/webshims/shims/combos/22.js
69
70
  - vendor/assets/javascripts/webshims/shims/combos/23.js
70
71
  - vendor/assets/javascripts/webshims/shims/combos/25.js
71
- - vendor/assets/javascripts/webshims/shims/combos/26.js
72
72
  - vendor/assets/javascripts/webshims/shims/combos/27.js
73
73
  - vendor/assets/javascripts/webshims/shims/combos/28.js
74
74
  - vendor/assets/javascripts/webshims/shims/combos/29.js
@@ -91,7 +91,7 @@ files:
91
91
  - vendor/assets/javascripts/webshims/shims/es5.js
92
92
  - vendor/assets/javascripts/webshims/shims/es6.js
93
93
  - vendor/assets/javascripts/webshims/shims/excanvas.js
94
- - vendor/assets/javascripts/webshims/shims/filereader.js
94
+ - vendor/assets/javascripts/webshims/shims/filereader-xhr.js
95
95
  - vendor/assets/javascripts/webshims/shims/form-combat.js
96
96
  - vendor/assets/javascripts/webshims/shims/form-core.js
97
97
  - vendor/assets/javascripts/webshims/shims/form-datalist-lazy.js
@@ -132,7 +132,6 @@ files:
132
132
  - vendor/assets/javascripts/webshims/shims/i18n/formcfg-sv.js
133
133
  - vendor/assets/javascripts/webshims/shims/i18n/formcfg-zh-CN.js
134
134
  - vendor/assets/javascripts/webshims/shims/i18n/formcfg-zh-TW.js
135
- - vendor/assets/javascripts/webshims/shims/jajax.js
136
135
  - vendor/assets/javascripts/webshims/shims/jme/_icons.scss
137
136
  - vendor/assets/javascripts/webshims/shims/jme/alternate-media.js
138
137
  - vendor/assets/javascripts/webshims/shims/jme/base.js
@@ -159,6 +158,8 @@ files:
159
158
  - vendor/assets/javascripts/webshims/shims/jpicker/images/rangearrows.gif
160
159
  - vendor/assets/javascripts/webshims/shims/jpicker/jpicker.css
161
160
  - vendor/assets/javascripts/webshims/shims/matchMedia.js
161
+ - vendor/assets/javascripts/webshims/shims/mediacapture-picker.js
162
+ - vendor/assets/javascripts/webshims/shims/mediacapture.js
162
163
  - vendor/assets/javascripts/webshims/shims/mediaelement-core.js
163
164
  - vendor/assets/javascripts/webshims/shims/mediaelement-debug.js
164
165
  - vendor/assets/javascripts/webshims/shims/mediaelement-jaris.js
@@ -166,13 +167,13 @@ files:
166
167
  - vendor/assets/javascripts/webshims/shims/mediaelement-yt.js
167
168
  - vendor/assets/javascripts/webshims/shims/moxie/flash/Moxie.cdn.swf
168
169
  - vendor/assets/javascripts/webshims/shims/moxie/flash/Moxie.min.swf
169
- - vendor/assets/javascripts/webshims/shims/moxie/js/moxie.js
170
- - vendor/assets/javascripts/webshims/shims/moxie/silverlight/Moxie.cdn.xap
171
- - vendor/assets/javascripts/webshims/shims/moxie/silverlight/Moxie.min.xap
170
+ - vendor/assets/javascripts/webshims/shims/moxie/js/moxie-html4.js
171
+ - vendor/assets/javascripts/webshims/shims/moxie/js/moxie-swf.js
172
172
  - vendor/assets/javascripts/webshims/shims/picture.js
173
173
  - vendor/assets/javascripts/webshims/shims/plugins/jquery.ui.position.js
174
174
  - vendor/assets/javascripts/webshims/shims/range-ui.js
175
175
  - vendor/assets/javascripts/webshims/shims/sizzle.js
176
+ - vendor/assets/javascripts/webshims/shims/sticky.js
176
177
  - vendor/assets/javascripts/webshims/shims/styles/color-picker.png
177
178
  - vendor/assets/javascripts/webshims/shims/styles/forms-ext.css
178
179
  - vendor/assets/javascripts/webshims/shims/styles/forms-picker.css
@@ -1,1262 +0,0 @@
1
- (function(){
2
- var jQuery = window.webshims && webshims.$ || window.jQuery;
3
-
4
- var rnotwhite = (/\S+/g);
5
- var nonce = jQuery.now();
6
- var rquery = (/\?/);
7
- var init = jQuery.fn.init;
8
-
9
- jQuery.parseJSON = function( data ) {
10
- return window.JSON.parse( data + "" );
11
- };
12
-
13
- // Cross-browser xml parsing
14
- jQuery.parseXML = function( data ) {
15
- var xml, tmp;
16
- if ( !data || typeof data !== "string" ) {
17
- return null;
18
- }
19
- try {
20
- if ( window.DOMParser ) { // Standard
21
- tmp = new DOMParser();
22
- xml = tmp.parseFromString( data, "text/xml" );
23
- } else { // IE
24
- xml = new ActiveXObject( "Microsoft.XMLDOM" );
25
- xml.async = "false";
26
- xml.loadXML( data );
27
- }
28
- } catch( e ) {
29
- xml = undefined;
30
- }
31
- if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
32
- jQuery.error( "Invalid XML: " + data );
33
- }
34
- return xml;
35
- };
36
-
37
- (function(){
38
- var
39
- // Document location
40
- ajaxLocParts,
41
- ajaxLocation,
42
-
43
- rhash = /#.*$/,
44
- rts = /([?&])_=[^&]*/,
45
- rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
46
- // #7653, #8125, #8152: local protocol detection
47
- rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
48
- rnoContent = /^(?:GET|HEAD)$/,
49
- rprotocol = /^\/\//,
50
- rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
51
-
52
- /* Prefilters
53
- * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
54
- * 2) These are called:
55
- * - BEFORE asking for a transport
56
- * - AFTER param serialization (s.data is a string if s.processData is true)
57
- * 3) key is the dataType
58
- * 4) the catchall symbol "*" can be used
59
- * 5) execution will start with transport dataType and THEN continue down to "*" if needed
60
- */
61
- prefilters = {},
62
-
63
- /* Transports bindings
64
- * 1) key is the dataType
65
- * 2) the catchall symbol "*" can be used
66
- * 3) selection will start with transport dataType and THEN go to "*" if needed
67
- */
68
- transports = {},
69
-
70
- // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
71
- allTypes = "*/".concat("*");
72
-
73
- // #8138, IE may throw an exception when accessing
74
- // a field from window.location if document.domain has been set
75
- try {
76
- ajaxLocation = location.href;
77
- } catch( e ) {
78
- // Use the href attribute of an A element
79
- // since IE will modify it given document.location
80
- ajaxLocation = document.createElement( "a" );
81
- ajaxLocation.href = "";
82
- ajaxLocation = ajaxLocation.href;
83
- }
84
-
85
- // Segment location into parts
86
- ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
87
-
88
- // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
89
- function addToPrefiltersOrTransports( structure ) {
90
-
91
- // dataTypeExpression is optional and defaults to "*"
92
- return function( dataTypeExpression, func ) {
93
-
94
- if ( typeof dataTypeExpression !== "string" ) {
95
- func = dataTypeExpression;
96
- dataTypeExpression = "*";
97
- }
98
-
99
- var dataType,
100
- i = 0,
101
- dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
102
-
103
- if ( jQuery.isFunction( func ) ) {
104
- // For each dataType in the dataTypeExpression
105
- while ( (dataType = dataTypes[i++]) ) {
106
- // Prepend if requested
107
- if ( dataType.charAt( 0 ) === "+" ) {
108
- dataType = dataType.slice( 1 ) || "*";
109
- (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
110
-
111
- // Otherwise append
112
- } else {
113
- (structure[ dataType ] = structure[ dataType ] || []).push( func );
114
- }
115
- }
116
- }
117
- };
118
- }
119
-
120
- // Base inspection function for prefilters and transports
121
- function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
122
-
123
- var inspected = {},
124
- seekingTransport = ( structure === transports );
125
-
126
- function inspect( dataType ) {
127
- var selected;
128
- inspected[ dataType ] = true;
129
- jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
130
- var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
131
- if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
132
- options.dataTypes.unshift( dataTypeOrTransport );
133
- inspect( dataTypeOrTransport );
134
- return false;
135
- } else if ( seekingTransport ) {
136
- return !( selected = dataTypeOrTransport );
137
- }
138
- });
139
- return selected;
140
- }
141
-
142
- return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
143
- }
144
-
145
- // A special extend for ajax options
146
- // that takes "flat" options (not to be deep extended)
147
- // Fixes #9887
148
- function ajaxExtend( target, src ) {
149
- var deep, key,
150
- flatOptions = jQuery.ajaxSettings.flatOptions || {};
151
-
152
- for ( key in src ) {
153
- if ( src[ key ] !== undefined ) {
154
- ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
155
- }
156
- }
157
- if ( deep ) {
158
- jQuery.extend( true, target, deep );
159
- }
160
-
161
- return target;
162
- }
163
-
164
- /* Handles responses to an ajax request:
165
- * - finds the right dataType (mediates between content-type and expected dataType)
166
- * - returns the corresponding response
167
- */
168
- function ajaxHandleResponses( s, jqXHR, responses ) {
169
- var firstDataType, ct, finalDataType, type,
170
- contents = s.contents,
171
- dataTypes = s.dataTypes;
172
-
173
- // Remove auto dataType and get content-type in the process
174
- while ( dataTypes[ 0 ] === "*" ) {
175
- dataTypes.shift();
176
- if ( ct === undefined ) {
177
- ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
178
- }
179
- }
180
-
181
- // Check if we're dealing with a known content-type
182
- if ( ct ) {
183
- for ( type in contents ) {
184
- if ( contents[ type ] && contents[ type ].test( ct ) ) {
185
- dataTypes.unshift( type );
186
- break;
187
- }
188
- }
189
- }
190
-
191
- // Check to see if we have a response for the expected dataType
192
- if ( dataTypes[ 0 ] in responses ) {
193
- finalDataType = dataTypes[ 0 ];
194
- } else {
195
- // Try convertible dataTypes
196
- for ( type in responses ) {
197
- if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
198
- finalDataType = type;
199
- break;
200
- }
201
- if ( !firstDataType ) {
202
- firstDataType = type;
203
- }
204
- }
205
- // Or just use first one
206
- finalDataType = finalDataType || firstDataType;
207
- }
208
-
209
- // If we found a dataType
210
- // We add the dataType to the list if needed
211
- // and return the corresponding response
212
- if ( finalDataType ) {
213
- if ( finalDataType !== dataTypes[ 0 ] ) {
214
- dataTypes.unshift( finalDataType );
215
- }
216
- return responses[ finalDataType ];
217
- }
218
- }
219
-
220
- /* Chain conversions given the request and the original response
221
- * Also sets the responseXXX fields on the jqXHR instance
222
- */
223
- function ajaxConvert( s, response, jqXHR, isSuccess ) {
224
- var conv2, current, conv, tmp, prev,
225
- converters = {},
226
- // Work with a copy of dataTypes in case we need to modify it for conversion
227
- dataTypes = s.dataTypes.slice();
228
-
229
- // Create converters map with lowercased keys
230
- if ( dataTypes[ 1 ] ) {
231
- for ( conv in s.converters ) {
232
- converters[ conv.toLowerCase() ] = s.converters[ conv ];
233
- }
234
- }
235
-
236
- current = dataTypes.shift();
237
-
238
- // Convert to each sequential dataType
239
- while ( current ) {
240
-
241
- if ( s.responseFields[ current ] ) {
242
- jqXHR[ s.responseFields[ current ] ] = response;
243
- }
244
-
245
- // Apply the dataFilter if provided
246
- if ( !prev && isSuccess && s.dataFilter ) {
247
- response = s.dataFilter( response, s.dataType );
248
- }
249
-
250
- prev = current;
251
- current = dataTypes.shift();
252
-
253
- if ( current ) {
254
-
255
- // There's only work to do if current dataType is non-auto
256
- if ( current === "*" ) {
257
-
258
- current = prev;
259
-
260
- // Convert response if prev dataType is non-auto and differs from current
261
- } else if ( prev !== "*" && prev !== current ) {
262
-
263
- // Seek a direct converter
264
- conv = converters[ prev + " " + current ] || converters[ "* " + current ];
265
-
266
- // If none found, seek a pair
267
- if ( !conv ) {
268
- for ( conv2 in converters ) {
269
-
270
- // If conv2 outputs current
271
- tmp = conv2.split( " " );
272
- if ( tmp[ 1 ] === current ) {
273
-
274
- // If prev can be converted to accepted input
275
- conv = converters[ prev + " " + tmp[ 0 ] ] ||
276
- converters[ "* " + tmp[ 0 ] ];
277
- if ( conv ) {
278
- // Condense equivalence converters
279
- if ( conv === true ) {
280
- conv = converters[ conv2 ];
281
-
282
- // Otherwise, insert the intermediate dataType
283
- } else if ( converters[ conv2 ] !== true ) {
284
- current = tmp[ 0 ];
285
- dataTypes.unshift( tmp[ 1 ] );
286
- }
287
- break;
288
- }
289
- }
290
- }
291
- }
292
-
293
- // Apply converter (if not an equivalence)
294
- if ( conv !== true ) {
295
-
296
- // Unless errors are allowed to bubble, catch and return them
297
- if ( conv && s[ "throws" ] ) {
298
- response = conv( response );
299
- } else {
300
- try {
301
- response = conv( response );
302
- } catch ( e ) {
303
- return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
304
- }
305
- }
306
- }
307
- }
308
- }
309
- }
310
-
311
- return { state: "success", data: response };
312
- }
313
-
314
- jQuery.extend({
315
-
316
- // Counter for holding the number of active queries
317
- active: 0,
318
-
319
- // Last-Modified header cache for next request
320
- lastModified: {},
321
- etag: {},
322
-
323
- ajaxSettings: {
324
- url: ajaxLocation,
325
- type: "GET",
326
- isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
327
- global: true,
328
- processData: true,
329
- async: true,
330
- contentType: "application/x-www-form-urlencoded; charset=UTF-8",
331
- /*
332
- timeout: 0,
333
- data: null,
334
- dataType: null,
335
- username: null,
336
- password: null,
337
- cache: null,
338
- throws: false,
339
- traditional: false,
340
- headers: {},
341
- */
342
-
343
- accepts: {
344
- "*": allTypes,
345
- text: "text/plain",
346
- html: "text/html",
347
- xml: "application/xml, text/xml",
348
- json: "application/json, text/javascript"
349
- },
350
-
351
- contents: {
352
- xml: /xml/,
353
- html: /html/,
354
- json: /json/
355
- },
356
-
357
- responseFields: {
358
- xml: "responseXML",
359
- text: "responseText",
360
- json: "responseJSON"
361
- },
362
-
363
- // Data converters
364
- // Keys separate source (or catchall "*") and destination types with a single space
365
- converters: {
366
-
367
- // Convert anything to text
368
- "* text": String,
369
-
370
- // Text to html (true = no transformation)
371
- "text html": true,
372
-
373
- // Evaluate text as a json expression
374
- "text json": jQuery.parseJSON,
375
-
376
- // Parse text as xml
377
- "text xml": jQuery.parseXML
378
- },
379
-
380
- // For options that shouldn't be deep extended:
381
- // you can add your own custom options here if
382
- // and when you create one that shouldn't be
383
- // deep extended (see ajaxExtend)
384
- flatOptions: {
385
- url: true,
386
- context: true
387
- }
388
- },
389
-
390
- // Creates a full fledged settings object into target
391
- // with both ajaxSettings and settings fields.
392
- // If target is omitted, writes into ajaxSettings.
393
- ajaxSetup: function( target, settings ) {
394
- return settings ?
395
-
396
- // Building a settings object
397
- ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
398
-
399
- // Extending ajaxSettings
400
- ajaxExtend( jQuery.ajaxSettings, target );
401
- },
402
-
403
- ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
404
- ajaxTransport: addToPrefiltersOrTransports( transports ),
405
-
406
- // Main method
407
- ajax: function( url, options ) {
408
-
409
- // If url is an object, simulate pre-1.5 signature
410
- if ( typeof url === "object" ) {
411
- options = url;
412
- url = undefined;
413
- }
414
-
415
- // Force options to be an object
416
- options = options || {};
417
-
418
- var // Cross-domain detection vars
419
- parts,
420
- // Loop variable
421
- i,
422
- // URL without anti-cache param
423
- cacheURL,
424
- // Response headers as string
425
- responseHeadersString,
426
- // timeout handle
427
- timeoutTimer,
428
-
429
- // To know if global events are to be dispatched
430
- fireGlobals,
431
-
432
- transport,
433
- // Response headers
434
- responseHeaders,
435
- // Create the final options object
436
- s = jQuery.ajaxSetup( {}, options ),
437
- // Callbacks context
438
- callbackContext = s.context || s,
439
- // Context for global events is callbackContext if it is a DOM node or jQuery collection
440
- globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
441
- jQuery( callbackContext ) :
442
- jQuery.event,
443
- // Deferreds
444
- deferred = jQuery.Deferred(),
445
- completeDeferred = jQuery.Callbacks("once memory"),
446
- // Status-dependent callbacks
447
- statusCode = s.statusCode || {},
448
- // Headers (they are sent all at once)
449
- requestHeaders = {},
450
- requestHeadersNames = {},
451
- // The jqXHR state
452
- state = 0,
453
- // Default abort message
454
- strAbort = "canceled",
455
- // Fake xhr
456
- jqXHR = {
457
- readyState: 0,
458
-
459
- // Builds headers hashtable if needed
460
- getResponseHeader: function( key ) {
461
- var match;
462
- if ( state === 2 ) {
463
- if ( !responseHeaders ) {
464
- responseHeaders = {};
465
- while ( (match = rheaders.exec( responseHeadersString )) ) {
466
- responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
467
- }
468
- }
469
- match = responseHeaders[ key.toLowerCase() ];
470
- }
471
- return match == null ? null : match;
472
- },
473
-
474
- // Raw string
475
- getAllResponseHeaders: function() {
476
- return state === 2 ? responseHeadersString : null;
477
- },
478
-
479
- // Caches the header
480
- setRequestHeader: function( name, value ) {
481
- var lname = name.toLowerCase();
482
- if ( !state ) {
483
- name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
484
- requestHeaders[ name ] = value;
485
- }
486
- return this;
487
- },
488
-
489
- // Overrides response content-type header
490
- overrideMimeType: function( type ) {
491
- if ( !state ) {
492
- s.mimeType = type;
493
- }
494
- return this;
495
- },
496
-
497
- // Status-dependent callbacks
498
- statusCode: function( map ) {
499
- var code;
500
- if ( map ) {
501
- if ( state < 2 ) {
502
- for ( code in map ) {
503
- // Lazy-add the new callback in a way that preserves old ones
504
- statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
505
- }
506
- } else {
507
- // Execute the appropriate callbacks
508
- jqXHR.always( map[ jqXHR.status ] );
509
- }
510
- }
511
- return this;
512
- },
513
-
514
- // Cancel the request
515
- abort: function( statusText ) {
516
- var finalText = statusText || strAbort;
517
- if ( transport ) {
518
- transport.abort( finalText );
519
- }
520
- done( 0, finalText );
521
- return this;
522
- }
523
- };
524
-
525
- // Attach deferreds
526
- deferred.promise( jqXHR ).complete = completeDeferred.add;
527
- jqXHR.success = jqXHR.done;
528
- jqXHR.error = jqXHR.fail;
529
-
530
- // Remove hash character (#7531: and string promotion)
531
- // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
532
- // Handle falsy url in the settings object (#10093: consistency with old signature)
533
- // We also use the url parameter if available
534
- s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
535
-
536
- // Alias method option to type as per ticket #12004
537
- s.type = options.method || options.type || s.method || s.type;
538
-
539
- // Extract dataTypes list
540
- s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
541
-
542
- // A cross-domain request is in order when we have a protocol:host:port mismatch
543
- if ( s.crossDomain == null ) {
544
- parts = rurl.exec( s.url.toLowerCase() );
545
- s.crossDomain = !!( parts &&
546
- ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
547
- ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
548
- ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
549
- );
550
- }
551
-
552
- // Convert data if not already a string
553
- if ( s.data && s.processData && typeof s.data !== "string" ) {
554
- s.data = jQuery.param( s.data, s.traditional );
555
- }
556
-
557
- // Apply prefilters
558
- inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
559
-
560
- // If request was aborted inside a prefilter, stop there
561
- if ( state === 2 ) {
562
- return jqXHR;
563
- }
564
-
565
- // We can fire global events as of now if asked to
566
- fireGlobals = 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
- // #9682: remove data so that it's not used in an eventual retry
590
- delete s.data;
591
- }
592
-
593
- // Add anti-cache in url if needed
594
- if ( s.cache === false ) {
595
- s.url = rts.test( cacheURL ) ?
596
-
597
- // If there is already a '_' parameter, set its value
598
- cacheURL.replace( rts, "$1_=" + nonce++ ) :
599
-
600
- // Otherwise add one to the end
601
- cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
602
- }
603
- }
604
-
605
- // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
606
- if ( s.ifModified ) {
607
- if ( jQuery.lastModified[ cacheURL ] ) {
608
- jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
609
- }
610
- if ( jQuery.etag[ cacheURL ] ) {
611
- jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
612
- }
613
- }
614
-
615
- // Set the correct header, if data is being sent
616
- if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
617
- jqXHR.setRequestHeader( "Content-Type", s.contentType );
618
- }
619
-
620
- // Set the Accepts header for the server, depending on the dataType
621
- jqXHR.setRequestHeader(
622
- "Accept",
623
- s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
624
- s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
625
- s.accepts[ "*" ]
626
- );
627
-
628
- // Check for headers option
629
- for ( i in s.headers ) {
630
- jqXHR.setRequestHeader( i, s.headers[ i ] );
631
- }
632
-
633
- // Allow custom headers/mimetypes and early abort
634
- if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
635
- // Abort if not done already and return
636
- return jqXHR.abort();
637
- }
638
-
639
- // aborting is no longer a cancellation
640
- strAbort = "abort";
641
-
642
- // Install callbacks on deferreds
643
- for ( i in { success: 1, error: 1, complete: 1 } ) {
644
- jqXHR[ i ]( s[ i ] );
645
- }
646
-
647
- // Get transport
648
- transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
649
-
650
- // If no transport, we auto-abort
651
- if ( !transport ) {
652
- done( -1, "No Transport" );
653
- } else {
654
- jqXHR.readyState = 1;
655
-
656
- // Send global event
657
- if ( fireGlobals ) {
658
- globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
659
- }
660
- // Timeout
661
- if ( s.async && s.timeout > 0 ) {
662
- timeoutTimer = setTimeout(function() {
663
- jqXHR.abort("timeout");
664
- }, s.timeout );
665
- }
666
-
667
- try {
668
- state = 1;
669
- transport.send( requestHeaders, done );
670
- } catch ( e ) {
671
- // Propagate exception as error if not done
672
- if ( state < 2 ) {
673
- done( -1, e );
674
- // Simply rethrow otherwise
675
- } else {
676
- throw e;
677
- }
678
- }
679
- }
680
-
681
- // Callback for when everything is done
682
- function done( status, nativeStatusText, responses, headers ) {
683
- var isSuccess, success, error, response, modified,
684
- statusText = nativeStatusText;
685
-
686
- // Called once
687
- if ( state === 2 ) {
688
- return;
689
- }
690
-
691
- // State is "done" now
692
- state = 2;
693
-
694
- // Clear timeout if it exists
695
- if ( timeoutTimer ) {
696
- clearTimeout( timeoutTimer );
697
- }
698
-
699
- // Dereference transport for early garbage collection
700
- // (no matter how long the jqXHR object will be used)
701
- transport = undefined;
702
-
703
- // Cache response headers
704
- responseHeadersString = headers || "";
705
-
706
- // Set readyState
707
- jqXHR.readyState = status > 0 ? 4 : 0;
708
-
709
- // Determine if successful
710
- isSuccess = status >= 200 && status < 300 || status === 304;
711
-
712
- // Get response data
713
- if ( responses ) {
714
- response = ajaxHandleResponses( s, jqXHR, responses );
715
- }
716
-
717
- // Convert no matter what (that way responseXXX fields are always set)
718
- response = ajaxConvert( s, response, jqXHR, isSuccess );
719
-
720
- // If successful, handle type chaining
721
- if ( isSuccess ) {
722
-
723
- // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
724
- if ( s.ifModified ) {
725
- modified = jqXHR.getResponseHeader("Last-Modified");
726
- if ( modified ) {
727
- jQuery.lastModified[ cacheURL ] = modified;
728
- }
729
- modified = jqXHR.getResponseHeader("etag");
730
- if ( modified ) {
731
- jQuery.etag[ cacheURL ] = modified;
732
- }
733
- }
734
-
735
- // if no content
736
- if ( status === 204 || s.type === "HEAD" ) {
737
- statusText = "nocontent";
738
-
739
- // if not modified
740
- } else if ( status === 304 ) {
741
- statusText = "notmodified";
742
-
743
- // If we have data, let's convert it
744
- } else {
745
- statusText = response.state;
746
- success = response.data;
747
- error = response.error;
748
- isSuccess = !error;
749
- }
750
- } else {
751
- // We extract error from statusText
752
- // then normalize statusText and status for non-aborts
753
- error = statusText;
754
- if ( status || !statusText ) {
755
- statusText = "error";
756
- if ( status < 0 ) {
757
- status = 0;
758
- }
759
- }
760
- }
761
-
762
- // Set data for the fake xhr object
763
- jqXHR.status = status;
764
- jqXHR.statusText = ( nativeStatusText || statusText ) + "";
765
-
766
- // Success/Error
767
- if ( isSuccess ) {
768
- deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
769
- } else {
770
- deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
771
- }
772
-
773
- // Status-dependent callbacks
774
- jqXHR.statusCode( statusCode );
775
- statusCode = undefined;
776
-
777
- if ( fireGlobals ) {
778
- globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
779
- [ jqXHR, s, isSuccess ? success : error ] );
780
- }
781
-
782
- // Complete
783
- completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
784
-
785
- if ( fireGlobals ) {
786
- globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
787
- // Handle the global AJAX counter
788
- if ( !( --jQuery.active ) ) {
789
- jQuery.event.trigger("ajaxStop");
790
- }
791
- }
792
- }
793
-
794
- return jqXHR;
795
- },
796
-
797
- getJSON: function( url, data, callback ) {
798
- return jQuery.get( url, data, callback, "json" );
799
- },
800
-
801
- getScript: function( url, callback ) {
802
- return jQuery.get( url, undefined, callback, "script" );
803
- }
804
- });
805
-
806
- jQuery.each( [ "get", "post" ], function( i, method ) {
807
- jQuery[ method ] = function( url, data, callback, type ) {
808
- // shift arguments if data argument was omitted
809
- if ( jQuery.isFunction( data ) ) {
810
- type = type || callback;
811
- callback = data;
812
- data = undefined;
813
- }
814
-
815
- return jQuery.ajax({
816
- url: url,
817
- type: method,
818
- dataType: type,
819
- data: data,
820
- success: callback
821
- });
822
- };
823
- });
824
-
825
- // Attach a bunch of functions for handling common AJAX events
826
- jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) {
827
- jQuery.fn[ type ] = function( fn ) {
828
- return this.on( type, fn );
829
- };
830
- });
831
- })();
832
-
833
-
834
- (function(){
835
- var oldCallbacks = [],
836
- rjsonp = /(=)\?(?=&|$)|\?\?/;
837
-
838
- // Default jsonp settings
839
- jQuery.ajaxSetup({
840
- jsonp: "callback",
841
- jsonpCallback: function() {
842
- var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
843
- this[ callback ] = true;
844
- return callback;
845
- }
846
- });
847
-
848
- // Detect, normalize options and install callbacks for jsonp requests
849
- jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
850
-
851
- var callbackName, overwritten, responseContainer,
852
- jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
853
- "url" :
854
- typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
855
- );
856
-
857
- // Handle iff the expected data type is "jsonp" or we have a parameter to set
858
- if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
859
-
860
- // Get callback name, remembering preexisting value associated with it
861
- callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
862
- s.jsonpCallback() :
863
- s.jsonpCallback;
864
-
865
- // Insert callback into url or form data
866
- if ( jsonProp ) {
867
- s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
868
- } else if ( s.jsonp !== false ) {
869
- s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
870
- }
871
-
872
- // Use data converter to retrieve json after script execution
873
- s.converters["script json"] = function() {
874
- if ( !responseContainer ) {
875
- jQuery.error( callbackName + " was not called" );
876
- }
877
- return responseContainer[ 0 ];
878
- };
879
-
880
- // force json dataType
881
- s.dataTypes[ 0 ] = "json";
882
-
883
- // Install callback
884
- overwritten = window[ callbackName ];
885
- window[ callbackName ] = function() {
886
- responseContainer = arguments;
887
- };
888
-
889
- // Clean-up function (fires after converters)
890
- jqXHR.always(function() {
891
- // Restore preexisting value
892
- window[ callbackName ] = overwritten;
893
-
894
- // Save back as free
895
- if ( s[ callbackName ] ) {
896
- // make sure that re-using the options doesn't screw things around
897
- s.jsonpCallback = originalSettings.jsonpCallback;
898
-
899
- // save the callback name for future use
900
- oldCallbacks.push( callbackName );
901
- }
902
-
903
- // Call if it was a function and we have a response
904
- if ( responseContainer && jQuery.isFunction( overwritten ) ) {
905
- overwritten( responseContainer[ 0 ] );
906
- }
907
-
908
- responseContainer = overwritten = undefined;
909
- });
910
-
911
- // Delegate to script
912
- return "script";
913
- }
914
- });
915
- })();
916
-
917
- (function(){
918
- // Keep a copy of the old load method
919
- var _load = jQuery.fn.load;
920
-
921
- /**
922
- * Load a url into a page
923
- */
924
- jQuery.fn.load = function( url, params, callback ) {
925
- if ( typeof url !== "string" && _load ) {
926
- return _load.apply( this, arguments );
927
- }
928
-
929
- var selector, response, type,
930
- self = this,
931
- off = url.indexOf(" ");
932
-
933
- if ( off >= 0 ) {
934
- selector = url.slice( off, url.length );
935
- url = url.slice( 0, off );
936
- }
937
-
938
- // If it's a function
939
- if ( jQuery.isFunction( params ) ) {
940
-
941
- // We assume that it's the callback
942
- callback = params;
943
- params = undefined;
944
-
945
- // Otherwise, build a param string
946
- } else if ( params && typeof params === "object" ) {
947
- type = "POST";
948
- }
949
-
950
- // If we have elements to modify, make the request
951
- if ( self.length > 0 ) {
952
- jQuery.ajax({
953
- url: url,
954
-
955
- // if "type" variable is undefined, then "GET" method will be used
956
- type: type,
957
- dataType: "html",
958
- data: params
959
- }).done(function( responseText ) {
960
-
961
- // Save response for use in complete callback
962
- response = arguments;
963
-
964
- self.html( selector ?
965
-
966
- // If a selector was specified, locate the right elements in a dummy div
967
- // Exclude scripts to avoid IE 'Permission Denied' errors
968
- jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
969
-
970
- // Otherwise use the full result
971
- responseText );
972
-
973
- }).complete( callback && function( jqXHR, status ) {
974
- self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
975
- });
976
- }
977
-
978
- return this;
979
- };
980
-
981
- })();
982
- (function(){
983
- // Install script dataType
984
- jQuery.ajaxSetup({
985
- accepts: {
986
- script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
987
- },
988
- contents: {
989
- script: /(?:java|ecma)script/
990
- },
991
- converters: {
992
- "text script": function( text ) {
993
- jQuery.globalEval( text );
994
- return text;
995
- }
996
- }
997
- });
998
-
999
- // Handle cache's special case and global
1000
- jQuery.ajaxPrefilter( "script", function( s ) {
1001
- if ( s.cache === undefined ) {
1002
- s.cache = false;
1003
- }
1004
- if ( s.crossDomain ) {
1005
- s.type = "GET";
1006
- s.global = false;
1007
- }
1008
- });
1009
-
1010
- // Bind script tag hack transport
1011
- jQuery.ajaxTransport( "script", function(s) {
1012
-
1013
- // This transport only deals with cross domain requests
1014
- if ( s.crossDomain ) {
1015
-
1016
- var script,
1017
- head = document.head || jQuery("head")[0] || document.documentElement;
1018
-
1019
- return {
1020
-
1021
- send: function( _, callback ) {
1022
-
1023
- script = document.createElement("script");
1024
-
1025
- script.async = true;
1026
-
1027
- if ( s.scriptCharset ) {
1028
- script.charset = s.scriptCharset;
1029
- }
1030
-
1031
- script.src = s.url;
1032
-
1033
- // Attach handlers for all browsers
1034
- script.onload = script.onreadystatechange = function( _, isAbort ) {
1035
-
1036
- if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
1037
-
1038
- // Handle memory leak in IE
1039
- script.onload = script.onreadystatechange = null;
1040
-
1041
- // Remove the script
1042
- if ( script.parentNode ) {
1043
- script.parentNode.removeChild( script );
1044
- }
1045
-
1046
- // Dereference the script
1047
- script = null;
1048
-
1049
- // Callback if not abort
1050
- if ( !isAbort ) {
1051
- callback( 200, "success" );
1052
- }
1053
- }
1054
- };
1055
-
1056
- // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
1057
- // Use native DOM manipulation to avoid our domManip AJAX trickery
1058
- head.insertBefore( script, head.firstChild );
1059
- },
1060
-
1061
- abort: function() {
1062
- if ( script ) {
1063
- script.onload( undefined, true );
1064
- }
1065
- }
1066
- };
1067
- }
1068
- });
1069
- })();
1070
- (function(){
1071
- var support = jQuery.support;
1072
- // Create the request object
1073
- // (This is still attached to ajaxSettings for backward compatibility)
1074
- jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ?
1075
- // Support: IE6+
1076
- function() {
1077
-
1078
- // XHR cannot access local files, always use ActiveX for that case
1079
- return !this.isLocal &&
1080
-
1081
- // Support: IE7-8
1082
- // oldIE XHR does not support non-RFC2616 methods (#13240)
1083
- // See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx
1084
- // and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9
1085
- // Although this check for six methods instead of eight
1086
- // since IE also does not support "trace" and "connect"
1087
- /^(get|post|head|put|delete|options)$/i.test( this.type ) &&
1088
-
1089
- createStandardXHR() || createActiveXHR();
1090
- } :
1091
- // For all other browsers, use the standard XMLHttpRequest object
1092
- createStandardXHR;
1093
-
1094
- var xhrId = 0,
1095
- xhrCallbacks = {},
1096
- xhrSupported = jQuery.ajaxSettings.xhr();
1097
-
1098
- // Support: IE<10
1099
- // Open requests must be manually aborted on unload (#5280)
1100
- if ( window.ActiveXObject ) {
1101
- jQuery( window ).on( "unload", function() {
1102
- for ( var key in xhrCallbacks ) {
1103
- xhrCallbacks[ key ]( undefined, true );
1104
- }
1105
- });
1106
- }
1107
-
1108
- // Determine support properties
1109
- support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
1110
- xhrSupported = support.ajax = !!xhrSupported;
1111
-
1112
- // Create transport if the browser can provide an xhr
1113
- if ( xhrSupported ) {
1114
-
1115
- jQuery.ajaxTransport(function( options ) {
1116
- // Cross domain only allowed if supported through XMLHttpRequest
1117
- if ( !options.crossDomain || support.cors ) {
1118
-
1119
- var callback;
1120
-
1121
- return {
1122
- send: function( headers, complete ) {
1123
- var i,
1124
- xhr = options.xhr(),
1125
- id = ++xhrId;
1126
-
1127
- // Open the socket
1128
- xhr.open( options.type, options.url, options.async, options.username, options.password );
1129
-
1130
- // Apply custom fields if provided
1131
- if ( options.xhrFields ) {
1132
- for ( i in options.xhrFields ) {
1133
- xhr[ i ] = options.xhrFields[ i ];
1134
- }
1135
- }
1136
-
1137
- // Override mime type if needed
1138
- if ( options.mimeType && xhr.overrideMimeType ) {
1139
- xhr.overrideMimeType( options.mimeType );
1140
- }
1141
-
1142
- // X-Requested-With header
1143
- // For cross-domain requests, seeing as conditions for a preflight are
1144
- // akin to a jigsaw puzzle, we simply never set it to be sure.
1145
- // (it can always be set on a per-request basis or even using ajaxSetup)
1146
- // For same-domain requests, won't change header if already provided.
1147
- if ( !options.crossDomain && !headers["X-Requested-With"] ) {
1148
- headers["X-Requested-With"] = "XMLHttpRequest";
1149
- }
1150
-
1151
- // Set headers
1152
- for ( i in headers ) {
1153
- // Support: IE<9
1154
- // IE's ActiveXObject throws a 'Type Mismatch' exception when setting
1155
- // request header to a null-value.
1156
- //
1157
- // To keep consistent with other XHR implementations, cast the value
1158
- // to string and ignore `undefined`.
1159
- if ( headers[ i ] !== undefined ) {
1160
- xhr.setRequestHeader( i, headers[ i ] + "" );
1161
- }
1162
- }
1163
-
1164
- // Do send the request
1165
- // This may raise an exception which is actually
1166
- // handled in jQuery.ajax (so no try/catch here)
1167
- xhr.send( ( options.hasContent && options.data ) || null );
1168
-
1169
- // Listener
1170
- callback = function( _, isAbort ) {
1171
- var status, statusText, responses;
1172
-
1173
- // Was never called and is aborted or complete
1174
- if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
1175
- // Clean up
1176
- delete xhrCallbacks[ id ];
1177
- callback = undefined;
1178
- xhr.onreadystatechange = jQuery.noop;
1179
-
1180
- // Abort manually if needed
1181
- if ( isAbort ) {
1182
- if ( xhr.readyState !== 4 ) {
1183
- xhr.abort();
1184
- }
1185
- } else {
1186
- responses = {};
1187
- status = xhr.status;
1188
-
1189
- // Support: IE<10
1190
- // Accessing binary-data responseText throws an exception
1191
- // (#11426)
1192
- if ( typeof xhr.responseText === "string" ) {
1193
- responses.text = xhr.responseText;
1194
- }
1195
-
1196
- // Firefox throws an exception when accessing
1197
- // statusText for faulty cross-domain requests
1198
- try {
1199
- statusText = xhr.statusText;
1200
- } catch( e ) {
1201
- // We normalize with Webkit giving an empty statusText
1202
- statusText = "";
1203
- }
1204
-
1205
- // Filter status for non standard behaviors
1206
-
1207
- // If the request is local and we have data: assume a success
1208
- // (success with no data won't get notified, that's the best we
1209
- // can do given current implementations)
1210
- if ( !status && options.isLocal && !options.crossDomain ) {
1211
- status = responses.text ? 200 : 404;
1212
- // IE - #1450: sometimes returns 1223 when it should be 204
1213
- } else if ( status === 1223 ) {
1214
- status = 204;
1215
- }
1216
- }
1217
- }
1218
-
1219
- // Call complete if needed
1220
- if ( responses ) {
1221
- complete( status, statusText, responses, xhr.getAllResponseHeaders() );
1222
- }
1223
- };
1224
-
1225
- if ( !options.async ) {
1226
- // if we're in sync mode we fire the callback
1227
- callback();
1228
- } else if ( xhr.readyState === 4 ) {
1229
- // (IE6 & IE7) if it's in cache and has been
1230
- // retrieved directly we need to fire the callback
1231
- setTimeout( callback );
1232
- } else {
1233
- // Add to the list of active xhr callbacks
1234
- xhr.onreadystatechange = xhrCallbacks[ id ] = callback;
1235
- }
1236
- },
1237
-
1238
- abort: function() {
1239
- if ( callback ) {
1240
- callback( undefined, true );
1241
- }
1242
- }
1243
- };
1244
- }
1245
- });
1246
- }
1247
-
1248
- // Functions to create xhrs
1249
- function createStandardXHR() {
1250
- try {
1251
- return new window.XMLHttpRequest();
1252
- } catch( e ) {}
1253
- }
1254
-
1255
- function createActiveXHR() {
1256
- try {
1257
- return new window.ActiveXObject( "Microsoft.XMLHTTP" );
1258
- } catch( e ) {}
1259
- }
1260
- })();
1261
- webshims.isReady('jajax', true);
1262
- })();