guff-compass 0.7.0

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