@clappr/player 0.12.3 → 0.12.5
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.
- package/dist/clappr.js +1853 -1832
- package/dist/clappr.js.map +1 -1
- package/dist/clappr.min.js +1 -1
- package/dist/clappr.min.js.map +1 -1
- package/dist/clappr.plainhtml5.js +1851 -1830
- package/dist/clappr.plainhtml5.js.map +1 -1
- package/dist/clappr.plainhtml5.min.js +1 -1
- package/dist/clappr.plainhtml5.min.js.map +1 -1
- package/package.json +9 -4
package/dist/clappr.js
CHANGED
|
@@ -283,1842 +283,1863 @@
|
|
|
283
283
|
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0;
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
|
-
function getDefaultExportFromCjs$1(x) {
|
|
287
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
288
|
-
}
|
|
289
286
|
|
|
290
|
-
/*
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
};
|
|
361
|
-
zepto.matches = function (element, selector) {
|
|
362
|
-
if (!selector || !element || element.nodeType !== 1) return false;
|
|
363
|
-
var matchesSelector = element.matches || element.webkitMatchesSelector || element.mozMatchesSelector || element.oMatchesSelector || element.matchesSelector;
|
|
364
|
-
if (matchesSelector) return matchesSelector.call(element, selector);
|
|
365
|
-
// fall back to performing a selector:
|
|
366
|
-
var match,
|
|
367
|
-
parent = element.parentNode,
|
|
368
|
-
temp = !parent;
|
|
369
|
-
if (temp) (parent = tempParent).appendChild(element);
|
|
370
|
-
match = ~zepto.qsa(parent, selector).indexOf(element);
|
|
371
|
-
temp && tempParent.removeChild(element);
|
|
372
|
-
return match;
|
|
287
|
+
/*
|
|
288
|
+
* Permanent fork of Zepto v1.2.0 (modules: zepto ajax callbacks deferred event ie selector).
|
|
289
|
+
* Originally vendored by Thiago Pontes; now maintained in clappr/clappr.
|
|
290
|
+
* Do not regenerate from upstream — see LICENSE in this package.
|
|
291
|
+
*/
|
|
292
|
+
|
|
293
|
+
var Zepto = function () {
|
|
294
|
+
var undefined$1,
|
|
295
|
+
key,
|
|
296
|
+
$,
|
|
297
|
+
classList,
|
|
298
|
+
emptyArray = [],
|
|
299
|
+
concat = emptyArray.concat,
|
|
300
|
+
filter = emptyArray.filter,
|
|
301
|
+
slice = emptyArray.slice,
|
|
302
|
+
document = window.document,
|
|
303
|
+
elementDisplay = {},
|
|
304
|
+
classCache = {},
|
|
305
|
+
cssNumber = {
|
|
306
|
+
'column-count': 1,
|
|
307
|
+
'columns': 1,
|
|
308
|
+
'font-weight': 1,
|
|
309
|
+
'line-height': 1,
|
|
310
|
+
'opacity': 1,
|
|
311
|
+
'z-index': 1,
|
|
312
|
+
'zoom': 1
|
|
313
|
+
},
|
|
314
|
+
fragmentRE = /^\s*<(!|\w+(?!\w))[^>]*>/,
|
|
315
|
+
singleTagRE = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
|
|
316
|
+
tagExpanderRE = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)(?![\w:])(?:"[^"]*"|'[^']*'|\/(?!>)|[^>"'\/])*)\/>/ig,
|
|
317
|
+
rootNodeRE = /^(?:body|html)$/i,
|
|
318
|
+
capitalRE = /([A-Z])/g,
|
|
319
|
+
// special attributes that should be get/set via method calls
|
|
320
|
+
methodAttributes = ['val', 'css', 'html', 'text', 'data', 'width', 'height', 'offset'],
|
|
321
|
+
adjacencyOperators = ['after', 'prepend', 'before', 'append'],
|
|
322
|
+
table = document.createElement('table'),
|
|
323
|
+
tableRow = document.createElement('tr'),
|
|
324
|
+
containers = {
|
|
325
|
+
'tr': document.createElement('tbody'),
|
|
326
|
+
'tbody': table,
|
|
327
|
+
'thead': table,
|
|
328
|
+
'tfoot': table,
|
|
329
|
+
'td': tableRow,
|
|
330
|
+
'th': tableRow,
|
|
331
|
+
'*': document.createElement('div')
|
|
332
|
+
},
|
|
333
|
+
readyRE = /complete|loaded|interactive/,
|
|
334
|
+
simpleSelectorRE = /^[\w-]*$/,
|
|
335
|
+
class2type = {},
|
|
336
|
+
toString = class2type.toString,
|
|
337
|
+
zepto = {},
|
|
338
|
+
camelize,
|
|
339
|
+
uniq,
|
|
340
|
+
tempParent = document.createElement('div'),
|
|
341
|
+
propMap = {
|
|
342
|
+
'tabindex': 'tabIndex',
|
|
343
|
+
'readonly': 'readOnly',
|
|
344
|
+
'for': 'htmlFor',
|
|
345
|
+
'class': 'className',
|
|
346
|
+
'maxlength': 'maxLength',
|
|
347
|
+
'cellspacing': 'cellSpacing',
|
|
348
|
+
'cellpadding': 'cellPadding',
|
|
349
|
+
'rowspan': 'rowSpan',
|
|
350
|
+
'colspan': 'colSpan',
|
|
351
|
+
'usemap': 'useMap',
|
|
352
|
+
'frameborder': 'frameBorder',
|
|
353
|
+
'contenteditable': 'contentEditable'
|
|
354
|
+
},
|
|
355
|
+
isArray = Array.isArray || function (object) {
|
|
356
|
+
return object instanceof Array;
|
|
373
357
|
};
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
358
|
+
zepto.matches = function (element, selector) {
|
|
359
|
+
if (!selector || !element || element.nodeType !== 1) return false;
|
|
360
|
+
var matchesSelector = element.matches || element.webkitMatchesSelector || element.mozMatchesSelector || element.oMatchesSelector || element.matchesSelector;
|
|
361
|
+
if (matchesSelector) return matchesSelector.call(element, selector);
|
|
362
|
+
// fall back to performing a selector:
|
|
363
|
+
var match,
|
|
364
|
+
parent = element.parentNode,
|
|
365
|
+
temp = !parent;
|
|
366
|
+
if (temp) (parent = tempParent).appendChild(element);
|
|
367
|
+
match = ~zepto.qsa(parent, selector).indexOf(element);
|
|
368
|
+
temp && tempParent.removeChild(element);
|
|
369
|
+
return match;
|
|
370
|
+
};
|
|
371
|
+
function type(obj) {
|
|
372
|
+
return obj == null ? String(obj) : class2type[toString.call(obj)] || "object";
|
|
373
|
+
}
|
|
374
|
+
function isFunction(value) {
|
|
375
|
+
return type(value) == "function";
|
|
376
|
+
}
|
|
377
|
+
function isWindow(obj) {
|
|
378
|
+
return obj != null && obj == obj.window;
|
|
379
|
+
}
|
|
380
|
+
function isDocument(obj) {
|
|
381
|
+
return obj != null && obj.nodeType == obj.DOCUMENT_NODE;
|
|
382
|
+
}
|
|
383
|
+
function isObject(obj) {
|
|
384
|
+
return type(obj) == "object";
|
|
385
|
+
}
|
|
386
|
+
function isPlainObject(obj) {
|
|
387
|
+
return isObject(obj) && !isWindow(obj) && Object.getPrototypeOf(obj) == Object.prototype;
|
|
388
|
+
}
|
|
389
|
+
function likeArray(obj) {
|
|
390
|
+
var length = !!obj && 'length' in obj && obj.length,
|
|
391
|
+
type = $.type(obj);
|
|
392
|
+
return 'function' != type && !isWindow(obj) && ('array' == type || length === 0 || typeof length == 'number' && length > 0 && length - 1 in obj);
|
|
393
|
+
}
|
|
394
|
+
function compact(array) {
|
|
395
|
+
return filter.call(array, function (item) {
|
|
396
|
+
return item != null;
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
function flatten(array) {
|
|
400
|
+
return array.length > 0 ? $.fn.concat.apply([], array) : array;
|
|
401
|
+
}
|
|
402
|
+
camelize = function (str) {
|
|
403
|
+
return str.replace(/-+(.)?/g, function (match, chr) {
|
|
404
|
+
return chr ? chr.toUpperCase() : '';
|
|
405
|
+
});
|
|
406
|
+
};
|
|
407
|
+
function dasherize(str) {
|
|
408
|
+
return str.replace(/::/g, '/').replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2').replace(/([a-z\d])([A-Z])/g, '$1_$2').replace(/_/g, '-').toLowerCase();
|
|
409
|
+
}
|
|
410
|
+
uniq = function (array) {
|
|
411
|
+
return filter.call(array, function (item, idx) {
|
|
412
|
+
return array.indexOf(item) == idx;
|
|
413
|
+
});
|
|
414
|
+
};
|
|
415
|
+
function classRE(name) {
|
|
416
|
+
return name in classCache ? classCache[name] : classCache[name] = new RegExp('(^|\\s)' + name + '(\\s|$)');
|
|
417
|
+
}
|
|
418
|
+
function maybeAddPx(name, value) {
|
|
419
|
+
return typeof value == "number" && !cssNumber[dasherize(name)] ? value + "px" : value;
|
|
420
|
+
}
|
|
421
|
+
function defaultDisplay(nodeName) {
|
|
422
|
+
var element, display;
|
|
423
|
+
if (!elementDisplay[nodeName]) {
|
|
424
|
+
element = document.createElement(nodeName);
|
|
425
|
+
document.body.appendChild(element);
|
|
426
|
+
display = getComputedStyle(element, '').getPropertyValue("display");
|
|
427
|
+
element.parentNode.removeChild(element);
|
|
428
|
+
display == "none" && (display = "block");
|
|
429
|
+
elementDisplay[nodeName] = display;
|
|
430
|
+
}
|
|
431
|
+
return elementDisplay[nodeName];
|
|
432
|
+
}
|
|
433
|
+
function children(element) {
|
|
434
|
+
return 'children' in element ? slice.call(element.children) : $.map(element.childNodes, function (node) {
|
|
435
|
+
if (node.nodeType == 1) return node;
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
function Z(dom, selector) {
|
|
439
|
+
var i,
|
|
440
|
+
len = dom ? dom.length : 0;
|
|
441
|
+
for (i = 0; i < len; i++) this[i] = dom[i];
|
|
442
|
+
this.length = len;
|
|
443
|
+
this.selector = selector || '';
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// `$.zepto.fragment` takes a html string and an optional tag name
|
|
447
|
+
// to generate DOM nodes from the given html string.
|
|
448
|
+
// The generated DOM nodes are returned as an array.
|
|
449
|
+
// This function can be overridden in plugins for example to make
|
|
450
|
+
// it compatible with browsers that don't support the DOM fully.
|
|
451
|
+
zepto.fragment = function (html, name, properties) {
|
|
452
|
+
var dom, nodes, container, match;
|
|
453
|
+
|
|
454
|
+
// A special case optimization for a single tag
|
|
455
|
+
if (match = singleTagRE.exec(html)) dom = $(document.createElement(match[1]));
|
|
456
|
+
if (!dom) {
|
|
457
|
+
if (html.replace) html = html.replace(tagExpanderRE, "<$1></$2>");
|
|
458
|
+
// exec() yields null without a match; previously test() && RegExp.$1
|
|
459
|
+
// yielded false. Both fall through to name = '*' below.
|
|
460
|
+
if (name === undefined$1) name = (match = fragmentRE.exec(html)) && match[1];
|
|
461
|
+
// Own-property check: `in` walks the prototype (`toString`, etc.) and
|
|
462
|
+
// would make container a function — childNodes then throws TypeError.
|
|
463
|
+
if (!Object.prototype.hasOwnProperty.call(containers, name)) name = '*';
|
|
464
|
+
container = containers[name];
|
|
465
|
+
container.innerHTML = '' + html;
|
|
466
|
+
dom = $.each(slice.call(container.childNodes), function () {
|
|
467
|
+
container.removeChild(this);
|
|
408
468
|
});
|
|
409
|
-
};
|
|
410
|
-
function dasherize(str) {
|
|
411
|
-
return str.replace(/::/g, '/').replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2').replace(/([a-z\d])([A-Z])/g, '$1_$2').replace(/_/g, '-').toLowerCase();
|
|
412
469
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
};
|
|
418
|
-
function classRE(name) {
|
|
419
|
-
return name in classCache ? classCache[name] : classCache[name] = new RegExp('(^|\\s)' + name + '(\\s|$)');
|
|
420
|
-
}
|
|
421
|
-
function maybeAddPx(name, value) {
|
|
422
|
-
return typeof value == "number" && !cssNumber[dasherize(name)] ? value + "px" : value;
|
|
423
|
-
}
|
|
424
|
-
function defaultDisplay(nodeName) {
|
|
425
|
-
var element, display;
|
|
426
|
-
if (!elementDisplay[nodeName]) {
|
|
427
|
-
element = document.createElement(nodeName);
|
|
428
|
-
document.body.appendChild(element);
|
|
429
|
-
display = getComputedStyle(element, '').getPropertyValue("display");
|
|
430
|
-
element.parentNode.removeChild(element);
|
|
431
|
-
display == "none" && (display = "block");
|
|
432
|
-
elementDisplay[nodeName] = display;
|
|
433
|
-
}
|
|
434
|
-
return elementDisplay[nodeName];
|
|
435
|
-
}
|
|
436
|
-
function children(element) {
|
|
437
|
-
return 'children' in element ? slice.call(element.children) : $.map(element.childNodes, function (node) {
|
|
438
|
-
if (node.nodeType == 1) return node;
|
|
470
|
+
if (isPlainObject(properties)) {
|
|
471
|
+
nodes = $(dom);
|
|
472
|
+
$.each(properties, function (key, value) {
|
|
473
|
+
if (methodAttributes.indexOf(key) > -1) nodes[key](value);else nodes.attr(key, value);
|
|
439
474
|
});
|
|
440
475
|
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
len = dom ? dom.length : 0;
|
|
444
|
-
for (i = 0; i < len; i++) this[i] = dom[i];
|
|
445
|
-
this.length = len;
|
|
446
|
-
this.selector = selector || '';
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
// `$.zepto.fragment` takes a html string and an optional tag name
|
|
450
|
-
// to generate DOM nodes from the given html string.
|
|
451
|
-
// The generated DOM nodes are returned as an array.
|
|
452
|
-
// This function can be overridden in plugins for example to make
|
|
453
|
-
// it compatible with browsers that don't support the DOM fully.
|
|
454
|
-
zepto.fragment = function (html, name, properties) {
|
|
455
|
-
var dom, nodes, container;
|
|
456
|
-
|
|
457
|
-
// A special case optimization for a single tag
|
|
458
|
-
if (singleTagRE.test(html)) dom = $(document.createElement(RegExp.$1));
|
|
459
|
-
if (!dom) {
|
|
460
|
-
if (html.replace) html = html.replace(tagExpanderRE, "<$1></$2>");
|
|
461
|
-
if (name === undefined$1) name = fragmentRE.test(html) && RegExp.$1;
|
|
462
|
-
if (!(name in containers)) name = '*';
|
|
463
|
-
container = containers[name];
|
|
464
|
-
container.innerHTML = '' + html;
|
|
465
|
-
dom = $.each(slice.call(container.childNodes), function () {
|
|
466
|
-
container.removeChild(this);
|
|
467
|
-
});
|
|
468
|
-
}
|
|
469
|
-
if (isPlainObject(properties)) {
|
|
470
|
-
nodes = $(dom);
|
|
471
|
-
$.each(properties, function (key, value) {
|
|
472
|
-
if (methodAttributes.indexOf(key) > -1) nodes[key](value);else nodes.attr(key, value);
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
|
-
return dom;
|
|
476
|
-
};
|
|
476
|
+
return dom;
|
|
477
|
+
};
|
|
477
478
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
479
|
+
// `$.zepto.Z` swaps out the prototype of the given `dom` array
|
|
480
|
+
// of nodes with `$.fn` and thus supplying all the Zepto functions
|
|
481
|
+
// to the array. This method can be overridden in plugins.
|
|
482
|
+
zepto.Z = function (dom, selector) {
|
|
483
|
+
return new Z(dom, selector);
|
|
484
|
+
};
|
|
484
485
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
486
|
+
// `$.zepto.isZ` should return `true` if the given object is a Zepto
|
|
487
|
+
// collection. This method can be overridden in plugins.
|
|
488
|
+
zepto.isZ = function (object) {
|
|
489
|
+
return object instanceof zepto.Z;
|
|
490
|
+
};
|
|
490
491
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
492
|
+
// `$.zepto.init` is Zepto's counterpart to jQuery's `$.fn.init` and
|
|
493
|
+
// takes a CSS selector and an optional context (and handles various
|
|
494
|
+
// special cases).
|
|
495
|
+
// This method can be overridden in plugins.
|
|
496
|
+
zepto.init = function (selector, context) {
|
|
497
|
+
var dom, match;
|
|
498
|
+
// If nothing given, return an empty Zepto collection
|
|
499
|
+
if (!selector) return zepto.Z();
|
|
500
|
+
// Optimize for string selectors
|
|
501
|
+
else if (typeof selector == 'string') {
|
|
502
|
+
selector = selector.trim();
|
|
503
|
+
// If it's a html fragment, create nodes from it
|
|
504
|
+
// Note: In both Chrome 21 and Firefox 15, DOM error 12
|
|
505
|
+
// is thrown if the fragment doesn't begin with <
|
|
506
|
+
if (selector[0] == '<' && (match = fragmentRE.exec(selector))) dom = zepto.fragment(selector, match[1], context), selector = null;
|
|
507
|
+
// If there's a context, create a collection on that context first, and select
|
|
508
|
+
// nodes from there
|
|
509
|
+
else if (context !== undefined$1) return $(context).find(selector);
|
|
510
|
+
// If it's a CSS selector, use it to select nodes.
|
|
511
|
+
else dom = zepto.qsa(document, selector);
|
|
512
|
+
}
|
|
513
|
+
// If a function is given, call it when the DOM is ready
|
|
514
|
+
else if (isFunction(selector)) return $(document).ready(selector);
|
|
515
|
+
// If a Zepto collection is given, just return it
|
|
516
|
+
else if (zepto.isZ(selector)) return selector;else {
|
|
517
|
+
// normalize array if an array of nodes is given
|
|
518
|
+
if (isArray(selector)) dom = compact(selector);
|
|
519
|
+
// Wrap DOM nodes.
|
|
520
|
+
else if (isObject(selector)) dom = [selector], selector = null;
|
|
521
|
+
// If it's a html fragment, create nodes from it
|
|
522
|
+
else if (match = fragmentRE.exec(selector)) dom = zepto.fragment(selector.trim(), match[1], context), selector = null;
|
|
523
|
+
// If there's a context, create a collection on that context first, and select
|
|
524
|
+
// nodes from there
|
|
525
|
+
else if (context !== undefined$1) return $(context).find(selector);
|
|
526
|
+
// And last but no least, if it's a CSS selector, use it to select nodes.
|
|
527
|
+
else dom = zepto.qsa(document, selector);
|
|
528
|
+
}
|
|
529
|
+
// create a new Zepto collection from the nodes found
|
|
530
|
+
return zepto.Z(dom, selector);
|
|
531
|
+
};
|
|
531
532
|
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
533
|
+
// `$` will be the base `Zepto` object. When calling this
|
|
534
|
+
// function just call `$.zepto.init, which makes the implementation
|
|
535
|
+
// details of selecting nodes and creating Zepto collections
|
|
536
|
+
// patchable in plugins.
|
|
537
|
+
$ = function (selector, context) {
|
|
538
|
+
return zepto.init(selector, context);
|
|
539
|
+
};
|
|
540
|
+
function extend(target, source, deep) {
|
|
541
|
+
for (key in source) if (deep && (isPlainObject(source[key]) || isArray(source[key]))) {
|
|
542
|
+
if (isPlainObject(source[key]) && !isPlainObject(target[key])) target[key] = {};
|
|
543
|
+
if (isArray(source[key]) && !isArray(target[key])) target[key] = [];
|
|
544
|
+
extend(target[key], source[key], deep);
|
|
545
|
+
} else if (source[key] !== undefined$1) target[key] = source[key];
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
// Copy all but undefined properties from one or more
|
|
549
|
+
// objects to the `target` object.
|
|
550
|
+
$.extend = function (target) {
|
|
551
|
+
var deep,
|
|
552
|
+
args = slice.call(arguments, 1);
|
|
553
|
+
if (typeof target == 'boolean') {
|
|
554
|
+
deep = target;
|
|
555
|
+
target = args.shift();
|
|
556
|
+
}
|
|
557
|
+
args.forEach(function (arg) {
|
|
558
|
+
extend(target, arg, deep);
|
|
559
|
+
});
|
|
560
|
+
return target;
|
|
561
|
+
};
|
|
561
562
|
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
}
|
|
563
|
+
// `$.zepto.qsa` is Zepto's CSS selector implementation which
|
|
564
|
+
// uses `document.querySelectorAll` and optimizes for some special cases, like `#id`.
|
|
565
|
+
// This method can be overridden in plugins.
|
|
566
|
+
zepto.qsa = function (element, selector) {
|
|
567
|
+
var found,
|
|
568
|
+
maybeID = selector[0] == '#',
|
|
569
|
+
maybeClass = !maybeID && selector[0] == '.',
|
|
570
|
+
nameOnly = maybeID || maybeClass ? selector.slice(1) : selector,
|
|
571
|
+
// Ensure that a 1 char tag name still gets checked
|
|
572
|
+
isSimple = simpleSelectorRE.test(nameOnly);
|
|
573
|
+
return element.getElementById && isSimple && maybeID ?
|
|
574
|
+
// Safari DocumentFragment doesn't have getElementById
|
|
575
|
+
(found = element.getElementById(nameOnly)) ? [found] : [] : element.nodeType !== 1 && element.nodeType !== 9 && element.nodeType !== 11 ? [] : slice.call(isSimple && !maybeID && element.getElementsByClassName ?
|
|
576
|
+
// DocumentFragment doesn't have getElementsByClassName/TagName
|
|
577
|
+
maybeClass ? element.getElementsByClassName(nameOnly) :
|
|
578
|
+
// If it's simple, it could be a class
|
|
579
|
+
element.getElementsByTagName(selector) :
|
|
580
|
+
// Or a tag
|
|
581
|
+
element.querySelectorAll(selector) // Or it's not simple, and we need to query all
|
|
582
|
+
);
|
|
583
|
+
};
|
|
584
|
+
function filtered(nodes, selector) {
|
|
585
|
+
return selector == null ? $(nodes) : $(nodes).filter(selector);
|
|
586
|
+
}
|
|
587
|
+
$.contains = document.documentElement.contains ? function (parent, node) {
|
|
588
|
+
return parent !== node && parent.contains(node);
|
|
589
|
+
} : function (parent, node) {
|
|
590
|
+
while (node && (node = node.parentNode)) if (node === parent) return true;
|
|
591
|
+
return false;
|
|
592
|
+
};
|
|
593
|
+
function funcArg(context, arg, idx, payload) {
|
|
594
|
+
return isFunction(arg) ? arg.call(context, idx, payload) : arg;
|
|
595
|
+
}
|
|
596
|
+
function setAttribute(node, name, value) {
|
|
597
|
+
value == null ? node.removeAttribute(name) : node.setAttribute(name, value);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
// access className property while respecting SVGAnimatedString
|
|
601
|
+
function className(node, value) {
|
|
602
|
+
var klass = node.className || '',
|
|
603
|
+
svg = klass && klass.baseVal !== undefined$1;
|
|
604
|
+
if (value === undefined$1) return svg ? klass.baseVal : klass;
|
|
605
|
+
svg ? klass.baseVal = value : node.className = value;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
// "true" => true
|
|
609
|
+
// "false" => false
|
|
610
|
+
// "null" => null
|
|
611
|
+
// "42" => 42
|
|
612
|
+
// "42.5" => 42.5
|
|
613
|
+
// "08" => "08"
|
|
614
|
+
// JSON => parse if valid
|
|
615
|
+
// String => self
|
|
616
|
+
function deserializeValue(value) {
|
|
617
|
+
try {
|
|
618
|
+
return value ? value == "true" || (value == "false" ? false : value == "null" ? null : +value + "" == value ? +value : /^[\[\{]/.test(value) ? $.parseJSON(value) : value) : value;
|
|
619
|
+
} catch (e) {
|
|
620
|
+
return value;
|
|
621
621
|
}
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
622
|
+
}
|
|
623
|
+
$.type = type;
|
|
624
|
+
$.isFunction = isFunction;
|
|
625
|
+
$.isWindow = isWindow;
|
|
626
|
+
$.isArray = isArray;
|
|
627
|
+
$.isPlainObject = isPlainObject;
|
|
628
|
+
$.isEmptyObject = function (obj) {
|
|
629
|
+
var name;
|
|
630
|
+
for (name in obj) return false;
|
|
631
|
+
return true;
|
|
632
|
+
};
|
|
633
|
+
$.isNumeric = function (val) {
|
|
634
|
+
var num = Number(val),
|
|
635
|
+
type = typeof val;
|
|
636
|
+
return val != null && type != 'boolean' && (type != 'string' || val.length) && !isNaN(num) && isFinite(num) || false;
|
|
637
|
+
};
|
|
638
|
+
$.inArray = function (elem, array, i) {
|
|
639
|
+
return emptyArray.indexOf.call(array, elem, i);
|
|
640
|
+
};
|
|
641
|
+
$.camelCase = camelize;
|
|
642
|
+
$.trim = function (str) {
|
|
643
|
+
return str == null ? "" : String.prototype.trim.call(str);
|
|
644
|
+
};
|
|
644
645
|
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
646
|
+
// plugin compatibility
|
|
647
|
+
$.uuid = 0;
|
|
648
|
+
$.support = {};
|
|
649
|
+
$.expr = {};
|
|
650
|
+
$.noop = function () {};
|
|
651
|
+
$.map = function (elements, callback) {
|
|
652
|
+
var value,
|
|
653
|
+
values = [],
|
|
654
|
+
i,
|
|
655
|
+
key;
|
|
656
|
+
if (likeArray(elements)) for (i = 0; i < elements.length; i++) {
|
|
657
|
+
value = callback(elements[i], i);
|
|
658
|
+
if (value != null) values.push(value);
|
|
659
|
+
} else for (key in elements) {
|
|
660
|
+
value = callback(elements[key], key);
|
|
661
|
+
if (value != null) values.push(value);
|
|
662
|
+
}
|
|
663
|
+
return flatten(values);
|
|
664
|
+
};
|
|
665
|
+
$.each = function (elements, callback) {
|
|
666
|
+
var i, key;
|
|
667
|
+
if (likeArray(elements)) {
|
|
668
|
+
for (i = 0; i < elements.length; i++) if (callback.call(elements[i], i, elements[i]) === false) return elements;
|
|
669
|
+
} else {
|
|
670
|
+
for (key in elements) if (callback.call(elements[key], key, elements[key]) === false) return elements;
|
|
671
|
+
}
|
|
672
|
+
return elements;
|
|
673
|
+
};
|
|
674
|
+
$.grep = function (elements, callback) {
|
|
675
|
+
return filter.call(elements, callback);
|
|
676
|
+
};
|
|
677
|
+
if (window.JSON) $.parseJSON = JSON.parse;
|
|
677
678
|
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
679
|
+
// Populate the class2type map
|
|
680
|
+
$.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function (i, name) {
|
|
681
|
+
class2type["[object " + name + "]"] = name.toLowerCase();
|
|
682
|
+
});
|
|
682
683
|
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
684
|
+
// Define methods that will be available on all
|
|
685
|
+
// Zepto collections
|
|
686
|
+
$.fn = {
|
|
687
|
+
constructor: zepto.Z,
|
|
688
|
+
length: 0,
|
|
689
|
+
// Because a collection acts like an array
|
|
690
|
+
// copy over these useful array functions.
|
|
691
|
+
forEach: emptyArray.forEach,
|
|
692
|
+
reduce: emptyArray.reduce,
|
|
693
|
+
push: emptyArray.push,
|
|
694
|
+
sort: emptyArray.sort,
|
|
695
|
+
splice: emptyArray.splice,
|
|
696
|
+
indexOf: emptyArray.indexOf,
|
|
697
|
+
concat: function () {
|
|
698
|
+
var i,
|
|
699
|
+
value,
|
|
700
|
+
args = [];
|
|
701
|
+
for (i = 0; i < arguments.length; i++) {
|
|
702
|
+
value = arguments[i];
|
|
703
|
+
args[i] = zepto.isZ(value) ? value.toArray() : value;
|
|
704
|
+
}
|
|
705
|
+
return concat.apply(zepto.isZ(this) ? this.toArray() : this, args);
|
|
706
|
+
},
|
|
707
|
+
// `map` and `slice` in the jQuery API work differently
|
|
708
|
+
// from their array counterparts
|
|
709
|
+
map: function (fn) {
|
|
710
|
+
return $($.map(this, function (el, i) {
|
|
711
|
+
return fn.call(el, i, el);
|
|
712
|
+
}));
|
|
713
|
+
},
|
|
714
|
+
slice: function () {
|
|
715
|
+
return $(slice.apply(this, arguments));
|
|
716
|
+
},
|
|
717
|
+
ready: function (callback) {
|
|
718
|
+
// need to check if document.body exists for IE as that browser reports
|
|
719
|
+
// document ready when it hasn't yet created the body element
|
|
720
|
+
if (readyRE.test(document.readyState) && document.body) callback($);else document.addEventListener('DOMContentLoaded', function () {
|
|
721
|
+
callback($);
|
|
722
|
+
}, false);
|
|
723
|
+
return this;
|
|
724
|
+
},
|
|
725
|
+
get: function (idx) {
|
|
726
|
+
return idx === undefined$1 ? slice.call(this) : this[idx >= 0 ? idx : idx + this.length];
|
|
727
|
+
},
|
|
728
|
+
toArray: function () {
|
|
729
|
+
return this.get();
|
|
730
|
+
},
|
|
731
|
+
size: function () {
|
|
732
|
+
return this.length;
|
|
733
|
+
},
|
|
734
|
+
remove: function () {
|
|
735
|
+
return this.each(function () {
|
|
736
|
+
if (this.parentNode != null) this.parentNode.removeChild(this);
|
|
737
|
+
});
|
|
738
|
+
},
|
|
739
|
+
each: function (callback) {
|
|
740
|
+
emptyArray.every.call(this, function (el, idx) {
|
|
741
|
+
return callback.call(el, idx, el) !== false;
|
|
742
|
+
});
|
|
743
|
+
return this;
|
|
744
|
+
},
|
|
745
|
+
filter: function (selector) {
|
|
746
|
+
if (isFunction(selector)) return this.not(this.not(selector));
|
|
747
|
+
return $(filter.call(this, function (element) {
|
|
748
|
+
return zepto.matches(element, selector);
|
|
749
|
+
}));
|
|
750
|
+
},
|
|
751
|
+
add: function (selector, context) {
|
|
752
|
+
return $(uniq(this.concat($(selector, context))));
|
|
753
|
+
},
|
|
754
|
+
is: function (selector) {
|
|
755
|
+
return this.length > 0 && zepto.matches(this[0], selector);
|
|
756
|
+
},
|
|
757
|
+
not: function (selector) {
|
|
758
|
+
var nodes = [];
|
|
759
|
+
if (isFunction(selector) && selector.call !== undefined$1) this.each(function (idx) {
|
|
760
|
+
if (!selector.call(this, idx)) nodes.push(this);
|
|
761
|
+
});else {
|
|
762
|
+
var excludes = typeof selector == 'string' ? this.filter(selector) : likeArray(selector) && isFunction(selector.item) ? slice.call(selector) : $(selector);
|
|
763
|
+
this.forEach(function (el) {
|
|
764
|
+
if (excludes.indexOf(el) < 0) nodes.push(el);
|
|
736
765
|
});
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
766
|
+
}
|
|
767
|
+
return $(nodes);
|
|
768
|
+
},
|
|
769
|
+
has: function (selector) {
|
|
770
|
+
return this.filter(function () {
|
|
771
|
+
return isObject(selector) ? $.contains(this, selector) : $(this).find(selector).size();
|
|
772
|
+
});
|
|
773
|
+
},
|
|
774
|
+
eq: function (idx) {
|
|
775
|
+
return idx === -1 ? this.slice(idx) : this.slice(idx, +idx + 1);
|
|
776
|
+
},
|
|
777
|
+
first: function () {
|
|
778
|
+
var el = this[0];
|
|
779
|
+
return el && !isObject(el) ? el : $(el);
|
|
780
|
+
},
|
|
781
|
+
last: function () {
|
|
782
|
+
var el = this[this.length - 1];
|
|
783
|
+
return el && !isObject(el) ? el : $(el);
|
|
784
|
+
},
|
|
785
|
+
find: function (selector) {
|
|
786
|
+
var result,
|
|
787
|
+
$this = this;
|
|
788
|
+
if (!selector) result = $();else if (typeof selector == 'object') result = $(selector).filter(function () {
|
|
789
|
+
var node = this;
|
|
790
|
+
return emptyArray.some.call($this, function (parent) {
|
|
791
|
+
return $.contains(parent, node);
|
|
741
792
|
});
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
if (excludes.indexOf(el) < 0) nodes.push(el);
|
|
764
|
-
});
|
|
793
|
+
});else if (this.length == 1) result = $(zepto.qsa(this[0], selector));else result = this.map(function () {
|
|
794
|
+
return zepto.qsa(this, selector);
|
|
795
|
+
});
|
|
796
|
+
return result;
|
|
797
|
+
},
|
|
798
|
+
closest: function (selector, context) {
|
|
799
|
+
var nodes = [],
|
|
800
|
+
collection = typeof selector == 'object' && $(selector);
|
|
801
|
+
this.each(function (_, node) {
|
|
802
|
+
while (node && !(collection ? collection.indexOf(node) >= 0 : zepto.matches(node, selector))) node = node !== context && !isDocument(node) && node.parentNode;
|
|
803
|
+
if (node && nodes.indexOf(node) < 0) nodes.push(node);
|
|
804
|
+
});
|
|
805
|
+
return $(nodes);
|
|
806
|
+
},
|
|
807
|
+
parents: function (selector) {
|
|
808
|
+
var ancestors = [],
|
|
809
|
+
nodes = this;
|
|
810
|
+
while (nodes.length > 0) nodes = $.map(nodes, function (node) {
|
|
811
|
+
if ((node = node.parentNode) && !isDocument(node) && ancestors.indexOf(node) < 0) {
|
|
812
|
+
ancestors.push(node);
|
|
813
|
+
return node;
|
|
765
814
|
}
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
return
|
|
775
|
-
},
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
$this = this;
|
|
787
|
-
if (!selector) result = $();else if (typeof selector == 'object') result = $(selector).filter(function () {
|
|
788
|
-
var node = this;
|
|
789
|
-
return emptyArray.some.call($this, function (parent) {
|
|
790
|
-
return $.contains(parent, node);
|
|
791
|
-
});
|
|
792
|
-
});else if (this.length == 1) result = $(zepto.qsa(this[0], selector));else result = this.map(function () {
|
|
793
|
-
return zepto.qsa(this, selector);
|
|
794
|
-
});
|
|
795
|
-
return result;
|
|
796
|
-
},
|
|
797
|
-
closest: function (selector, context) {
|
|
798
|
-
var nodes = [],
|
|
799
|
-
collection = typeof selector == 'object' && $(selector);
|
|
800
|
-
this.each(function (_, node) {
|
|
801
|
-
while (node && !(collection ? collection.indexOf(node) >= 0 : zepto.matches(node, selector))) node = node !== context && !isDocument(node) && node.parentNode;
|
|
802
|
-
if (node && nodes.indexOf(node) < 0) nodes.push(node);
|
|
803
|
-
});
|
|
804
|
-
return $(nodes);
|
|
805
|
-
},
|
|
806
|
-
parents: function (selector) {
|
|
807
|
-
var ancestors = [],
|
|
808
|
-
nodes = this;
|
|
809
|
-
while (nodes.length > 0) nodes = $.map(nodes, function (node) {
|
|
810
|
-
if ((node = node.parentNode) && !isDocument(node) && ancestors.indexOf(node) < 0) {
|
|
811
|
-
ancestors.push(node);
|
|
812
|
-
return node;
|
|
813
|
-
}
|
|
815
|
+
});
|
|
816
|
+
return filtered(ancestors, selector);
|
|
817
|
+
},
|
|
818
|
+
parent: function (selector) {
|
|
819
|
+
return filtered(uniq(this.pluck('parentNode')), selector);
|
|
820
|
+
},
|
|
821
|
+
children: function (selector) {
|
|
822
|
+
return filtered(this.map(function () {
|
|
823
|
+
return children(this);
|
|
824
|
+
}), selector);
|
|
825
|
+
},
|
|
826
|
+
contents: function () {
|
|
827
|
+
return this.map(function () {
|
|
828
|
+
return this.contentDocument || slice.call(this.childNodes);
|
|
829
|
+
});
|
|
830
|
+
},
|
|
831
|
+
siblings: function (selector) {
|
|
832
|
+
return filtered(this.map(function (i, el) {
|
|
833
|
+
return filter.call(children(el.parentNode), function (child) {
|
|
834
|
+
return child !== el;
|
|
814
835
|
});
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
836
|
+
}), selector);
|
|
837
|
+
},
|
|
838
|
+
empty: function () {
|
|
839
|
+
return this.each(function () {
|
|
840
|
+
this.innerHTML = '';
|
|
841
|
+
});
|
|
842
|
+
},
|
|
843
|
+
// `pluck` is borrowed from Prototype.js
|
|
844
|
+
pluck: function (property) {
|
|
845
|
+
return $.map(this, function (el) {
|
|
846
|
+
return el[property];
|
|
847
|
+
});
|
|
848
|
+
},
|
|
849
|
+
show: function () {
|
|
850
|
+
return this.each(function () {
|
|
851
|
+
this.style.display == "none" && (this.style.display = '');
|
|
852
|
+
if (getComputedStyle(this, '').getPropertyValue("display") == "none") this.style.display = defaultDisplay(this.nodeName);
|
|
853
|
+
});
|
|
854
|
+
},
|
|
855
|
+
replaceWith: function (newContent) {
|
|
856
|
+
return this.before(newContent).remove();
|
|
857
|
+
},
|
|
858
|
+
wrap: function (structure) {
|
|
859
|
+
var func = isFunction(structure);
|
|
860
|
+
if (this[0] && !func) var dom = $(structure).get(0),
|
|
861
|
+
clone = dom.parentNode || this.length > 1;
|
|
862
|
+
return this.each(function (index) {
|
|
863
|
+
$(this).wrapAll(func ? structure.call(this, index) : clone ? dom.cloneNode(true) : dom);
|
|
864
|
+
});
|
|
865
|
+
},
|
|
866
|
+
wrapAll: function (structure) {
|
|
867
|
+
if (this[0]) {
|
|
868
|
+
$(this[0]).before(structure = $(structure));
|
|
869
|
+
var children;
|
|
870
|
+
// drill down to the inmost element
|
|
871
|
+
while ((children = structure.children()).length) structure = children.first();
|
|
872
|
+
$(structure).append(this);
|
|
873
|
+
}
|
|
874
|
+
return this;
|
|
875
|
+
},
|
|
876
|
+
wrapInner: function (structure) {
|
|
877
|
+
var func = isFunction(structure);
|
|
878
|
+
return this.each(function (index) {
|
|
879
|
+
var self = $(this),
|
|
880
|
+
contents = self.contents(),
|
|
881
|
+
dom = func ? structure.call(this, index) : structure;
|
|
882
|
+
contents.length ? contents.wrapAll(dom) : self.append(dom);
|
|
883
|
+
});
|
|
884
|
+
},
|
|
885
|
+
unwrap: function () {
|
|
886
|
+
this.parent().each(function () {
|
|
887
|
+
$(this).replaceWith($(this).children());
|
|
888
|
+
});
|
|
889
|
+
return this;
|
|
890
|
+
},
|
|
891
|
+
clone: function () {
|
|
892
|
+
return this.map(function () {
|
|
893
|
+
return this.cloneNode(true);
|
|
894
|
+
});
|
|
895
|
+
},
|
|
896
|
+
hide: function () {
|
|
897
|
+
return this.css("display", "none");
|
|
898
|
+
},
|
|
899
|
+
toggle: function (setting) {
|
|
900
|
+
return this.each(function () {
|
|
901
|
+
var el = $(this);
|
|
902
|
+
(setting === undefined$1 ? el.css("display") == "none" : setting) ? el.show() : el.hide();
|
|
903
|
+
});
|
|
904
|
+
},
|
|
905
|
+
prev: function (selector) {
|
|
906
|
+
return $(this.pluck('previousElementSibling')).filter(selector || '*');
|
|
907
|
+
},
|
|
908
|
+
next: function (selector) {
|
|
909
|
+
return $(this.pluck('nextElementSibling')).filter(selector || '*');
|
|
910
|
+
},
|
|
911
|
+
html: function (html) {
|
|
912
|
+
return 0 in arguments ? this.each(function (idx) {
|
|
913
|
+
var originHtml = this.innerHTML;
|
|
914
|
+
$(this).empty().append(funcArg(this, html, idx, originHtml));
|
|
915
|
+
}) : 0 in this ? this[0].innerHTML : null;
|
|
916
|
+
},
|
|
917
|
+
text: function (text) {
|
|
918
|
+
return 0 in arguments ? this.each(function (idx) {
|
|
919
|
+
var newText = funcArg(this, text, idx, this.textContent);
|
|
920
|
+
this.textContent = newText == null ? '' : '' + newText;
|
|
921
|
+
}) : 0 in this ? this.pluck('textContent').join("") : null;
|
|
922
|
+
},
|
|
923
|
+
attr: function (name, value) {
|
|
924
|
+
var result;
|
|
925
|
+
return typeof name == 'string' && !(1 in arguments) ? 0 in this && this[0].nodeType == 1 && (result = this[0].getAttribute(name)) != null ? result : undefined$1 : this.each(function (idx) {
|
|
926
|
+
if (this.nodeType !== 1) return;
|
|
927
|
+
if (isObject(name)) for (key in name) setAttribute(this, key, name[key]);else setAttribute(this, name, funcArg(this, value, idx, this.getAttribute(name)));
|
|
928
|
+
});
|
|
929
|
+
},
|
|
930
|
+
removeAttr: function (name) {
|
|
931
|
+
return this.each(function () {
|
|
932
|
+
this.nodeType === 1 && name.split(' ').forEach(function (attribute) {
|
|
933
|
+
setAttribute(this, attribute);
|
|
934
|
+
}, this);
|
|
935
|
+
});
|
|
936
|
+
},
|
|
937
|
+
prop: function (name, value) {
|
|
938
|
+
name = propMap[name] || name;
|
|
939
|
+
return 1 in arguments ? this.each(function (idx) {
|
|
940
|
+
this[name] = funcArg(this, value, idx, this[name]);
|
|
941
|
+
}) : this[0] && this[0][name];
|
|
942
|
+
},
|
|
943
|
+
removeProp: function (name) {
|
|
944
|
+
name = propMap[name] || name;
|
|
945
|
+
return this.each(function () {
|
|
946
|
+
delete this[name];
|
|
947
|
+
});
|
|
948
|
+
},
|
|
949
|
+
data: function (name, value) {
|
|
950
|
+
var attrName = 'data-' + name.replace(capitalRE, '-$1').toLowerCase();
|
|
951
|
+
var data = 1 in arguments ? this.attr(attrName, value) : this.attr(attrName);
|
|
952
|
+
return data !== null ? deserializeValue(data) : undefined$1;
|
|
953
|
+
},
|
|
954
|
+
val: function (value) {
|
|
955
|
+
if (0 in arguments) {
|
|
956
|
+
if (value == null) value = "";
|
|
957
|
+
return this.each(function (idx) {
|
|
958
|
+
this.value = funcArg(this, value, idx, this.value);
|
|
828
959
|
});
|
|
829
|
-
}
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
960
|
+
} else {
|
|
961
|
+
return this[0] && (this[0].multiple ? $(this[0]).find('option').filter(function () {
|
|
962
|
+
return this.selected;
|
|
963
|
+
}).pluck('value') : this[0].value);
|
|
964
|
+
}
|
|
965
|
+
},
|
|
966
|
+
offset: function (coordinates) {
|
|
967
|
+
if (coordinates) return this.each(function (index) {
|
|
968
|
+
var $this = $(this),
|
|
969
|
+
coords = funcArg(this, coordinates, index, $this.offset()),
|
|
970
|
+
parentOffset = $this.offsetParent().offset(),
|
|
971
|
+
props = {
|
|
972
|
+
top: coords.top - parentOffset.top,
|
|
973
|
+
left: coords.left - parentOffset.left
|
|
974
|
+
};
|
|
975
|
+
if ($this.css('position') == 'static') props['position'] = 'relative';
|
|
976
|
+
$this.css(props);
|
|
977
|
+
});
|
|
978
|
+
if (!this.length) return null;
|
|
979
|
+
if (document.documentElement !== this[0] && !$.contains(document.documentElement, this[0])) return {
|
|
980
|
+
top: 0,
|
|
981
|
+
left: 0
|
|
982
|
+
};
|
|
983
|
+
var obj = this[0].getBoundingClientRect();
|
|
984
|
+
return {
|
|
985
|
+
left: obj.left + window.pageXOffset,
|
|
986
|
+
top: obj.top + window.pageYOffset,
|
|
987
|
+
width: Math.round(obj.width),
|
|
988
|
+
height: Math.round(obj.height)
|
|
989
|
+
};
|
|
990
|
+
},
|
|
991
|
+
css: function (property, value) {
|
|
992
|
+
if (arguments.length < 2) {
|
|
993
|
+
var element = this[0];
|
|
994
|
+
if (typeof property == 'string') {
|
|
995
|
+
if (!element) return;
|
|
996
|
+
return element.style[camelize(property)] || getComputedStyle(element, '').getPropertyValue(property);
|
|
997
|
+
} else if (isArray(property)) {
|
|
998
|
+
if (!element) return;
|
|
999
|
+
var props = {};
|
|
1000
|
+
var computedStyle = getComputedStyle(element, '');
|
|
1001
|
+
$.each(property, function (_, prop) {
|
|
1002
|
+
props[prop] = element.style[camelize(prop)] || computedStyle.getPropertyValue(prop);
|
|
834
1003
|
});
|
|
835
|
-
|
|
836
|
-
},
|
|
837
|
-
empty: function () {
|
|
838
|
-
return this.each(function () {
|
|
839
|
-
this.innerHTML = '';
|
|
840
|
-
});
|
|
841
|
-
},
|
|
842
|
-
// `pluck` is borrowed from Prototype.js
|
|
843
|
-
pluck: function (property) {
|
|
844
|
-
return $.map(this, function (el) {
|
|
845
|
-
return el[property];
|
|
846
|
-
});
|
|
847
|
-
},
|
|
848
|
-
show: function () {
|
|
849
|
-
return this.each(function () {
|
|
850
|
-
this.style.display == "none" && (this.style.display = '');
|
|
851
|
-
if (getComputedStyle(this, '').getPropertyValue("display") == "none") this.style.display = defaultDisplay(this.nodeName);
|
|
852
|
-
});
|
|
853
|
-
},
|
|
854
|
-
replaceWith: function (newContent) {
|
|
855
|
-
return this.before(newContent).remove();
|
|
856
|
-
},
|
|
857
|
-
wrap: function (structure) {
|
|
858
|
-
var func = isFunction(structure);
|
|
859
|
-
if (this[0] && !func) var dom = $(structure).get(0),
|
|
860
|
-
clone = dom.parentNode || this.length > 1;
|
|
861
|
-
return this.each(function (index) {
|
|
862
|
-
$(this).wrapAll(func ? structure.call(this, index) : clone ? dom.cloneNode(true) : dom);
|
|
863
|
-
});
|
|
864
|
-
},
|
|
865
|
-
wrapAll: function (structure) {
|
|
866
|
-
if (this[0]) {
|
|
867
|
-
$(this[0]).before(structure = $(structure));
|
|
868
|
-
var children;
|
|
869
|
-
// drill down to the inmost element
|
|
870
|
-
while ((children = structure.children()).length) structure = children.first();
|
|
871
|
-
$(structure).append(this);
|
|
1004
|
+
return props;
|
|
872
1005
|
}
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
});
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
this.
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
return 0 in arguments ? this.each(function (idx) {
|
|
918
|
-
var newText = funcArg(this, text, idx, this.textContent);
|
|
919
|
-
this.textContent = newText == null ? '' : '' + newText;
|
|
920
|
-
}) : 0 in this ? this.pluck('textContent').join("") : null;
|
|
921
|
-
},
|
|
922
|
-
attr: function (name, value) {
|
|
923
|
-
var result;
|
|
924
|
-
return typeof name == 'string' && !(1 in arguments) ? 0 in this && this[0].nodeType == 1 && (result = this[0].getAttribute(name)) != null ? result : undefined$1 : this.each(function (idx) {
|
|
925
|
-
if (this.nodeType !== 1) return;
|
|
926
|
-
if (isObject(name)) for (key in name) setAttribute(this, key, name[key]);else setAttribute(this, name, funcArg(this, value, idx, this.getAttribute(name)));
|
|
927
|
-
});
|
|
928
|
-
},
|
|
929
|
-
removeAttr: function (name) {
|
|
930
|
-
return this.each(function () {
|
|
931
|
-
this.nodeType === 1 && name.split(' ').forEach(function (attribute) {
|
|
932
|
-
setAttribute(this, attribute);
|
|
933
|
-
}, this);
|
|
934
|
-
});
|
|
935
|
-
},
|
|
936
|
-
prop: function (name, value) {
|
|
937
|
-
name = propMap[name] || name;
|
|
938
|
-
return 1 in arguments ? this.each(function (idx) {
|
|
939
|
-
this[name] = funcArg(this, value, idx, this[name]);
|
|
940
|
-
}) : this[0] && this[0][name];
|
|
941
|
-
},
|
|
942
|
-
removeProp: function (name) {
|
|
943
|
-
name = propMap[name] || name;
|
|
944
|
-
return this.each(function () {
|
|
945
|
-
delete this[name];
|
|
1006
|
+
}
|
|
1007
|
+
var css = '';
|
|
1008
|
+
if (type(property) == 'string') {
|
|
1009
|
+
if (!value && value !== 0) this.each(function () {
|
|
1010
|
+
this.style.removeProperty(dasherize(property));
|
|
1011
|
+
});else css = dasherize(property) + ":" + maybeAddPx(property, value);
|
|
1012
|
+
} else {
|
|
1013
|
+
for (key in property) if (!property[key] && property[key] !== 0) this.each(function () {
|
|
1014
|
+
this.style.removeProperty(dasherize(key));
|
|
1015
|
+
});else css += dasherize(key) + ':' + maybeAddPx(key, property[key]) + ';';
|
|
1016
|
+
}
|
|
1017
|
+
return this.each(function () {
|
|
1018
|
+
this.style.cssText += ';' + css;
|
|
1019
|
+
});
|
|
1020
|
+
},
|
|
1021
|
+
index: function (element) {
|
|
1022
|
+
return element ? this.indexOf($(element)[0]) : this.parent().children().indexOf(this[0]);
|
|
1023
|
+
},
|
|
1024
|
+
hasClass: function (name) {
|
|
1025
|
+
if (!name) return false;
|
|
1026
|
+
return emptyArray.some.call(this, function (el) {
|
|
1027
|
+
return this.test(className(el));
|
|
1028
|
+
}, classRE(name));
|
|
1029
|
+
},
|
|
1030
|
+
addClass: function (name) {
|
|
1031
|
+
if (!name) return this;
|
|
1032
|
+
return this.each(function (idx) {
|
|
1033
|
+
if (!('className' in this)) return;
|
|
1034
|
+
classList = [];
|
|
1035
|
+
var cls = className(this),
|
|
1036
|
+
newName = funcArg(this, name, idx, cls);
|
|
1037
|
+
newName.split(/\s+/g).forEach(function (klass) {
|
|
1038
|
+
if (!$(this).hasClass(klass)) classList.push(klass);
|
|
1039
|
+
}, this);
|
|
1040
|
+
classList.length && className(this, cls + (cls ? " " : "") + classList.join(" "));
|
|
1041
|
+
});
|
|
1042
|
+
},
|
|
1043
|
+
removeClass: function (name) {
|
|
1044
|
+
return this.each(function (idx) {
|
|
1045
|
+
if (!('className' in this)) return;
|
|
1046
|
+
if (name === undefined$1) return className(this, '');
|
|
1047
|
+
classList = className(this);
|
|
1048
|
+
funcArg(this, name, idx, classList).split(/\s+/g).forEach(function (klass) {
|
|
1049
|
+
classList = classList.replace(classRE(klass), " ");
|
|
946
1050
|
});
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
this.value = funcArg(this, value, idx, this.value);
|
|
958
|
-
});
|
|
959
|
-
} else {
|
|
960
|
-
return this[0] && (this[0].multiple ? $(this[0]).find('option').filter(function () {
|
|
961
|
-
return this.selected;
|
|
962
|
-
}).pluck('value') : this[0].value);
|
|
963
|
-
}
|
|
964
|
-
},
|
|
965
|
-
offset: function (coordinates) {
|
|
966
|
-
if (coordinates) return this.each(function (index) {
|
|
967
|
-
var $this = $(this),
|
|
968
|
-
coords = funcArg(this, coordinates, index, $this.offset()),
|
|
969
|
-
parentOffset = $this.offsetParent().offset(),
|
|
970
|
-
props = {
|
|
971
|
-
top: coords.top - parentOffset.top,
|
|
972
|
-
left: coords.left - parentOffset.left
|
|
973
|
-
};
|
|
974
|
-
if ($this.css('position') == 'static') props['position'] = 'relative';
|
|
975
|
-
$this.css(props);
|
|
1051
|
+
className(this, classList.trim());
|
|
1052
|
+
});
|
|
1053
|
+
},
|
|
1054
|
+
toggleClass: function (name, when) {
|
|
1055
|
+
if (!name) return this;
|
|
1056
|
+
return this.each(function (idx) {
|
|
1057
|
+
var $this = $(this),
|
|
1058
|
+
names = funcArg(this, name, idx, className(this));
|
|
1059
|
+
names.split(/\s+/g).forEach(function (klass) {
|
|
1060
|
+
(when === undefined$1 ? !$this.hasClass(klass) : when) ? $this.addClass(klass) : $this.removeClass(klass);
|
|
976
1061
|
});
|
|
977
|
-
|
|
978
|
-
|
|
1062
|
+
});
|
|
1063
|
+
},
|
|
1064
|
+
scrollTop: function (value) {
|
|
1065
|
+
if (!this.length) return;
|
|
1066
|
+
var hasScrollTop = 'scrollTop' in this[0];
|
|
1067
|
+
if (value === undefined$1) return hasScrollTop ? this[0].scrollTop : this[0].pageYOffset;
|
|
1068
|
+
return this.each(hasScrollTop ? function () {
|
|
1069
|
+
this.scrollTop = value;
|
|
1070
|
+
} : function () {
|
|
1071
|
+
this.scrollTo(this.scrollX, value);
|
|
1072
|
+
});
|
|
1073
|
+
},
|
|
1074
|
+
scrollLeft: function (value) {
|
|
1075
|
+
if (!this.length) return;
|
|
1076
|
+
var hasScrollLeft = 'scrollLeft' in this[0];
|
|
1077
|
+
if (value === undefined$1) return hasScrollLeft ? this[0].scrollLeft : this[0].pageXOffset;
|
|
1078
|
+
return this.each(hasScrollLeft ? function () {
|
|
1079
|
+
this.scrollLeft = value;
|
|
1080
|
+
} : function () {
|
|
1081
|
+
this.scrollTo(value, this.scrollY);
|
|
1082
|
+
});
|
|
1083
|
+
},
|
|
1084
|
+
position: function () {
|
|
1085
|
+
if (!this.length) return;
|
|
1086
|
+
var elem = this[0],
|
|
1087
|
+
// Get *real* offsetParent
|
|
1088
|
+
offsetParent = this.offsetParent(),
|
|
1089
|
+
// Get correct offsets
|
|
1090
|
+
offset = this.offset(),
|
|
1091
|
+
parentOffset = rootNodeRE.test(offsetParent[0].nodeName) ? {
|
|
979
1092
|
top: 0,
|
|
980
1093
|
left: 0
|
|
981
|
-
};
|
|
982
|
-
var obj = this[0].getBoundingClientRect();
|
|
983
|
-
return {
|
|
984
|
-
left: obj.left + window.pageXOffset,
|
|
985
|
-
top: obj.top + window.pageYOffset,
|
|
986
|
-
width: Math.round(obj.width),
|
|
987
|
-
height: Math.round(obj.height)
|
|
988
|
-
};
|
|
989
|
-
},
|
|
990
|
-
css: function (property, value) {
|
|
991
|
-
if (arguments.length < 2) {
|
|
992
|
-
var element = this[0];
|
|
993
|
-
if (typeof property == 'string') {
|
|
994
|
-
if (!element) return;
|
|
995
|
-
return element.style[camelize(property)] || getComputedStyle(element, '').getPropertyValue(property);
|
|
996
|
-
} else if (isArray(property)) {
|
|
997
|
-
if (!element) return;
|
|
998
|
-
var props = {};
|
|
999
|
-
var computedStyle = getComputedStyle(element, '');
|
|
1000
|
-
$.each(property, function (_, prop) {
|
|
1001
|
-
props[prop] = element.style[camelize(prop)] || computedStyle.getPropertyValue(prop);
|
|
1002
|
-
});
|
|
1003
|
-
return props;
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
var css = '';
|
|
1007
|
-
if (type(property) == 'string') {
|
|
1008
|
-
if (!value && value !== 0) this.each(function () {
|
|
1009
|
-
this.style.removeProperty(dasherize(property));
|
|
1010
|
-
});else css = dasherize(property) + ":" + maybeAddPx(property, value);
|
|
1011
|
-
} else {
|
|
1012
|
-
for (key in property) if (!property[key] && property[key] !== 0) this.each(function () {
|
|
1013
|
-
this.style.removeProperty(dasherize(key));
|
|
1014
|
-
});else css += dasherize(key) + ':' + maybeAddPx(key, property[key]) + ';';
|
|
1015
|
-
}
|
|
1016
|
-
return this.each(function () {
|
|
1017
|
-
this.style.cssText += ';' + css;
|
|
1018
|
-
});
|
|
1019
|
-
},
|
|
1020
|
-
index: function (element) {
|
|
1021
|
-
return element ? this.indexOf($(element)[0]) : this.parent().children().indexOf(this[0]);
|
|
1022
|
-
},
|
|
1023
|
-
hasClass: function (name) {
|
|
1024
|
-
if (!name) return false;
|
|
1025
|
-
return emptyArray.some.call(this, function (el) {
|
|
1026
|
-
return this.test(className(el));
|
|
1027
|
-
}, classRE(name));
|
|
1028
|
-
},
|
|
1029
|
-
addClass: function (name) {
|
|
1030
|
-
if (!name) return this;
|
|
1031
|
-
return this.each(function (idx) {
|
|
1032
|
-
if (!('className' in this)) return;
|
|
1033
|
-
classList = [];
|
|
1034
|
-
var cls = className(this),
|
|
1035
|
-
newName = funcArg(this, name, idx, cls);
|
|
1036
|
-
newName.split(/\s+/g).forEach(function (klass) {
|
|
1037
|
-
if (!$(this).hasClass(klass)) classList.push(klass);
|
|
1038
|
-
}, this);
|
|
1039
|
-
classList.length && className(this, cls + (cls ? " " : "") + classList.join(" "));
|
|
1040
|
-
});
|
|
1041
|
-
},
|
|
1042
|
-
removeClass: function (name) {
|
|
1043
|
-
return this.each(function (idx) {
|
|
1044
|
-
if (!('className' in this)) return;
|
|
1045
|
-
if (name === undefined$1) return className(this, '');
|
|
1046
|
-
classList = className(this);
|
|
1047
|
-
funcArg(this, name, idx, classList).split(/\s+/g).forEach(function (klass) {
|
|
1048
|
-
classList = classList.replace(classRE(klass), " ");
|
|
1049
|
-
});
|
|
1050
|
-
className(this, classList.trim());
|
|
1051
|
-
});
|
|
1052
|
-
},
|
|
1053
|
-
toggleClass: function (name, when) {
|
|
1054
|
-
if (!name) return this;
|
|
1055
|
-
return this.each(function (idx) {
|
|
1056
|
-
var $this = $(this),
|
|
1057
|
-
names = funcArg(this, name, idx, className(this));
|
|
1058
|
-
names.split(/\s+/g).forEach(function (klass) {
|
|
1059
|
-
(when === undefined$1 ? !$this.hasClass(klass) : when) ? $this.addClass(klass) : $this.removeClass(klass);
|
|
1060
|
-
});
|
|
1061
|
-
});
|
|
1062
|
-
},
|
|
1063
|
-
scrollTop: function (value) {
|
|
1064
|
-
if (!this.length) return;
|
|
1065
|
-
var hasScrollTop = 'scrollTop' in this[0];
|
|
1066
|
-
if (value === undefined$1) return hasScrollTop ? this[0].scrollTop : this[0].pageYOffset;
|
|
1067
|
-
return this.each(hasScrollTop ? function () {
|
|
1068
|
-
this.scrollTop = value;
|
|
1069
|
-
} : function () {
|
|
1070
|
-
this.scrollTo(this.scrollX, value);
|
|
1071
|
-
});
|
|
1072
|
-
},
|
|
1073
|
-
scrollLeft: function (value) {
|
|
1074
|
-
if (!this.length) return;
|
|
1075
|
-
var hasScrollLeft = 'scrollLeft' in this[0];
|
|
1076
|
-
if (value === undefined$1) return hasScrollLeft ? this[0].scrollLeft : this[0].pageXOffset;
|
|
1077
|
-
return this.each(hasScrollLeft ? function () {
|
|
1078
|
-
this.scrollLeft = value;
|
|
1079
|
-
} : function () {
|
|
1080
|
-
this.scrollTo(value, this.scrollY);
|
|
1081
|
-
});
|
|
1082
|
-
},
|
|
1083
|
-
position: function () {
|
|
1084
|
-
if (!this.length) return;
|
|
1085
|
-
var elem = this[0],
|
|
1086
|
-
// Get *real* offsetParent
|
|
1087
|
-
offsetParent = this.offsetParent(),
|
|
1088
|
-
// Get correct offsets
|
|
1089
|
-
offset = this.offset(),
|
|
1090
|
-
parentOffset = rootNodeRE.test(offsetParent[0].nodeName) ? {
|
|
1091
|
-
top: 0,
|
|
1092
|
-
left: 0
|
|
1093
|
-
} : offsetParent.offset();
|
|
1094
|
-
|
|
1095
|
-
// Subtract element margins
|
|
1096
|
-
// note: when an element has margin: auto the offsetLeft and marginLeft
|
|
1097
|
-
// are the same in Safari causing offset.left to incorrectly be 0
|
|
1098
|
-
offset.top -= parseFloat($(elem).css('margin-top')) || 0;
|
|
1099
|
-
offset.left -= parseFloat($(elem).css('margin-left')) || 0;
|
|
1100
|
-
|
|
1101
|
-
// Add offsetParent borders
|
|
1102
|
-
parentOffset.top += parseFloat($(offsetParent[0]).css('border-top-width')) || 0;
|
|
1103
|
-
parentOffset.left += parseFloat($(offsetParent[0]).css('border-left-width')) || 0;
|
|
1104
|
-
|
|
1105
|
-
// Subtract the two offsets
|
|
1106
|
-
return {
|
|
1107
|
-
top: offset.top - parentOffset.top,
|
|
1108
|
-
left: offset.left - parentOffset.left
|
|
1109
|
-
};
|
|
1110
|
-
},
|
|
1111
|
-
offsetParent: function () {
|
|
1112
|
-
return this.map(function () {
|
|
1113
|
-
var parent = this.offsetParent || document.body;
|
|
1114
|
-
while (parent && !rootNodeRE.test(parent.nodeName) && $(parent).css("position") == "static") parent = parent.offsetParent;
|
|
1115
|
-
return parent;
|
|
1116
|
-
});
|
|
1117
|
-
}
|
|
1118
|
-
};
|
|
1094
|
+
} : offsetParent.offset();
|
|
1119
1095
|
|
|
1120
|
-
|
|
1121
|
-
|
|
1096
|
+
// Subtract element margins
|
|
1097
|
+
// note: when an element has margin: auto the offsetLeft and marginLeft
|
|
1098
|
+
// are the same in Safari causing offset.left to incorrectly be 0
|
|
1099
|
+
offset.top -= parseFloat($(elem).css('margin-top')) || 0;
|
|
1100
|
+
offset.left -= parseFloat($(elem).css('margin-left')) || 0;
|
|
1122
1101
|
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
el = this[0];
|
|
1132
|
-
if (value === undefined$1) return isWindow(el) ? el['inner' + dimensionProperty] : isDocument(el) ? el.documentElement['scroll' + dimensionProperty] : (offset = this.offset()) && offset[dimension];else return this.each(function (idx) {
|
|
1133
|
-
el = $(this);
|
|
1134
|
-
el.css(dimension, funcArg(this, value, idx, el[dimension]()));
|
|
1135
|
-
});
|
|
1102
|
+
// Add offsetParent borders
|
|
1103
|
+
parentOffset.top += parseFloat($(offsetParent[0]).css('border-top-width')) || 0;
|
|
1104
|
+
parentOffset.left += parseFloat($(offsetParent[0]).css('border-left-width')) || 0;
|
|
1105
|
+
|
|
1106
|
+
// Subtract the two offsets
|
|
1107
|
+
return {
|
|
1108
|
+
top: offset.top - parentOffset.top,
|
|
1109
|
+
left: offset.left - parentOffset.left
|
|
1136
1110
|
};
|
|
1111
|
+
},
|
|
1112
|
+
offsetParent: function () {
|
|
1113
|
+
return this.map(function () {
|
|
1114
|
+
var parent = this.offsetParent || document.body;
|
|
1115
|
+
while (parent && !rootNodeRE.test(parent.nodeName) && $(parent).css("position") == "static") parent = parent.offsetParent;
|
|
1116
|
+
return parent;
|
|
1117
|
+
});
|
|
1118
|
+
}
|
|
1119
|
+
};
|
|
1120
|
+
|
|
1121
|
+
// for now
|
|
1122
|
+
$.fn.detach = $.fn.remove
|
|
1123
|
+
|
|
1124
|
+
// Generate the `width` and `height` functions
|
|
1125
|
+
;
|
|
1126
|
+
['width', 'height'].forEach(function (dimension) {
|
|
1127
|
+
var dimensionProperty = dimension.replace(/./, function (m) {
|
|
1128
|
+
return m[0].toUpperCase();
|
|
1137
1129
|
});
|
|
1138
|
-
function
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
parent = inside ? target : target.parentNode;
|
|
1168
|
-
|
|
1169
|
-
// convert all methods to a "before" operation
|
|
1170
|
-
target = operatorIndex == 0 ? target.nextSibling : operatorIndex == 1 ? target.firstChild : operatorIndex == 2 ? target : null;
|
|
1171
|
-
var parentInDocument = $.contains(document.documentElement, parent);
|
|
1172
|
-
nodes.forEach(function (node) {
|
|
1173
|
-
if (copyByClone) node = node.cloneNode(true);else if (!parent) return $(node).remove();
|
|
1174
|
-
parent.insertBefore(node, target);
|
|
1175
|
-
if (parentInDocument) traverseNode(node, function (el) {
|
|
1176
|
-
if (el.nodeName != null && el.nodeName.toUpperCase() === 'SCRIPT' && (!el.type || el.type === 'text/javascript') && !el.src) {
|
|
1177
|
-
var target = el.ownerDocument ? el.ownerDocument.defaultView : window;
|
|
1178
|
-
target['eval'].call(target, el.innerHTML);
|
|
1179
|
-
}
|
|
1130
|
+
$.fn[dimension] = function (value) {
|
|
1131
|
+
var offset,
|
|
1132
|
+
el = this[0];
|
|
1133
|
+
if (value === undefined$1) return isWindow(el) ? el['inner' + dimensionProperty] : isDocument(el) ? el.documentElement['scroll' + dimensionProperty] : (offset = this.offset()) && offset[dimension];else return this.each(function (idx) {
|
|
1134
|
+
el = $(this);
|
|
1135
|
+
el.css(dimension, funcArg(this, value, idx, el[dimension]()));
|
|
1136
|
+
});
|
|
1137
|
+
};
|
|
1138
|
+
});
|
|
1139
|
+
function traverseNode(node, fun) {
|
|
1140
|
+
fun(node);
|
|
1141
|
+
for (var i = 0, len = node.childNodes.length; i < len; i++) traverseNode(node.childNodes[i], fun);
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
// Generate the `after`, `prepend`, `before`, `append`,
|
|
1145
|
+
// `insertAfter`, `insertBefore`, `appendTo`, and `prependTo` methods.
|
|
1146
|
+
adjacencyOperators.forEach(function (operator, operatorIndex) {
|
|
1147
|
+
var inside = operatorIndex % 2; //=> prepend, append
|
|
1148
|
+
|
|
1149
|
+
$.fn[operator] = function () {
|
|
1150
|
+
// arguments can be nodes, arrays of nodes, Zepto objects and HTML strings
|
|
1151
|
+
var argType,
|
|
1152
|
+
nodes = $.map(arguments, function (arg) {
|
|
1153
|
+
var arr = [];
|
|
1154
|
+
argType = type(arg);
|
|
1155
|
+
if (argType == "array") {
|
|
1156
|
+
arg.forEach(function (el) {
|
|
1157
|
+
if (el.nodeType !== undefined$1) return arr.push(el);else if ($.zepto.isZ(el)) return arr = arr.concat(el.get());
|
|
1158
|
+
arr = arr.concat(zepto.fragment(el));
|
|
1180
1159
|
});
|
|
1160
|
+
return arr;
|
|
1161
|
+
}
|
|
1162
|
+
return argType == "object" || arg == null ? arg : zepto.fragment(arg);
|
|
1163
|
+
}),
|
|
1164
|
+
parent,
|
|
1165
|
+
copyByClone = this.length > 1;
|
|
1166
|
+
if (nodes.length < 1) return this;
|
|
1167
|
+
return this.each(function (_, target) {
|
|
1168
|
+
parent = inside ? target : target.parentNode;
|
|
1169
|
+
|
|
1170
|
+
// convert all methods to a "before" operation
|
|
1171
|
+
target = operatorIndex == 0 ? target.nextSibling : operatorIndex == 1 ? target.firstChild : operatorIndex == 2 ? target : null;
|
|
1172
|
+
var parentInDocument = $.contains(document.documentElement, parent);
|
|
1173
|
+
nodes.forEach(function (node) {
|
|
1174
|
+
if (copyByClone) node = node.cloneNode(true);else if (!parent) return $(node).remove();
|
|
1175
|
+
parent.insertBefore(node, target);
|
|
1176
|
+
if (parentInDocument) traverseNode(node, function (el) {
|
|
1177
|
+
if (el.nodeName != null && el.nodeName.toUpperCase() === 'SCRIPT' && (!el.type || el.type === 'text/javascript') && !el.src) {
|
|
1178
|
+
var target = el.ownerDocument ? el.ownerDocument.defaultView : window;
|
|
1179
|
+
target['eval'].call(target, el.innerHTML);
|
|
1180
|
+
}
|
|
1181
1181
|
});
|
|
1182
1182
|
});
|
|
1183
|
-
};
|
|
1183
|
+
});
|
|
1184
|
+
};
|
|
1184
1185
|
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1186
|
+
// after => insertAfter
|
|
1187
|
+
// prepend => prependTo
|
|
1188
|
+
// before => insertBefore
|
|
1189
|
+
// append => appendTo
|
|
1190
|
+
$.fn[inside ? operator + 'To' : 'insert' + (operatorIndex ? 'Before' : 'After')] = function (html) {
|
|
1191
|
+
$(html)[operator](this);
|
|
1192
|
+
return this;
|
|
1193
|
+
};
|
|
1194
|
+
});
|
|
1195
|
+
zepto.Z.prototype = Z.prototype = $.fn;
|
|
1195
1196
|
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
ajaxSuccess(responseData[0], xhr, options, deferred);
|
|
1298
|
-
}
|
|
1299
|
-
window[callbackName] = originalCallback;
|
|
1300
|
-
if (responseData && $.isFunction(originalCallback)) originalCallback(responseData[0]);
|
|
1301
|
-
originalCallback = responseData = undefined;
|
|
1302
|
-
});
|
|
1303
|
-
if (ajaxBeforeSend(xhr, options) === false) {
|
|
1304
|
-
abort('abort');
|
|
1305
|
-
return xhr;
|
|
1197
|
+
// Export internal API functions in the `$.zepto` namespace
|
|
1198
|
+
zepto.uniq = uniq;
|
|
1199
|
+
zepto.deserializeValue = deserializeValue;
|
|
1200
|
+
$.zepto = zepto;
|
|
1201
|
+
return $;
|
|
1202
|
+
}();
|
|
1203
|
+
window.Zepto = Zepto;
|
|
1204
|
+
window.$ === undefined && (window.$ = Zepto);
|
|
1205
|
+
(function ($) {
|
|
1206
|
+
var jsonpID = +new Date(),
|
|
1207
|
+
document = window.document,
|
|
1208
|
+
key,
|
|
1209
|
+
name,
|
|
1210
|
+
scriptTypeRE = /^(?:text|application)\/javascript/i,
|
|
1211
|
+
xmlTypeRE = /^(?:text|application)\/xml/i,
|
|
1212
|
+
jsonType = 'application/json',
|
|
1213
|
+
htmlType = 'text/html',
|
|
1214
|
+
blankRE = /^\s*$/,
|
|
1215
|
+
originAnchor = document.createElement('a');
|
|
1216
|
+
originAnchor.href = window.location.href;
|
|
1217
|
+
|
|
1218
|
+
// trigger a custom event and return false if it was cancelled
|
|
1219
|
+
function triggerAndReturn(context, eventName, data) {
|
|
1220
|
+
var event = $.Event(eventName);
|
|
1221
|
+
$(context).trigger(event, data);
|
|
1222
|
+
return !event.isDefaultPrevented();
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
// trigger an Ajax "global" event
|
|
1226
|
+
function triggerGlobal(settings, context, eventName, data) {
|
|
1227
|
+
if (settings.global) return triggerAndReturn(context || document, eventName, data);
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
// Number of active Ajax requests
|
|
1231
|
+
$.active = 0;
|
|
1232
|
+
function ajaxStart(settings) {
|
|
1233
|
+
if (settings.global && $.active++ === 0) triggerGlobal(settings, null, 'ajaxStart');
|
|
1234
|
+
}
|
|
1235
|
+
function ajaxStop(settings) {
|
|
1236
|
+
if (settings.global && ! --$.active) triggerGlobal(settings, null, 'ajaxStop');
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
// triggers an extra global event "ajaxBeforeSend" that's like "ajaxSend" but cancelable
|
|
1240
|
+
function ajaxBeforeSend(xhr, settings) {
|
|
1241
|
+
var context = settings.context;
|
|
1242
|
+
if (settings.beforeSend.call(context, xhr, settings) === false || triggerGlobal(settings, context, 'ajaxBeforeSend', [xhr, settings]) === false) return false;
|
|
1243
|
+
triggerGlobal(settings, context, 'ajaxSend', [xhr, settings]);
|
|
1244
|
+
}
|
|
1245
|
+
function ajaxSuccess(data, xhr, settings, deferred) {
|
|
1246
|
+
var context = settings.context,
|
|
1247
|
+
status = 'success';
|
|
1248
|
+
settings.success.call(context, data, status, xhr);
|
|
1249
|
+
if (deferred) deferred.resolveWith(context, [data, status, xhr]);
|
|
1250
|
+
triggerGlobal(settings, context, 'ajaxSuccess', [xhr, settings, data]);
|
|
1251
|
+
ajaxComplete(status, xhr, settings);
|
|
1252
|
+
}
|
|
1253
|
+
// type: "timeout", "error", "abort", "parsererror"
|
|
1254
|
+
function ajaxError(error, type, xhr, settings, deferred) {
|
|
1255
|
+
var context = settings.context;
|
|
1256
|
+
settings.error.call(context, xhr, type, error);
|
|
1257
|
+
if (deferred) deferred.rejectWith(context, [xhr, type, error]);
|
|
1258
|
+
triggerGlobal(settings, context, 'ajaxError', [xhr, settings, error || type]);
|
|
1259
|
+
ajaxComplete(type, xhr, settings);
|
|
1260
|
+
}
|
|
1261
|
+
// status: "success", "notmodified", "error", "timeout", "abort", "parsererror"
|
|
1262
|
+
function ajaxComplete(status, xhr, settings) {
|
|
1263
|
+
var context = settings.context;
|
|
1264
|
+
settings.complete.call(context, xhr, status);
|
|
1265
|
+
triggerGlobal(settings, context, 'ajaxComplete', [xhr, settings]);
|
|
1266
|
+
ajaxStop(settings);
|
|
1267
|
+
}
|
|
1268
|
+
function ajaxDataFilter(data, type, settings) {
|
|
1269
|
+
if (settings.dataFilter == empty) return data;
|
|
1270
|
+
var context = settings.context;
|
|
1271
|
+
return settings.dataFilter.call(context, data, type);
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
// Empty function, used as default callback
|
|
1275
|
+
function empty() {}
|
|
1276
|
+
$.ajaxJSONP = function (options, deferred) {
|
|
1277
|
+
if (!('type' in options)) return $.ajax(options);
|
|
1278
|
+
var _callbackName = options.jsonpCallback,
|
|
1279
|
+
callbackName = ($.isFunction(_callbackName) ? _callbackName() : _callbackName) || 'Zepto' + jsonpID++,
|
|
1280
|
+
script = document.createElement('script'),
|
|
1281
|
+
originalCallback = window[callbackName],
|
|
1282
|
+
responseData,
|
|
1283
|
+
abort = function (errorType) {
|
|
1284
|
+
$(script).triggerHandler('error', errorType || 'abort');
|
|
1285
|
+
},
|
|
1286
|
+
xhr = {
|
|
1287
|
+
abort: abort
|
|
1288
|
+
},
|
|
1289
|
+
abortTimeout;
|
|
1290
|
+
if (deferred) deferred.promise(xhr);
|
|
1291
|
+
$(script).on('load error', function (e, errorType) {
|
|
1292
|
+
clearTimeout(abortTimeout);
|
|
1293
|
+
$(script).off().remove();
|
|
1294
|
+
if (e.type == 'error' || !responseData) {
|
|
1295
|
+
ajaxError(null, errorType || 'error', xhr, options, deferred);
|
|
1296
|
+
} else {
|
|
1297
|
+
ajaxSuccess(responseData[0], xhr, options, deferred);
|
|
1306
1298
|
}
|
|
1307
|
-
window[callbackName] =
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
abort('timeout');
|
|
1314
|
-
}, options.timeout);
|
|
1299
|
+
window[callbackName] = originalCallback;
|
|
1300
|
+
if (responseData && $.isFunction(originalCallback)) originalCallback(responseData[0]);
|
|
1301
|
+
originalCallback = responseData = undefined;
|
|
1302
|
+
});
|
|
1303
|
+
if (ajaxBeforeSend(xhr, options) === false) {
|
|
1304
|
+
abort('abort');
|
|
1315
1305
|
return xhr;
|
|
1306
|
+
}
|
|
1307
|
+
window[callbackName] = function () {
|
|
1308
|
+
responseData = arguments;
|
|
1316
1309
|
};
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1310
|
+
|
|
1311
|
+
// Rewrite the last `=?` after `?` without a regex (avoids ReDoS on `.+`).
|
|
1312
|
+
// `i > q + 1` preserves the original `.+` requirement of at least one
|
|
1313
|
+
// character between `?` and `=?`.
|
|
1314
|
+
var q = options.url.indexOf('?'),
|
|
1315
|
+
i = q > -1 ? options.url.lastIndexOf('=?') : -1;
|
|
1316
|
+
script.src = i > q + 1 ? options.url.slice(0, i + 1) + callbackName + options.url.slice(i + 2) : options.url;
|
|
1317
|
+
document.head.appendChild(script);
|
|
1318
|
+
if (options.timeout > 0) abortTimeout = setTimeout(function () {
|
|
1319
|
+
abort('timeout');
|
|
1320
|
+
}, options.timeout);
|
|
1321
|
+
return xhr;
|
|
1322
|
+
};
|
|
1323
|
+
$.ajaxSettings = {
|
|
1324
|
+
// Default type of request
|
|
1325
|
+
type: 'GET',
|
|
1326
|
+
// Callback that is executed before request
|
|
1327
|
+
beforeSend: empty,
|
|
1328
|
+
// Callback that is executed if the request succeeds
|
|
1329
|
+
success: empty,
|
|
1330
|
+
// Callback that is executed the the server drops error
|
|
1331
|
+
error: empty,
|
|
1332
|
+
// Callback that is executed on request complete (both: error and success)
|
|
1333
|
+
complete: empty,
|
|
1334
|
+
// The context for the callbacks
|
|
1335
|
+
context: null,
|
|
1336
|
+
// Whether to trigger "global" Ajax events
|
|
1337
|
+
global: true,
|
|
1338
|
+
// Transport
|
|
1339
|
+
xhr: function () {
|
|
1340
|
+
return new window.XMLHttpRequest();
|
|
1341
|
+
},
|
|
1342
|
+
// MIME types mapping
|
|
1343
|
+
// IIS returns Javascript as "application/x-javascript"
|
|
1344
|
+
accepts: {
|
|
1345
|
+
script: 'text/javascript, application/javascript, application/x-javascript',
|
|
1346
|
+
json: jsonType,
|
|
1347
|
+
xml: 'application/xml, text/xml',
|
|
1348
|
+
html: htmlType,
|
|
1349
|
+
text: 'text/plain'
|
|
1350
|
+
},
|
|
1351
|
+
// Whether the request is to another domain
|
|
1352
|
+
crossDomain: false,
|
|
1353
|
+
// Default timeout
|
|
1354
|
+
timeout: 0,
|
|
1355
|
+
// Whether data should be serialized to string
|
|
1356
|
+
processData: true,
|
|
1357
|
+
// Whether the browser should be allowed to cache GET responses
|
|
1358
|
+
cache: true,
|
|
1359
|
+
//Used to handle the raw response data of XMLHttpRequest.
|
|
1360
|
+
//This is a pre-filtering function to sanitize the response.
|
|
1361
|
+
//The sanitized response should be returned
|
|
1362
|
+
dataFilter: empty
|
|
1363
|
+
};
|
|
1364
|
+
function mimeToDataType(mime) {
|
|
1365
|
+
if (mime) mime = mime.split(';', 2)[0];
|
|
1366
|
+
return mime && (mime == htmlType ? 'html' : mime == jsonType ? 'json' : scriptTypeRE.test(mime) ? 'script' : xmlTypeRE.test(mime) && 'xml') || 'text';
|
|
1367
|
+
}
|
|
1368
|
+
function appendQuery(url, query) {
|
|
1369
|
+
if (query == '') return url;
|
|
1370
|
+
return (url + '&' + query).replace(/[&?]{1,2}/, '?');
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
// serialize payload and append it to the URL for GET requests
|
|
1374
|
+
function serializeData(options) {
|
|
1375
|
+
if (options.processData && options.data && $.type(options.data) != "string") options.data = $.param(options.data, options.traditional);
|
|
1376
|
+
if (options.data && (!options.type || options.type.toUpperCase() == 'GET' || 'jsonp' == options.dataType)) options.url = appendQuery(options.url, options.data), options.data = undefined;
|
|
1377
|
+
}
|
|
1378
|
+
$.ajax = function (options) {
|
|
1379
|
+
var settings = $.extend({}, options || {}),
|
|
1380
|
+
deferred = $.Deferred && $.Deferred(),
|
|
1381
|
+
urlAnchor,
|
|
1382
|
+
hashIndex;
|
|
1383
|
+
for (key in $.ajaxSettings) if (settings[key] === undefined) settings[key] = $.ajaxSettings[key];
|
|
1384
|
+
ajaxStart(settings);
|
|
1385
|
+
if (!settings.crossDomain) {
|
|
1386
|
+
urlAnchor = document.createElement('a');
|
|
1387
|
+
urlAnchor.href = settings.url;
|
|
1388
|
+
// cleans up URL for .href (IE only), see https://github.com/madrobby/zepto/pull/1049
|
|
1389
|
+
urlAnchor.href = urlAnchor.href;
|
|
1390
|
+
settings.crossDomain = originAnchor.protocol + '//' + originAnchor.host !== urlAnchor.protocol + '//' + urlAnchor.host;
|
|
1391
|
+
}
|
|
1392
|
+
if (!settings.url) settings.url = window.location.toString();
|
|
1393
|
+
if ((hashIndex = settings.url.indexOf('#')) > -1) settings.url = settings.url.slice(0, hashIndex);
|
|
1394
|
+
serializeData(settings);
|
|
1395
|
+
var dataType = settings.dataType,
|
|
1396
|
+
hasPlaceholder = /\?.+=\?/.test(settings.url);
|
|
1397
|
+
if (hasPlaceholder) dataType = 'jsonp';
|
|
1398
|
+
if (settings.cache === false || (!options || options.cache !== true) && ('script' == dataType || 'jsonp' == dataType)) settings.url = appendQuery(settings.url, '_=' + Date.now());
|
|
1399
|
+
if ('jsonp' == dataType) {
|
|
1400
|
+
if (!hasPlaceholder) settings.url = appendQuery(settings.url, settings.jsonp ? settings.jsonp + '=?' : settings.jsonp === false ? '' : 'callback=?');
|
|
1401
|
+
return $.ajaxJSONP(settings, deferred);
|
|
1402
|
+
}
|
|
1403
|
+
var mime = settings.accepts[dataType],
|
|
1404
|
+
headers = {},
|
|
1405
|
+
setHeader = function (name, value) {
|
|
1406
|
+
headers[name.toLowerCase()] = [name, value];
|
|
1344
1407
|
},
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
hashIndex;
|
|
1377
|
-
for (key in $.ajaxSettings) if (settings[key] === undefined) settings[key] = $.ajaxSettings[key];
|
|
1378
|
-
ajaxStart(settings);
|
|
1379
|
-
if (!settings.crossDomain) {
|
|
1380
|
-
urlAnchor = document.createElement('a');
|
|
1381
|
-
urlAnchor.href = settings.url;
|
|
1382
|
-
// cleans up URL for .href (IE only), see https://github.com/madrobby/zepto/pull/1049
|
|
1383
|
-
urlAnchor.href = urlAnchor.href;
|
|
1384
|
-
settings.crossDomain = originAnchor.protocol + '//' + originAnchor.host !== urlAnchor.protocol + '//' + urlAnchor.host;
|
|
1385
|
-
}
|
|
1386
|
-
if (!settings.url) settings.url = window.location.toString();
|
|
1387
|
-
if ((hashIndex = settings.url.indexOf('#')) > -1) settings.url = settings.url.slice(0, hashIndex);
|
|
1388
|
-
serializeData(settings);
|
|
1389
|
-
var dataType = settings.dataType,
|
|
1390
|
-
hasPlaceholder = /\?.+=\?/.test(settings.url);
|
|
1391
|
-
if (hasPlaceholder) dataType = 'jsonp';
|
|
1392
|
-
if (settings.cache === false || (!options || options.cache !== true) && ('script' == dataType || 'jsonp' == dataType)) settings.url = appendQuery(settings.url, '_=' + Date.now());
|
|
1393
|
-
if ('jsonp' == dataType) {
|
|
1394
|
-
if (!hasPlaceholder) settings.url = appendQuery(settings.url, settings.jsonp ? settings.jsonp + '=?' : settings.jsonp === false ? '' : 'callback=?');
|
|
1395
|
-
return $.ajaxJSONP(settings, deferred);
|
|
1396
|
-
}
|
|
1397
|
-
var mime = settings.accepts[dataType],
|
|
1398
|
-
headers = {},
|
|
1399
|
-
setHeader = function (name, value) {
|
|
1400
|
-
headers[name.toLowerCase()] = [name, value];
|
|
1401
|
-
},
|
|
1402
|
-
protocol = /^([\w-]+:)\/\//.test(settings.url) ? RegExp.$1 : window.location.protocol,
|
|
1403
|
-
xhr = settings.xhr(),
|
|
1404
|
-
nativeSetHeader = xhr.setRequestHeader,
|
|
1405
|
-
abortTimeout;
|
|
1406
|
-
if (deferred) deferred.promise(xhr);
|
|
1407
|
-
if (!settings.crossDomain) setHeader('X-Requested-With', 'XMLHttpRequest');
|
|
1408
|
-
setHeader('Accept', mime || '*/*');
|
|
1409
|
-
if (mime = settings.mimeType || mime) {
|
|
1410
|
-
if (mime.indexOf(',') > -1) mime = mime.split(',', 2)[0];
|
|
1411
|
-
xhr.overrideMimeType && xhr.overrideMimeType(mime);
|
|
1412
|
-
}
|
|
1413
|
-
if (settings.contentType || settings.contentType !== false && settings.data && settings.type.toUpperCase() != 'GET') setHeader('Content-Type', settings.contentType || 'application/x-www-form-urlencoded');
|
|
1414
|
-
if (settings.headers) for (name in settings.headers) setHeader(name, settings.headers[name]);
|
|
1415
|
-
xhr.setRequestHeader = setHeader;
|
|
1416
|
-
xhr.onreadystatechange = function () {
|
|
1417
|
-
if (xhr.readyState == 4) {
|
|
1418
|
-
xhr.onreadystatechange = empty;
|
|
1419
|
-
clearTimeout(abortTimeout);
|
|
1420
|
-
var result,
|
|
1421
|
-
error = false;
|
|
1422
|
-
if (xhr.status >= 200 && xhr.status < 300 || xhr.status == 304 || xhr.status == 0 && protocol == 'file:') {
|
|
1423
|
-
dataType = dataType || mimeToDataType(settings.mimeType || xhr.getResponseHeader('content-type'));
|
|
1424
|
-
if (xhr.responseType == 'arraybuffer' || xhr.responseType == 'blob') result = xhr.response;else {
|
|
1425
|
-
result = xhr.responseText;
|
|
1426
|
-
try {
|
|
1427
|
-
// http://perfectionkills.com/global-eval-what-are-the-options/
|
|
1428
|
-
// sanitize response accordingly if data filter callback provided
|
|
1429
|
-
result = ajaxDataFilter(result, dataType, settings);
|
|
1430
|
-
if (dataType == 'script') (1, eval)(result);else if (dataType == 'xml') result = xhr.responseXML;else if (dataType == 'json') result = blankRE.test(result) ? null : $.parseJSON(result);
|
|
1431
|
-
} catch (e) {
|
|
1432
|
-
error = e;
|
|
1433
|
-
}
|
|
1434
|
-
if (error) return ajaxError(error, 'parsererror', xhr, settings, deferred);
|
|
1408
|
+
protocol = /^([\w-]+:)\/\//.test(settings.url) ? RegExp.$1 : window.location.protocol,
|
|
1409
|
+
xhr = settings.xhr(),
|
|
1410
|
+
nativeSetHeader = xhr.setRequestHeader,
|
|
1411
|
+
abortTimeout;
|
|
1412
|
+
if (deferred) deferred.promise(xhr);
|
|
1413
|
+
if (!settings.crossDomain) setHeader('X-Requested-With', 'XMLHttpRequest');
|
|
1414
|
+
setHeader('Accept', mime || '*/*');
|
|
1415
|
+
if (mime = settings.mimeType || mime) {
|
|
1416
|
+
if (mime.indexOf(',') > -1) mime = mime.split(',', 2)[0];
|
|
1417
|
+
xhr.overrideMimeType && xhr.overrideMimeType(mime);
|
|
1418
|
+
}
|
|
1419
|
+
if (settings.contentType || settings.contentType !== false && settings.data && settings.type.toUpperCase() != 'GET') setHeader('Content-Type', settings.contentType || 'application/x-www-form-urlencoded');
|
|
1420
|
+
if (settings.headers) for (name in settings.headers) setHeader(name, settings.headers[name]);
|
|
1421
|
+
xhr.setRequestHeader = setHeader;
|
|
1422
|
+
xhr.onreadystatechange = function () {
|
|
1423
|
+
if (xhr.readyState == 4) {
|
|
1424
|
+
xhr.onreadystatechange = empty;
|
|
1425
|
+
clearTimeout(abortTimeout);
|
|
1426
|
+
var result,
|
|
1427
|
+
error = false;
|
|
1428
|
+
if (xhr.status >= 200 && xhr.status < 300 || xhr.status == 304 || xhr.status == 0 && protocol == 'file:') {
|
|
1429
|
+
dataType = dataType || mimeToDataType(settings.mimeType || xhr.getResponseHeader('content-type'));
|
|
1430
|
+
if (xhr.responseType == 'arraybuffer' || xhr.responseType == 'blob') result = xhr.response;else {
|
|
1431
|
+
result = xhr.responseText;
|
|
1432
|
+
try {
|
|
1433
|
+
// http://perfectionkills.com/global-eval-what-are-the-options/
|
|
1434
|
+
// sanitize response accordingly if data filter callback provided
|
|
1435
|
+
result = ajaxDataFilter(result, dataType, settings);
|
|
1436
|
+
if (dataType == 'script') (1, eval)(result);else if (dataType == 'xml') result = xhr.responseXML;else if (dataType == 'json') result = blankRE.test(result) ? null : $.parseJSON(result);
|
|
1437
|
+
} catch (e) {
|
|
1438
|
+
error = e;
|
|
1435
1439
|
}
|
|
1436
|
-
|
|
1437
|
-
} else {
|
|
1438
|
-
ajaxError(xhr.statusText || null, xhr.status ? 'error' : 'abort', xhr, settings, deferred);
|
|
1440
|
+
if (error) return ajaxError(error, 'parsererror', xhr, settings, deferred);
|
|
1439
1441
|
}
|
|
1442
|
+
ajaxSuccess(result, xhr, settings, deferred);
|
|
1443
|
+
} else {
|
|
1444
|
+
ajaxError(xhr.statusText || null, xhr.status ? 'error' : 'abort', xhr, settings, deferred);
|
|
1440
1445
|
}
|
|
1441
|
-
}
|
|
1442
|
-
if (ajaxBeforeSend(xhr, settings) === false) {
|
|
1443
|
-
xhr.abort();
|
|
1444
|
-
ajaxError(null, 'abort', xhr, settings, deferred);
|
|
1445
|
-
return xhr;
|
|
1446
|
-
}
|
|
1447
|
-
var async = 'async' in settings ? settings.async : true;
|
|
1448
|
-
xhr.open(settings.type, settings.url, async, settings.username, settings.password);
|
|
1449
|
-
if (settings.xhrFields) for (name in settings.xhrFields) xhr[name] = settings.xhrFields[name];
|
|
1450
|
-
for (name in headers) nativeSetHeader.apply(xhr, headers[name]);
|
|
1451
|
-
if (settings.timeout > 0) abortTimeout = setTimeout(function () {
|
|
1452
|
-
xhr.onreadystatechange = empty;
|
|
1453
|
-
xhr.abort();
|
|
1454
|
-
ajaxError(null, 'timeout', xhr, settings, deferred);
|
|
1455
|
-
}, settings.timeout);
|
|
1456
|
-
|
|
1457
|
-
// avoid sending empty string (#319)
|
|
1458
|
-
xhr.send(settings.data ? settings.data : null);
|
|
1459
|
-
return xhr;
|
|
1446
|
+
}
|
|
1460
1447
|
};
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
if (!$.isFunction(success)) dataType = success, success = undefined;
|
|
1466
|
-
return {
|
|
1467
|
-
url: url,
|
|
1468
|
-
data: data,
|
|
1469
|
-
success: success,
|
|
1470
|
-
dataType: dataType
|
|
1471
|
-
};
|
|
1448
|
+
if (ajaxBeforeSend(xhr, settings) === false) {
|
|
1449
|
+
xhr.abort();
|
|
1450
|
+
ajaxError(null, 'abort', xhr, settings, deferred);
|
|
1451
|
+
return xhr;
|
|
1472
1452
|
}
|
|
1473
|
-
|
|
1474
|
-
()
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
()
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1453
|
+
var async = 'async' in settings ? settings.async : true;
|
|
1454
|
+
xhr.open(settings.type, settings.url, async, settings.username, settings.password);
|
|
1455
|
+
if (settings.xhrFields) for (name in settings.xhrFields) xhr[name] = settings.xhrFields[name];
|
|
1456
|
+
for (name in headers) nativeSetHeader.apply(xhr, headers[name]);
|
|
1457
|
+
if (settings.timeout > 0) abortTimeout = setTimeout(function () {
|
|
1458
|
+
xhr.onreadystatechange = empty;
|
|
1459
|
+
xhr.abort();
|
|
1460
|
+
ajaxError(null, 'timeout', xhr, settings, deferred);
|
|
1461
|
+
}, settings.timeout);
|
|
1462
|
+
|
|
1463
|
+
// avoid sending empty string (#319)
|
|
1464
|
+
xhr.send(settings.data ? settings.data : null);
|
|
1465
|
+
return xhr;
|
|
1466
|
+
};
|
|
1467
|
+
|
|
1468
|
+
// handle optional data/success arguments
|
|
1469
|
+
function parseArguments(url, data, success, dataType) {
|
|
1470
|
+
if ($.isFunction(data)) dataType = success, success = data, data = undefined;
|
|
1471
|
+
if (!$.isFunction(success)) dataType = success, success = undefined;
|
|
1472
|
+
return {
|
|
1473
|
+
url: url,
|
|
1474
|
+
data: data,
|
|
1475
|
+
success: success,
|
|
1476
|
+
dataType: dataType
|
|
1488
1477
|
};
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1478
|
+
}
|
|
1479
|
+
$.get = function /* url, data, success, dataType */
|
|
1480
|
+
() {
|
|
1481
|
+
return $.ajax(parseArguments.apply(null, arguments));
|
|
1482
|
+
};
|
|
1483
|
+
$.post = function /* url, data, success, dataType */
|
|
1484
|
+
() {
|
|
1485
|
+
var options = parseArguments.apply(null, arguments);
|
|
1486
|
+
options.type = 'POST';
|
|
1487
|
+
return $.ajax(options);
|
|
1488
|
+
};
|
|
1489
|
+
$.getJSON = function /* url, data, success */
|
|
1490
|
+
() {
|
|
1491
|
+
var options = parseArguments.apply(null, arguments);
|
|
1492
|
+
options.dataType = 'json';
|
|
1493
|
+
return $.ajax(options);
|
|
1494
|
+
};
|
|
1495
|
+
$.fn.load = function (url, data, success) {
|
|
1496
|
+
if (!this.length) return this;
|
|
1497
|
+
var self = this,
|
|
1498
|
+
parts = url.split(/\s/),
|
|
1499
|
+
selector,
|
|
1500
|
+
options = parseArguments(url, data, success),
|
|
1501
|
+
callback = options.success;
|
|
1502
|
+
if (parts.length > 1) options.url = parts[0], selector = parts[1];
|
|
1503
|
+
options.success = function (response) {
|
|
1504
|
+
// With a selector, parse into a detached container and drop <script>
|
|
1505
|
+
// nodes structurally before finding matches. Without a selector the
|
|
1506
|
+
// response is inserted as-is (same asymmetry as jQuery). This is not
|
|
1507
|
+
// a sanitizer: event-handler attrs and javascript: URLs still pass.
|
|
1508
|
+
if (selector) {
|
|
1509
|
+
var container = $('<div>').html(response);
|
|
1510
|
+
container.find('script').remove();
|
|
1511
|
+
self.html(container.find(selector));
|
|
1512
|
+
} else {
|
|
1513
|
+
self.html(response);
|
|
1514
|
+
}
|
|
1515
|
+
callback && callback.apply(self, arguments);
|
|
1503
1516
|
};
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1517
|
+
$.ajax(options);
|
|
1518
|
+
return this;
|
|
1519
|
+
};
|
|
1520
|
+
var escape = encodeURIComponent;
|
|
1521
|
+
function serialize(params, obj, traditional, scope) {
|
|
1522
|
+
var type,
|
|
1523
|
+
array = $.isArray(obj),
|
|
1524
|
+
hash = $.isPlainObject(obj);
|
|
1525
|
+
$.each(obj, function (key, value) {
|
|
1526
|
+
type = $.type(value);
|
|
1527
|
+
if (scope) key = traditional ? scope : scope + '[' + (hash || type == 'object' || type == 'array' ? key : '') + ']';
|
|
1528
|
+
// handle data in serializeArray() format
|
|
1529
|
+
if (!scope && array) params.add(value.name, value.value);
|
|
1530
|
+
// recurse into nested objects
|
|
1531
|
+
else if (type == "array" || !traditional && type == "object") serialize(params, value, traditional, key);else params.add(key, value);
|
|
1532
|
+
});
|
|
1533
|
+
}
|
|
1534
|
+
$.param = function (obj, traditional) {
|
|
1535
|
+
var params = [];
|
|
1536
|
+
params.add = function (key, value) {
|
|
1537
|
+
if ($.isFunction(value)) value = value();
|
|
1538
|
+
if (value == null) value = "";
|
|
1539
|
+
this.push(escape(key) + '=' + escape(value));
|
|
1527
1540
|
};
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1541
|
+
serialize(params, obj, traditional);
|
|
1542
|
+
return params.join('&').replace(/%20/g, '+');
|
|
1543
|
+
};
|
|
1544
|
+
})(Zepto);
|
|
1545
|
+
(function ($) {
|
|
1546
|
+
// Create a collection of callbacks to be fired in a sequence, with configurable behaviour
|
|
1547
|
+
// Option flags:
|
|
1548
|
+
// - once: Callbacks fired at most one time.
|
|
1549
|
+
// - memory: Remember the most recent context and arguments
|
|
1550
|
+
// - stopOnFalse: Cease iterating over callback list
|
|
1551
|
+
// - unique: Permit adding at most one instance of the same callback
|
|
1552
|
+
$.Callbacks = function (options) {
|
|
1553
|
+
options = $.extend({}, options);
|
|
1554
|
+
var memory,
|
|
1555
|
+
// Last fire value (for non-forgettable lists)
|
|
1556
|
+
fired,
|
|
1557
|
+
// Flag to know if list was already fired
|
|
1558
|
+
firing,
|
|
1559
|
+
// Flag to know if list is currently firing
|
|
1560
|
+
firingStart,
|
|
1561
|
+
// First callback to fire (used internally by add and fireWith)
|
|
1562
|
+
firingLength,
|
|
1563
|
+
// End of the loop when firing
|
|
1564
|
+
firingIndex,
|
|
1565
|
+
// Index of currently firing callback (modified by remove if needed)
|
|
1566
|
+
list = [],
|
|
1567
|
+
// Actual callback list
|
|
1568
|
+
stack = !options.once && [],
|
|
1569
|
+
// Stack of fire calls for repeatable lists
|
|
1570
|
+
fire = function (data) {
|
|
1571
|
+
memory = options.memory && data;
|
|
1572
|
+
fired = true;
|
|
1573
|
+
firingIndex = firingStart || 0;
|
|
1574
|
+
firingStart = 0;
|
|
1575
|
+
firingLength = list.length;
|
|
1576
|
+
firing = true;
|
|
1577
|
+
for (; list && firingIndex < firingLength; ++firingIndex) {
|
|
1578
|
+
if (list[firingIndex].apply(data[0], data[1]) === false && options.stopOnFalse) {
|
|
1579
|
+
memory = false;
|
|
1580
|
+
break;
|
|
1566
1581
|
}
|
|
1567
|
-
|
|
1582
|
+
}
|
|
1583
|
+
firing = false;
|
|
1584
|
+
if (list) {
|
|
1585
|
+
if (stack) stack.length && fire(stack.shift());else if (memory) list.length = 0;else Callbacks.disable();
|
|
1586
|
+
}
|
|
1587
|
+
},
|
|
1588
|
+
Callbacks = {
|
|
1589
|
+
add: function () {
|
|
1568
1590
|
if (list) {
|
|
1569
|
-
|
|
1591
|
+
var start = list.length,
|
|
1592
|
+
add = function (args) {
|
|
1593
|
+
$.each(args, function (_, arg) {
|
|
1594
|
+
if (typeof arg === "function") {
|
|
1595
|
+
if (!options.unique || !Callbacks.has(arg)) list.push(arg);
|
|
1596
|
+
} else if (arg && arg.length && typeof arg !== 'string') add(arg);
|
|
1597
|
+
});
|
|
1598
|
+
};
|
|
1599
|
+
add(arguments);
|
|
1600
|
+
if (firing) firingLength = list.length;else if (memory) {
|
|
1601
|
+
firingStart = start;
|
|
1602
|
+
fire(memory);
|
|
1603
|
+
}
|
|
1570
1604
|
}
|
|
1605
|
+
return this;
|
|
1571
1606
|
},
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
var
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
};
|
|
1583
|
-
add(arguments);
|
|
1584
|
-
if (firing) firingLength = list.length;else if (memory) {
|
|
1585
|
-
firingStart = start;
|
|
1586
|
-
fire(memory);
|
|
1587
|
-
}
|
|
1588
|
-
}
|
|
1589
|
-
return this;
|
|
1590
|
-
},
|
|
1591
|
-
remove: function () {
|
|
1592
|
-
if (list) {
|
|
1593
|
-
$.each(arguments, function (_, arg) {
|
|
1594
|
-
var index;
|
|
1595
|
-
while ((index = $.inArray(arg, list, index)) > -1) {
|
|
1596
|
-
list.splice(index, 1);
|
|
1597
|
-
// Handle firing indexes
|
|
1598
|
-
if (firing) {
|
|
1599
|
-
if (index <= firingLength) --firingLength;
|
|
1600
|
-
if (index <= firingIndex) --firingIndex;
|
|
1601
|
-
}
|
|
1607
|
+
remove: function () {
|
|
1608
|
+
if (list) {
|
|
1609
|
+
$.each(arguments, function (_, arg) {
|
|
1610
|
+
var index;
|
|
1611
|
+
while ((index = $.inArray(arg, list, index)) > -1) {
|
|
1612
|
+
list.splice(index, 1);
|
|
1613
|
+
// Handle firing indexes
|
|
1614
|
+
if (firing) {
|
|
1615
|
+
if (index <= firingLength) --firingLength;
|
|
1616
|
+
if (index <= firingIndex) --firingIndex;
|
|
1602
1617
|
}
|
|
1603
|
-
}
|
|
1604
|
-
}
|
|
1605
|
-
return this;
|
|
1606
|
-
},
|
|
1607
|
-
has: function (fn) {
|
|
1608
|
-
return !!(list && (fn ? $.inArray(fn, list) > -1 : list.length));
|
|
1609
|
-
},
|
|
1610
|
-
empty: function () {
|
|
1611
|
-
firingLength = list.length = 0;
|
|
1612
|
-
return this;
|
|
1613
|
-
},
|
|
1614
|
-
disable: function () {
|
|
1615
|
-
list = stack = memory = undefined;
|
|
1616
|
-
return this;
|
|
1617
|
-
},
|
|
1618
|
-
disabled: function () {
|
|
1619
|
-
return !list;
|
|
1620
|
-
},
|
|
1621
|
-
lock: function () {
|
|
1622
|
-
stack = undefined;
|
|
1623
|
-
if (!memory) Callbacks.disable();
|
|
1624
|
-
return this;
|
|
1625
|
-
},
|
|
1626
|
-
locked: function () {
|
|
1627
|
-
return !stack;
|
|
1628
|
-
},
|
|
1629
|
-
fireWith: function (context, args) {
|
|
1630
|
-
if (list && (!fired || stack)) {
|
|
1631
|
-
args = args || [];
|
|
1632
|
-
args = [context, args.slice ? args.slice() : args];
|
|
1633
|
-
if (firing) stack.push(args);else fire(args);
|
|
1634
|
-
}
|
|
1635
|
-
return this;
|
|
1636
|
-
},
|
|
1637
|
-
fire: function () {
|
|
1638
|
-
return Callbacks.fireWith(this, arguments);
|
|
1639
|
-
},
|
|
1640
|
-
fired: function () {
|
|
1641
|
-
return !!fired;
|
|
1642
|
-
}
|
|
1643
|
-
};
|
|
1644
|
-
return Callbacks;
|
|
1645
|
-
};
|
|
1646
|
-
})(Zepto);
|
|
1647
|
-
(function ($) {
|
|
1648
|
-
var slice = Array.prototype.slice;
|
|
1649
|
-
function Deferred(func) {
|
|
1650
|
-
var tuples = [
|
|
1651
|
-
// action, add listener, listener list, final state
|
|
1652
|
-
["resolve", "done", $.Callbacks({
|
|
1653
|
-
once: 1,
|
|
1654
|
-
memory: 1
|
|
1655
|
-
}), "resolved"], ["reject", "fail", $.Callbacks({
|
|
1656
|
-
once: 1,
|
|
1657
|
-
memory: 1
|
|
1658
|
-
}), "rejected"], ["notify", "progress", $.Callbacks({
|
|
1659
|
-
memory: 1
|
|
1660
|
-
})]],
|
|
1661
|
-
state = "pending",
|
|
1662
|
-
promise = {
|
|
1663
|
-
state: function () {
|
|
1664
|
-
return state;
|
|
1665
|
-
},
|
|
1666
|
-
always: function () {
|
|
1667
|
-
deferred.done(arguments).fail(arguments);
|
|
1668
|
-
return this;
|
|
1669
|
-
},
|
|
1670
|
-
then: function /* fnDone [, fnFailed [, fnProgress]] */
|
|
1671
|
-
() {
|
|
1672
|
-
var fns = arguments;
|
|
1673
|
-
return Deferred(function (defer) {
|
|
1674
|
-
$.each(tuples, function (i, tuple) {
|
|
1675
|
-
var fn = $.isFunction(fns[i]) && fns[i];
|
|
1676
|
-
deferred[tuple[1]](function () {
|
|
1677
|
-
var returned = fn && fn.apply(this, arguments);
|
|
1678
|
-
if (returned && $.isFunction(returned.promise)) {
|
|
1679
|
-
returned.promise().done(defer.resolve).fail(defer.reject).progress(defer.notify);
|
|
1680
|
-
} else {
|
|
1681
|
-
var context = this === promise ? defer.promise() : this,
|
|
1682
|
-
values = fn ? [returned] : arguments;
|
|
1683
|
-
defer[tuple[0] + "With"](context, values);
|
|
1684
|
-
}
|
|
1685
|
-
});
|
|
1686
|
-
});
|
|
1687
|
-
fns = null;
|
|
1688
|
-
}).promise();
|
|
1689
|
-
},
|
|
1690
|
-
promise: function (obj) {
|
|
1691
|
-
return obj != null ? $.extend(obj, promise) : promise;
|
|
1618
|
+
}
|
|
1619
|
+
});
|
|
1692
1620
|
}
|
|
1621
|
+
return this;
|
|
1622
|
+
},
|
|
1623
|
+
has: function (fn) {
|
|
1624
|
+
return !!(list && (fn ? $.inArray(fn, list) > -1 : list.length));
|
|
1693
1625
|
},
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
var list = tuple[2],
|
|
1697
|
-
stateString = tuple[3];
|
|
1698
|
-
promise[tuple[1]] = list.add;
|
|
1699
|
-
if (stateString) {
|
|
1700
|
-
list.add(function () {
|
|
1701
|
-
state = stateString;
|
|
1702
|
-
}, tuples[i ^ 1][2].disable, tuples[2][2].lock);
|
|
1703
|
-
}
|
|
1704
|
-
deferred[tuple[0]] = function () {
|
|
1705
|
-
deferred[tuple[0] + "With"](this === deferred ? promise : this, arguments);
|
|
1626
|
+
empty: function () {
|
|
1627
|
+
firingLength = list.length = 0;
|
|
1706
1628
|
return this;
|
|
1707
|
-
}
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
if (
|
|
1728
|
-
deferred.notifyWith(ctx, val);
|
|
1729
|
-
} else if (! --remain) {
|
|
1730
|
-
deferred.resolveWith(ctx, val);
|
|
1731
|
-
}
|
|
1732
|
-
};
|
|
1733
|
-
};
|
|
1734
|
-
if (len > 1) {
|
|
1735
|
-
progressValues = new Array(len);
|
|
1736
|
-
progressContexts = new Array(len);
|
|
1737
|
-
resolveContexts = new Array(len);
|
|
1738
|
-
for (; i < len; ++i) {
|
|
1739
|
-
if (resolveValues[i] && $.isFunction(resolveValues[i].promise)) {
|
|
1740
|
-
resolveValues[i].promise().done(updateFn(i, resolveContexts, resolveValues)).fail(deferred.reject).progress(updateFn(i, progressContexts, progressValues));
|
|
1741
|
-
} else {
|
|
1742
|
-
--remain;
|
|
1629
|
+
},
|
|
1630
|
+
disable: function () {
|
|
1631
|
+
list = stack = memory = undefined;
|
|
1632
|
+
return this;
|
|
1633
|
+
},
|
|
1634
|
+
disabled: function () {
|
|
1635
|
+
return !list;
|
|
1636
|
+
},
|
|
1637
|
+
lock: function () {
|
|
1638
|
+
stack = undefined;
|
|
1639
|
+
if (!memory) Callbacks.disable();
|
|
1640
|
+
return this;
|
|
1641
|
+
},
|
|
1642
|
+
locked: function () {
|
|
1643
|
+
return !stack;
|
|
1644
|
+
},
|
|
1645
|
+
fireWith: function (context, args) {
|
|
1646
|
+
if (list && (!fired || stack)) {
|
|
1647
|
+
args = args || [];
|
|
1648
|
+
args = [context, args.slice ? args.slice() : args];
|
|
1649
|
+
if (firing) stack.push(args);else fire(args);
|
|
1743
1650
|
}
|
|
1651
|
+
return this;
|
|
1652
|
+
},
|
|
1653
|
+
fire: function () {
|
|
1654
|
+
return Callbacks.fireWith(this, arguments);
|
|
1655
|
+
},
|
|
1656
|
+
fired: function () {
|
|
1657
|
+
return !!fired;
|
|
1744
1658
|
}
|
|
1745
|
-
}
|
|
1746
|
-
if (!remain) deferred.resolveWith(resolveContexts, resolveValues);
|
|
1747
|
-
return deferred.promise();
|
|
1748
|
-
};
|
|
1749
|
-
$.Deferred = Deferred;
|
|
1750
|
-
})(Zepto);
|
|
1751
|
-
(function ($) {
|
|
1752
|
-
var _zid = 1,
|
|
1753
|
-
undefined$1,
|
|
1754
|
-
slice = Array.prototype.slice,
|
|
1755
|
-
isFunction = $.isFunction,
|
|
1756
|
-
isString = function (obj) {
|
|
1757
|
-
return typeof obj == 'string';
|
|
1758
|
-
},
|
|
1759
|
-
handlers = {},
|
|
1760
|
-
specialEvents = {},
|
|
1761
|
-
focusinSupported = 'onfocusin' in window,
|
|
1762
|
-
focus = {
|
|
1763
|
-
focus: 'focusin',
|
|
1764
|
-
blur: 'focusout'
|
|
1765
|
-
},
|
|
1766
|
-
hover = {
|
|
1767
|
-
mouseenter: 'mouseover',
|
|
1768
|
-
mouseleave: 'mouseout'
|
|
1769
1659
|
};
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1660
|
+
return Callbacks;
|
|
1661
|
+
};
|
|
1662
|
+
})(Zepto);
|
|
1663
|
+
(function ($) {
|
|
1664
|
+
var slice = Array.prototype.slice;
|
|
1665
|
+
function Deferred(func) {
|
|
1666
|
+
var tuples = [
|
|
1667
|
+
// action, add listener, listener list, final state
|
|
1668
|
+
["resolve", "done", $.Callbacks({
|
|
1669
|
+
once: 1,
|
|
1670
|
+
memory: 1
|
|
1671
|
+
}), "resolved"], ["reject", "fail", $.Callbacks({
|
|
1672
|
+
once: 1,
|
|
1673
|
+
memory: 1
|
|
1674
|
+
}), "rejected"], ["notify", "progress", $.Callbacks({
|
|
1675
|
+
memory: 1
|
|
1676
|
+
})]],
|
|
1677
|
+
state = "pending",
|
|
1678
|
+
promise = {
|
|
1679
|
+
state: function () {
|
|
1680
|
+
return state;
|
|
1681
|
+
},
|
|
1682
|
+
always: function () {
|
|
1683
|
+
deferred.done(arguments).fail(arguments);
|
|
1684
|
+
return this;
|
|
1685
|
+
},
|
|
1686
|
+
then: function /* fnDone [, fnFailed [, fnProgress]] */
|
|
1687
|
+
() {
|
|
1688
|
+
var fns = arguments;
|
|
1689
|
+
return Deferred(function (defer) {
|
|
1690
|
+
$.each(tuples, function (i, tuple) {
|
|
1691
|
+
var fn = $.isFunction(fns[i]) && fns[i];
|
|
1692
|
+
deferred[tuple[1]](function () {
|
|
1693
|
+
var returned = fn && fn.apply(this, arguments);
|
|
1694
|
+
if (returned && $.isFunction(returned.promise)) {
|
|
1695
|
+
returned.promise().done(defer.resolve).fail(defer.reject).progress(defer.notify);
|
|
1696
|
+
} else {
|
|
1697
|
+
var context = this === promise ? defer.promise() : this,
|
|
1698
|
+
values = fn ? [returned] : arguments;
|
|
1699
|
+
defer[tuple[0] + "With"](context, values);
|
|
1700
|
+
}
|
|
1701
|
+
});
|
|
1702
|
+
});
|
|
1703
|
+
fns = null;
|
|
1704
|
+
}).promise();
|
|
1705
|
+
},
|
|
1706
|
+
promise: function (obj) {
|
|
1707
|
+
return obj != null ? $.extend(obj, promise) : promise;
|
|
1708
|
+
}
|
|
1709
|
+
},
|
|
1710
|
+
deferred = {};
|
|
1711
|
+
$.each(tuples, function (i, tuple) {
|
|
1712
|
+
var list = tuple[2],
|
|
1713
|
+
stateString = tuple[3];
|
|
1714
|
+
promise[tuple[1]] = list.add;
|
|
1715
|
+
if (stateString) {
|
|
1716
|
+
list.add(function () {
|
|
1717
|
+
state = stateString;
|
|
1718
|
+
}, tuples[i ^ 1][2].disable, tuples[2][2].lock);
|
|
1719
|
+
}
|
|
1720
|
+
deferred[tuple[0]] = function () {
|
|
1721
|
+
deferred[tuple[0] + "With"](this === deferred ? promise : this, arguments);
|
|
1722
|
+
return this;
|
|
1786
1723
|
};
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
if (!
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
var callback = delegator || fn;
|
|
1812
|
-
handler.proxy = function (e) {
|
|
1813
|
-
e = compatible(e);
|
|
1814
|
-
if (e.isImmediatePropagationStopped()) return;
|
|
1815
|
-
e.data = data;
|
|
1816
|
-
var result = callback.apply(element, e._args == undefined$1 ? [e] : [e].concat(e._args));
|
|
1817
|
-
if (result === false) e.preventDefault(), e.stopPropagation();
|
|
1818
|
-
return result;
|
|
1819
|
-
};
|
|
1820
|
-
handler.i = set.length;
|
|
1821
|
-
set.push(handler);
|
|
1822
|
-
if ('addEventListener' in element) element.addEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture));
|
|
1823
|
-
});
|
|
1824
|
-
}
|
|
1825
|
-
function remove(element, events, fn, selector, capture) {
|
|
1826
|
-
var id = zid(element);
|
|
1827
|
-
(events || '').split(/\s/).forEach(function (event) {
|
|
1828
|
-
findHandlers(element, event, fn, selector).forEach(function (handler) {
|
|
1829
|
-
delete handlers[id][handler.i];
|
|
1830
|
-
if ('removeEventListener' in element) element.removeEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture));
|
|
1831
|
-
});
|
|
1832
|
-
});
|
|
1833
|
-
}
|
|
1834
|
-
$.event = {
|
|
1835
|
-
add: add,
|
|
1836
|
-
remove: remove
|
|
1837
|
-
};
|
|
1838
|
-
$.proxy = function (fn, context) {
|
|
1839
|
-
var args = 2 in arguments && slice.call(arguments, 2);
|
|
1840
|
-
if (isFunction(fn)) {
|
|
1841
|
-
var proxyFn = function () {
|
|
1842
|
-
return fn.apply(context, args ? args.concat(slice.call(arguments)) : arguments);
|
|
1724
|
+
deferred[tuple[0] + "With"] = list.fireWith;
|
|
1725
|
+
});
|
|
1726
|
+
promise.promise(deferred);
|
|
1727
|
+
if (func) func.call(deferred, deferred);
|
|
1728
|
+
return deferred;
|
|
1729
|
+
}
|
|
1730
|
+
$.when = function (sub) {
|
|
1731
|
+
var resolveValues = slice.call(arguments),
|
|
1732
|
+
len = resolveValues.length,
|
|
1733
|
+
i = 0,
|
|
1734
|
+
remain = len !== 1 || sub && $.isFunction(sub.promise) ? len : 0,
|
|
1735
|
+
deferred = remain === 1 ? sub : Deferred(),
|
|
1736
|
+
progressValues,
|
|
1737
|
+
progressContexts,
|
|
1738
|
+
resolveContexts,
|
|
1739
|
+
updateFn = function (i, ctx, val) {
|
|
1740
|
+
return function (value) {
|
|
1741
|
+
ctx[i] = this;
|
|
1742
|
+
val[i] = arguments.length > 1 ? slice.call(arguments) : value;
|
|
1743
|
+
if (val === progressValues) {
|
|
1744
|
+
deferred.notifyWith(ctx, val);
|
|
1745
|
+
} else if (! --remain) {
|
|
1746
|
+
deferred.resolveWith(ctx, val);
|
|
1747
|
+
}
|
|
1843
1748
|
};
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1749
|
+
};
|
|
1750
|
+
if (len > 1) {
|
|
1751
|
+
progressValues = new Array(len);
|
|
1752
|
+
progressContexts = new Array(len);
|
|
1753
|
+
resolveContexts = new Array(len);
|
|
1754
|
+
for (; i < len; ++i) {
|
|
1755
|
+
if (resolveValues[i] && $.isFunction(resolveValues[i].promise)) {
|
|
1756
|
+
resolveValues[i].promise().done(updateFn(i, resolveContexts, resolveValues)).fail(deferred.reject).progress(updateFn(i, progressContexts, progressValues));
|
|
1850
1757
|
} else {
|
|
1851
|
-
|
|
1758
|
+
--remain;
|
|
1852
1759
|
}
|
|
1853
|
-
} else {
|
|
1854
|
-
throw new TypeError("expected function");
|
|
1855
1760
|
}
|
|
1761
|
+
}
|
|
1762
|
+
if (!remain) deferred.resolveWith(resolveContexts, resolveValues);
|
|
1763
|
+
return deferred.promise();
|
|
1764
|
+
};
|
|
1765
|
+
$.Deferred = Deferred;
|
|
1766
|
+
})(Zepto);
|
|
1767
|
+
(function ($) {
|
|
1768
|
+
var _zid = 1,
|
|
1769
|
+
undefined$1,
|
|
1770
|
+
slice = Array.prototype.slice,
|
|
1771
|
+
isFunction = $.isFunction,
|
|
1772
|
+
isString = function (obj) {
|
|
1773
|
+
return typeof obj == 'string';
|
|
1774
|
+
},
|
|
1775
|
+
// Prototype-less map: handlers['__proto__'] must never resolve to
|
|
1776
|
+
// Object.prototype (CodeQL js/prototype-polluting-assignment).
|
|
1777
|
+
handlers = Object.create(null),
|
|
1778
|
+
specialEvents = {},
|
|
1779
|
+
focusinSupported = 'onfocusin' in window,
|
|
1780
|
+
focus = {
|
|
1781
|
+
focus: 'focusin',
|
|
1782
|
+
blur: 'focusout'
|
|
1783
|
+
},
|
|
1784
|
+
hover = {
|
|
1785
|
+
mouseenter: 'mouseover',
|
|
1786
|
+
mouseleave: 'mouseout'
|
|
1856
1787
|
};
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1788
|
+
specialEvents.click = specialEvents.mousedown = specialEvents.mouseup = specialEvents.mousemove = 'MouseEvents';
|
|
1789
|
+
function zid(element) {
|
|
1790
|
+
// Always a number — a forged element._zid string must not become a
|
|
1791
|
+
// dynamic key into handlers.
|
|
1792
|
+
var id = element._zid;
|
|
1793
|
+
if (typeof id !== 'number') element._zid = id = _zid++;
|
|
1794
|
+
return id;
|
|
1795
|
+
}
|
|
1796
|
+
function findHandlers(element, event, fn, selector) {
|
|
1797
|
+
event = parse(event);
|
|
1798
|
+
if (event.ns) var matcher = matcherFor(event.ns);
|
|
1799
|
+
return (handlers[zid(element)] || []).filter(function (handler) {
|
|
1800
|
+
return handler && (!event.e || handler.e == event.e) && (!event.ns || matcher.test(handler.ns)) && (!fn || zid(handler.fn) === zid(fn)) && (!selector || handler.sel == selector);
|
|
1801
|
+
});
|
|
1802
|
+
}
|
|
1803
|
+
function parse(event) {
|
|
1804
|
+
var parts = ('' + event).split('.');
|
|
1805
|
+
return {
|
|
1806
|
+
e: parts[0],
|
|
1807
|
+
ns: parts.slice(1).sort().join(' ')
|
|
1865
1808
|
};
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1809
|
+
}
|
|
1810
|
+
function matcherFor(ns) {
|
|
1811
|
+
return new RegExp('(?:^| )' + ns.replace(' ', ' .* ?') + '(?: |$)');
|
|
1812
|
+
}
|
|
1813
|
+
function eventCapture(handler, captureSetting) {
|
|
1814
|
+
return handler.del && !focusinSupported && handler.e in focus || !!captureSetting;
|
|
1815
|
+
}
|
|
1816
|
+
function realEvent(type) {
|
|
1817
|
+
return hover[type] || focusinSupported && focus[type] || type;
|
|
1818
|
+
}
|
|
1819
|
+
function add(element, events, fn, data, selector, delegator, capture) {
|
|
1820
|
+
var id = zid(element),
|
|
1821
|
+
set = handlers[id] || (handlers[id] = []);
|
|
1822
|
+
events.split(/\s/).forEach(function (event) {
|
|
1823
|
+
if (event == 'ready') return $(document).ready(fn);
|
|
1824
|
+
var handler = parse(event);
|
|
1825
|
+
handler.fn = fn;
|
|
1826
|
+
handler.sel = selector;
|
|
1827
|
+
// emulate mouseenter, mouseleave
|
|
1828
|
+
if (handler.e in hover) fn = function (e) {
|
|
1829
|
+
var related = e.relatedTarget;
|
|
1830
|
+
if (!related || related !== this && !$.contains(this, related)) return handler.fn.apply(this, arguments);
|
|
1877
1831
|
};
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1832
|
+
handler.del = delegator;
|
|
1833
|
+
var callback = delegator || fn;
|
|
1834
|
+
handler.proxy = function (e) {
|
|
1835
|
+
e = compatible(e);
|
|
1836
|
+
if (e.isImmediatePropagationStopped()) return;
|
|
1837
|
+
e.data = data;
|
|
1838
|
+
var result = callback.apply(element, e._args == undefined$1 ? [e] : [e].concat(e._args));
|
|
1839
|
+
if (result === false) e.preventDefault(), e.stopPropagation();
|
|
1840
|
+
return result;
|
|
1841
|
+
};
|
|
1842
|
+
handler.i = set.length;
|
|
1843
|
+
set.push(handler);
|
|
1844
|
+
if ('addEventListener' in element) element.addEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture));
|
|
1845
|
+
});
|
|
1846
|
+
}
|
|
1847
|
+
function remove(element, events, fn, selector, capture) {
|
|
1848
|
+
var id = zid(element);
|
|
1849
|
+
(events || '').split(/\s/).forEach(function (event) {
|
|
1850
|
+
findHandlers(element, event, fn, selector).forEach(function (handler) {
|
|
1851
|
+
// Keep delete (not splice) so handler.i remains a stable index for off().
|
|
1852
|
+
delete handlers[id][handler.i];
|
|
1853
|
+
if ('removeEventListener' in element) element.removeEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture));
|
|
1854
|
+
});
|
|
1855
|
+
});
|
|
1856
|
+
}
|
|
1857
|
+
$.event = {
|
|
1858
|
+
add: add,
|
|
1859
|
+
remove: remove
|
|
1860
|
+
};
|
|
1861
|
+
$.proxy = function (fn, context) {
|
|
1862
|
+
var args = 2 in arguments && slice.call(arguments, 2);
|
|
1863
|
+
if (isFunction(fn)) {
|
|
1864
|
+
var proxyFn = function () {
|
|
1865
|
+
return fn.apply(context, args ? args.concat(slice.call(arguments)) : arguments);
|
|
1866
|
+
};
|
|
1867
|
+
proxyFn._zid = zid(fn);
|
|
1868
|
+
return proxyFn;
|
|
1869
|
+
} else if (isString(context)) {
|
|
1870
|
+
if (args) {
|
|
1871
|
+
args.unshift(fn[context], fn);
|
|
1872
|
+
return $.proxy.apply(null, args);
|
|
1873
|
+
} else {
|
|
1874
|
+
return $.proxy(fn[context], fn);
|
|
1890
1875
|
}
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
function createProxy(event) {
|
|
1894
|
-
var key,
|
|
1895
|
-
proxy = {
|
|
1896
|
-
originalEvent: event
|
|
1897
|
-
};
|
|
1898
|
-
for (key in event) if (!ignoreProperties.test(key) && event[key] !== undefined$1) proxy[key] = event[key];
|
|
1899
|
-
return compatible(proxy, event);
|
|
1876
|
+
} else {
|
|
1877
|
+
throw new TypeError("expected function");
|
|
1900
1878
|
}
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1879
|
+
};
|
|
1880
|
+
$.fn.bind = function (event, data, callback) {
|
|
1881
|
+
return this.on(event, data, callback);
|
|
1882
|
+
};
|
|
1883
|
+
$.fn.unbind = function (event, callback) {
|
|
1884
|
+
return this.off(event, callback);
|
|
1885
|
+
};
|
|
1886
|
+
$.fn.one = function (event, selector, data, callback) {
|
|
1887
|
+
return this.on(event, selector, data, callback, 1);
|
|
1888
|
+
};
|
|
1889
|
+
var returnTrue = function () {
|
|
1890
|
+
return true;
|
|
1891
|
+
},
|
|
1892
|
+
returnFalse = function () {
|
|
1893
|
+
return false;
|
|
1894
|
+
},
|
|
1895
|
+
ignoreProperties = /^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/,
|
|
1896
|
+
eventMethods = {
|
|
1897
|
+
preventDefault: 'isDefaultPrevented',
|
|
1898
|
+
stopImmediatePropagation: 'isImmediatePropagationStopped',
|
|
1899
|
+
stopPropagation: 'isPropagationStopped'
|
|
1914
1900
|
};
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
return $this;
|
|
1924
|
-
}
|
|
1925
|
-
if (!isString(selector) && !isFunction(callback) && callback !== false) callback = data, data = selector, selector = undefined$1;
|
|
1926
|
-
if (callback === undefined$1 || data === false) callback = data, data = undefined$1;
|
|
1927
|
-
if (callback === false) callback = returnFalse;
|
|
1928
|
-
return $this.each(function (_, element) {
|
|
1929
|
-
if (one) autoRemove = function (e) {
|
|
1930
|
-
remove(element, e.type, callback);
|
|
1931
|
-
return callback.apply(this, arguments);
|
|
1932
|
-
};
|
|
1933
|
-
if (selector) delegator = function (e) {
|
|
1934
|
-
var evt,
|
|
1935
|
-
match = $(e.target).closest(selector, element).get(0);
|
|
1936
|
-
if (match && match !== element) {
|
|
1937
|
-
evt = $.extend(createProxy(e), {
|
|
1938
|
-
currentTarget: match,
|
|
1939
|
-
liveFired: element
|
|
1940
|
-
});
|
|
1941
|
-
return (autoRemove || callback).apply(match, [evt].concat(slice.call(arguments, 1)));
|
|
1942
|
-
}
|
|
1901
|
+
function compatible(event, source) {
|
|
1902
|
+
if (source || !event.isDefaultPrevented) {
|
|
1903
|
+
source || (source = event);
|
|
1904
|
+
$.each(eventMethods, function (name, predicate) {
|
|
1905
|
+
var sourceMethod = source[name];
|
|
1906
|
+
event[name] = function () {
|
|
1907
|
+
this[predicate] = returnTrue;
|
|
1908
|
+
return sourceMethod && sourceMethod.apply(source, arguments);
|
|
1943
1909
|
};
|
|
1944
|
-
|
|
1945
|
-
});
|
|
1946
|
-
};
|
|
1947
|
-
$.fn.off = function (event, selector, callback) {
|
|
1948
|
-
var $this = this;
|
|
1949
|
-
if (event && !isString(event)) {
|
|
1950
|
-
$.each(event, function (type, fn) {
|
|
1951
|
-
$this.off(type, selector, fn);
|
|
1952
|
-
});
|
|
1953
|
-
return $this;
|
|
1954
|
-
}
|
|
1955
|
-
if (!isString(selector) && !isFunction(callback) && callback !== false) callback = selector, selector = undefined$1;
|
|
1956
|
-
if (callback === false) callback = returnFalse;
|
|
1957
|
-
return $this.each(function () {
|
|
1958
|
-
remove(this, event, callback, selector);
|
|
1959
|
-
});
|
|
1960
|
-
};
|
|
1961
|
-
$.fn.trigger = function (event, args) {
|
|
1962
|
-
event = isString(event) || $.isPlainObject(event) ? $.Event(event) : compatible(event);
|
|
1963
|
-
event._args = args;
|
|
1964
|
-
return this.each(function () {
|
|
1965
|
-
// handle focus(), blur() by calling them directly
|
|
1966
|
-
if (event.type in focus && typeof this[event.type] == "function") this[event.type]();
|
|
1967
|
-
// items in the collection might not be DOM elements
|
|
1968
|
-
else if ('dispatchEvent' in this) this.dispatchEvent(event);else $(this).triggerHandler(event, args);
|
|
1969
|
-
});
|
|
1970
|
-
};
|
|
1971
|
-
|
|
1972
|
-
// triggers event handlers on current element just as if an event occurred,
|
|
1973
|
-
// doesn't trigger an actual event, doesn't bubble
|
|
1974
|
-
$.fn.triggerHandler = function (event, args) {
|
|
1975
|
-
var e, result;
|
|
1976
|
-
this.each(function (i, element) {
|
|
1977
|
-
e = createProxy(isString(event) ? $.Event(event) : event);
|
|
1978
|
-
e._args = args;
|
|
1979
|
-
e.target = element;
|
|
1980
|
-
$.each(findHandlers(element, event.type || event), function (i, handler) {
|
|
1981
|
-
result = handler.proxy(e);
|
|
1982
|
-
if (e.isImmediatePropagationStopped()) return false;
|
|
1983
|
-
});
|
|
1910
|
+
event[predicate] = returnFalse;
|
|
1984
1911
|
});
|
|
1985
|
-
|
|
1912
|
+
if (source.defaultPrevented !== undefined$1 ? source.defaultPrevented : 'returnValue' in source ? source.returnValue === false : source.getPreventDefault && source.getPreventDefault()) event.isDefaultPrevented = returnTrue;
|
|
1986
1913
|
}
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1914
|
+
return event;
|
|
1915
|
+
}
|
|
1916
|
+
function createProxy(event) {
|
|
1917
|
+
var key,
|
|
1918
|
+
proxy = {
|
|
1919
|
+
originalEvent: event
|
|
1993
1920
|
};
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
1921
|
+
for (key in event) if (!ignoreProperties.test(key) && event[key] !== undefined$1) proxy[key] = event[key];
|
|
1922
|
+
return compatible(proxy, event);
|
|
1923
|
+
}
|
|
1924
|
+
$.fn.delegate = function (selector, event, callback) {
|
|
1925
|
+
return this.on(event, selector, callback);
|
|
1926
|
+
};
|
|
1927
|
+
$.fn.undelegate = function (selector, event, callback) {
|
|
1928
|
+
return this.off(event, selector, callback);
|
|
1929
|
+
};
|
|
1930
|
+
$.fn.live = function (event, callback) {
|
|
1931
|
+
$(document.body).delegate(this.selector, event, callback);
|
|
1932
|
+
return this;
|
|
1933
|
+
};
|
|
1934
|
+
$.fn.die = function (event, callback) {
|
|
1935
|
+
$(document.body).undelegate(this.selector, event, callback);
|
|
1936
|
+
return this;
|
|
1937
|
+
};
|
|
1938
|
+
$.fn.on = function (event, selector, data, callback, one) {
|
|
1939
|
+
var autoRemove,
|
|
1940
|
+
delegator,
|
|
1941
|
+
$this = this;
|
|
1942
|
+
if (event && !isString(event)) {
|
|
1943
|
+
$.each(event, function (type, fn) {
|
|
1944
|
+
$this.on(type, selector, data, fn, one);
|
|
1945
|
+
});
|
|
1946
|
+
return $this;
|
|
1947
|
+
}
|
|
1948
|
+
if (!isString(selector) && !isFunction(callback) && callback !== false) callback = data, data = selector, selector = undefined$1;
|
|
1949
|
+
if (callback === undefined$1 || data === false) callback = data, data = undefined$1;
|
|
1950
|
+
if (callback === false) callback = returnFalse;
|
|
1951
|
+
return $this.each(function (_, element) {
|
|
1952
|
+
if (one) autoRemove = function (e) {
|
|
1953
|
+
remove(element, e.type, callback);
|
|
1954
|
+
return callback.apply(this, arguments);
|
|
1955
|
+
};
|
|
1956
|
+
if (selector) delegator = function (e) {
|
|
1957
|
+
var evt,
|
|
1958
|
+
match = $(e.target).closest(selector, element).get(0);
|
|
1959
|
+
if (match && match !== element) {
|
|
1960
|
+
evt = $.extend(createProxy(e), {
|
|
1961
|
+
currentTarget: match,
|
|
1962
|
+
liveFired: element
|
|
1963
|
+
});
|
|
1964
|
+
return (autoRemove || callback).apply(match, [evt].concat(slice.call(arguments, 1)));
|
|
2016
1965
|
}
|
|
2017
1966
|
};
|
|
1967
|
+
add(element, event, callback, data, selector, delegator || autoRemove);
|
|
1968
|
+
});
|
|
1969
|
+
};
|
|
1970
|
+
$.fn.off = function (event, selector, callback) {
|
|
1971
|
+
var $this = this;
|
|
1972
|
+
if (event && !isString(event)) {
|
|
1973
|
+
$.each(event, function (type, fn) {
|
|
1974
|
+
$this.off(type, selector, fn);
|
|
1975
|
+
});
|
|
1976
|
+
return $this;
|
|
2018
1977
|
}
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
1978
|
+
if (!isString(selector) && !isFunction(callback) && callback !== false) callback = selector, selector = undefined$1;
|
|
1979
|
+
if (callback === false) callback = returnFalse;
|
|
1980
|
+
return $this.each(function () {
|
|
1981
|
+
remove(this, event, callback, selector);
|
|
1982
|
+
});
|
|
1983
|
+
};
|
|
1984
|
+
$.fn.trigger = function (event, args) {
|
|
1985
|
+
event = isString(event) || $.isPlainObject(event) ? $.Event(event) : compatible(event);
|
|
1986
|
+
event._args = args;
|
|
1987
|
+
return this.each(function () {
|
|
1988
|
+
// handle focus(), blur() by calling them directly
|
|
1989
|
+
if (event.type in focus && typeof this[event.type] == "function") this[event.type]();
|
|
1990
|
+
// items in the collection might not be DOM elements
|
|
1991
|
+
else if ('dispatchEvent' in this) this.dispatchEvent(event);else $(this).triggerHandler(event, args);
|
|
1992
|
+
});
|
|
1993
|
+
};
|
|
2028
1994
|
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
var filters = $.expr[':'] = {
|
|
2041
|
-
visible: function () {
|
|
2042
|
-
if (visible(this)) return this;
|
|
2043
|
-
},
|
|
2044
|
-
hidden: function () {
|
|
2045
|
-
if (!visible(this)) return this;
|
|
2046
|
-
},
|
|
2047
|
-
selected: function () {
|
|
2048
|
-
if (this.selected) return this;
|
|
2049
|
-
},
|
|
2050
|
-
checked: function () {
|
|
2051
|
-
if (this.checked) return this;
|
|
2052
|
-
},
|
|
2053
|
-
parent: function () {
|
|
2054
|
-
return this.parentNode;
|
|
2055
|
-
},
|
|
2056
|
-
first: function (idx) {
|
|
2057
|
-
if (idx === 0) return this;
|
|
2058
|
-
},
|
|
2059
|
-
last: function (idx, nodes) {
|
|
2060
|
-
if (idx === nodes.length - 1) return this;
|
|
2061
|
-
},
|
|
2062
|
-
eq: function (idx, _, value) {
|
|
2063
|
-
if (idx === value) return this;
|
|
2064
|
-
},
|
|
2065
|
-
contains: function (idx, _, text) {
|
|
2066
|
-
if ($(this).text().indexOf(text) > -1) return this;
|
|
2067
|
-
},
|
|
2068
|
-
has: function (idx, _, sel) {
|
|
2069
|
-
if (zepto.qsa(this, sel).length) return this;
|
|
2070
|
-
}
|
|
2071
|
-
};
|
|
2072
|
-
var filterRe = new RegExp('(.*):(\\w+)(?:\\(([^)]+)\\))?$\\s*'),
|
|
2073
|
-
childRe = /^\s*>/,
|
|
2074
|
-
classTag = 'Zepto' + +new Date();
|
|
2075
|
-
function process(sel, fn) {
|
|
2076
|
-
// quote the hash in `a[href^=#]` expression
|
|
2077
|
-
sel = sel.replace(/=#\]/g, '="#"]');
|
|
2078
|
-
var filter,
|
|
2079
|
-
arg,
|
|
2080
|
-
match = filterRe.exec(sel);
|
|
2081
|
-
if (match && match[2] in filters) {
|
|
2082
|
-
filter = filters[match[2]], arg = match[3];
|
|
2083
|
-
sel = match[1];
|
|
2084
|
-
if (arg) {
|
|
2085
|
-
var num = Number(arg);
|
|
2086
|
-
if (isNaN(num)) arg = arg.replace(/^["']|["']$/g, '');else arg = num;
|
|
2087
|
-
}
|
|
2088
|
-
}
|
|
2089
|
-
return fn(sel, filter, arg);
|
|
2090
|
-
}
|
|
2091
|
-
zepto.qsa = function (node, selector) {
|
|
2092
|
-
return process(selector, function (sel, filter, arg) {
|
|
2093
|
-
try {
|
|
2094
|
-
var taggedParent;
|
|
2095
|
-
if (!sel && filter) sel = '*';else if (childRe.test(sel))
|
|
2096
|
-
// support "> *" child queries by tagging the parent node with a
|
|
2097
|
-
// unique class and prepending that classname onto the selector
|
|
2098
|
-
taggedParent = $(node).addClass(classTag), sel = '.' + classTag + ' ' + sel;
|
|
2099
|
-
var nodes = oldQsa(node, sel);
|
|
2100
|
-
} catch (e) {
|
|
2101
|
-
console.error('error performing selector: %o', selector);
|
|
2102
|
-
throw e;
|
|
2103
|
-
} finally {
|
|
2104
|
-
if (taggedParent) taggedParent.removeClass(classTag);
|
|
2105
|
-
}
|
|
2106
|
-
return !filter ? nodes : zepto.uniq($.map(nodes, function (n, i) {
|
|
2107
|
-
return filter.call(n, i, nodes, arg);
|
|
2108
|
-
}));
|
|
1995
|
+
// triggers event handlers on current element just as if an event occurred,
|
|
1996
|
+
// doesn't trigger an actual event, doesn't bubble
|
|
1997
|
+
$.fn.triggerHandler = function (event, args) {
|
|
1998
|
+
var e, result;
|
|
1999
|
+
this.each(function (i, element) {
|
|
2000
|
+
e = createProxy(isString(event) ? $.Event(event) : event);
|
|
2001
|
+
e._args = args;
|
|
2002
|
+
e.target = element;
|
|
2003
|
+
$.each(findHandlers(element, event.type || event), function (i, handler) {
|
|
2004
|
+
result = handler.proxy(e);
|
|
2005
|
+
if (e.isImmediatePropagationStopped()) return false;
|
|
2109
2006
|
});
|
|
2007
|
+
});
|
|
2008
|
+
return result;
|
|
2009
|
+
}
|
|
2010
|
+
|
|
2011
|
+
// shortcut methods for `.bind(event, fn)` for each event type.
|
|
2012
|
+
// Skip names already defined (e.g. ajax $.fn.load) — this fork concatenates
|
|
2013
|
+
// ajax before event, unlike upstream's default `event ajax` order.
|
|
2014
|
+
;
|
|
2015
|
+
('focusin focusout focus blur load resize scroll unload click dblclick ' + 'mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave ' + 'change select keydown keypress keyup error').split(' ').forEach(function (event) {
|
|
2016
|
+
if ($.fn[event]) return;
|
|
2017
|
+
$.fn[event] = function (callback) {
|
|
2018
|
+
return 0 in arguments ? this.bind(event, callback) : this.trigger(event);
|
|
2110
2019
|
};
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2020
|
+
});
|
|
2021
|
+
$.Event = function (type, props) {
|
|
2022
|
+
if (!isString(type)) props = type, type = props.type;
|
|
2023
|
+
var event = document.createEvent(specialEvents[type] || 'Events'),
|
|
2024
|
+
bubbles = true;
|
|
2025
|
+
if (props) for (var name in props) name == 'bubbles' ? bubbles = !!props[name] : event[name] = props[name];
|
|
2026
|
+
event.initEvent(type, bubbles, true);
|
|
2027
|
+
return compatible(event);
|
|
2028
|
+
};
|
|
2029
|
+
})(Zepto);
|
|
2030
|
+
(function () {
|
|
2031
|
+
// getComputedStyle shouldn't freak out when called
|
|
2032
|
+
// without a valid element as argument
|
|
2033
|
+
try {
|
|
2034
|
+
getComputedStyle(undefined);
|
|
2035
|
+
} catch (e) {
|
|
2036
|
+
var nativeGetComputedStyle = getComputedStyle;
|
|
2037
|
+
window.getComputedStyle = function (element, pseudoElement) {
|
|
2038
|
+
try {
|
|
2039
|
+
return nativeGetComputedStyle(element, pseudoElement);
|
|
2040
|
+
} catch (e) {
|
|
2041
|
+
return null;
|
|
2042
|
+
}
|
|
2115
2043
|
};
|
|
2116
|
-
}
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2044
|
+
}
|
|
2045
|
+
})();
|
|
2046
|
+
(function ($) {
|
|
2047
|
+
var zepto = $.zepto,
|
|
2048
|
+
oldQsa = zepto.qsa,
|
|
2049
|
+
oldMatches = zepto.matches;
|
|
2050
|
+
function visible(elem) {
|
|
2051
|
+
elem = $(elem);
|
|
2052
|
+
return !!(elem.width() || elem.height()) && elem.css("display") !== "none";
|
|
2053
|
+
}
|
|
2054
|
+
|
|
2055
|
+
// Implements a subset from:
|
|
2056
|
+
// http://api.jquery.com/category/selectors/jquery-selector-extensions/
|
|
2057
|
+
//
|
|
2058
|
+
// Each filter function receives the current index, all nodes in the
|
|
2059
|
+
// considered set, and a value if there were parentheses. The value
|
|
2060
|
+
// of `this` is the node currently being considered. The function returns the
|
|
2061
|
+
// resulting node(s), null, or undefined.
|
|
2062
|
+
//
|
|
2063
|
+
// Complex selectors are not supported:
|
|
2064
|
+
// li:has(label:contains("foo")) + li:has(label:contains("bar"))
|
|
2065
|
+
// ul.inner:first > li
|
|
2066
|
+
var filters = $.expr[':'] = {
|
|
2067
|
+
visible: function () {
|
|
2068
|
+
if (visible(this)) return this;
|
|
2069
|
+
},
|
|
2070
|
+
hidden: function () {
|
|
2071
|
+
if (!visible(this)) return this;
|
|
2072
|
+
},
|
|
2073
|
+
selected: function () {
|
|
2074
|
+
if (this.selected) return this;
|
|
2075
|
+
},
|
|
2076
|
+
checked: function () {
|
|
2077
|
+
if (this.checked) return this;
|
|
2078
|
+
},
|
|
2079
|
+
parent: function () {
|
|
2080
|
+
return this.parentNode;
|
|
2081
|
+
},
|
|
2082
|
+
first: function (idx) {
|
|
2083
|
+
if (idx === 0) return this;
|
|
2084
|
+
},
|
|
2085
|
+
last: function (idx, nodes) {
|
|
2086
|
+
if (idx === nodes.length - 1) return this;
|
|
2087
|
+
},
|
|
2088
|
+
eq: function (idx, _, value) {
|
|
2089
|
+
if (idx === value) return this;
|
|
2090
|
+
},
|
|
2091
|
+
contains: function (idx, _, text) {
|
|
2092
|
+
if ($(this).text().indexOf(text) > -1) return this;
|
|
2093
|
+
},
|
|
2094
|
+
has: function (idx, _, sel) {
|
|
2095
|
+
if (zepto.qsa(this, sel).length) return this;
|
|
2096
|
+
}
|
|
2097
|
+
};
|
|
2098
|
+
var filterRe = new RegExp('(.*):(\\w+)(?:\\(([^)]+)\\))?$\\s*'),
|
|
2099
|
+
childRe = /^\s*>/,
|
|
2100
|
+
classTag = 'Zepto' + +new Date();
|
|
2101
|
+
function process(sel, fn) {
|
|
2102
|
+
// quote the hash in `a[href^=#]` expression
|
|
2103
|
+
sel = sel.replace(/=#\]/g, '="#"]');
|
|
2104
|
+
var filter,
|
|
2105
|
+
arg,
|
|
2106
|
+
match = filterRe.exec(sel);
|
|
2107
|
+
if (match && match[2] in filters) {
|
|
2108
|
+
filter = filters[match[2]], arg = match[3];
|
|
2109
|
+
sel = match[1];
|
|
2110
|
+
if (arg) {
|
|
2111
|
+
var num = Number(arg);
|
|
2112
|
+
if (isNaN(num)) arg = arg.replace(/^["']|["']$/g, '');else arg = num;
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
return fn(sel, filter, arg);
|
|
2116
|
+
}
|
|
2117
|
+
zepto.qsa = function (node, selector) {
|
|
2118
|
+
return process(selector, function (sel, filter, arg) {
|
|
2119
|
+
try {
|
|
2120
|
+
var taggedParent;
|
|
2121
|
+
if (!sel && filter) sel = '*';else if (childRe.test(sel))
|
|
2122
|
+
// support "> *" child queries by tagging the parent node with a
|
|
2123
|
+
// unique class and prepending that classname onto the selector
|
|
2124
|
+
taggedParent = $(node).addClass(classTag), sel = '.' + classTag + ' ' + sel;
|
|
2125
|
+
var nodes = oldQsa(node, sel);
|
|
2126
|
+
} catch (e) {
|
|
2127
|
+
console.error('error performing selector: %o', selector);
|
|
2128
|
+
throw e;
|
|
2129
|
+
} finally {
|
|
2130
|
+
if (taggedParent) taggedParent.removeClass(classTag);
|
|
2131
|
+
}
|
|
2132
|
+
return !filter ? nodes : zepto.uniq($.map(nodes, function (n, i) {
|
|
2133
|
+
return filter.call(n, i, nodes, arg);
|
|
2134
|
+
}));
|
|
2135
|
+
});
|
|
2136
|
+
};
|
|
2137
|
+
zepto.matches = function (node, selector) {
|
|
2138
|
+
return process(selector, function (sel, filter, arg) {
|
|
2139
|
+
return (!sel || oldMatches(node, sel)) && (!filter || filter.call(node, null, arg) === node);
|
|
2140
|
+
});
|
|
2141
|
+
};
|
|
2142
|
+
})(Zepto);
|
|
2122
2143
|
|
|
2123
2144
|
// Copyright 2014 Globo.com Player authors. All rights reserved.
|
|
2124
2145
|
// Use of this source code is governed by a BSD-style
|
|
@@ -2675,8 +2696,8 @@
|
|
|
2675
2696
|
// Set viewport size
|
|
2676
2697
|
var getViewportSize = function getViewportSize() {
|
|
2677
2698
|
var viewportObject = {};
|
|
2678
|
-
viewportObject.width =
|
|
2679
|
-
viewportObject.height =
|
|
2699
|
+
viewportObject.width = Zepto(window).width();
|
|
2700
|
+
viewportObject.height = Zepto(window).height();
|
|
2680
2701
|
return viewportObject;
|
|
2681
2702
|
};
|
|
2682
2703
|
|
|
@@ -3039,7 +3060,7 @@
|
|
|
3039
3060
|
return _createClass$2(DomRecycler, null, [{
|
|
3040
3061
|
key: "configure",
|
|
3041
3062
|
value: function configure(options) {
|
|
3042
|
-
this.options =
|
|
3063
|
+
this.options = Zepto.extend(true, this.options, options);
|
|
3043
3064
|
}
|
|
3044
3065
|
}, {
|
|
3045
3066
|
key: "create",
|
|
@@ -3053,7 +3074,7 @@
|
|
|
3053
3074
|
key: "garbage",
|
|
3054
3075
|
value: function garbage(el) {
|
|
3055
3076
|
if (!this.options.recycleVideo || el.tagName.toUpperCase() !== 'VIDEO') return;
|
|
3056
|
-
|
|
3077
|
+
Zepto(el).children().remove();
|
|
3057
3078
|
Object.values(el.attributes).forEach(function (attr) {
|
|
3058
3079
|
return el.removeAttribute(attr.name);
|
|
3059
3080
|
});
|
|
@@ -4365,7 +4386,7 @@
|
|
|
4365
4386
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
4366
4387
|
baseUrl: ''
|
|
4367
4388
|
};
|
|
4368
|
-
return
|
|
4389
|
+
return Zepto('<style class="clappr-style"></style>').html(tmpl(style.toString())(options));
|
|
4369
4390
|
}
|
|
4370
4391
|
};
|
|
4371
4392
|
var delegateEventSplitter = /^(\S+)\s*(.*)$/;
|
|
@@ -4518,9 +4539,9 @@
|
|
|
4518
4539
|
* the dom element wrapped by `$`
|
|
4519
4540
|
*
|
|
4520
4541
|
* @property $el
|
|
4521
|
-
* @type
|
|
4542
|
+
* @type {Object}
|
|
4522
4543
|
*/
|
|
4523
|
-
this.$el =
|
|
4544
|
+
this.$el = Zepto.zepto.isZ(element) ? element : Zepto(element);
|
|
4524
4545
|
/**
|
|
4525
4546
|
* the dom element itself
|
|
4526
4547
|
*
|
|
@@ -4581,10 +4602,10 @@
|
|
|
4581
4602
|
key: "_ensureElement",
|
|
4582
4603
|
value: function _ensureElement() {
|
|
4583
4604
|
if (!this.el) {
|
|
4584
|
-
var attrs =
|
|
4605
|
+
var attrs = Zepto.extend(true, {}, this.attributes);
|
|
4585
4606
|
if (this.id) attrs.id = this.id;
|
|
4586
4607
|
if (this.className) attrs["class"] = this.className;
|
|
4587
|
-
var $el =
|
|
4608
|
+
var $el = Zepto(DomRecycler.create(this.tagName)).attr(attrs);
|
|
4588
4609
|
this.setElement($el, false);
|
|
4589
4610
|
} else {
|
|
4590
4611
|
this.setElement(this.el, false);
|
|
@@ -4792,7 +4813,7 @@
|
|
|
4792
4813
|
_this.volume = 100;
|
|
4793
4814
|
_this.playback = options.playback;
|
|
4794
4815
|
_this.playerError = playerError;
|
|
4795
|
-
_this.settings =
|
|
4816
|
+
_this.settings = Zepto.extend(true, {}, _this.playback.settings);
|
|
4796
4817
|
_this.isReady = false;
|
|
4797
4818
|
_this.mediaControlDisabled = false;
|
|
4798
4819
|
_this.plugins = [_this.playback];
|
|
@@ -5487,7 +5508,7 @@
|
|
|
5487
5508
|
key: "configure",
|
|
5488
5509
|
value: function configure(options, oldOptions) {
|
|
5489
5510
|
this.trigger(Events$1.CONTAINER_OPTIONS_WILL_CHANGE, oldOptions);
|
|
5490
|
-
this._options =
|
|
5511
|
+
this._options = Zepto.extend(true, this._options, options);
|
|
5491
5512
|
this.updateStyle();
|
|
5492
5513
|
this.playback.configure(this.options);
|
|
5493
5514
|
this.trigger(Events$1.CONTAINER_OPTIONS_CHANGE);
|
|
@@ -5886,7 +5907,7 @@
|
|
|
5886
5907
|
}, {
|
|
5887
5908
|
key: "configure",
|
|
5888
5909
|
value: function configure(options) {
|
|
5889
|
-
this._options =
|
|
5910
|
+
this._options = Zepto.extend(true, this._options, options);
|
|
5890
5911
|
}
|
|
5891
5912
|
|
|
5892
5913
|
/**
|
|
@@ -6011,7 +6032,7 @@
|
|
|
6011
6032
|
key: "createContainers",
|
|
6012
6033
|
value: function createContainers() {
|
|
6013
6034
|
var _this2 = this;
|
|
6014
|
-
return
|
|
6035
|
+
return Zepto.Deferred(function (promise) {
|
|
6015
6036
|
promise.resolve(_this2.options.sources.map(function (source) {
|
|
6016
6037
|
return _this2.createContainer(source);
|
|
6017
6038
|
}));
|
|
@@ -6049,7 +6070,7 @@
|
|
|
6049
6070
|
playback: playback
|
|
6050
6071
|
});
|
|
6051
6072
|
var container = new Container(options, this._i18n, this.playerError);
|
|
6052
|
-
var defer =
|
|
6073
|
+
var defer = Zepto.Deferred();
|
|
6053
6074
|
defer.promise(container);
|
|
6054
6075
|
this.addContainerPlugins(container);
|
|
6055
6076
|
this.listenToOnce(container, Events$1.CONTAINER_READY, function () {
|
|
@@ -6099,10 +6120,10 @@
|
|
|
6099
6120
|
_this._boundHandleWindowResize = function (o) {
|
|
6100
6121
|
return _this.handleWindowResize(o);
|
|
6101
6122
|
};
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
Browser.isMobile &&
|
|
6123
|
+
Zepto(document).bind('fullscreenchange', _this._boundFullscreenHandler);
|
|
6124
|
+
Zepto(document).bind('MSFullscreenChange', _this._boundFullscreenHandler);
|
|
6125
|
+
Zepto(document).bind('mozfullscreenchange', _this._boundFullscreenHandler);
|
|
6126
|
+
Browser.isMobile && Zepto(window).bind('resize', _this._boundHandleWindowResize);
|
|
6106
6127
|
return _this;
|
|
6107
6128
|
}
|
|
6108
6129
|
_inherits$2(Core, _UIObject);
|
|
@@ -6223,7 +6244,7 @@
|
|
|
6223
6244
|
}, {
|
|
6224
6245
|
key: "createContainers",
|
|
6225
6246
|
value: function createContainers(options) {
|
|
6226
|
-
this.defer =
|
|
6247
|
+
this.defer = Zepto.Deferred();
|
|
6227
6248
|
this.defer.promise(this);
|
|
6228
6249
|
this.containerFactory = new ContainerFactory(options, options.loader, this.i18n, this.playerError);
|
|
6229
6250
|
this.prepareContainers();
|
|
@@ -6254,8 +6275,8 @@
|
|
|
6254
6275
|
height: this.options.height
|
|
6255
6276
|
};
|
|
6256
6277
|
this.currentSize = {
|
|
6257
|
-
width:
|
|
6258
|
-
height:
|
|
6278
|
+
width: Zepto(window).width(),
|
|
6279
|
+
height: Zepto(window).height()
|
|
6259
6280
|
};
|
|
6260
6281
|
}
|
|
6261
6282
|
}
|
|
@@ -6265,8 +6286,8 @@
|
|
|
6265
6286
|
this.$el.removeClass('fullscreen');
|
|
6266
6287
|
this.currentSize = this.previousSize;
|
|
6267
6288
|
this.previousSize = {
|
|
6268
|
-
width:
|
|
6269
|
-
height:
|
|
6289
|
+
width: Zepto(window).width(),
|
|
6290
|
+
height: Zepto(window).height()
|
|
6270
6291
|
};
|
|
6271
6292
|
this.resize(this.currentSize);
|
|
6272
6293
|
}
|
|
@@ -6327,7 +6348,7 @@
|
|
|
6327
6348
|
key: "resolveOnContainersReady",
|
|
6328
6349
|
value: function resolveOnContainersReady(containers) {
|
|
6329
6350
|
var _this4 = this;
|
|
6330
|
-
|
|
6351
|
+
Zepto.when.apply(Zepto, containers).done(function () {
|
|
6331
6352
|
_this4.defer.resolve(_this4);
|
|
6332
6353
|
_this4.ready = true;
|
|
6333
6354
|
_this4.trigger(Events$1.CORE_READY);
|
|
@@ -6359,7 +6380,7 @@
|
|
|
6359
6380
|
this.containers.forEach(function (container) {
|
|
6360
6381
|
return container.destroy();
|
|
6361
6382
|
});
|
|
6362
|
-
this.containerFactory.options =
|
|
6383
|
+
this.containerFactory.options = Zepto.extend(true, this.options, {
|
|
6363
6384
|
sources: sources
|
|
6364
6385
|
});
|
|
6365
6386
|
this.prepareContainers();
|
|
@@ -6375,10 +6396,10 @@
|
|
|
6375
6396
|
return plugin.destroy();
|
|
6376
6397
|
});
|
|
6377
6398
|
this.$el.remove();
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
Browser.isMobile &&
|
|
6399
|
+
Zepto(document).unbind('fullscreenchange', this._boundFullscreenHandler);
|
|
6400
|
+
Zepto(document).unbind('MSFullscreenChange', this._boundFullscreenHandler);
|
|
6401
|
+
Zepto(document).unbind('mozfullscreenchange', this._boundFullscreenHandler);
|
|
6402
|
+
Browser.isMobile && Zepto(window).unbind('resize', this._boundHandleWindowResize);
|
|
6382
6403
|
this.stopListening();
|
|
6383
6404
|
this.undelegateEvents();
|
|
6384
6405
|
}
|
|
@@ -6536,9 +6557,9 @@
|
|
|
6536
6557
|
key: "configure",
|
|
6537
6558
|
value: function configure(options) {
|
|
6538
6559
|
var _this7 = this;
|
|
6539
|
-
var oldOptions =
|
|
6560
|
+
var oldOptions = Zepto.extend(true, {}, this._options);
|
|
6540
6561
|
this.trigger(Events$1.CORE_OPTIONS_WILL_CHANGE, oldOptions);
|
|
6541
|
-
this._options =
|
|
6562
|
+
this._options = Zepto.extend(true, this._options, options);
|
|
6542
6563
|
this.configureDomRecycler();
|
|
6543
6564
|
var sources = options.source || options.sources;
|
|
6544
6565
|
sources && this.load(sources, options.mimeType || this.options.mimeType);
|
|
@@ -6730,7 +6751,7 @@
|
|
|
6730
6751
|
plugins: {},
|
|
6731
6752
|
playbacks: []
|
|
6732
6753
|
};
|
|
6733
|
-
var currentVersion = "0.14.
|
|
6754
|
+
var currentVersion = "0.14.5";
|
|
6734
6755
|
return /*#__PURE__*/function () {
|
|
6735
6756
|
/**
|
|
6736
6757
|
* builds the loader
|
|
@@ -7114,7 +7135,7 @@
|
|
|
7114
7135
|
includeResetStyle: true,
|
|
7115
7136
|
playback: playbackDefaultOptions
|
|
7116
7137
|
};
|
|
7117
|
-
_this._options =
|
|
7138
|
+
_this._options = Zepto.extend(true, defaultOptions, options);
|
|
7118
7139
|
_this.options.sources = _this._normalizeSources(options);
|
|
7119
7140
|
if (!_this.options.chromeless) {
|
|
7120
7141
|
// "allowUserInteraction" cannot be false if not in chromeless mode.
|
|
@@ -7869,7 +7890,7 @@
|
|
|
7869
7890
|
posterUrl = _this.options.poster.url;
|
|
7870
7891
|
}
|
|
7871
7892
|
}
|
|
7872
|
-
|
|
7893
|
+
Zepto.extend(true, _this.el, {
|
|
7873
7894
|
muted: _this.options.mute,
|
|
7874
7895
|
defaultMuted: _this.options.mute,
|
|
7875
7896
|
loop: _this.options.loop,
|
|
@@ -7908,7 +7929,7 @@
|
|
|
7908
7929
|
key: "supportedVersion",
|
|
7909
7930
|
get: function get() {
|
|
7910
7931
|
return {
|
|
7911
|
-
min: "0.14.
|
|
7932
|
+
min: "0.14.5"
|
|
7912
7933
|
};
|
|
7913
7934
|
}
|
|
7914
7935
|
}, {
|
|
@@ -8712,7 +8733,7 @@
|
|
|
8712
8733
|
key: "supportedVersion",
|
|
8713
8734
|
get: function get() {
|
|
8714
8735
|
return {
|
|
8715
|
-
min: "0.14.
|
|
8736
|
+
min: "0.14.5"
|
|
8716
8737
|
};
|
|
8717
8738
|
}
|
|
8718
8739
|
}, {
|
|
@@ -8767,7 +8788,7 @@
|
|
|
8767
8788
|
key: "supportedVersion",
|
|
8768
8789
|
get: function get() {
|
|
8769
8790
|
return {
|
|
8770
|
-
min: "0.14.
|
|
8791
|
+
min: "0.14.5"
|
|
8771
8792
|
};
|
|
8772
8793
|
}
|
|
8773
8794
|
}, {
|
|
@@ -8847,7 +8868,7 @@
|
|
|
8847
8868
|
key: "supportedVersion",
|
|
8848
8869
|
get: function get() {
|
|
8849
8870
|
return {
|
|
8850
|
-
min: "0.14.
|
|
8871
|
+
min: "0.14.5"
|
|
8851
8872
|
};
|
|
8852
8873
|
}
|
|
8853
8874
|
}, {
|
|
@@ -8979,7 +9000,7 @@
|
|
|
8979
9000
|
key: "supportedVersion",
|
|
8980
9001
|
get: function get() {
|
|
8981
9002
|
return {
|
|
8982
|
-
min: "0.14.
|
|
9003
|
+
min: "0.14.5"
|
|
8983
9004
|
};
|
|
8984
9005
|
}
|
|
8985
9006
|
}, {
|
|
@@ -9090,7 +9111,7 @@
|
|
|
9090
9111
|
'default_error_message': '在尝试加载视频时出现了问题。'
|
|
9091
9112
|
}
|
|
9092
9113
|
};
|
|
9093
|
-
this._messages =
|
|
9114
|
+
this._messages = Zepto.extend(true, defaultMessages, this.core.options.strings || {});
|
|
9094
9115
|
this._messages['de-DE'] = this._messages.de;
|
|
9095
9116
|
this._messages['pt-BR'] = this._messages.pt;
|
|
9096
9117
|
this._messages['en-US'] = this._messages.en;
|
|
@@ -9120,7 +9141,7 @@
|
|
|
9120
9141
|
key: "supportedVersion",
|
|
9121
9142
|
get: function get() {
|
|
9122
9143
|
return {
|
|
9123
|
-
min: "0.14.
|
|
9144
|
+
min: "0.14.5"
|
|
9124
9145
|
};
|
|
9125
9146
|
}
|
|
9126
9147
|
}, {
|
|
@@ -9149,7 +9170,7 @@
|
|
|
9149
9170
|
@type {string}
|
|
9150
9171
|
@default
|
|
9151
9172
|
*/
|
|
9152
|
-
var version$2 = "0.14.
|
|
9173
|
+
var version$2 = "0.14.5";
|
|
9153
9174
|
|
|
9154
9175
|
// Built-in Plugins/Playbacks
|
|
9155
9176
|
|
|
@@ -9182,7 +9203,7 @@
|
|
|
9182
9203
|
Styler: Styler,
|
|
9183
9204
|
version: version$2,
|
|
9184
9205
|
template: tmpl,
|
|
9185
|
-
$:
|
|
9206
|
+
$: Zepto
|
|
9186
9207
|
};
|
|
9187
9208
|
|
|
9188
9209
|
function _assertThisInitialized$1(e) {
|
|
@@ -9298,7 +9319,7 @@
|
|
|
9298
9319
|
key: "supportedVersion",
|
|
9299
9320
|
get: function get() {
|
|
9300
9321
|
return {
|
|
9301
|
-
min: "0.14.
|
|
9322
|
+
min: "0.14.5"
|
|
9302
9323
|
};
|
|
9303
9324
|
}
|
|
9304
9325
|
}, {
|
|
@@ -9361,7 +9382,7 @@
|
|
|
9361
9382
|
key: "supportedVersion",
|
|
9362
9383
|
get: function get() {
|
|
9363
9384
|
return {
|
|
9364
|
-
min: "0.14.
|
|
9385
|
+
min: "0.14.5"
|
|
9365
9386
|
};
|
|
9366
9387
|
}
|
|
9367
9388
|
}, {
|
|
@@ -9526,7 +9547,7 @@
|
|
|
9526
9547
|
key: "supportedVersion",
|
|
9527
9548
|
get: function get() {
|
|
9528
9549
|
return {
|
|
9529
|
-
min: "0.14.
|
|
9550
|
+
min: "0.14.5"
|
|
9530
9551
|
};
|
|
9531
9552
|
}
|
|
9532
9553
|
}, {
|
|
@@ -9657,7 +9678,7 @@
|
|
|
9657
9678
|
key: "supportedVersion",
|
|
9658
9679
|
get: function get() {
|
|
9659
9680
|
return {
|
|
9660
|
-
min: "0.14.
|
|
9681
|
+
min: "0.14.5"
|
|
9661
9682
|
};
|
|
9662
9683
|
}
|
|
9663
9684
|
}, {
|
|
@@ -9707,7 +9728,7 @@
|
|
|
9707
9728
|
key: "supportedVersion",
|
|
9708
9729
|
get: function get() {
|
|
9709
9730
|
return {
|
|
9710
|
-
min: "0.14.
|
|
9731
|
+
min: "0.14.5"
|
|
9711
9732
|
};
|
|
9712
9733
|
}
|
|
9713
9734
|
}, {
|
|
@@ -9807,7 +9828,7 @@
|
|
|
9807
9828
|
}(UICorePlugin);
|
|
9808
9829
|
var playIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path fill=\"#010101\" d=\"M1.425.35L14.575 8l-13.15 7.65V.35z\"/>\n</svg>";
|
|
9809
9830
|
var pauseIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" fill=\"#010101\" d=\"M1.712 14.76H6.43V1.24H1.71v13.52zm7.86-13.52v13.52h4.716V1.24H9.573z\"/>\n</svg>";
|
|
9810
|
-
var oldIcon =
|
|
9831
|
+
var oldIcon = Zepto('link[rel="shortcut icon"]');
|
|
9811
9832
|
var Favicon$1 = /*#__PURE__*/function (_CorePlugin) {
|
|
9812
9833
|
function Favicon(core) {
|
|
9813
9834
|
var _this;
|
|
@@ -9827,7 +9848,7 @@
|
|
|
9827
9848
|
key: "supportedVersion",
|
|
9828
9849
|
get: function get() {
|
|
9829
9850
|
return {
|
|
9830
|
-
min: "0.14.
|
|
9851
|
+
min: "0.14.5"
|
|
9831
9852
|
};
|
|
9832
9853
|
}
|
|
9833
9854
|
}, {
|
|
@@ -9882,15 +9903,15 @@
|
|
|
9882
9903
|
}, {
|
|
9883
9904
|
key: "createIcon",
|
|
9884
9905
|
value: function createIcon(svg) {
|
|
9885
|
-
var canvas =
|
|
9906
|
+
var canvas = Zepto('<canvas/>');
|
|
9886
9907
|
canvas[0].width = 16;
|
|
9887
9908
|
canvas[0].height = 16;
|
|
9888
9909
|
var ctx = canvas[0].getContext('2d');
|
|
9889
9910
|
ctx.fillStyle = '#000';
|
|
9890
|
-
var d =
|
|
9911
|
+
var d = Zepto(svg).find('path').attr('d');
|
|
9891
9912
|
var path = new Path2D(d);
|
|
9892
9913
|
ctx.fill(path);
|
|
9893
|
-
var icon =
|
|
9914
|
+
var icon = Zepto('<link rel="shortcut icon" type="image/png"/>');
|
|
9894
9915
|
icon.attr('href', canvas[0].toDataURL('image/png'));
|
|
9895
9916
|
return icon;
|
|
9896
9917
|
}
|
|
@@ -9913,15 +9934,15 @@
|
|
|
9913
9934
|
}, {
|
|
9914
9935
|
key: "resetIcon",
|
|
9915
9936
|
value: function resetIcon() {
|
|
9916
|
-
|
|
9917
|
-
|
|
9937
|
+
Zepto('link[rel="shortcut icon"]').remove();
|
|
9938
|
+
Zepto('head').append(this.oldIcon);
|
|
9918
9939
|
}
|
|
9919
9940
|
}, {
|
|
9920
9941
|
key: "changeIcon",
|
|
9921
9942
|
value: function changeIcon(icon) {
|
|
9922
9943
|
if (icon) {
|
|
9923
|
-
|
|
9924
|
-
|
|
9944
|
+
Zepto('link[rel="shortcut icon"]').remove();
|
|
9945
|
+
Zepto('head').append(icon);
|
|
9925
9946
|
}
|
|
9926
9947
|
}
|
|
9927
9948
|
}]);
|
|
@@ -9950,7 +9971,7 @@
|
|
|
9950
9971
|
key: "supportedVersion",
|
|
9951
9972
|
get: function get() {
|
|
9952
9973
|
return {
|
|
9953
|
-
min: "0.14.
|
|
9974
|
+
min: "0.14.5"
|
|
9954
9975
|
};
|
|
9955
9976
|
}
|
|
9956
9977
|
}, {
|
|
@@ -10421,8 +10442,8 @@
|
|
|
10421
10442
|
_this.kibo = new Kibo(_this.options.focusElement);
|
|
10422
10443
|
_this.bindKeyEvents();
|
|
10423
10444
|
if (_this.container) {
|
|
10424
|
-
if (
|
|
10425
|
-
_this.settings =
|
|
10445
|
+
if (!Zepto.isEmptyObject(_this.container.settings)) {
|
|
10446
|
+
_this.settings = Zepto.extend({}, _this.container.settings);
|
|
10426
10447
|
}
|
|
10427
10448
|
} else {
|
|
10428
10449
|
_this.settings = {};
|
|
@@ -10437,8 +10458,8 @@
|
|
|
10437
10458
|
_this.updateDragHandler = function (event) {
|
|
10438
10459
|
return _this.updateDrag(event);
|
|
10439
10460
|
};
|
|
10440
|
-
|
|
10441
|
-
|
|
10461
|
+
Zepto(document).bind('mouseup', _this.stopDragHandler);
|
|
10462
|
+
Zepto(document).bind('mousemove', _this.updateDragHandler);
|
|
10442
10463
|
return _this;
|
|
10443
10464
|
}
|
|
10444
10465
|
_inherits$1(MediaControl, _UICorePlugin);
|
|
@@ -10451,7 +10472,7 @@
|
|
|
10451
10472
|
key: "supportedVersion",
|
|
10452
10473
|
get: function get() {
|
|
10453
10474
|
return {
|
|
10454
|
-
min: "0.14.
|
|
10475
|
+
min: "0.14.5"
|
|
10455
10476
|
};
|
|
10456
10477
|
}
|
|
10457
10478
|
}, {
|
|
@@ -11016,7 +11037,7 @@
|
|
|
11016
11037
|
}, {
|
|
11017
11038
|
key: "getSettings",
|
|
11018
11039
|
value: function getSettings() {
|
|
11019
|
-
return
|
|
11040
|
+
return Zepto.extend(true, {}, this.container && this.container.settings);
|
|
11020
11041
|
}
|
|
11021
11042
|
}, {
|
|
11022
11043
|
key: "highDefinitionUpdate",
|
|
@@ -11166,13 +11187,13 @@
|
|
|
11166
11187
|
}, {
|
|
11167
11188
|
key: "applyButtonStyle",
|
|
11168
11189
|
value: function applyButtonStyle(element) {
|
|
11169
|
-
this.buttonsColor && element &&
|
|
11190
|
+
this.buttonsColor && element && Zepto(element).find('svg path').css('fill', this.buttonsColor);
|
|
11170
11191
|
}
|
|
11171
11192
|
}, {
|
|
11172
11193
|
key: "destroy",
|
|
11173
11194
|
value: function destroy() {
|
|
11174
|
-
|
|
11175
|
-
|
|
11195
|
+
Zepto(document).unbind('mouseup', this.stopDragHandler);
|
|
11196
|
+
Zepto(document).unbind('mousemove', this.updateDragHandler);
|
|
11176
11197
|
this.unbindKeyEvents();
|
|
11177
11198
|
this.stopListening();
|
|
11178
11199
|
_superPropGet$1(MediaControl, "destroy", this, 3)([]);
|
|
@@ -11281,7 +11302,7 @@
|
|
|
11281
11302
|
key: "supportedVersion",
|
|
11282
11303
|
get: function get() {
|
|
11283
11304
|
return {
|
|
11284
|
-
min: "0.14.
|
|
11305
|
+
min: "0.14.5"
|
|
11285
11306
|
};
|
|
11286
11307
|
}
|
|
11287
11308
|
}, {
|
|
@@ -11500,7 +11521,7 @@
|
|
|
11500
11521
|
key: "supportedVersion",
|
|
11501
11522
|
get: function get() {
|
|
11502
11523
|
return {
|
|
11503
|
-
min: "0.14.
|
|
11524
|
+
min: "0.14.5"
|
|
11504
11525
|
};
|
|
11505
11526
|
}
|
|
11506
11527
|
}, {
|
|
@@ -11704,7 +11725,7 @@
|
|
|
11704
11725
|
key: "supportedVersion",
|
|
11705
11726
|
get: function get() {
|
|
11706
11727
|
return {
|
|
11707
|
-
min: "0.14.
|
|
11728
|
+
min: "0.14.5"
|
|
11708
11729
|
};
|
|
11709
11730
|
}
|
|
11710
11731
|
}, {
|
|
@@ -11786,7 +11807,7 @@
|
|
|
11786
11807
|
key: "supportedVersion",
|
|
11787
11808
|
get: function get() {
|
|
11788
11809
|
return {
|
|
11789
|
-
min: "0.14.
|
|
11810
|
+
min: "0.14.5"
|
|
11790
11811
|
};
|
|
11791
11812
|
}
|
|
11792
11813
|
}, {
|
|
@@ -11872,7 +11893,7 @@
|
|
|
11872
11893
|
}, {
|
|
11873
11894
|
key: "onStatsAdd",
|
|
11874
11895
|
value: function onStatsAdd(metric) {
|
|
11875
|
-
|
|
11896
|
+
Zepto.extend(this.externalMetrics, metric);
|
|
11876
11897
|
}
|
|
11877
11898
|
}, {
|
|
11878
11899
|
key: "getStats",
|
|
@@ -11883,7 +11904,7 @@
|
|
|
11883
11904
|
rebufferingTime: this.isRebuffering() ? this.rebufferingTime + this.getRebufferingTime() : this.rebufferingTime,
|
|
11884
11905
|
watchingTime: this.isRebuffering() ? this.getWatchingTime() - this.getRebufferingTime() : this.getWatchingTime()
|
|
11885
11906
|
};
|
|
11886
|
-
|
|
11907
|
+
Zepto.extend(metrics, this.externalMetrics);
|
|
11887
11908
|
return metrics;
|
|
11888
11909
|
}
|
|
11889
11910
|
}, {
|
|
@@ -11913,7 +11934,7 @@
|
|
|
11913
11934
|
key: "supportedVersion",
|
|
11914
11935
|
get: function get() {
|
|
11915
11936
|
return {
|
|
11916
|
-
min: "0.14.
|
|
11937
|
+
min: "0.14.5"
|
|
11917
11938
|
};
|
|
11918
11939
|
}
|
|
11919
11940
|
}, {
|
|
@@ -11987,7 +12008,7 @@
|
|
|
11987
12008
|
WaterMark: WaterMarkPlugin
|
|
11988
12009
|
};
|
|
11989
12010
|
|
|
11990
|
-
var version$1 = "0.12.
|
|
12011
|
+
var version$1 = "0.12.5";
|
|
11991
12012
|
for (var _i = 0, _Object$values = Object.values(Plugins); _i < _Object$values.length; _i++) {
|
|
11992
12013
|
var plugin = _Object$values[_i];
|
|
11993
12014
|
Loader.registerPlugin(plugin);
|
|
@@ -48745,7 +48766,7 @@ Schedule: ${scheduleItems.map(seg => segmentToString(seg))} pos: ${this.timeline
|
|
|
48745
48766
|
key: "supportedVersion",
|
|
48746
48767
|
get: function get() {
|
|
48747
48768
|
return {
|
|
48748
|
-
min: "0.14.
|
|
48769
|
+
min: "0.14.5"
|
|
48749
48770
|
};
|
|
48750
48771
|
}
|
|
48751
48772
|
}, {
|