Add support for old jquery functions
hiromipaw

hiromipaw commited on 2017-06-16 12:11:50
Zeige 2 geänderte Dateien mit 499 Einfügungen und 0 Löschungen.

... ...
@@ -46,6 +46,7 @@
46 46
   <script type="text/javascript" src="../js/jquery.ba-bbq.min.js">
47 47
 /*  Source: https://raw.github.com/cowboy/jquery-bbq/v1.2.1/jquery.ba-bbq.js */
48 48
   </script>
49
+  <script type="text/javascript" src="../js/jquery-migrate-1.0.0.js"></script>
49 50
   <script type="text/javascript" src="../js/dlpage01.js">
50 51
 # /* Displays detected section */
51 52
   </script>
... ...
@@ -0,0 +1,498 @@
1
+/*!
2
+ * jQuery Migrate - v1.0.0 - 2013-01-14
3
+ * https://github.com/jquery/jquery-migrate
4
+ * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT
5
+ */
6
+(function( jQuery, window, undefined ) {
7
+"use strict";
8
+
9
+
10
+var warnedAbout = {};
11
+
12
+// List of warnings already given; public read only
13
+jQuery.migrateWarnings = [];
14
+
15
+// Set to true to prevent console output; migrateWarnings still maintained
16
+// jQuery.migrateMute = false;
17
+
18
+// Forget any warnings we've already given; public
19
+jQuery.migrateReset = function() {
20
+	warnedAbout = {};
21
+	jQuery.migrateWarnings.length = 0;
22
+};
23
+
24
+function migrateWarn( msg) {
25
+	if ( !warnedAbout[ msg ] ) {
26
+		warnedAbout[ msg ] = true;
27
+		jQuery.migrateWarnings.push( msg );
28
+		if ( window.console && console.warn && !jQuery.migrateMute ) {
29
+			console.warn( "JQMIGRATE: " + msg );
30
+		}
31
+	}
32
+}
33
+
34
+function migrateWarnProp( obj, prop, value, msg ) {
35
+	if ( Object.defineProperty ) {
36
+		// On ES5 browsers (non-oldIE), warn if the code tries to get prop;
37
+		// allow property to be overwritten in case some other plugin wants it
38
+		try {
39
+			Object.defineProperty( obj, prop, {
40
+				configurable: true,
41
+				enumerable: true,
42
+				get: function() {
43
+					migrateWarn( msg );
44
+					return value;
45
+				},
46
+				set: function( newValue ) {
47
+					migrateWarn( msg );
48
+					value = newValue;
49
+				}
50
+			});
51
+			return;
52
+		} catch( err ) {
53
+			// IE8 is a dope about Object.defineProperty, can't warn there
54
+		}
55
+	}
56
+
57
+	// Non-ES5 (or broken) browser; just set the property
58
+	jQuery._definePropertyBroken = true;
59
+	obj[ prop ] = value;
60
+}
61
+
62
+if ( document.compatMode === "BackCompat" ) {
63
+	// jQuery has never supported or tested Quirks Mode
64
+	migrateWarn( "jQuery is not compatible with Quirks Mode" );
65
+}
66
+
67
+
68
+var attrFn = {},
69
+	attr = jQuery.attr,
70
+	valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get ||
71
+		function() { return null; },
72
+	valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set ||
73
+		function() { return undefined; },
74
+	rnoType = /^(?:input|button)$/i,
75
+	rnoAttrNodeType = /^[238]$/,
76
+	rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
77
+	ruseDefault = /^(?:checked|selected)$/i;
78
+
79
+// jQuery.attrFn
80
+migrateWarnProp( jQuery, "attrFn", attrFn, "jQuery.attrFn is deprecated" );
81
+
82
+jQuery.attr = function( elem, name, value, pass ) {
83
+	var lowerName = name.toLowerCase(),
84
+		nType = elem && elem.nodeType;
85
+
86
+	if ( pass ) {
87
+		migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");
88
+		if ( elem && !rnoAttrNodeType.test( nType ) && jQuery.isFunction( jQuery.fn[ name ] ) ) {
89
+			return jQuery( elem )[ name ]( value );
90
+		}
91
+	}
92
+
93
+	// Warn if user tries to set `type` since it breaks on IE 6/7/8
94
+	if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) ) {
95
+		migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8");
96
+	}
97
+
98
+	// Restore boolHook for boolean property/attribute synchronization
99
+	if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) {
100
+		jQuery.attrHooks[ lowerName ] = {
101
+			get: function( elem, name ) {
102
+				// Align boolean attributes with corresponding properties
103
+				// Fall back to attribute presence where some booleans are not supported
104
+				var attrNode,
105
+					property = jQuery.prop( elem, name );
106
+				return property === true || typeof property !== "boolean" &&
107
+					( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
108
+
109
+					name.toLowerCase() :
110
+					undefined;
111
+			},
112
+			set: function( elem, value, name ) {
113
+				var propName;
114
+				if ( value === false ) {
115
+					// Remove boolean attributes when set to false
116
+					jQuery.removeAttr( elem, name );
117
+				} else {
118
+					// value is true since we know at this point it's type boolean and not false
119
+					// Set boolean attributes to the same name and set the DOM property
120
+					propName = jQuery.propFix[ name ] || name;
121
+					if ( propName in elem ) {
122
+						// Only set the IDL specifically if it already exists on the element
123
+						elem[ propName ] = true;
124
+					}
125
+
126
+					elem.setAttribute( name, name.toLowerCase() );
127
+				}
128
+				return name;
129
+			}
130
+		};
131
+
132
+		// Warn only for attributes that can remain distinct from their properties post-1.9
133
+		if ( ruseDefault.test( lowerName ) ) {
134
+			migrateWarn( "jQuery.fn.attr(" + lowerName + ") may use property instead of attribute" );
135
+		}
136
+	}
137
+
138
+	return attr.call( jQuery, elem, name, value );
139
+};
140
+
141
+// attrHooks: value
142
+jQuery.attrHooks.value = {
143
+	get: function( elem, name ) {
144
+		var nodeName = ( elem.nodeName || "" ).toLowerCase();
145
+		if ( nodeName === "button" ) {
146
+			return valueAttrGet.apply( this, arguments );
147
+		}
148
+		if ( nodeName !== "input" && nodeName !== "option" ) {
149
+			migrateWarn("property-based jQuery.fn.attr('value') is deprecated");
150
+		}
151
+		return name in elem ?
152
+			elem.value :
153
+			null;
154
+	},
155
+	set: function( elem, value ) {
156
+		var nodeName = ( elem.nodeName || "" ).toLowerCase();
157
+		if ( nodeName === "button" ) {
158
+			return valueAttrSet.apply( this, arguments );
159
+		}
160
+		if ( nodeName !== "input" && nodeName !== "option" ) {
161
+			migrateWarn("property-based jQuery.fn.attr('value', val) is deprecated");
162
+		}
163
+		// Does not return so that setAttribute is also used
164
+		elem.value = value;
165
+	}
166
+};
167
+
168
+
169
+var matched, browser,
170
+	oldInit = jQuery.fn.init,
171
+	// Note this does NOT include the # XSS fix from 1.7!
172
+	rquickExpr = /^(?:.*(<[\w\W]+>)[^>]*|#([\w\-]*))$/;
173
+
174
+// $(html) "looks like html" rule change
175
+jQuery.fn.init = function( selector, context, rootjQuery ) {
176
+	var match;
177
+
178
+	if ( selector && typeof selector === "string" && !jQuery.isPlainObject( context ) &&
179
+			(match = rquickExpr.exec( selector )) && match[1] ) {
180
+		// This is an HTML string according to the "old" rules; is it still?
181
+		if ( selector.charAt( 0 ) !== "<" ) {
182
+			migrateWarn("$(html) HTML strings must start with '<' character");
183
+		}
184
+		// Now process using loose rules; let pre-1.8 play too
185
+		if ( context && context.context ) {
186
+			// jQuery object as context; parseHTML expects a DOM object
187
+			context = context.context;
188
+		}
189
+		if ( jQuery.parseHTML ) {
190
+			return oldInit.call( this, jQuery.parseHTML( jQuery.trim(selector), context, true ),
191
+					context, rootjQuery );
192
+		}
193
+	}
194
+	return oldInit.apply( this, arguments );
195
+};
196
+jQuery.fn.init.prototype = jQuery.fn;
197
+
198
+jQuery.uaMatch = function( ua ) {
199
+	ua = ua.toLowerCase();
200
+
201
+	var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
202
+		/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
203
+		/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
204
+		/(msie) ([\w.]+)/.exec( ua ) ||
205
+		ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
206
+		[];
207
+
208
+	return {
209
+		browser: match[ 1 ] || "",
210
+		version: match[ 2 ] || "0"
211
+	};
212
+};
213
+
214
+matched = jQuery.uaMatch( navigator.userAgent );
215
+browser = {};
216
+
217
+if ( matched.browser ) {
218
+	browser[ matched.browser ] = true;
219
+	browser.version = matched.version;
220
+}
221
+
222
+// Chrome is Webkit, but Webkit is also Safari.
223
+if ( browser.chrome ) {
224
+	browser.webkit = true;
225
+} else if ( browser.webkit ) {
226
+	browser.safari = true;
227
+}
228
+
229
+jQuery.browser = browser;
230
+
231
+// Warn if the code tries to get jQuery.browser
232
+migrateWarnProp( jQuery, "browser", browser, "jQuery.browser is deprecated" );
233
+
234
+jQuery.sub = function() {
235
+	function jQuerySub( selector, context ) {
236
+		return new jQuerySub.fn.init( selector, context );
237
+	}
238
+	jQuery.extend( true, jQuerySub, this );
239
+	jQuerySub.superclass = this;
240
+	jQuerySub.fn = jQuerySub.prototype = this();
241
+	jQuerySub.fn.constructor = jQuerySub;
242
+	jQuerySub.sub = this.sub;
243
+	jQuerySub.fn.init = function init( selector, context ) {
244
+		if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
245
+			context = jQuerySub( context );
246
+		}
247
+
248
+		return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
249
+	};
250
+	jQuerySub.fn.init.prototype = jQuerySub.fn;
251
+	var rootjQuerySub = jQuerySub(document);
252
+	migrateWarn( "jQuery.sub() is deprecated" );
253
+	return jQuerySub;
254
+};
255
+
256
+
257
+var oldFnData = jQuery.fn.data;
258
+
259
+jQuery.fn.data = function( name ) {
260
+	var ret, evt,
261
+		elem = this[0];
262
+
263
+	// Handles 1.7 which has this behavior and 1.8 which doesn't
264
+	if ( elem && name === "events" && arguments.length === 1 ) {
265
+		ret = jQuery.data( elem, name );
266
+		evt = jQuery._data( elem, name );
267
+		if ( ( ret === undefined || ret === evt ) && evt !== undefined ) {
268
+			migrateWarn("Use of jQuery.fn.data('events') is deprecated");
269
+			return evt;
270
+		}
271
+	}
272
+	return oldFnData.apply( this, arguments );
273
+};
274
+
275
+
276
+var rscriptType = /\/(java|ecma)script/i,
277
+	oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack,
278
+	oldFragment = jQuery.buildFragment;
279
+
280
+jQuery.fn.andSelf = function() {
281
+	migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
282
+	return oldSelf.apply( this, arguments );
283
+};
284
+
285
+// Since jQuery.clean is used internally on older versions, we only shim if it's missing
286
+if ( !jQuery.clean ) {
287
+	jQuery.clean = function( elems, context, fragment, scripts ) {
288
+		// Set context per 1.8 logic
289
+		context = context || document;
290
+		context = !context.nodeType && context[0] || context;
291
+		context = context.ownerDocument || context;
292
+
293
+		migrateWarn("jQuery.clean() is deprecated");
294
+
295
+		var i, elem, handleScript, jsTags,
296
+			ret = [];
297
+
298
+		jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes );
299
+
300
+		// Complex logic lifted directly from jQuery 1.8
301
+		if ( fragment ) {
302
+			// Special handling of each script element
303
+			handleScript = function( elem ) {
304
+				// Check if we consider it executable
305
+				if ( !elem.type || rscriptType.test( elem.type ) ) {
306
+					// Detach the script and store it in the scripts array (if provided) or the fragment
307
+					// Return truthy to indicate that it has been handled
308
+					return scripts ?
309
+						scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
310
+						fragment.appendChild( elem );
311
+				}
312
+			};
313
+
314
+			for ( i = 0; (elem = ret[i]) != null; i++ ) {
315
+				// Check if we're done after handling an executable script
316
+				if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
317
+					// Append to fragment and handle embedded scripts
318
+					fragment.appendChild( elem );
319
+					if ( typeof elem.getElementsByTagName !== "undefined" ) {
320
+						// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
321
+						jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
322
+
323
+						// Splice the scripts into ret after their former ancestor and advance our index beyond them
324
+						ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
325
+						i += jsTags.length;
326
+					}
327
+				}
328
+			}
329
+		}
330
+
331
+		return ret;
332
+	};
333
+}
334
+
335
+jQuery.buildFragment = function( elems, context, scripts, selection ) {
336
+	var ret,
337
+		warning = "jQuery.buildFragment() is deprecated";
338
+
339
+	// Set context per 1.8 logic
340
+	context = context || document;
341
+	context = !context.nodeType && context[0] || context;
342
+	context = context.ownerDocument || context;
343
+
344
+	try {
345
+		ret = oldFragment.call( jQuery, elems, context, scripts, selection );
346
+
347
+	// jQuery < 1.8 required arrayish context; jQuery 1.9 fails on it
348
+	} catch( x ) {
349
+		ret = oldFragment.call( jQuery, elems, context.nodeType ? [ context ] : context[ 0 ], scripts, selection );
350
+
351
+		// Success from tweaking context means buildFragment was called by the user
352
+		migrateWarn( warning );
353
+	}
354
+
355
+	// jQuery < 1.9 returned an object instead of the fragment itself
356
+	if ( !ret.fragment ) {
357
+		migrateWarnProp( ret, "fragment", ret, warning );
358
+		migrateWarnProp( ret, "cacheable", false, warning );
359
+	}
360
+
361
+	return ret;
362
+};
363
+
364
+var eventAdd = jQuery.event.add,
365
+	eventRemove = jQuery.event.remove,
366
+	eventTrigger = jQuery.event.trigger,
367
+	oldToggle = jQuery.fn.toggle,
368
+	oldLive = jQuery.fn.live,
369
+	oldDie = jQuery.fn.die,
370
+	ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",
371
+	rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ),
372
+	rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
373
+	hoverHack = function( events ) {
374
+		if ( typeof( events ) != "string" || jQuery.event.special.hover ) {
375
+			return events;
376
+		}
377
+		if ( rhoverHack.test( events ) ) {
378
+			migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'");
379
+		}
380
+		return events && events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
381
+	};
382
+
383
+// Event props removed in 1.9, put them back if needed; no practical way to warn them
384
+if ( jQuery.event.props && jQuery.event.props[ 0 ] !== "attrChange" ) {
385
+	jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" );
386
+}
387
+
388
+// Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7
389
+migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" );
390
+
391
+// Support for 'hover' pseudo-event and ajax event warnings
392
+jQuery.event.add = function( elem, types, handler, data, selector ){
393
+	if ( elem !== document && rajaxEvent.test( types ) ) {
394
+		migrateWarn( "AJAX events should be attached to document: " + types );
395
+	}
396
+	eventAdd.call( this, elem, hoverHack( types || "" ), handler, data, selector );
397
+};
398
+jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
399
+	eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes );
400
+};
401
+
402
+jQuery.fn.error = function() {
403
+	var args = Array.prototype.slice.call( arguments, 0);
404
+	migrateWarn("jQuery.fn.error() is deprecated");
405
+	args.splice( 0, 0, "error" );
406
+	if ( arguments.length ) {
407
+		return this.bind.apply( this, args );
408
+	}
409
+	// error event should not bubble to window, although it does pre-1.7
410
+	this.triggerHandler.apply( this, args );
411
+	return this;
412
+};
413
+
414
+jQuery.fn.toggle = function( fn, fn2 ) {
415
+
416
+	// Don't mess with animation or css toggles
417
+	if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {
418
+		return oldToggle.apply( this, arguments );
419
+	}
420
+	migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");
421
+
422
+	// Save reference to arguments for access in closure
423
+	var args = arguments,
424
+		guid = fn.guid || jQuery.guid++,
425
+		i = 0,
426
+		toggler = function( event ) {
427
+			// Figure out which function to execute
428
+			var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
429
+			jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
430
+
431
+			// Make sure that clicks stop
432
+			event.preventDefault();
433
+
434
+			// and execute the function
435
+			return args[ lastToggle ].apply( this, arguments ) || false;
436
+		};
437
+
438
+	// link all the functions, so any of them can unbind this click handler
439
+	toggler.guid = guid;
440
+	while ( i < args.length ) {
441
+		args[ i++ ].guid = guid;
442
+	}
443
+
444
+	return this.click( toggler );
445
+};
446
+
447
+jQuery.fn.live = function( types, data, fn ) {
448
+	migrateWarn("jQuery.fn.live() is deprecated");
449
+	if ( oldLive ) {
450
+		return oldLive.apply( this, arguments );
451
+	}
452
+	jQuery( this.context ).on( types, this.selector, data, fn );
453
+	return this;
454
+};
455
+
456
+jQuery.fn.die = function( types, fn ) {
457
+	migrateWarn("jQuery.fn.die() is deprecated");
458
+	if ( oldDie ) {
459
+		return oldDie.apply( this, arguments );
460
+	}
461
+	jQuery( this.context ).off( types, this.selector || "**", fn );
462
+	return this;
463
+};
464
+
465
+// Turn global events into document-triggered events
466
+jQuery.event.trigger = function( event, data, elem, onlyHandlers  ){
467
+	if ( !elem & !rajaxEvent.test( event ) ) {
468
+		migrateWarn( "Global events are undocumented and deprecated" );
469
+	}
470
+	return eventTrigger.call( this,  event, data, elem || document, onlyHandlers  );
471
+};
472
+jQuery.each( ajaxEvents.split("|"),
473
+	function( _, name ) {
474
+		jQuery.event.special[ name ] = {
475
+			setup: function() {
476
+				var elem = this;
477
+
478
+				// The document needs no shimming; must be !== for oldIE
479
+				if ( elem !== document ) {
480
+					jQuery.event.add( document, name + "." + jQuery.guid, function() {
481
+						jQuery.event.trigger( name, null, elem, true );
482
+					});
483
+					jQuery._data( this, name, jQuery.guid++ );
484
+				}
485
+				return false;
486
+			},
487
+			teardown: function() {
488
+				if ( this !== document ) {
489
+					jQuery.event.remove( document, name + "." + jQuery._data( this, name ) );
490
+				}
491
+				return false;
492
+			}
493
+		};
494
+	}
495
+);
496
+
497
+
498
+})( jQuery, window );
0 499