corrade-nucleus-nucleons – Blame information for rev 20

Subversion Repositories:
Rev:
Rev Author Line No. Line
20 office 1 define([
2 "./var/arr",
3 "./var/slice",
4 "./var/concat",
5 "./var/push",
6 "./var/indexOf",
7 "./var/class2type",
8 "./var/toString",
9 "./var/hasOwn",
10 "./var/trim",
11 "./var/support"
12 ], function( arr, slice, concat, push, indexOf, class2type, toString, hasOwn, trim, support ) {
13  
14 var
15 // Use the correct document accordingly with window argument (sandbox)
16 document = window.document,
17  
18 version = "@VERSION",
19  
20 // Define a local copy of jQuery
21 jQuery = function( selector, context ) {
22 // The jQuery object is actually just the init constructor 'enhanced'
23 // Need init if jQuery is called (just allow error to be thrown if not included)
24 return new jQuery.fn.init( selector, context );
25 },
26  
27 // Matches dashed string for camelizing
28 rmsPrefix = /^-ms-/,
29 rdashAlpha = /-([\da-z])/gi,
30  
31 // Used by jQuery.camelCase as callback to replace()
32 fcamelCase = function( all, letter ) {
33 return letter.toUpperCase();
34 };
35  
36 jQuery.fn = jQuery.prototype = {
37 // The current version of jQuery being used
38 jquery: version,
39  
40 constructor: jQuery,
41  
42 // Start with an empty selector
43 selector: "",
44  
45 // The default length of a jQuery object is 0
46 length: 0,
47  
48 toArray: function() {
49 return slice.call( this );
50 },
51  
52 // Get the Nth element in the matched element set OR
53 // Get the whole matched element set as a clean array
54 get: function( num ) {
55 return num != null ?
56  
57 // Return a 'clean' array
58 ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
59  
60 // Return just the object
61 slice.call( this );
62 },
63  
64 // Take an array of elements and push it onto the stack
65 // (returning the new matched element set)
66 pushStack: function( elems ) {
67  
68 // Build a new jQuery matched element set
69 var ret = jQuery.merge( this.constructor(), elems );
70  
71 // Add the old object onto the stack (as a reference)
72 ret.prevObject = this;
73 ret.context = this.context;
74  
75 // Return the newly-formed element set
76 return ret;
77 },
78  
79 // Execute a callback for every element in the matched set.
80 // (You can seed the arguments with an array of args, but this is
81 // only used internally.)
82 each: function( callback, args ) {
83 return jQuery.each( this, callback, args );
84 },
85  
86 map: function( callback ) {
87 return this.pushStack( jQuery.map(this, function( elem, i ) {
88 return callback.call( elem, i, elem );
89 }));
90 },
91  
92 slice: function() {
93 return this.pushStack( slice.apply( this, arguments ) );
94 },
95  
96 first: function() {
97 return this.eq( 0 );
98 },
99  
100 last: function() {
101 return this.eq( -1 );
102 },
103  
104 eq: function( i ) {
105 var len = this.length,
106 j = +i + ( i < 0 ? len : 0 );
107 return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
108 },
109  
110 end: function() {
111 return this.prevObject || this.constructor(null);
112 },
113  
114 // For internal use only.
115 // Behaves like an Array's method, not like a jQuery method.
116 push: push,
117 sort: arr.sort,
118 splice: arr.splice
119 };
120  
121 jQuery.extend = jQuery.fn.extend = function() {
122 var options, name, src, copy, copyIsArray, clone,
123 target = arguments[0] || {},
124 i = 1,
125 length = arguments.length,
126 deep = false;
127  
128 // Handle a deep copy situation
129 if ( typeof target === "boolean" ) {
130 deep = target;
131  
132 // skip the boolean and the target
133 target = arguments[ i ] || {};
134 i++;
135 }
136  
137 // Handle case when target is a string or something (possible in deep copy)
138 if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
139 target = {};
140 }
141  
142 // extend jQuery itself if only one argument is passed
143 if ( i === length ) {
144 target = this;
145 i--;
146 }
147  
148 for ( ; i < length; i++ ) {
149 // Only deal with non-null/undefined values
150 if ( (options = arguments[ i ]) != null ) {
151 // Extend the base object
152 for ( name in options ) {
153 src = target[ name ];
154 copy = options[ name ];
155  
156 // Prevent never-ending loop
157 if ( target === copy ) {
158 continue;
159 }
160  
161 // Recurse if we're merging plain objects or arrays
162 if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
163 if ( copyIsArray ) {
164 copyIsArray = false;
165 clone = src && jQuery.isArray(src) ? src : [];
166  
167 } else {
168 clone = src && jQuery.isPlainObject(src) ? src : {};
169 }
170  
171 // Never move original objects, clone them
172 target[ name ] = jQuery.extend( deep, clone, copy );
173  
174 // Don't bring in undefined values
175 } else if ( copy !== undefined ) {
176 target[ name ] = copy;
177 }
178 }
179 }
180 }
181  
182 // Return the modified object
183 return target;
184 };
185  
186 jQuery.extend({
187 // Unique for each copy of jQuery on the page
188 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
189  
190 // Assume jQuery is ready without the ready module
191 isReady: true,
192  
193 error: function( msg ) {
194 throw new Error( msg );
195 },
196  
197 noop: function() {},
198  
199 // See test/unit/core.js for details concerning isFunction.
200 // Since version 1.3, DOM methods and functions like alert
201 // aren't supported. They return false on IE (#2968).
202 isFunction: function( obj ) {
203 return jQuery.type(obj) === "function";
204 },
205  
206 isArray: Array.isArray,
207  
208 isWindow: function( obj ) {
209 return obj != null && obj === obj.window;
210 },
211  
212 isNumeric: function( obj ) {
213 // parseFloat NaNs numeric-cast false positives (null|true|false|"")
214 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
215 // subtraction forces infinities to NaN
216 return obj - parseFloat( obj ) >= 0;
217 },
218  
219 isPlainObject: function( obj ) {
220 // Not plain objects:
221 // - Any object or value whose internal [[Class]] property is not "[object Object]"
222 // - DOM nodes
223 // - window
224 if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
225 return false;
226 }
227  
228 // Support: Firefox <20
229 // The try/catch suppresses exceptions thrown when attempting to access
230 // the "constructor" property of certain host objects, ie. |window.location|
231 // https://bugzilla.mozilla.org/show_bug.cgi?id=814622
232 try {
233 if ( obj.constructor &&
234 !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
235 return false;
236 }
237 } catch ( e ) {
238 return false;
239 }
240  
241 // If the function hasn't returned already, we're confident that
242 // |obj| is a plain object, created by {} or constructed with new Object
243 return true;
244 },
245  
246 isEmptyObject: function( obj ) {
247 var name;
248 for ( name in obj ) {
249 return false;
250 }
251 return true;
252 },
253  
254 type: function( obj ) {
255 if ( obj == null ) {
256 return obj + "";
257 }
258 // Support: Android < 4.0, iOS < 6 (functionish RegExp)
259 return typeof obj === "object" || typeof obj === "function" ?
260 class2type[ toString.call(obj) ] || "object" :
261 typeof obj;
262 },
263  
264 // Evaluates a script in a global context
265 globalEval: function( code ) {
266 var script,
267 indirect = eval;
268  
269 code = jQuery.trim( code );
270  
271 if ( code ) {
272 // If the code includes a valid, prologue position
273 // strict mode pragma, execute code by injecting a
274 // script tag into the document.
275 if ( code.indexOf("use strict") === 1 ) {
276 script = document.createElement("script");
277 script.text = code;
278 document.head.appendChild( script ).parentNode.removeChild( script );
279 } else {
280 // Otherwise, avoid the DOM node creation, insertion
281 // and removal by using an indirect global eval
282 indirect( code );
283 }
284 }
285 },
286  
287 // Convert dashed to camelCase; used by the css and data modules
288 // Microsoft forgot to hump their vendor prefix (#9572)
289 camelCase: function( string ) {
290 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
291 },
292  
293 nodeName: function( elem, name ) {
294 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
295 },
296  
297 // args is for internal usage only
298 each: function( obj, callback, args ) {
299 var value,
300 i = 0,
301 length = obj.length,
302 isArray = isArraylike( obj );
303  
304 if ( args ) {
305 if ( isArray ) {
306 for ( ; i < length; i++ ) {
307 value = callback.apply( obj[ i ], args );
308  
309 if ( value === false ) {
310 break;
311 }
312 }
313 } else {
314 for ( i in obj ) {
315 value = callback.apply( obj[ i ], args );
316  
317 if ( value === false ) {
318 break;
319 }
320 }
321 }
322  
323 // A special, fast, case for the most common use of each
324 } else {
325 if ( isArray ) {
326 for ( ; i < length; i++ ) {
327 value = callback.call( obj[ i ], i, obj[ i ] );
328  
329 if ( value === false ) {
330 break;
331 }
332 }
333 } else {
334 for ( i in obj ) {
335 value = callback.call( obj[ i ], i, obj[ i ] );
336  
337 if ( value === false ) {
338 break;
339 }
340 }
341 }
342 }
343  
344 return obj;
345 },
346  
347 trim: function( text ) {
348 return text == null ? "" : trim.call( text );
349 },
350  
351 // results is for internal usage only
352 makeArray: function( arr, results ) {
353 var ret = results || [];
354  
355 if ( arr != null ) {
356 if ( isArraylike( Object(arr) ) ) {
357 jQuery.merge( ret,
358 typeof arr === "string" ?
359 [ arr ] : arr
360 );
361 } else {
362 push.call( ret, arr );
363 }
364 }
365  
366 return ret;
367 },
368  
369 inArray: function( elem, arr, i ) {
370 return arr == null ? -1 : indexOf.call( arr, elem, i );
371 },
372  
373 merge: function( first, second ) {
374 var len = +second.length,
375 j = 0,
376 i = first.length;
377  
378 for ( ; j < len; j++ ) {
379 first[ i++ ] = second[ j ];
380 }
381  
382 first.length = i;
383  
384 return first;
385 },
386  
387 grep: function( elems, callback, invert ) {
388 var callbackInverse,
389 matches = [],
390 i = 0,
391 length = elems.length,
392 callbackExpect = !invert;
393  
394 // Go through the array, only saving the items
395 // that pass the validator function
396 for ( ; i < length; i++ ) {
397 callbackInverse = !callback( elems[ i ], i );
398 if ( callbackInverse !== callbackExpect ) {
399 matches.push( elems[ i ] );
400 }
401 }
402  
403 return matches;
404 },
405  
406 // arg is for internal usage only
407 map: function( elems, callback, arg ) {
408 var value,
409 i = 0,
410 length = elems.length,
411 isArray = isArraylike( elems ),
412 ret = [];
413  
414 // Go through the array, translating each of the items to their new values
415 if ( isArray ) {
416 for ( ; i < length; i++ ) {
417 value = callback( elems[ i ], i, arg );
418  
419 if ( value != null ) {
420 ret.push( value );
421 }
422 }
423  
424 // Go through every key on the object,
425 } else {
426 for ( i in elems ) {
427 value = callback( elems[ i ], i, arg );
428  
429 if ( value != null ) {
430 ret.push( value );
431 }
432 }
433 }
434  
435 // Flatten any nested arrays
436 return concat.apply( [], ret );
437 },
438  
439 // A global GUID counter for objects
440 guid: 1,
441  
442 // Bind a function to a context, optionally partially applying any
443 // arguments.
444 proxy: function( fn, context ) {
445 var tmp, args, proxy;
446  
447 if ( typeof context === "string" ) {
448 tmp = fn[ context ];
449 context = fn;
450 fn = tmp;
451 }
452  
453 // Quick check to determine if target is callable, in the spec
454 // this throws a TypeError, but we will just return undefined.
455 if ( !jQuery.isFunction( fn ) ) {
456 return undefined;
457 }
458  
459 // Simulated bind
460 args = slice.call( arguments, 2 );
461 proxy = function() {
462 return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
463 };
464  
465 // Set the guid of unique handler to the same of original handler, so it can be removed
466 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
467  
468 return proxy;
469 },
470  
471 now: Date.now,
472  
473 // jQuery.support is not used in Core but other projects attach their
474 // properties to it so it needs to exist.
475 support: support
476 });
477  
478 // Populate the class2type map
479 jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
480 class2type[ "[object " + name + "]" ] = name.toLowerCase();
481 });
482  
483 function isArraylike( obj ) {
484 var length = obj.length,
485 type = jQuery.type( obj );
486  
487 if ( type === "function" || jQuery.isWindow( obj ) ) {
488 return false;
489 }
490  
491 if ( obj.nodeType === 1 && length ) {
492 return true;
493 }
494  
495 return type === "array" || length === 0 ||
496 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
497 }
498  
499 return jQuery;
500 });