@clappr/player 0.12.1 → 0.12.4
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 +1859 -1839
- 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 +1856 -1836
- 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,1834 @@
|
|
|
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+|!)[^>]*>/,
|
|
315
|
+
singleTagRE = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
|
|
316
|
+
tagExpanderRE = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\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
|
-
|
|
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;
|
|
453
|
+
|
|
454
|
+
// A special case optimization for a single tag
|
|
455
|
+
if (singleTagRE.test(html)) dom = $(document.createElement(RegExp.$1));
|
|
456
|
+
if (!dom) {
|
|
457
|
+
if (html.replace) html = html.replace(tagExpanderRE, "<$1></$2>");
|
|
458
|
+
if (name === undefined$1) name = fragmentRE.test(html) && RegExp.$1;
|
|
459
|
+
if (!(name in containers)) name = '*';
|
|
460
|
+
container = containers[name];
|
|
461
|
+
container.innerHTML = '' + html;
|
|
462
|
+
dom = $.each(slice.call(container.childNodes), function () {
|
|
463
|
+
container.removeChild(this);
|
|
400
464
|
});
|
|
401
465
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
return str.replace(/-+(.)?/g, function (match, chr) {
|
|
407
|
-
return chr ? chr.toUpperCase() : '';
|
|
466
|
+
if (isPlainObject(properties)) {
|
|
467
|
+
nodes = $(dom);
|
|
468
|
+
$.each(properties, function (key, value) {
|
|
469
|
+
if (methodAttributes.indexOf(key) > -1) nodes[key](value);else nodes.attr(key, value);
|
|
408
470
|
});
|
|
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
471
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
return array.indexOf(item) == idx;
|
|
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;
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
function Z(dom, selector) {
|
|
442
|
-
var i,
|
|
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
|
-
};
|
|
472
|
+
return dom;
|
|
473
|
+
};
|
|
477
474
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
475
|
+
// `$.zepto.Z` swaps out the prototype of the given `dom` array
|
|
476
|
+
// of nodes with `$.fn` and thus supplying all the Zepto functions
|
|
477
|
+
// to the array. This method can be overridden in plugins.
|
|
478
|
+
zepto.Z = function (dom, selector) {
|
|
479
|
+
return new Z(dom, selector);
|
|
480
|
+
};
|
|
484
481
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
482
|
+
// `$.zepto.isZ` should return `true` if the given object is a Zepto
|
|
483
|
+
// collection. This method can be overridden in plugins.
|
|
484
|
+
zepto.isZ = function (object) {
|
|
485
|
+
return object instanceof zepto.Z;
|
|
486
|
+
};
|
|
490
487
|
|
|
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
|
-
|
|
488
|
+
// `$.zepto.init` is Zepto's counterpart to jQuery's `$.fn.init` and
|
|
489
|
+
// takes a CSS selector and an optional context (and handles various
|
|
490
|
+
// special cases).
|
|
491
|
+
// This method can be overridden in plugins.
|
|
492
|
+
zepto.init = function (selector, context) {
|
|
493
|
+
var dom;
|
|
494
|
+
// If nothing given, return an empty Zepto collection
|
|
495
|
+
if (!selector) return zepto.Z();
|
|
496
|
+
// Optimize for string selectors
|
|
497
|
+
else if (typeof selector == 'string') {
|
|
498
|
+
selector = selector.trim();
|
|
499
|
+
// If it's a html fragment, create nodes from it
|
|
500
|
+
// Note: In both Chrome 21 and Firefox 15, DOM error 12
|
|
501
|
+
// is thrown if the fragment doesn't begin with <
|
|
502
|
+
if (selector[0] == '<' && fragmentRE.test(selector)) dom = zepto.fragment(selector, RegExp.$1, context), selector = null;
|
|
503
|
+
// If there's a context, create a collection on that context first, and select
|
|
504
|
+
// nodes from there
|
|
505
|
+
else if (context !== undefined$1) return $(context).find(selector);
|
|
506
|
+
// If it's a CSS selector, use it to select nodes.
|
|
507
|
+
else dom = zepto.qsa(document, selector);
|
|
508
|
+
}
|
|
509
|
+
// If a function is given, call it when the DOM is ready
|
|
510
|
+
else if (isFunction(selector)) return $(document).ready(selector);
|
|
511
|
+
// If a Zepto collection is given, just return it
|
|
512
|
+
else if (zepto.isZ(selector)) return selector;else {
|
|
513
|
+
// normalize array if an array of nodes is given
|
|
514
|
+
if (isArray(selector)) dom = compact(selector);
|
|
515
|
+
// Wrap DOM nodes.
|
|
516
|
+
else if (isObject(selector)) dom = [selector], selector = null;
|
|
517
|
+
// If it's a html fragment, create nodes from it
|
|
518
|
+
else if (fragmentRE.test(selector)) dom = zepto.fragment(selector.trim(), RegExp.$1, context), selector = null;
|
|
519
|
+
// If there's a context, create a collection on that context first, and select
|
|
520
|
+
// nodes from there
|
|
521
|
+
else if (context !== undefined$1) return $(context).find(selector);
|
|
522
|
+
// And last but no least, if it's a CSS selector, use it to select nodes.
|
|
523
|
+
else dom = zepto.qsa(document, selector);
|
|
524
|
+
}
|
|
525
|
+
// create a new Zepto collection from the nodes found
|
|
526
|
+
return zepto.Z(dom, selector);
|
|
527
|
+
};
|
|
531
528
|
|
|
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
|
-
|
|
529
|
+
// `$` will be the base `Zepto` object. When calling this
|
|
530
|
+
// function just call `$.zepto.init, which makes the implementation
|
|
531
|
+
// details of selecting nodes and creating Zepto collections
|
|
532
|
+
// patchable in plugins.
|
|
533
|
+
$ = function (selector, context) {
|
|
534
|
+
return zepto.init(selector, context);
|
|
535
|
+
};
|
|
536
|
+
function extend(target, source, deep) {
|
|
537
|
+
for (key in source) if (deep && (isPlainObject(source[key]) || isArray(source[key]))) {
|
|
538
|
+
if (isPlainObject(source[key]) && !isPlainObject(target[key])) target[key] = {};
|
|
539
|
+
if (isArray(source[key]) && !isArray(target[key])) target[key] = [];
|
|
540
|
+
extend(target[key], source[key], deep);
|
|
541
|
+
} else if (source[key] !== undefined$1) target[key] = source[key];
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
// Copy all but undefined properties from one or more
|
|
545
|
+
// objects to the `target` object.
|
|
546
|
+
$.extend = function (target) {
|
|
547
|
+
var deep,
|
|
548
|
+
args = slice.call(arguments, 1);
|
|
549
|
+
if (typeof target == 'boolean') {
|
|
550
|
+
deep = target;
|
|
551
|
+
target = args.shift();
|
|
552
|
+
}
|
|
553
|
+
args.forEach(function (arg) {
|
|
554
|
+
extend(target, arg, deep);
|
|
555
|
+
});
|
|
556
|
+
return target;
|
|
557
|
+
};
|
|
561
558
|
|
|
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
|
-
}
|
|
559
|
+
// `$.zepto.qsa` is Zepto's CSS selector implementation which
|
|
560
|
+
// uses `document.querySelectorAll` and optimizes for some special cases, like `#id`.
|
|
561
|
+
// This method can be overridden in plugins.
|
|
562
|
+
zepto.qsa = function (element, selector) {
|
|
563
|
+
var found,
|
|
564
|
+
maybeID = selector[0] == '#',
|
|
565
|
+
maybeClass = !maybeID && selector[0] == '.',
|
|
566
|
+
nameOnly = maybeID || maybeClass ? selector.slice(1) : selector,
|
|
567
|
+
// Ensure that a 1 char tag name still gets checked
|
|
568
|
+
isSimple = simpleSelectorRE.test(nameOnly);
|
|
569
|
+
return element.getElementById && isSimple && maybeID ?
|
|
570
|
+
// Safari DocumentFragment doesn't have getElementById
|
|
571
|
+
(found = element.getElementById(nameOnly)) ? [found] : [] : element.nodeType !== 1 && element.nodeType !== 9 && element.nodeType !== 11 ? [] : slice.call(isSimple && !maybeID && element.getElementsByClassName ?
|
|
572
|
+
// DocumentFragment doesn't have getElementsByClassName/TagName
|
|
573
|
+
maybeClass ? element.getElementsByClassName(nameOnly) :
|
|
574
|
+
// If it's simple, it could be a class
|
|
575
|
+
element.getElementsByTagName(selector) :
|
|
576
|
+
// Or a tag
|
|
577
|
+
element.querySelectorAll(selector) // Or it's not simple, and we need to query all
|
|
578
|
+
);
|
|
579
|
+
};
|
|
580
|
+
function filtered(nodes, selector) {
|
|
581
|
+
return selector == null ? $(nodes) : $(nodes).filter(selector);
|
|
582
|
+
}
|
|
583
|
+
$.contains = document.documentElement.contains ? function (parent, node) {
|
|
584
|
+
return parent !== node && parent.contains(node);
|
|
585
|
+
} : function (parent, node) {
|
|
586
|
+
while (node && (node = node.parentNode)) if (node === parent) return true;
|
|
587
|
+
return false;
|
|
588
|
+
};
|
|
589
|
+
function funcArg(context, arg, idx, payload) {
|
|
590
|
+
return isFunction(arg) ? arg.call(context, idx, payload) : arg;
|
|
591
|
+
}
|
|
592
|
+
function setAttribute(node, name, value) {
|
|
593
|
+
value == null ? node.removeAttribute(name) : node.setAttribute(name, value);
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
// access className property while respecting SVGAnimatedString
|
|
597
|
+
function className(node, value) {
|
|
598
|
+
var klass = node.className || '',
|
|
599
|
+
svg = klass && klass.baseVal !== undefined$1;
|
|
600
|
+
if (value === undefined$1) return svg ? klass.baseVal : klass;
|
|
601
|
+
svg ? klass.baseVal = value : node.className = value;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
// "true" => true
|
|
605
|
+
// "false" => false
|
|
606
|
+
// "null" => null
|
|
607
|
+
// "42" => 42
|
|
608
|
+
// "42.5" => 42.5
|
|
609
|
+
// "08" => "08"
|
|
610
|
+
// JSON => parse if valid
|
|
611
|
+
// String => self
|
|
612
|
+
function deserializeValue(value) {
|
|
613
|
+
try {
|
|
614
|
+
return value ? value == "true" || (value == "false" ? false : value == "null" ? null : +value + "" == value ? +value : /^[\[\{]/.test(value) ? $.parseJSON(value) : value) : value;
|
|
615
|
+
} catch (e) {
|
|
616
|
+
return value;
|
|
621
617
|
}
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
618
|
+
}
|
|
619
|
+
$.type = type;
|
|
620
|
+
$.isFunction = isFunction;
|
|
621
|
+
$.isWindow = isWindow;
|
|
622
|
+
$.isArray = isArray;
|
|
623
|
+
$.isPlainObject = isPlainObject;
|
|
624
|
+
$.isEmptyObject = function (obj) {
|
|
625
|
+
var name;
|
|
626
|
+
for (name in obj) return false;
|
|
627
|
+
return true;
|
|
628
|
+
};
|
|
629
|
+
$.isNumeric = function (val) {
|
|
630
|
+
var num = Number(val),
|
|
631
|
+
type = typeof val;
|
|
632
|
+
return val != null && type != 'boolean' && (type != 'string' || val.length) && !isNaN(num) && isFinite(num) || false;
|
|
633
|
+
};
|
|
634
|
+
$.inArray = function (elem, array, i) {
|
|
635
|
+
return emptyArray.indexOf.call(array, elem, i);
|
|
636
|
+
};
|
|
637
|
+
$.camelCase = camelize;
|
|
638
|
+
$.trim = function (str) {
|
|
639
|
+
return str == null ? "" : String.prototype.trim.call(str);
|
|
640
|
+
};
|
|
644
641
|
|
|
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
|
-
|
|
642
|
+
// plugin compatibility
|
|
643
|
+
$.uuid = 0;
|
|
644
|
+
$.support = {};
|
|
645
|
+
$.expr = {};
|
|
646
|
+
$.noop = function () {};
|
|
647
|
+
$.map = function (elements, callback) {
|
|
648
|
+
var value,
|
|
649
|
+
values = [],
|
|
650
|
+
i,
|
|
651
|
+
key;
|
|
652
|
+
if (likeArray(elements)) for (i = 0; i < elements.length; i++) {
|
|
653
|
+
value = callback(elements[i], i);
|
|
654
|
+
if (value != null) values.push(value);
|
|
655
|
+
} else for (key in elements) {
|
|
656
|
+
value = callback(elements[key], key);
|
|
657
|
+
if (value != null) values.push(value);
|
|
658
|
+
}
|
|
659
|
+
return flatten(values);
|
|
660
|
+
};
|
|
661
|
+
$.each = function (elements, callback) {
|
|
662
|
+
var i, key;
|
|
663
|
+
if (likeArray(elements)) {
|
|
664
|
+
for (i = 0; i < elements.length; i++) if (callback.call(elements[i], i, elements[i]) === false) return elements;
|
|
665
|
+
} else {
|
|
666
|
+
for (key in elements) if (callback.call(elements[key], key, elements[key]) === false) return elements;
|
|
667
|
+
}
|
|
668
|
+
return elements;
|
|
669
|
+
};
|
|
670
|
+
$.grep = function (elements, callback) {
|
|
671
|
+
return filter.call(elements, callback);
|
|
672
|
+
};
|
|
673
|
+
if (window.JSON) $.parseJSON = JSON.parse;
|
|
677
674
|
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
675
|
+
// Populate the class2type map
|
|
676
|
+
$.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function (i, name) {
|
|
677
|
+
class2type["[object " + name + "]"] = name.toLowerCase();
|
|
678
|
+
});
|
|
682
679
|
|
|
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
|
-
|
|
680
|
+
// Define methods that will be available on all
|
|
681
|
+
// Zepto collections
|
|
682
|
+
$.fn = {
|
|
683
|
+
constructor: zepto.Z,
|
|
684
|
+
length: 0,
|
|
685
|
+
// Because a collection acts like an array
|
|
686
|
+
// copy over these useful array functions.
|
|
687
|
+
forEach: emptyArray.forEach,
|
|
688
|
+
reduce: emptyArray.reduce,
|
|
689
|
+
push: emptyArray.push,
|
|
690
|
+
sort: emptyArray.sort,
|
|
691
|
+
splice: emptyArray.splice,
|
|
692
|
+
indexOf: emptyArray.indexOf,
|
|
693
|
+
concat: function () {
|
|
694
|
+
var i,
|
|
695
|
+
value,
|
|
696
|
+
args = [];
|
|
697
|
+
for (i = 0; i < arguments.length; i++) {
|
|
698
|
+
value = arguments[i];
|
|
699
|
+
args[i] = zepto.isZ(value) ? value.toArray() : value;
|
|
700
|
+
}
|
|
701
|
+
return concat.apply(zepto.isZ(this) ? this.toArray() : this, args);
|
|
702
|
+
},
|
|
703
|
+
// `map` and `slice` in the jQuery API work differently
|
|
704
|
+
// from their array counterparts
|
|
705
|
+
map: function (fn) {
|
|
706
|
+
return $($.map(this, function (el, i) {
|
|
707
|
+
return fn.call(el, i, el);
|
|
708
|
+
}));
|
|
709
|
+
},
|
|
710
|
+
slice: function () {
|
|
711
|
+
return $(slice.apply(this, arguments));
|
|
712
|
+
},
|
|
713
|
+
ready: function (callback) {
|
|
714
|
+
// need to check if document.body exists for IE as that browser reports
|
|
715
|
+
// document ready when it hasn't yet created the body element
|
|
716
|
+
if (readyRE.test(document.readyState) && document.body) callback($);else document.addEventListener('DOMContentLoaded', function () {
|
|
717
|
+
callback($);
|
|
718
|
+
}, false);
|
|
719
|
+
return this;
|
|
720
|
+
},
|
|
721
|
+
get: function (idx) {
|
|
722
|
+
return idx === undefined$1 ? slice.call(this) : this[idx >= 0 ? idx : idx + this.length];
|
|
723
|
+
},
|
|
724
|
+
toArray: function () {
|
|
725
|
+
return this.get();
|
|
726
|
+
},
|
|
727
|
+
size: function () {
|
|
728
|
+
return this.length;
|
|
729
|
+
},
|
|
730
|
+
remove: function () {
|
|
731
|
+
return this.each(function () {
|
|
732
|
+
if (this.parentNode != null) this.parentNode.removeChild(this);
|
|
733
|
+
});
|
|
734
|
+
},
|
|
735
|
+
each: function (callback) {
|
|
736
|
+
emptyArray.every.call(this, function (el, idx) {
|
|
737
|
+
return callback.call(el, idx, el) !== false;
|
|
738
|
+
});
|
|
739
|
+
return this;
|
|
740
|
+
},
|
|
741
|
+
filter: function (selector) {
|
|
742
|
+
if (isFunction(selector)) return this.not(this.not(selector));
|
|
743
|
+
return $(filter.call(this, function (element) {
|
|
744
|
+
return zepto.matches(element, selector);
|
|
745
|
+
}));
|
|
746
|
+
},
|
|
747
|
+
add: function (selector, context) {
|
|
748
|
+
return $(uniq(this.concat($(selector, context))));
|
|
749
|
+
},
|
|
750
|
+
is: function (selector) {
|
|
751
|
+
return this.length > 0 && zepto.matches(this[0], selector);
|
|
752
|
+
},
|
|
753
|
+
not: function (selector) {
|
|
754
|
+
var nodes = [];
|
|
755
|
+
if (isFunction(selector) && selector.call !== undefined$1) this.each(function (idx) {
|
|
756
|
+
if (!selector.call(this, idx)) nodes.push(this);
|
|
757
|
+
});else {
|
|
758
|
+
var excludes = typeof selector == 'string' ? this.filter(selector) : likeArray(selector) && isFunction(selector.item) ? slice.call(selector) : $(selector);
|
|
759
|
+
this.forEach(function (el) {
|
|
760
|
+
if (excludes.indexOf(el) < 0) nodes.push(el);
|
|
736
761
|
});
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
762
|
+
}
|
|
763
|
+
return $(nodes);
|
|
764
|
+
},
|
|
765
|
+
has: function (selector) {
|
|
766
|
+
return this.filter(function () {
|
|
767
|
+
return isObject(selector) ? $.contains(this, selector) : $(this).find(selector).size();
|
|
768
|
+
});
|
|
769
|
+
},
|
|
770
|
+
eq: function (idx) {
|
|
771
|
+
return idx === -1 ? this.slice(idx) : this.slice(idx, +idx + 1);
|
|
772
|
+
},
|
|
773
|
+
first: function () {
|
|
774
|
+
var el = this[0];
|
|
775
|
+
return el && !isObject(el) ? el : $(el);
|
|
776
|
+
},
|
|
777
|
+
last: function () {
|
|
778
|
+
var el = this[this.length - 1];
|
|
779
|
+
return el && !isObject(el) ? el : $(el);
|
|
780
|
+
},
|
|
781
|
+
find: function (selector) {
|
|
782
|
+
var result,
|
|
783
|
+
$this = this;
|
|
784
|
+
if (!selector) result = $();else if (typeof selector == 'object') result = $(selector).filter(function () {
|
|
785
|
+
var node = this;
|
|
786
|
+
return emptyArray.some.call($this, function (parent) {
|
|
787
|
+
return $.contains(parent, node);
|
|
741
788
|
});
|
|
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
|
-
});
|
|
789
|
+
});else if (this.length == 1) result = $(zepto.qsa(this[0], selector));else result = this.map(function () {
|
|
790
|
+
return zepto.qsa(this, selector);
|
|
791
|
+
});
|
|
792
|
+
return result;
|
|
793
|
+
},
|
|
794
|
+
closest: function (selector, context) {
|
|
795
|
+
var nodes = [],
|
|
796
|
+
collection = typeof selector == 'object' && $(selector);
|
|
797
|
+
this.each(function (_, node) {
|
|
798
|
+
while (node && !(collection ? collection.indexOf(node) >= 0 : zepto.matches(node, selector))) node = node !== context && !isDocument(node) && node.parentNode;
|
|
799
|
+
if (node && nodes.indexOf(node) < 0) nodes.push(node);
|
|
800
|
+
});
|
|
801
|
+
return $(nodes);
|
|
802
|
+
},
|
|
803
|
+
parents: function (selector) {
|
|
804
|
+
var ancestors = [],
|
|
805
|
+
nodes = this;
|
|
806
|
+
while (nodes.length > 0) nodes = $.map(nodes, function (node) {
|
|
807
|
+
if ((node = node.parentNode) && !isDocument(node) && ancestors.indexOf(node) < 0) {
|
|
808
|
+
ancestors.push(node);
|
|
809
|
+
return node;
|
|
765
810
|
}
|
|
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
|
-
}
|
|
811
|
+
});
|
|
812
|
+
return filtered(ancestors, selector);
|
|
813
|
+
},
|
|
814
|
+
parent: function (selector) {
|
|
815
|
+
return filtered(uniq(this.pluck('parentNode')), selector);
|
|
816
|
+
},
|
|
817
|
+
children: function (selector) {
|
|
818
|
+
return filtered(this.map(function () {
|
|
819
|
+
return children(this);
|
|
820
|
+
}), selector);
|
|
821
|
+
},
|
|
822
|
+
contents: function () {
|
|
823
|
+
return this.map(function () {
|
|
824
|
+
return this.contentDocument || slice.call(this.childNodes);
|
|
825
|
+
});
|
|
826
|
+
},
|
|
827
|
+
siblings: function (selector) {
|
|
828
|
+
return filtered(this.map(function (i, el) {
|
|
829
|
+
return filter.call(children(el.parentNode), function (child) {
|
|
830
|
+
return child !== el;
|
|
814
831
|
});
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
832
|
+
}), selector);
|
|
833
|
+
},
|
|
834
|
+
empty: function () {
|
|
835
|
+
return this.each(function () {
|
|
836
|
+
this.innerHTML = '';
|
|
837
|
+
});
|
|
838
|
+
},
|
|
839
|
+
// `pluck` is borrowed from Prototype.js
|
|
840
|
+
pluck: function (property) {
|
|
841
|
+
return $.map(this, function (el) {
|
|
842
|
+
return el[property];
|
|
843
|
+
});
|
|
844
|
+
},
|
|
845
|
+
show: function () {
|
|
846
|
+
return this.each(function () {
|
|
847
|
+
this.style.display == "none" && (this.style.display = '');
|
|
848
|
+
if (getComputedStyle(this, '').getPropertyValue("display") == "none") this.style.display = defaultDisplay(this.nodeName);
|
|
849
|
+
});
|
|
850
|
+
},
|
|
851
|
+
replaceWith: function (newContent) {
|
|
852
|
+
return this.before(newContent).remove();
|
|
853
|
+
},
|
|
854
|
+
wrap: function (structure) {
|
|
855
|
+
var func = isFunction(structure);
|
|
856
|
+
if (this[0] && !func) var dom = $(structure).get(0),
|
|
857
|
+
clone = dom.parentNode || this.length > 1;
|
|
858
|
+
return this.each(function (index) {
|
|
859
|
+
$(this).wrapAll(func ? structure.call(this, index) : clone ? dom.cloneNode(true) : dom);
|
|
860
|
+
});
|
|
861
|
+
},
|
|
862
|
+
wrapAll: function (structure) {
|
|
863
|
+
if (this[0]) {
|
|
864
|
+
$(this[0]).before(structure = $(structure));
|
|
865
|
+
var children;
|
|
866
|
+
// drill down to the inmost element
|
|
867
|
+
while ((children = structure.children()).length) structure = children.first();
|
|
868
|
+
$(structure).append(this);
|
|
869
|
+
}
|
|
870
|
+
return this;
|
|
871
|
+
},
|
|
872
|
+
wrapInner: function (structure) {
|
|
873
|
+
var func = isFunction(structure);
|
|
874
|
+
return this.each(function (index) {
|
|
875
|
+
var self = $(this),
|
|
876
|
+
contents = self.contents(),
|
|
877
|
+
dom = func ? structure.call(this, index) : structure;
|
|
878
|
+
contents.length ? contents.wrapAll(dom) : self.append(dom);
|
|
879
|
+
});
|
|
880
|
+
},
|
|
881
|
+
unwrap: function () {
|
|
882
|
+
this.parent().each(function () {
|
|
883
|
+
$(this).replaceWith($(this).children());
|
|
884
|
+
});
|
|
885
|
+
return this;
|
|
886
|
+
},
|
|
887
|
+
clone: function () {
|
|
888
|
+
return this.map(function () {
|
|
889
|
+
return this.cloneNode(true);
|
|
890
|
+
});
|
|
891
|
+
},
|
|
892
|
+
hide: function () {
|
|
893
|
+
return this.css("display", "none");
|
|
894
|
+
},
|
|
895
|
+
toggle: function (setting) {
|
|
896
|
+
return this.each(function () {
|
|
897
|
+
var el = $(this);
|
|
898
|
+
(setting === undefined$1 ? el.css("display") == "none" : setting) ? el.show() : el.hide();
|
|
899
|
+
});
|
|
900
|
+
},
|
|
901
|
+
prev: function (selector) {
|
|
902
|
+
return $(this.pluck('previousElementSibling')).filter(selector || '*');
|
|
903
|
+
},
|
|
904
|
+
next: function (selector) {
|
|
905
|
+
return $(this.pluck('nextElementSibling')).filter(selector || '*');
|
|
906
|
+
},
|
|
907
|
+
html: function (html) {
|
|
908
|
+
return 0 in arguments ? this.each(function (idx) {
|
|
909
|
+
var originHtml = this.innerHTML;
|
|
910
|
+
$(this).empty().append(funcArg(this, html, idx, originHtml));
|
|
911
|
+
}) : 0 in this ? this[0].innerHTML : null;
|
|
912
|
+
},
|
|
913
|
+
text: function (text) {
|
|
914
|
+
return 0 in arguments ? this.each(function (idx) {
|
|
915
|
+
var newText = funcArg(this, text, idx, this.textContent);
|
|
916
|
+
this.textContent = newText == null ? '' : '' + newText;
|
|
917
|
+
}) : 0 in this ? this.pluck('textContent').join("") : null;
|
|
918
|
+
},
|
|
919
|
+
attr: function (name, value) {
|
|
920
|
+
var result;
|
|
921
|
+
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) {
|
|
922
|
+
if (this.nodeType !== 1) return;
|
|
923
|
+
if (isObject(name)) for (key in name) setAttribute(this, key, name[key]);else setAttribute(this, name, funcArg(this, value, idx, this.getAttribute(name)));
|
|
924
|
+
});
|
|
925
|
+
},
|
|
926
|
+
removeAttr: function (name) {
|
|
927
|
+
return this.each(function () {
|
|
928
|
+
this.nodeType === 1 && name.split(' ').forEach(function (attribute) {
|
|
929
|
+
setAttribute(this, attribute);
|
|
930
|
+
}, this);
|
|
931
|
+
});
|
|
932
|
+
},
|
|
933
|
+
prop: function (name, value) {
|
|
934
|
+
name = propMap[name] || name;
|
|
935
|
+
return 1 in arguments ? this.each(function (idx) {
|
|
936
|
+
this[name] = funcArg(this, value, idx, this[name]);
|
|
937
|
+
}) : this[0] && this[0][name];
|
|
938
|
+
},
|
|
939
|
+
removeProp: function (name) {
|
|
940
|
+
name = propMap[name] || name;
|
|
941
|
+
return this.each(function () {
|
|
942
|
+
delete this[name];
|
|
943
|
+
});
|
|
944
|
+
},
|
|
945
|
+
data: function (name, value) {
|
|
946
|
+
var attrName = 'data-' + name.replace(capitalRE, '-$1').toLowerCase();
|
|
947
|
+
var data = 1 in arguments ? this.attr(attrName, value) : this.attr(attrName);
|
|
948
|
+
return data !== null ? deserializeValue(data) : undefined$1;
|
|
949
|
+
},
|
|
950
|
+
val: function (value) {
|
|
951
|
+
if (0 in arguments) {
|
|
952
|
+
if (value == null) value = "";
|
|
953
|
+
return this.each(function (idx) {
|
|
954
|
+
this.value = funcArg(this, value, idx, this.value);
|
|
828
955
|
});
|
|
829
|
-
}
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
956
|
+
} else {
|
|
957
|
+
return this[0] && (this[0].multiple ? $(this[0]).find('option').filter(function () {
|
|
958
|
+
return this.selected;
|
|
959
|
+
}).pluck('value') : this[0].value);
|
|
960
|
+
}
|
|
961
|
+
},
|
|
962
|
+
offset: function (coordinates) {
|
|
963
|
+
if (coordinates) return this.each(function (index) {
|
|
964
|
+
var $this = $(this),
|
|
965
|
+
coords = funcArg(this, coordinates, index, $this.offset()),
|
|
966
|
+
parentOffset = $this.offsetParent().offset(),
|
|
967
|
+
props = {
|
|
968
|
+
top: coords.top - parentOffset.top,
|
|
969
|
+
left: coords.left - parentOffset.left
|
|
970
|
+
};
|
|
971
|
+
if ($this.css('position') == 'static') props['position'] = 'relative';
|
|
972
|
+
$this.css(props);
|
|
973
|
+
});
|
|
974
|
+
if (!this.length) return null;
|
|
975
|
+
if (document.documentElement !== this[0] && !$.contains(document.documentElement, this[0])) return {
|
|
976
|
+
top: 0,
|
|
977
|
+
left: 0
|
|
978
|
+
};
|
|
979
|
+
var obj = this[0].getBoundingClientRect();
|
|
980
|
+
return {
|
|
981
|
+
left: obj.left + window.pageXOffset,
|
|
982
|
+
top: obj.top + window.pageYOffset,
|
|
983
|
+
width: Math.round(obj.width),
|
|
984
|
+
height: Math.round(obj.height)
|
|
985
|
+
};
|
|
986
|
+
},
|
|
987
|
+
css: function (property, value) {
|
|
988
|
+
if (arguments.length < 2) {
|
|
989
|
+
var element = this[0];
|
|
990
|
+
if (typeof property == 'string') {
|
|
991
|
+
if (!element) return;
|
|
992
|
+
return element.style[camelize(property)] || getComputedStyle(element, '').getPropertyValue(property);
|
|
993
|
+
} else if (isArray(property)) {
|
|
994
|
+
if (!element) return;
|
|
995
|
+
var props = {};
|
|
996
|
+
var computedStyle = getComputedStyle(element, '');
|
|
997
|
+
$.each(property, function (_, prop) {
|
|
998
|
+
props[prop] = element.style[camelize(prop)] || computedStyle.getPropertyValue(prop);
|
|
834
999
|
});
|
|
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);
|
|
1000
|
+
return props;
|
|
872
1001
|
}
|
|
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];
|
|
1002
|
+
}
|
|
1003
|
+
var css = '';
|
|
1004
|
+
if (type(property) == 'string') {
|
|
1005
|
+
if (!value && value !== 0) this.each(function () {
|
|
1006
|
+
this.style.removeProperty(dasherize(property));
|
|
1007
|
+
});else css = dasherize(property) + ":" + maybeAddPx(property, value);
|
|
1008
|
+
} else {
|
|
1009
|
+
for (key in property) if (!property[key] && property[key] !== 0) this.each(function () {
|
|
1010
|
+
this.style.removeProperty(dasherize(key));
|
|
1011
|
+
});else css += dasherize(key) + ':' + maybeAddPx(key, property[key]) + ';';
|
|
1012
|
+
}
|
|
1013
|
+
return this.each(function () {
|
|
1014
|
+
this.style.cssText += ';' + css;
|
|
1015
|
+
});
|
|
1016
|
+
},
|
|
1017
|
+
index: function (element) {
|
|
1018
|
+
return element ? this.indexOf($(element)[0]) : this.parent().children().indexOf(this[0]);
|
|
1019
|
+
},
|
|
1020
|
+
hasClass: function (name) {
|
|
1021
|
+
if (!name) return false;
|
|
1022
|
+
return emptyArray.some.call(this, function (el) {
|
|
1023
|
+
return this.test(className(el));
|
|
1024
|
+
}, classRE(name));
|
|
1025
|
+
},
|
|
1026
|
+
addClass: function (name) {
|
|
1027
|
+
if (!name) return this;
|
|
1028
|
+
return this.each(function (idx) {
|
|
1029
|
+
if (!('className' in this)) return;
|
|
1030
|
+
classList = [];
|
|
1031
|
+
var cls = className(this),
|
|
1032
|
+
newName = funcArg(this, name, idx, cls);
|
|
1033
|
+
newName.split(/\s+/g).forEach(function (klass) {
|
|
1034
|
+
if (!$(this).hasClass(klass)) classList.push(klass);
|
|
1035
|
+
}, this);
|
|
1036
|
+
classList.length && className(this, cls + (cls ? " " : "") + classList.join(" "));
|
|
1037
|
+
});
|
|
1038
|
+
},
|
|
1039
|
+
removeClass: function (name) {
|
|
1040
|
+
return this.each(function (idx) {
|
|
1041
|
+
if (!('className' in this)) return;
|
|
1042
|
+
if (name === undefined$1) return className(this, '');
|
|
1043
|
+
classList = className(this);
|
|
1044
|
+
funcArg(this, name, idx, classList).split(/\s+/g).forEach(function (klass) {
|
|
1045
|
+
classList = classList.replace(classRE(klass), " ");
|
|
946
1046
|
});
|
|
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);
|
|
1047
|
+
className(this, classList.trim());
|
|
1048
|
+
});
|
|
1049
|
+
},
|
|
1050
|
+
toggleClass: function (name, when) {
|
|
1051
|
+
if (!name) return this;
|
|
1052
|
+
return this.each(function (idx) {
|
|
1053
|
+
var $this = $(this),
|
|
1054
|
+
names = funcArg(this, name, idx, className(this));
|
|
1055
|
+
names.split(/\s+/g).forEach(function (klass) {
|
|
1056
|
+
(when === undefined$1 ? !$this.hasClass(klass) : when) ? $this.addClass(klass) : $this.removeClass(klass);
|
|
976
1057
|
});
|
|
977
|
-
|
|
978
|
-
|
|
1058
|
+
});
|
|
1059
|
+
},
|
|
1060
|
+
scrollTop: function (value) {
|
|
1061
|
+
if (!this.length) return;
|
|
1062
|
+
var hasScrollTop = 'scrollTop' in this[0];
|
|
1063
|
+
if (value === undefined$1) return hasScrollTop ? this[0].scrollTop : this[0].pageYOffset;
|
|
1064
|
+
return this.each(hasScrollTop ? function () {
|
|
1065
|
+
this.scrollTop = value;
|
|
1066
|
+
} : function () {
|
|
1067
|
+
this.scrollTo(this.scrollX, value);
|
|
1068
|
+
});
|
|
1069
|
+
},
|
|
1070
|
+
scrollLeft: function (value) {
|
|
1071
|
+
if (!this.length) return;
|
|
1072
|
+
var hasScrollLeft = 'scrollLeft' in this[0];
|
|
1073
|
+
if (value === undefined$1) return hasScrollLeft ? this[0].scrollLeft : this[0].pageXOffset;
|
|
1074
|
+
return this.each(hasScrollLeft ? function () {
|
|
1075
|
+
this.scrollLeft = value;
|
|
1076
|
+
} : function () {
|
|
1077
|
+
this.scrollTo(value, this.scrollY);
|
|
1078
|
+
});
|
|
1079
|
+
},
|
|
1080
|
+
position: function () {
|
|
1081
|
+
if (!this.length) return;
|
|
1082
|
+
var elem = this[0],
|
|
1083
|
+
// Get *real* offsetParent
|
|
1084
|
+
offsetParent = this.offsetParent(),
|
|
1085
|
+
// Get correct offsets
|
|
1086
|
+
offset = this.offset(),
|
|
1087
|
+
parentOffset = rootNodeRE.test(offsetParent[0].nodeName) ? {
|
|
979
1088
|
top: 0,
|
|
980
1089
|
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
|
-
};
|
|
1090
|
+
} : offsetParent.offset();
|
|
1119
1091
|
|
|
1120
|
-
|
|
1121
|
-
|
|
1092
|
+
// Subtract element margins
|
|
1093
|
+
// note: when an element has margin: auto the offsetLeft and marginLeft
|
|
1094
|
+
// are the same in Safari causing offset.left to incorrectly be 0
|
|
1095
|
+
offset.top -= parseFloat($(elem).css('margin-top')) || 0;
|
|
1096
|
+
offset.left -= parseFloat($(elem).css('margin-left')) || 0;
|
|
1122
1097
|
|
|
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
|
-
});
|
|
1098
|
+
// Add offsetParent borders
|
|
1099
|
+
parentOffset.top += parseFloat($(offsetParent[0]).css('border-top-width')) || 0;
|
|
1100
|
+
parentOffset.left += parseFloat($(offsetParent[0]).css('border-left-width')) || 0;
|
|
1101
|
+
|
|
1102
|
+
// Subtract the two offsets
|
|
1103
|
+
return {
|
|
1104
|
+
top: offset.top - parentOffset.top,
|
|
1105
|
+
left: offset.left - parentOffset.left
|
|
1136
1106
|
};
|
|
1107
|
+
},
|
|
1108
|
+
offsetParent: function () {
|
|
1109
|
+
return this.map(function () {
|
|
1110
|
+
var parent = this.offsetParent || document.body;
|
|
1111
|
+
while (parent && !rootNodeRE.test(parent.nodeName) && $(parent).css("position") == "static") parent = parent.offsetParent;
|
|
1112
|
+
return parent;
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
};
|
|
1116
|
+
|
|
1117
|
+
// for now
|
|
1118
|
+
$.fn.detach = $.fn.remove
|
|
1119
|
+
|
|
1120
|
+
// Generate the `width` and `height` functions
|
|
1121
|
+
;
|
|
1122
|
+
['width', 'height'].forEach(function (dimension) {
|
|
1123
|
+
var dimensionProperty = dimension.replace(/./, function (m) {
|
|
1124
|
+
return m[0].toUpperCase();
|
|
1137
1125
|
});
|
|
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
|
-
}
|
|
1126
|
+
$.fn[dimension] = function (value) {
|
|
1127
|
+
var offset,
|
|
1128
|
+
el = this[0];
|
|
1129
|
+
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) {
|
|
1130
|
+
el = $(this);
|
|
1131
|
+
el.css(dimension, funcArg(this, value, idx, el[dimension]()));
|
|
1132
|
+
});
|
|
1133
|
+
};
|
|
1134
|
+
});
|
|
1135
|
+
function traverseNode(node, fun) {
|
|
1136
|
+
fun(node);
|
|
1137
|
+
for (var i = 0, len = node.childNodes.length; i < len; i++) traverseNode(node.childNodes[i], fun);
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
// Generate the `after`, `prepend`, `before`, `append`,
|
|
1141
|
+
// `insertAfter`, `insertBefore`, `appendTo`, and `prependTo` methods.
|
|
1142
|
+
adjacencyOperators.forEach(function (operator, operatorIndex) {
|
|
1143
|
+
var inside = operatorIndex % 2; //=> prepend, append
|
|
1144
|
+
|
|
1145
|
+
$.fn[operator] = function () {
|
|
1146
|
+
// arguments can be nodes, arrays of nodes, Zepto objects and HTML strings
|
|
1147
|
+
var argType,
|
|
1148
|
+
nodes = $.map(arguments, function (arg) {
|
|
1149
|
+
var arr = [];
|
|
1150
|
+
argType = type(arg);
|
|
1151
|
+
if (argType == "array") {
|
|
1152
|
+
arg.forEach(function (el) {
|
|
1153
|
+
if (el.nodeType !== undefined$1) return arr.push(el);else if ($.zepto.isZ(el)) return arr = arr.concat(el.get());
|
|
1154
|
+
arr = arr.concat(zepto.fragment(el));
|
|
1180
1155
|
});
|
|
1156
|
+
return arr;
|
|
1157
|
+
}
|
|
1158
|
+
return argType == "object" || arg == null ? arg : zepto.fragment(arg);
|
|
1159
|
+
}),
|
|
1160
|
+
parent,
|
|
1161
|
+
copyByClone = this.length > 1;
|
|
1162
|
+
if (nodes.length < 1) return this;
|
|
1163
|
+
return this.each(function (_, target) {
|
|
1164
|
+
parent = inside ? target : target.parentNode;
|
|
1165
|
+
|
|
1166
|
+
// convert all methods to a "before" operation
|
|
1167
|
+
target = operatorIndex == 0 ? target.nextSibling : operatorIndex == 1 ? target.firstChild : operatorIndex == 2 ? target : null;
|
|
1168
|
+
var parentInDocument = $.contains(document.documentElement, parent);
|
|
1169
|
+
nodes.forEach(function (node) {
|
|
1170
|
+
if (copyByClone) node = node.cloneNode(true);else if (!parent) return $(node).remove();
|
|
1171
|
+
parent.insertBefore(node, target);
|
|
1172
|
+
if (parentInDocument) traverseNode(node, function (el) {
|
|
1173
|
+
if (el.nodeName != null && el.nodeName.toUpperCase() === 'SCRIPT' && (!el.type || el.type === 'text/javascript') && !el.src) {
|
|
1174
|
+
var target = el.ownerDocument ? el.ownerDocument.defaultView : window;
|
|
1175
|
+
target['eval'].call(target, el.innerHTML);
|
|
1176
|
+
}
|
|
1181
1177
|
});
|
|
1182
1178
|
});
|
|
1183
|
-
};
|
|
1179
|
+
});
|
|
1180
|
+
};
|
|
1184
1181
|
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1182
|
+
// after => insertAfter
|
|
1183
|
+
// prepend => prependTo
|
|
1184
|
+
// before => insertBefore
|
|
1185
|
+
// append => appendTo
|
|
1186
|
+
$.fn[inside ? operator + 'To' : 'insert' + (operatorIndex ? 'Before' : 'After')] = function (html) {
|
|
1187
|
+
$(html)[operator](this);
|
|
1188
|
+
return this;
|
|
1189
|
+
};
|
|
1190
|
+
});
|
|
1191
|
+
zepto.Z.prototype = Z.prototype = $.fn;
|
|
1195
1192
|
|
|
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
|
-
|
|
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;
|
|
1193
|
+
// Export internal API functions in the `$.zepto` namespace
|
|
1194
|
+
zepto.uniq = uniq;
|
|
1195
|
+
zepto.deserializeValue = deserializeValue;
|
|
1196
|
+
$.zepto = zepto;
|
|
1197
|
+
return $;
|
|
1198
|
+
}();
|
|
1199
|
+
window.Zepto = Zepto;
|
|
1200
|
+
window.$ === undefined && (window.$ = Zepto);
|
|
1201
|
+
(function ($) {
|
|
1202
|
+
var jsonpID = +new Date(),
|
|
1203
|
+
document = window.document,
|
|
1204
|
+
key,
|
|
1205
|
+
name,
|
|
1206
|
+
rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
|
|
1207
|
+
scriptTypeRE = /^(?:text|application)\/javascript/i,
|
|
1208
|
+
xmlTypeRE = /^(?:text|application)\/xml/i,
|
|
1209
|
+
jsonType = 'application/json',
|
|
1210
|
+
htmlType = 'text/html',
|
|
1211
|
+
blankRE = /^\s*$/,
|
|
1212
|
+
originAnchor = document.createElement('a');
|
|
1213
|
+
originAnchor.href = window.location.href;
|
|
1214
|
+
|
|
1215
|
+
// trigger a custom event and return false if it was cancelled
|
|
1216
|
+
function triggerAndReturn(context, eventName, data) {
|
|
1217
|
+
var event = $.Event(eventName);
|
|
1218
|
+
$(context).trigger(event, data);
|
|
1219
|
+
return !event.isDefaultPrevented();
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
// trigger an Ajax "global" event
|
|
1223
|
+
function triggerGlobal(settings, context, eventName, data) {
|
|
1224
|
+
if (settings.global) return triggerAndReturn(context || document, eventName, data);
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
// Number of active Ajax requests
|
|
1228
|
+
$.active = 0;
|
|
1229
|
+
function ajaxStart(settings) {
|
|
1230
|
+
if (settings.global && $.active++ === 0) triggerGlobal(settings, null, 'ajaxStart');
|
|
1231
|
+
}
|
|
1232
|
+
function ajaxStop(settings) {
|
|
1233
|
+
if (settings.global && ! --$.active) triggerGlobal(settings, null, 'ajaxStop');
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
// triggers an extra global event "ajaxBeforeSend" that's like "ajaxSend" but cancelable
|
|
1237
|
+
function ajaxBeforeSend(xhr, settings) {
|
|
1238
|
+
var context = settings.context;
|
|
1239
|
+
if (settings.beforeSend.call(context, xhr, settings) === false || triggerGlobal(settings, context, 'ajaxBeforeSend', [xhr, settings]) === false) return false;
|
|
1240
|
+
triggerGlobal(settings, context, 'ajaxSend', [xhr, settings]);
|
|
1241
|
+
}
|
|
1242
|
+
function ajaxSuccess(data, xhr, settings, deferred) {
|
|
1243
|
+
var context = settings.context,
|
|
1244
|
+
status = 'success';
|
|
1245
|
+
settings.success.call(context, data, status, xhr);
|
|
1246
|
+
if (deferred) deferred.resolveWith(context, [data, status, xhr]);
|
|
1247
|
+
triggerGlobal(settings, context, 'ajaxSuccess', [xhr, settings, data]);
|
|
1248
|
+
ajaxComplete(status, xhr, settings);
|
|
1249
|
+
}
|
|
1250
|
+
// type: "timeout", "error", "abort", "parsererror"
|
|
1251
|
+
function ajaxError(error, type, xhr, settings, deferred) {
|
|
1252
|
+
var context = settings.context;
|
|
1253
|
+
settings.error.call(context, xhr, type, error);
|
|
1254
|
+
if (deferred) deferred.rejectWith(context, [xhr, type, error]);
|
|
1255
|
+
triggerGlobal(settings, context, 'ajaxError', [xhr, settings, error || type]);
|
|
1256
|
+
ajaxComplete(type, xhr, settings);
|
|
1257
|
+
}
|
|
1258
|
+
// status: "success", "notmodified", "error", "timeout", "abort", "parsererror"
|
|
1259
|
+
function ajaxComplete(status, xhr, settings) {
|
|
1260
|
+
var context = settings.context;
|
|
1261
|
+
settings.complete.call(context, xhr, status);
|
|
1262
|
+
triggerGlobal(settings, context, 'ajaxComplete', [xhr, settings]);
|
|
1263
|
+
ajaxStop(settings);
|
|
1264
|
+
}
|
|
1265
|
+
function ajaxDataFilter(data, type, settings) {
|
|
1266
|
+
if (settings.dataFilter == empty) return data;
|
|
1267
|
+
var context = settings.context;
|
|
1268
|
+
return settings.dataFilter.call(context, data, type);
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
// Empty function, used as default callback
|
|
1272
|
+
function empty() {}
|
|
1273
|
+
$.ajaxJSONP = function (options, deferred) {
|
|
1274
|
+
if (!('type' in options)) return $.ajax(options);
|
|
1275
|
+
var _callbackName = options.jsonpCallback,
|
|
1276
|
+
callbackName = ($.isFunction(_callbackName) ? _callbackName() : _callbackName) || 'Zepto' + jsonpID++,
|
|
1277
|
+
script = document.createElement('script'),
|
|
1278
|
+
originalCallback = window[callbackName],
|
|
1279
|
+
responseData,
|
|
1280
|
+
abort = function (errorType) {
|
|
1281
|
+
$(script).triggerHandler('error', errorType || 'abort');
|
|
1282
|
+
},
|
|
1283
|
+
xhr = {
|
|
1284
|
+
abort: abort
|
|
1285
|
+
},
|
|
1286
|
+
abortTimeout;
|
|
1287
|
+
if (deferred) deferred.promise(xhr);
|
|
1288
|
+
$(script).on('load error', function (e, errorType) {
|
|
1289
|
+
clearTimeout(abortTimeout);
|
|
1290
|
+
$(script).off().remove();
|
|
1291
|
+
if (e.type == 'error' || !responseData) {
|
|
1292
|
+
ajaxError(null, errorType || 'error', xhr, options, deferred);
|
|
1293
|
+
} else {
|
|
1294
|
+
ajaxSuccess(responseData[0], xhr, options, deferred);
|
|
1306
1295
|
}
|
|
1307
|
-
window[callbackName] =
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
abort('timeout');
|
|
1314
|
-
}, options.timeout);
|
|
1296
|
+
window[callbackName] = originalCallback;
|
|
1297
|
+
if (responseData && $.isFunction(originalCallback)) originalCallback(responseData[0]);
|
|
1298
|
+
originalCallback = responseData = undefined;
|
|
1299
|
+
});
|
|
1300
|
+
if (ajaxBeforeSend(xhr, options) === false) {
|
|
1301
|
+
abort('abort');
|
|
1315
1302
|
return xhr;
|
|
1303
|
+
}
|
|
1304
|
+
window[callbackName] = function () {
|
|
1305
|
+
responseData = arguments;
|
|
1316
1306
|
};
|
|
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
|
-
|
|
1307
|
+
script.src = options.url.replace(/\?(.+)=\?/, '?$1=' + callbackName);
|
|
1308
|
+
document.head.appendChild(script);
|
|
1309
|
+
if (options.timeout > 0) abortTimeout = setTimeout(function () {
|
|
1310
|
+
abort('timeout');
|
|
1311
|
+
}, options.timeout);
|
|
1312
|
+
return xhr;
|
|
1313
|
+
};
|
|
1314
|
+
$.ajaxSettings = {
|
|
1315
|
+
// Default type of request
|
|
1316
|
+
type: 'GET',
|
|
1317
|
+
// Callback that is executed before request
|
|
1318
|
+
beforeSend: empty,
|
|
1319
|
+
// Callback that is executed if the request succeeds
|
|
1320
|
+
success: empty,
|
|
1321
|
+
// Callback that is executed the the server drops error
|
|
1322
|
+
error: empty,
|
|
1323
|
+
// Callback that is executed on request complete (both: error and success)
|
|
1324
|
+
complete: empty,
|
|
1325
|
+
// The context for the callbacks
|
|
1326
|
+
context: null,
|
|
1327
|
+
// Whether to trigger "global" Ajax events
|
|
1328
|
+
global: true,
|
|
1329
|
+
// Transport
|
|
1330
|
+
xhr: function () {
|
|
1331
|
+
return new window.XMLHttpRequest();
|
|
1332
|
+
},
|
|
1333
|
+
// MIME types mapping
|
|
1334
|
+
// IIS returns Javascript as "application/x-javascript"
|
|
1335
|
+
accepts: {
|
|
1336
|
+
script: 'text/javascript, application/javascript, application/x-javascript',
|
|
1337
|
+
json: jsonType,
|
|
1338
|
+
xml: 'application/xml, text/xml',
|
|
1339
|
+
html: htmlType,
|
|
1340
|
+
text: 'text/plain'
|
|
1341
|
+
},
|
|
1342
|
+
// Whether the request is to another domain
|
|
1343
|
+
crossDomain: false,
|
|
1344
|
+
// Default timeout
|
|
1345
|
+
timeout: 0,
|
|
1346
|
+
// Whether data should be serialized to string
|
|
1347
|
+
processData: true,
|
|
1348
|
+
// Whether the browser should be allowed to cache GET responses
|
|
1349
|
+
cache: true,
|
|
1350
|
+
//Used to handle the raw response data of XMLHttpRequest.
|
|
1351
|
+
//This is a pre-filtering function to sanitize the response.
|
|
1352
|
+
//The sanitized response should be returned
|
|
1353
|
+
dataFilter: empty
|
|
1354
|
+
};
|
|
1355
|
+
function mimeToDataType(mime) {
|
|
1356
|
+
if (mime) mime = mime.split(';', 2)[0];
|
|
1357
|
+
return mime && (mime == htmlType ? 'html' : mime == jsonType ? 'json' : scriptTypeRE.test(mime) ? 'script' : xmlTypeRE.test(mime) && 'xml') || 'text';
|
|
1358
|
+
}
|
|
1359
|
+
function appendQuery(url, query) {
|
|
1360
|
+
if (query == '') return url;
|
|
1361
|
+
return (url + '&' + query).replace(/[&?]{1,2}/, '?');
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
// serialize payload and append it to the URL for GET requests
|
|
1365
|
+
function serializeData(options) {
|
|
1366
|
+
if (options.processData && options.data && $.type(options.data) != "string") options.data = $.param(options.data, options.traditional);
|
|
1367
|
+
if (options.data && (!options.type || options.type.toUpperCase() == 'GET' || 'jsonp' == options.dataType)) options.url = appendQuery(options.url, options.data), options.data = undefined;
|
|
1368
|
+
}
|
|
1369
|
+
$.ajax = function (options) {
|
|
1370
|
+
var settings = $.extend({}, options || {}),
|
|
1371
|
+
deferred = $.Deferred && $.Deferred(),
|
|
1372
|
+
urlAnchor,
|
|
1373
|
+
hashIndex;
|
|
1374
|
+
for (key in $.ajaxSettings) if (settings[key] === undefined) settings[key] = $.ajaxSettings[key];
|
|
1375
|
+
ajaxStart(settings);
|
|
1376
|
+
if (!settings.crossDomain) {
|
|
1377
|
+
urlAnchor = document.createElement('a');
|
|
1378
|
+
urlAnchor.href = settings.url;
|
|
1379
|
+
// cleans up URL for .href (IE only), see https://github.com/madrobby/zepto/pull/1049
|
|
1380
|
+
urlAnchor.href = urlAnchor.href;
|
|
1381
|
+
settings.crossDomain = originAnchor.protocol + '//' + originAnchor.host !== urlAnchor.protocol + '//' + urlAnchor.host;
|
|
1382
|
+
}
|
|
1383
|
+
if (!settings.url) settings.url = window.location.toString();
|
|
1384
|
+
if ((hashIndex = settings.url.indexOf('#')) > -1) settings.url = settings.url.slice(0, hashIndex);
|
|
1385
|
+
serializeData(settings);
|
|
1386
|
+
var dataType = settings.dataType,
|
|
1387
|
+
hasPlaceholder = /\?.+=\?/.test(settings.url);
|
|
1388
|
+
if (hasPlaceholder) dataType = 'jsonp';
|
|
1389
|
+
if (settings.cache === false || (!options || options.cache !== true) && ('script' == dataType || 'jsonp' == dataType)) settings.url = appendQuery(settings.url, '_=' + Date.now());
|
|
1390
|
+
if ('jsonp' == dataType) {
|
|
1391
|
+
if (!hasPlaceholder) settings.url = appendQuery(settings.url, settings.jsonp ? settings.jsonp + '=?' : settings.jsonp === false ? '' : 'callback=?');
|
|
1392
|
+
return $.ajaxJSONP(settings, deferred);
|
|
1393
|
+
}
|
|
1394
|
+
var mime = settings.accepts[dataType],
|
|
1395
|
+
headers = {},
|
|
1396
|
+
setHeader = function (name, value) {
|
|
1397
|
+
headers[name.toLowerCase()] = [name, value];
|
|
1344
1398
|
},
|
|
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);
|
|
1399
|
+
protocol = /^([\w-]+:)\/\//.test(settings.url) ? RegExp.$1 : window.location.protocol,
|
|
1400
|
+
xhr = settings.xhr(),
|
|
1401
|
+
nativeSetHeader = xhr.setRequestHeader,
|
|
1402
|
+
abortTimeout;
|
|
1403
|
+
if (deferred) deferred.promise(xhr);
|
|
1404
|
+
if (!settings.crossDomain) setHeader('X-Requested-With', 'XMLHttpRequest');
|
|
1405
|
+
setHeader('Accept', mime || '*/*');
|
|
1406
|
+
if (mime = settings.mimeType || mime) {
|
|
1407
|
+
if (mime.indexOf(',') > -1) mime = mime.split(',', 2)[0];
|
|
1408
|
+
xhr.overrideMimeType && xhr.overrideMimeType(mime);
|
|
1409
|
+
}
|
|
1410
|
+
if (settings.contentType || settings.contentType !== false && settings.data && settings.type.toUpperCase() != 'GET') setHeader('Content-Type', settings.contentType || 'application/x-www-form-urlencoded');
|
|
1411
|
+
if (settings.headers) for (name in settings.headers) setHeader(name, settings.headers[name]);
|
|
1412
|
+
xhr.setRequestHeader = setHeader;
|
|
1413
|
+
xhr.onreadystatechange = function () {
|
|
1414
|
+
if (xhr.readyState == 4) {
|
|
1415
|
+
xhr.onreadystatechange = empty;
|
|
1416
|
+
clearTimeout(abortTimeout);
|
|
1417
|
+
var result,
|
|
1418
|
+
error = false;
|
|
1419
|
+
if (xhr.status >= 200 && xhr.status < 300 || xhr.status == 304 || xhr.status == 0 && protocol == 'file:') {
|
|
1420
|
+
dataType = dataType || mimeToDataType(settings.mimeType || xhr.getResponseHeader('content-type'));
|
|
1421
|
+
if (xhr.responseType == 'arraybuffer' || xhr.responseType == 'blob') result = xhr.response;else {
|
|
1422
|
+
result = xhr.responseText;
|
|
1423
|
+
try {
|
|
1424
|
+
// http://perfectionkills.com/global-eval-what-are-the-options/
|
|
1425
|
+
// sanitize response accordingly if data filter callback provided
|
|
1426
|
+
result = ajaxDataFilter(result, dataType, settings);
|
|
1427
|
+
if (dataType == 'script') (1, eval)(result);else if (dataType == 'xml') result = xhr.responseXML;else if (dataType == 'json') result = blankRE.test(result) ? null : $.parseJSON(result);
|
|
1428
|
+
} catch (e) {
|
|
1429
|
+
error = e;
|
|
1435
1430
|
}
|
|
1436
|
-
|
|
1437
|
-
} else {
|
|
1438
|
-
ajaxError(xhr.statusText || null, xhr.status ? 'error' : 'abort', xhr, settings, deferred);
|
|
1431
|
+
if (error) return ajaxError(error, 'parsererror', xhr, settings, deferred);
|
|
1439
1432
|
}
|
|
1433
|
+
ajaxSuccess(result, xhr, settings, deferred);
|
|
1434
|
+
} else {
|
|
1435
|
+
ajaxError(xhr.statusText || null, xhr.status ? 'error' : 'abort', xhr, settings, deferred);
|
|
1440
1436
|
}
|
|
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;
|
|
1437
|
+
}
|
|
1460
1438
|
};
|
|
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
|
-
};
|
|
1439
|
+
if (ajaxBeforeSend(xhr, settings) === false) {
|
|
1440
|
+
xhr.abort();
|
|
1441
|
+
ajaxError(null, 'abort', xhr, settings, deferred);
|
|
1442
|
+
return xhr;
|
|
1472
1443
|
}
|
|
1473
|
-
|
|
1474
|
-
()
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
()
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1444
|
+
var async = 'async' in settings ? settings.async : true;
|
|
1445
|
+
xhr.open(settings.type, settings.url, async, settings.username, settings.password);
|
|
1446
|
+
if (settings.xhrFields) for (name in settings.xhrFields) xhr[name] = settings.xhrFields[name];
|
|
1447
|
+
for (name in headers) nativeSetHeader.apply(xhr, headers[name]);
|
|
1448
|
+
if (settings.timeout > 0) abortTimeout = setTimeout(function () {
|
|
1449
|
+
xhr.onreadystatechange = empty;
|
|
1450
|
+
xhr.abort();
|
|
1451
|
+
ajaxError(null, 'timeout', xhr, settings, deferred);
|
|
1452
|
+
}, settings.timeout);
|
|
1453
|
+
|
|
1454
|
+
// avoid sending empty string (#319)
|
|
1455
|
+
xhr.send(settings.data ? settings.data : null);
|
|
1456
|
+
return xhr;
|
|
1457
|
+
};
|
|
1458
|
+
|
|
1459
|
+
// handle optional data/success arguments
|
|
1460
|
+
function parseArguments(url, data, success, dataType) {
|
|
1461
|
+
if ($.isFunction(data)) dataType = success, success = data, data = undefined;
|
|
1462
|
+
if (!$.isFunction(success)) dataType = success, success = undefined;
|
|
1463
|
+
return {
|
|
1464
|
+
url: url,
|
|
1465
|
+
data: data,
|
|
1466
|
+
success: success,
|
|
1467
|
+
dataType: dataType
|
|
1488
1468
|
};
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1469
|
+
}
|
|
1470
|
+
$.get = function /* url, data, success, dataType */
|
|
1471
|
+
() {
|
|
1472
|
+
return $.ajax(parseArguments.apply(null, arguments));
|
|
1473
|
+
};
|
|
1474
|
+
$.post = function /* url, data, success, dataType */
|
|
1475
|
+
() {
|
|
1476
|
+
var options = parseArguments.apply(null, arguments);
|
|
1477
|
+
options.type = 'POST';
|
|
1478
|
+
return $.ajax(options);
|
|
1479
|
+
};
|
|
1480
|
+
$.getJSON = function /* url, data, success */
|
|
1481
|
+
() {
|
|
1482
|
+
var options = parseArguments.apply(null, arguments);
|
|
1483
|
+
options.dataType = 'json';
|
|
1484
|
+
return $.ajax(options);
|
|
1485
|
+
};
|
|
1486
|
+
$.fn.load = function (url, data, success) {
|
|
1487
|
+
if (!this.length) return this;
|
|
1488
|
+
var self = this,
|
|
1489
|
+
parts = url.split(/\s/),
|
|
1490
|
+
selector,
|
|
1491
|
+
options = parseArguments(url, data, success),
|
|
1492
|
+
callback = options.success;
|
|
1493
|
+
if (parts.length > 1) options.url = parts[0], selector = parts[1];
|
|
1494
|
+
options.success = function (response) {
|
|
1495
|
+
self.html(selector ? $('<div>').html(response.replace(rscript, "")).find(selector) : response);
|
|
1496
|
+
callback && callback.apply(self, arguments);
|
|
1503
1497
|
};
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1498
|
+
$.ajax(options);
|
|
1499
|
+
return this;
|
|
1500
|
+
};
|
|
1501
|
+
var escape = encodeURIComponent;
|
|
1502
|
+
function serialize(params, obj, traditional, scope) {
|
|
1503
|
+
var type,
|
|
1504
|
+
array = $.isArray(obj),
|
|
1505
|
+
hash = $.isPlainObject(obj);
|
|
1506
|
+
$.each(obj, function (key, value) {
|
|
1507
|
+
type = $.type(value);
|
|
1508
|
+
if (scope) key = traditional ? scope : scope + '[' + (hash || type == 'object' || type == 'array' ? key : '') + ']';
|
|
1509
|
+
// handle data in serializeArray() format
|
|
1510
|
+
if (!scope && array) params.add(value.name, value.value);
|
|
1511
|
+
// recurse into nested objects
|
|
1512
|
+
else if (type == "array" || !traditional && type == "object") serialize(params, value, traditional, key);else params.add(key, value);
|
|
1513
|
+
});
|
|
1514
|
+
}
|
|
1515
|
+
$.param = function (obj, traditional) {
|
|
1516
|
+
var params = [];
|
|
1517
|
+
params.add = function (key, value) {
|
|
1518
|
+
if ($.isFunction(value)) value = value();
|
|
1519
|
+
if (value == null) value = "";
|
|
1520
|
+
this.push(escape(key) + '=' + escape(value));
|
|
1527
1521
|
};
|
|
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
|
-
|
|
1522
|
+
serialize(params, obj, traditional);
|
|
1523
|
+
return params.join('&').replace(/%20/g, '+');
|
|
1524
|
+
};
|
|
1525
|
+
})(Zepto);
|
|
1526
|
+
(function ($) {
|
|
1527
|
+
// Create a collection of callbacks to be fired in a sequence, with configurable behaviour
|
|
1528
|
+
// Option flags:
|
|
1529
|
+
// - once: Callbacks fired at most one time.
|
|
1530
|
+
// - memory: Remember the most recent context and arguments
|
|
1531
|
+
// - stopOnFalse: Cease iterating over callback list
|
|
1532
|
+
// - unique: Permit adding at most one instance of the same callback
|
|
1533
|
+
$.Callbacks = function (options) {
|
|
1534
|
+
options = $.extend({}, options);
|
|
1535
|
+
var memory,
|
|
1536
|
+
// Last fire value (for non-forgettable lists)
|
|
1537
|
+
fired,
|
|
1538
|
+
// Flag to know if list was already fired
|
|
1539
|
+
firing,
|
|
1540
|
+
// Flag to know if list is currently firing
|
|
1541
|
+
firingStart,
|
|
1542
|
+
// First callback to fire (used internally by add and fireWith)
|
|
1543
|
+
firingLength,
|
|
1544
|
+
// End of the loop when firing
|
|
1545
|
+
firingIndex,
|
|
1546
|
+
// Index of currently firing callback (modified by remove if needed)
|
|
1547
|
+
list = [],
|
|
1548
|
+
// Actual callback list
|
|
1549
|
+
stack = !options.once && [],
|
|
1550
|
+
// Stack of fire calls for repeatable lists
|
|
1551
|
+
fire = function (data) {
|
|
1552
|
+
memory = options.memory && data;
|
|
1553
|
+
fired = true;
|
|
1554
|
+
firingIndex = firingStart || 0;
|
|
1555
|
+
firingStart = 0;
|
|
1556
|
+
firingLength = list.length;
|
|
1557
|
+
firing = true;
|
|
1558
|
+
for (; list && firingIndex < firingLength; ++firingIndex) {
|
|
1559
|
+
if (list[firingIndex].apply(data[0], data[1]) === false && options.stopOnFalse) {
|
|
1560
|
+
memory = false;
|
|
1561
|
+
break;
|
|
1566
1562
|
}
|
|
1567
|
-
|
|
1563
|
+
}
|
|
1564
|
+
firing = false;
|
|
1565
|
+
if (list) {
|
|
1566
|
+
if (stack) stack.length && fire(stack.shift());else if (memory) list.length = 0;else Callbacks.disable();
|
|
1567
|
+
}
|
|
1568
|
+
},
|
|
1569
|
+
Callbacks = {
|
|
1570
|
+
add: function () {
|
|
1568
1571
|
if (list) {
|
|
1569
|
-
|
|
1572
|
+
var start = list.length,
|
|
1573
|
+
add = function (args) {
|
|
1574
|
+
$.each(args, function (_, arg) {
|
|
1575
|
+
if (typeof arg === "function") {
|
|
1576
|
+
if (!options.unique || !Callbacks.has(arg)) list.push(arg);
|
|
1577
|
+
} else if (arg && arg.length && typeof arg !== 'string') add(arg);
|
|
1578
|
+
});
|
|
1579
|
+
};
|
|
1580
|
+
add(arguments);
|
|
1581
|
+
if (firing) firingLength = list.length;else if (memory) {
|
|
1582
|
+
firingStart = start;
|
|
1583
|
+
fire(memory);
|
|
1584
|
+
}
|
|
1570
1585
|
}
|
|
1586
|
+
return this;
|
|
1571
1587
|
},
|
|
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
|
-
}
|
|
1588
|
+
remove: function () {
|
|
1589
|
+
if (list) {
|
|
1590
|
+
$.each(arguments, function (_, arg) {
|
|
1591
|
+
var index;
|
|
1592
|
+
while ((index = $.inArray(arg, list, index)) > -1) {
|
|
1593
|
+
list.splice(index, 1);
|
|
1594
|
+
// Handle firing indexes
|
|
1595
|
+
if (firing) {
|
|
1596
|
+
if (index <= firingLength) --firingLength;
|
|
1597
|
+
if (index <= firingIndex) --firingIndex;
|
|
1602
1598
|
}
|
|
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;
|
|
1599
|
+
}
|
|
1600
|
+
});
|
|
1692
1601
|
}
|
|
1602
|
+
return this;
|
|
1603
|
+
},
|
|
1604
|
+
has: function (fn) {
|
|
1605
|
+
return !!(list && (fn ? $.inArray(fn, list) > -1 : list.length));
|
|
1693
1606
|
},
|
|
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);
|
|
1607
|
+
empty: function () {
|
|
1608
|
+
firingLength = list.length = 0;
|
|
1706
1609
|
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;
|
|
1610
|
+
},
|
|
1611
|
+
disable: function () {
|
|
1612
|
+
list = stack = memory = undefined;
|
|
1613
|
+
return this;
|
|
1614
|
+
},
|
|
1615
|
+
disabled: function () {
|
|
1616
|
+
return !list;
|
|
1617
|
+
},
|
|
1618
|
+
lock: function () {
|
|
1619
|
+
stack = undefined;
|
|
1620
|
+
if (!memory) Callbacks.disable();
|
|
1621
|
+
return this;
|
|
1622
|
+
},
|
|
1623
|
+
locked: function () {
|
|
1624
|
+
return !stack;
|
|
1625
|
+
},
|
|
1626
|
+
fireWith: function (context, args) {
|
|
1627
|
+
if (list && (!fired || stack)) {
|
|
1628
|
+
args = args || [];
|
|
1629
|
+
args = [context, args.slice ? args.slice() : args];
|
|
1630
|
+
if (firing) stack.push(args);else fire(args);
|
|
1743
1631
|
}
|
|
1632
|
+
return this;
|
|
1633
|
+
},
|
|
1634
|
+
fire: function () {
|
|
1635
|
+
return Callbacks.fireWith(this, arguments);
|
|
1636
|
+
},
|
|
1637
|
+
fired: function () {
|
|
1638
|
+
return !!fired;
|
|
1744
1639
|
}
|
|
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
1640
|
};
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1641
|
+
return Callbacks;
|
|
1642
|
+
};
|
|
1643
|
+
})(Zepto);
|
|
1644
|
+
(function ($) {
|
|
1645
|
+
var slice = Array.prototype.slice;
|
|
1646
|
+
function Deferred(func) {
|
|
1647
|
+
var tuples = [
|
|
1648
|
+
// action, add listener, listener list, final state
|
|
1649
|
+
["resolve", "done", $.Callbacks({
|
|
1650
|
+
once: 1,
|
|
1651
|
+
memory: 1
|
|
1652
|
+
}), "resolved"], ["reject", "fail", $.Callbacks({
|
|
1653
|
+
once: 1,
|
|
1654
|
+
memory: 1
|
|
1655
|
+
}), "rejected"], ["notify", "progress", $.Callbacks({
|
|
1656
|
+
memory: 1
|
|
1657
|
+
})]],
|
|
1658
|
+
state = "pending",
|
|
1659
|
+
promise = {
|
|
1660
|
+
state: function () {
|
|
1661
|
+
return state;
|
|
1662
|
+
},
|
|
1663
|
+
always: function () {
|
|
1664
|
+
deferred.done(arguments).fail(arguments);
|
|
1665
|
+
return this;
|
|
1666
|
+
},
|
|
1667
|
+
then: function /* fnDone [, fnFailed [, fnProgress]] */
|
|
1668
|
+
() {
|
|
1669
|
+
var fns = arguments;
|
|
1670
|
+
return Deferred(function (defer) {
|
|
1671
|
+
$.each(tuples, function (i, tuple) {
|
|
1672
|
+
var fn = $.isFunction(fns[i]) && fns[i];
|
|
1673
|
+
deferred[tuple[1]](function () {
|
|
1674
|
+
var returned = fn && fn.apply(this, arguments);
|
|
1675
|
+
if (returned && $.isFunction(returned.promise)) {
|
|
1676
|
+
returned.promise().done(defer.resolve).fail(defer.reject).progress(defer.notify);
|
|
1677
|
+
} else {
|
|
1678
|
+
var context = this === promise ? defer.promise() : this,
|
|
1679
|
+
values = fn ? [returned] : arguments;
|
|
1680
|
+
defer[tuple[0] + "With"](context, values);
|
|
1681
|
+
}
|
|
1682
|
+
});
|
|
1683
|
+
});
|
|
1684
|
+
fns = null;
|
|
1685
|
+
}).promise();
|
|
1686
|
+
},
|
|
1687
|
+
promise: function (obj) {
|
|
1688
|
+
return obj != null ? $.extend(obj, promise) : promise;
|
|
1689
|
+
}
|
|
1690
|
+
},
|
|
1691
|
+
deferred = {};
|
|
1692
|
+
$.each(tuples, function (i, tuple) {
|
|
1693
|
+
var list = tuple[2],
|
|
1694
|
+
stateString = tuple[3];
|
|
1695
|
+
promise[tuple[1]] = list.add;
|
|
1696
|
+
if (stateString) {
|
|
1697
|
+
list.add(function () {
|
|
1698
|
+
state = stateString;
|
|
1699
|
+
}, tuples[i ^ 1][2].disable, tuples[2][2].lock);
|
|
1700
|
+
}
|
|
1701
|
+
deferred[tuple[0]] = function () {
|
|
1702
|
+
deferred[tuple[0] + "With"](this === deferred ? promise : this, arguments);
|
|
1703
|
+
return this;
|
|
1786
1704
|
};
|
|
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);
|
|
1705
|
+
deferred[tuple[0] + "With"] = list.fireWith;
|
|
1706
|
+
});
|
|
1707
|
+
promise.promise(deferred);
|
|
1708
|
+
if (func) func.call(deferred, deferred);
|
|
1709
|
+
return deferred;
|
|
1710
|
+
}
|
|
1711
|
+
$.when = function (sub) {
|
|
1712
|
+
var resolveValues = slice.call(arguments),
|
|
1713
|
+
len = resolveValues.length,
|
|
1714
|
+
i = 0,
|
|
1715
|
+
remain = len !== 1 || sub && $.isFunction(sub.promise) ? len : 0,
|
|
1716
|
+
deferred = remain === 1 ? sub : Deferred(),
|
|
1717
|
+
progressValues,
|
|
1718
|
+
progressContexts,
|
|
1719
|
+
resolveContexts,
|
|
1720
|
+
updateFn = function (i, ctx, val) {
|
|
1721
|
+
return function (value) {
|
|
1722
|
+
ctx[i] = this;
|
|
1723
|
+
val[i] = arguments.length > 1 ? slice.call(arguments) : value;
|
|
1724
|
+
if (val === progressValues) {
|
|
1725
|
+
deferred.notifyWith(ctx, val);
|
|
1726
|
+
} else if (! --remain) {
|
|
1727
|
+
deferred.resolveWith(ctx, val);
|
|
1728
|
+
}
|
|
1843
1729
|
};
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1730
|
+
};
|
|
1731
|
+
if (len > 1) {
|
|
1732
|
+
progressValues = new Array(len);
|
|
1733
|
+
progressContexts = new Array(len);
|
|
1734
|
+
resolveContexts = new Array(len);
|
|
1735
|
+
for (; i < len; ++i) {
|
|
1736
|
+
if (resolveValues[i] && $.isFunction(resolveValues[i].promise)) {
|
|
1737
|
+
resolveValues[i].promise().done(updateFn(i, resolveContexts, resolveValues)).fail(deferred.reject).progress(updateFn(i, progressContexts, progressValues));
|
|
1850
1738
|
} else {
|
|
1851
|
-
|
|
1739
|
+
--remain;
|
|
1852
1740
|
}
|
|
1853
|
-
} else {
|
|
1854
|
-
throw new TypeError("expected function");
|
|
1855
1741
|
}
|
|
1742
|
+
}
|
|
1743
|
+
if (!remain) deferred.resolveWith(resolveContexts, resolveValues);
|
|
1744
|
+
return deferred.promise();
|
|
1745
|
+
};
|
|
1746
|
+
$.Deferred = Deferred;
|
|
1747
|
+
})(Zepto);
|
|
1748
|
+
(function ($) {
|
|
1749
|
+
var _zid = 1,
|
|
1750
|
+
undefined$1,
|
|
1751
|
+
slice = Array.prototype.slice,
|
|
1752
|
+
isFunction = $.isFunction,
|
|
1753
|
+
isString = function (obj) {
|
|
1754
|
+
return typeof obj == 'string';
|
|
1755
|
+
},
|
|
1756
|
+
handlers = {},
|
|
1757
|
+
specialEvents = {},
|
|
1758
|
+
focusinSupported = 'onfocusin' in window,
|
|
1759
|
+
focus = {
|
|
1760
|
+
focus: 'focusin',
|
|
1761
|
+
blur: 'focusout'
|
|
1762
|
+
},
|
|
1763
|
+
hover = {
|
|
1764
|
+
mouseenter: 'mouseover',
|
|
1765
|
+
mouseleave: 'mouseout'
|
|
1856
1766
|
};
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1767
|
+
specialEvents.click = specialEvents.mousedown = specialEvents.mouseup = specialEvents.mousemove = 'MouseEvents';
|
|
1768
|
+
function zid(element) {
|
|
1769
|
+
return element._zid || (element._zid = _zid++);
|
|
1770
|
+
}
|
|
1771
|
+
function findHandlers(element, event, fn, selector) {
|
|
1772
|
+
event = parse(event);
|
|
1773
|
+
if (event.ns) var matcher = matcherFor(event.ns);
|
|
1774
|
+
return (handlers[zid(element)] || []).filter(function (handler) {
|
|
1775
|
+
return handler && (!event.e || handler.e == event.e) && (!event.ns || matcher.test(handler.ns)) && (!fn || zid(handler.fn) === zid(fn)) && (!selector || handler.sel == selector);
|
|
1776
|
+
});
|
|
1777
|
+
}
|
|
1778
|
+
function parse(event) {
|
|
1779
|
+
var parts = ('' + event).split('.');
|
|
1780
|
+
return {
|
|
1781
|
+
e: parts[0],
|
|
1782
|
+
ns: parts.slice(1).sort().join(' ')
|
|
1865
1783
|
};
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1784
|
+
}
|
|
1785
|
+
function matcherFor(ns) {
|
|
1786
|
+
return new RegExp('(?:^| )' + ns.replace(' ', ' .* ?') + '(?: |$)');
|
|
1787
|
+
}
|
|
1788
|
+
function eventCapture(handler, captureSetting) {
|
|
1789
|
+
return handler.del && !focusinSupported && handler.e in focus || !!captureSetting;
|
|
1790
|
+
}
|
|
1791
|
+
function realEvent(type) {
|
|
1792
|
+
return hover[type] || focusinSupported && focus[type] || type;
|
|
1793
|
+
}
|
|
1794
|
+
function add(element, events, fn, data, selector, delegator, capture) {
|
|
1795
|
+
var id = zid(element),
|
|
1796
|
+
set = handlers[id] || (handlers[id] = []);
|
|
1797
|
+
events.split(/\s/).forEach(function (event) {
|
|
1798
|
+
if (event == 'ready') return $(document).ready(fn);
|
|
1799
|
+
var handler = parse(event);
|
|
1800
|
+
handler.fn = fn;
|
|
1801
|
+
handler.sel = selector;
|
|
1802
|
+
// emulate mouseenter, mouseleave
|
|
1803
|
+
if (handler.e in hover) fn = function (e) {
|
|
1804
|
+
var related = e.relatedTarget;
|
|
1805
|
+
if (!related || related !== this && !$.contains(this, related)) return handler.fn.apply(this, arguments);
|
|
1877
1806
|
};
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1807
|
+
handler.del = delegator;
|
|
1808
|
+
var callback = delegator || fn;
|
|
1809
|
+
handler.proxy = function (e) {
|
|
1810
|
+
e = compatible(e);
|
|
1811
|
+
if (e.isImmediatePropagationStopped()) return;
|
|
1812
|
+
e.data = data;
|
|
1813
|
+
var result = callback.apply(element, e._args == undefined$1 ? [e] : [e].concat(e._args));
|
|
1814
|
+
if (result === false) e.preventDefault(), e.stopPropagation();
|
|
1815
|
+
return result;
|
|
1816
|
+
};
|
|
1817
|
+
handler.i = set.length;
|
|
1818
|
+
set.push(handler);
|
|
1819
|
+
if ('addEventListener' in element) element.addEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture));
|
|
1820
|
+
});
|
|
1821
|
+
}
|
|
1822
|
+
function remove(element, events, fn, selector, capture) {
|
|
1823
|
+
var id = zid(element);
|
|
1824
|
+
(events || '').split(/\s/).forEach(function (event) {
|
|
1825
|
+
findHandlers(element, event, fn, selector).forEach(function (handler) {
|
|
1826
|
+
delete handlers[id][handler.i];
|
|
1827
|
+
if ('removeEventListener' in element) element.removeEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture));
|
|
1828
|
+
});
|
|
1829
|
+
});
|
|
1830
|
+
}
|
|
1831
|
+
$.event = {
|
|
1832
|
+
add: add,
|
|
1833
|
+
remove: remove
|
|
1834
|
+
};
|
|
1835
|
+
$.proxy = function (fn, context) {
|
|
1836
|
+
var args = 2 in arguments && slice.call(arguments, 2);
|
|
1837
|
+
if (isFunction(fn)) {
|
|
1838
|
+
var proxyFn = function () {
|
|
1839
|
+
return fn.apply(context, args ? args.concat(slice.call(arguments)) : arguments);
|
|
1840
|
+
};
|
|
1841
|
+
proxyFn._zid = zid(fn);
|
|
1842
|
+
return proxyFn;
|
|
1843
|
+
} else if (isString(context)) {
|
|
1844
|
+
if (args) {
|
|
1845
|
+
args.unshift(fn[context], fn);
|
|
1846
|
+
return $.proxy.apply(null, args);
|
|
1847
|
+
} else {
|
|
1848
|
+
return $.proxy(fn[context], fn);
|
|
1890
1849
|
}
|
|
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);
|
|
1850
|
+
} else {
|
|
1851
|
+
throw new TypeError("expected function");
|
|
1900
1852
|
}
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1853
|
+
};
|
|
1854
|
+
$.fn.bind = function (event, data, callback) {
|
|
1855
|
+
return this.on(event, data, callback);
|
|
1856
|
+
};
|
|
1857
|
+
$.fn.unbind = function (event, callback) {
|
|
1858
|
+
return this.off(event, callback);
|
|
1859
|
+
};
|
|
1860
|
+
$.fn.one = function (event, selector, data, callback) {
|
|
1861
|
+
return this.on(event, selector, data, callback, 1);
|
|
1862
|
+
};
|
|
1863
|
+
var returnTrue = function () {
|
|
1864
|
+
return true;
|
|
1865
|
+
},
|
|
1866
|
+
returnFalse = function () {
|
|
1867
|
+
return false;
|
|
1868
|
+
},
|
|
1869
|
+
ignoreProperties = /^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/,
|
|
1870
|
+
eventMethods = {
|
|
1871
|
+
preventDefault: 'isDefaultPrevented',
|
|
1872
|
+
stopImmediatePropagation: 'isImmediatePropagationStopped',
|
|
1873
|
+
stopPropagation: 'isPropagationStopped'
|
|
1914
1874
|
};
|
|
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);
|
|
1875
|
+
function compatible(event, source) {
|
|
1876
|
+
if (source || !event.isDefaultPrevented) {
|
|
1877
|
+
source || (source = event);
|
|
1878
|
+
$.each(eventMethods, function (name, predicate) {
|
|
1879
|
+
var sourceMethod = source[name];
|
|
1880
|
+
event[name] = function () {
|
|
1881
|
+
this[predicate] = returnTrue;
|
|
1882
|
+
return sourceMethod && sourceMethod.apply(source, arguments);
|
|
1932
1883
|
};
|
|
1933
|
-
|
|
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
|
-
}
|
|
1943
|
-
};
|
|
1944
|
-
add(element, event, callback, data, selector, delegator || autoRemove);
|
|
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
|
-
});
|
|
1884
|
+
event[predicate] = returnFalse;
|
|
1984
1885
|
});
|
|
1985
|
-
|
|
1886
|
+
if (source.defaultPrevented !== undefined$1 ? source.defaultPrevented : 'returnValue' in source ? source.returnValue === false : source.getPreventDefault && source.getPreventDefault()) event.isDefaultPrevented = returnTrue;
|
|
1986
1887
|
}
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1888
|
+
return event;
|
|
1889
|
+
}
|
|
1890
|
+
function createProxy(event) {
|
|
1891
|
+
var key,
|
|
1892
|
+
proxy = {
|
|
1893
|
+
originalEvent: event
|
|
1993
1894
|
};
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
1895
|
+
for (key in event) if (!ignoreProperties.test(key) && event[key] !== undefined$1) proxy[key] = event[key];
|
|
1896
|
+
return compatible(proxy, event);
|
|
1897
|
+
}
|
|
1898
|
+
$.fn.delegate = function (selector, event, callback) {
|
|
1899
|
+
return this.on(event, selector, callback);
|
|
1900
|
+
};
|
|
1901
|
+
$.fn.undelegate = function (selector, event, callback) {
|
|
1902
|
+
return this.off(event, selector, callback);
|
|
1903
|
+
};
|
|
1904
|
+
$.fn.live = function (event, callback) {
|
|
1905
|
+
$(document.body).delegate(this.selector, event, callback);
|
|
1906
|
+
return this;
|
|
1907
|
+
};
|
|
1908
|
+
$.fn.die = function (event, callback) {
|
|
1909
|
+
$(document.body).undelegate(this.selector, event, callback);
|
|
1910
|
+
return this;
|
|
1911
|
+
};
|
|
1912
|
+
$.fn.on = function (event, selector, data, callback, one) {
|
|
1913
|
+
var autoRemove,
|
|
1914
|
+
delegator,
|
|
1915
|
+
$this = this;
|
|
1916
|
+
if (event && !isString(event)) {
|
|
1917
|
+
$.each(event, function (type, fn) {
|
|
1918
|
+
$this.on(type, selector, data, fn, one);
|
|
1919
|
+
});
|
|
1920
|
+
return $this;
|
|
1921
|
+
}
|
|
1922
|
+
if (!isString(selector) && !isFunction(callback) && callback !== false) callback = data, data = selector, selector = undefined$1;
|
|
1923
|
+
if (callback === undefined$1 || data === false) callback = data, data = undefined$1;
|
|
1924
|
+
if (callback === false) callback = returnFalse;
|
|
1925
|
+
return $this.each(function (_, element) {
|
|
1926
|
+
if (one) autoRemove = function (e) {
|
|
1927
|
+
remove(element, e.type, callback);
|
|
1928
|
+
return callback.apply(this, arguments);
|
|
1929
|
+
};
|
|
1930
|
+
if (selector) delegator = function (e) {
|
|
1931
|
+
var evt,
|
|
1932
|
+
match = $(e.target).closest(selector, element).get(0);
|
|
1933
|
+
if (match && match !== element) {
|
|
1934
|
+
evt = $.extend(createProxy(e), {
|
|
1935
|
+
currentTarget: match,
|
|
1936
|
+
liveFired: element
|
|
1937
|
+
});
|
|
1938
|
+
return (autoRemove || callback).apply(match, [evt].concat(slice.call(arguments, 1)));
|
|
2016
1939
|
}
|
|
2017
1940
|
};
|
|
1941
|
+
add(element, event, callback, data, selector, delegator || autoRemove);
|
|
1942
|
+
});
|
|
1943
|
+
};
|
|
1944
|
+
$.fn.off = function (event, selector, callback) {
|
|
1945
|
+
var $this = this;
|
|
1946
|
+
if (event && !isString(event)) {
|
|
1947
|
+
$.each(event, function (type, fn) {
|
|
1948
|
+
$this.off(type, selector, fn);
|
|
1949
|
+
});
|
|
1950
|
+
return $this;
|
|
2018
1951
|
}
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
1952
|
+
if (!isString(selector) && !isFunction(callback) && callback !== false) callback = selector, selector = undefined$1;
|
|
1953
|
+
if (callback === false) callback = returnFalse;
|
|
1954
|
+
return $this.each(function () {
|
|
1955
|
+
remove(this, event, callback, selector);
|
|
1956
|
+
});
|
|
1957
|
+
};
|
|
1958
|
+
$.fn.trigger = function (event, args) {
|
|
1959
|
+
event = isString(event) || $.isPlainObject(event) ? $.Event(event) : compatible(event);
|
|
1960
|
+
event._args = args;
|
|
1961
|
+
return this.each(function () {
|
|
1962
|
+
// handle focus(), blur() by calling them directly
|
|
1963
|
+
if (event.type in focus && typeof this[event.type] == "function") this[event.type]();
|
|
1964
|
+
// items in the collection might not be DOM elements
|
|
1965
|
+
else if ('dispatchEvent' in this) this.dispatchEvent(event);else $(this).triggerHandler(event, args);
|
|
1966
|
+
});
|
|
1967
|
+
};
|
|
2028
1968
|
|
|
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
|
-
}));
|
|
1969
|
+
// triggers event handlers on current element just as if an event occurred,
|
|
1970
|
+
// doesn't trigger an actual event, doesn't bubble
|
|
1971
|
+
$.fn.triggerHandler = function (event, args) {
|
|
1972
|
+
var e, result;
|
|
1973
|
+
this.each(function (i, element) {
|
|
1974
|
+
e = createProxy(isString(event) ? $.Event(event) : event);
|
|
1975
|
+
e._args = args;
|
|
1976
|
+
e.target = element;
|
|
1977
|
+
$.each(findHandlers(element, event.type || event), function (i, handler) {
|
|
1978
|
+
result = handler.proxy(e);
|
|
1979
|
+
if (e.isImmediatePropagationStopped()) return false;
|
|
2109
1980
|
});
|
|
1981
|
+
});
|
|
1982
|
+
return result;
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
// shortcut methods for `.bind(event, fn)` for each event type
|
|
1986
|
+
;
|
|
1987
|
+
('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) {
|
|
1988
|
+
$.fn[event] = function (callback) {
|
|
1989
|
+
return 0 in arguments ? this.bind(event, callback) : this.trigger(event);
|
|
2110
1990
|
};
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
1991
|
+
});
|
|
1992
|
+
$.Event = function (type, props) {
|
|
1993
|
+
if (!isString(type)) props = type, type = props.type;
|
|
1994
|
+
var event = document.createEvent(specialEvents[type] || 'Events'),
|
|
1995
|
+
bubbles = true;
|
|
1996
|
+
if (props) for (var name in props) name == 'bubbles' ? bubbles = !!props[name] : event[name] = props[name];
|
|
1997
|
+
event.initEvent(type, bubbles, true);
|
|
1998
|
+
return compatible(event);
|
|
1999
|
+
};
|
|
2000
|
+
})(Zepto);
|
|
2001
|
+
(function () {
|
|
2002
|
+
// getComputedStyle shouldn't freak out when called
|
|
2003
|
+
// without a valid element as argument
|
|
2004
|
+
try {
|
|
2005
|
+
getComputedStyle(undefined);
|
|
2006
|
+
} catch (e) {
|
|
2007
|
+
var nativeGetComputedStyle = getComputedStyle;
|
|
2008
|
+
window.getComputedStyle = function (element, pseudoElement) {
|
|
2009
|
+
try {
|
|
2010
|
+
return nativeGetComputedStyle(element, pseudoElement);
|
|
2011
|
+
} catch (e) {
|
|
2012
|
+
return null;
|
|
2013
|
+
}
|
|
2115
2014
|
};
|
|
2116
|
-
}
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2015
|
+
}
|
|
2016
|
+
})();
|
|
2017
|
+
(function ($) {
|
|
2018
|
+
var zepto = $.zepto,
|
|
2019
|
+
oldQsa = zepto.qsa,
|
|
2020
|
+
oldMatches = zepto.matches;
|
|
2021
|
+
function visible(elem) {
|
|
2022
|
+
elem = $(elem);
|
|
2023
|
+
return !!(elem.width() || elem.height()) && elem.css("display") !== "none";
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2026
|
+
// Implements a subset from:
|
|
2027
|
+
// http://api.jquery.com/category/selectors/jquery-selector-extensions/
|
|
2028
|
+
//
|
|
2029
|
+
// Each filter function receives the current index, all nodes in the
|
|
2030
|
+
// considered set, and a value if there were parentheses. The value
|
|
2031
|
+
// of `this` is the node currently being considered. The function returns the
|
|
2032
|
+
// resulting node(s), null, or undefined.
|
|
2033
|
+
//
|
|
2034
|
+
// Complex selectors are not supported:
|
|
2035
|
+
// li:has(label:contains("foo")) + li:has(label:contains("bar"))
|
|
2036
|
+
// ul.inner:first > li
|
|
2037
|
+
var filters = $.expr[':'] = {
|
|
2038
|
+
visible: function () {
|
|
2039
|
+
if (visible(this)) return this;
|
|
2040
|
+
},
|
|
2041
|
+
hidden: function () {
|
|
2042
|
+
if (!visible(this)) return this;
|
|
2043
|
+
},
|
|
2044
|
+
selected: function () {
|
|
2045
|
+
if (this.selected) return this;
|
|
2046
|
+
},
|
|
2047
|
+
checked: function () {
|
|
2048
|
+
if (this.checked) return this;
|
|
2049
|
+
},
|
|
2050
|
+
parent: function () {
|
|
2051
|
+
return this.parentNode;
|
|
2052
|
+
},
|
|
2053
|
+
first: function (idx) {
|
|
2054
|
+
if (idx === 0) return this;
|
|
2055
|
+
},
|
|
2056
|
+
last: function (idx, nodes) {
|
|
2057
|
+
if (idx === nodes.length - 1) return this;
|
|
2058
|
+
},
|
|
2059
|
+
eq: function (idx, _, value) {
|
|
2060
|
+
if (idx === value) return this;
|
|
2061
|
+
},
|
|
2062
|
+
contains: function (idx, _, text) {
|
|
2063
|
+
if ($(this).text().indexOf(text) > -1) return this;
|
|
2064
|
+
},
|
|
2065
|
+
has: function (idx, _, sel) {
|
|
2066
|
+
if (zepto.qsa(this, sel).length) return this;
|
|
2067
|
+
}
|
|
2068
|
+
};
|
|
2069
|
+
var filterRe = new RegExp('(.*):(\\w+)(?:\\(([^)]+)\\))?$\\s*'),
|
|
2070
|
+
childRe = /^\s*>/,
|
|
2071
|
+
classTag = 'Zepto' + +new Date();
|
|
2072
|
+
function process(sel, fn) {
|
|
2073
|
+
// quote the hash in `a[href^=#]` expression
|
|
2074
|
+
sel = sel.replace(/=#\]/g, '="#"]');
|
|
2075
|
+
var filter,
|
|
2076
|
+
arg,
|
|
2077
|
+
match = filterRe.exec(sel);
|
|
2078
|
+
if (match && match[2] in filters) {
|
|
2079
|
+
filter = filters[match[2]], arg = match[3];
|
|
2080
|
+
sel = match[1];
|
|
2081
|
+
if (arg) {
|
|
2082
|
+
var num = Number(arg);
|
|
2083
|
+
if (isNaN(num)) arg = arg.replace(/^["']|["']$/g, '');else arg = num;
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
return fn(sel, filter, arg);
|
|
2087
|
+
}
|
|
2088
|
+
zepto.qsa = function (node, selector) {
|
|
2089
|
+
return process(selector, function (sel, filter, arg) {
|
|
2090
|
+
try {
|
|
2091
|
+
var taggedParent;
|
|
2092
|
+
if (!sel && filter) sel = '*';else if (childRe.test(sel))
|
|
2093
|
+
// support "> *" child queries by tagging the parent node with a
|
|
2094
|
+
// unique class and prepending that classname onto the selector
|
|
2095
|
+
taggedParent = $(node).addClass(classTag), sel = '.' + classTag + ' ' + sel;
|
|
2096
|
+
var nodes = oldQsa(node, sel);
|
|
2097
|
+
} catch (e) {
|
|
2098
|
+
console.error('error performing selector: %o', selector);
|
|
2099
|
+
throw e;
|
|
2100
|
+
} finally {
|
|
2101
|
+
if (taggedParent) taggedParent.removeClass(classTag);
|
|
2102
|
+
}
|
|
2103
|
+
return !filter ? nodes : zepto.uniq($.map(nodes, function (n, i) {
|
|
2104
|
+
return filter.call(n, i, nodes, arg);
|
|
2105
|
+
}));
|
|
2106
|
+
});
|
|
2107
|
+
};
|
|
2108
|
+
zepto.matches = function (node, selector) {
|
|
2109
|
+
return process(selector, function (sel, filter, arg) {
|
|
2110
|
+
return (!sel || oldMatches(node, sel)) && (!filter || filter.call(node, null, arg) === node);
|
|
2111
|
+
});
|
|
2112
|
+
};
|
|
2113
|
+
})(Zepto);
|
|
2122
2114
|
|
|
2123
2115
|
// Copyright 2014 Globo.com Player authors. All rights reserved.
|
|
2124
2116
|
// Use of this source code is governed by a BSD-style
|
|
@@ -2675,8 +2667,8 @@
|
|
|
2675
2667
|
// Set viewport size
|
|
2676
2668
|
var getViewportSize = function getViewportSize() {
|
|
2677
2669
|
var viewportObject = {};
|
|
2678
|
-
viewportObject.width =
|
|
2679
|
-
viewportObject.height =
|
|
2670
|
+
viewportObject.width = Zepto(window).width();
|
|
2671
|
+
viewportObject.height = Zepto(window).height();
|
|
2680
2672
|
return viewportObject;
|
|
2681
2673
|
};
|
|
2682
2674
|
|
|
@@ -3039,7 +3031,7 @@
|
|
|
3039
3031
|
return _createClass$2(DomRecycler, null, [{
|
|
3040
3032
|
key: "configure",
|
|
3041
3033
|
value: function configure(options) {
|
|
3042
|
-
this.options =
|
|
3034
|
+
this.options = Zepto.extend(true, this.options, options);
|
|
3043
3035
|
}
|
|
3044
3036
|
}, {
|
|
3045
3037
|
key: "create",
|
|
@@ -3053,7 +3045,7 @@
|
|
|
3053
3045
|
key: "garbage",
|
|
3054
3046
|
value: function garbage(el) {
|
|
3055
3047
|
if (!this.options.recycleVideo || el.tagName.toUpperCase() !== 'VIDEO') return;
|
|
3056
|
-
|
|
3048
|
+
Zepto(el).children().remove();
|
|
3057
3049
|
Object.values(el.attributes).forEach(function (attr) {
|
|
3058
3050
|
return el.removeAttribute(attr.name);
|
|
3059
3051
|
});
|
|
@@ -3728,9 +3720,17 @@
|
|
|
3728
3720
|
* @param {boolean} state true if dvr enabled
|
|
3729
3721
|
*/
|
|
3730
3722
|
Events$1.PLAYBACK_DVR = 'playback:dvr';
|
|
3731
|
-
|
|
3723
|
+
/**
|
|
3724
|
+
* Fired when the playback requests the media control to be disabled.
|
|
3725
|
+
*
|
|
3726
|
+
* @event PLAYBACK_MEDIACONTROL_DISABLE
|
|
3727
|
+
*/
|
|
3732
3728
|
Events$1.PLAYBACK_MEDIACONTROL_DISABLE = 'playback:mediacontrol:disable';
|
|
3733
|
-
|
|
3729
|
+
/**
|
|
3730
|
+
* Fired when the playback requests the media control to be enabled.
|
|
3731
|
+
*
|
|
3732
|
+
* @event PLAYBACK_MEDIACONTROL_ENABLE
|
|
3733
|
+
*/
|
|
3734
3734
|
Events$1.PLAYBACK_MEDIACONTROL_ENABLE = 'playback:mediacontrol:enable';
|
|
3735
3735
|
/**
|
|
3736
3736
|
* Fired when the media for a playback ends.
|
|
@@ -3787,9 +3787,21 @@
|
|
|
3787
3787
|
* @param {String} name Playback name
|
|
3788
3788
|
*/
|
|
3789
3789
|
Events$1.PLAYBACK_ERROR = 'playback:error';
|
|
3790
|
-
|
|
3790
|
+
/**
|
|
3791
|
+
* Fired when the playback has stats data to report.
|
|
3792
|
+
*
|
|
3793
|
+
* @event PLAYBACK_STATS_ADD
|
|
3794
|
+
* @param {Object} stats Data
|
|
3795
|
+
* stats object, its shape depends on the playback implementation
|
|
3796
|
+
*/
|
|
3791
3797
|
Events$1.PLAYBACK_STATS_ADD = 'playback:stats:add';
|
|
3792
|
-
|
|
3798
|
+
/**
|
|
3799
|
+
* Fired when a media fragment/segment has finished loading.
|
|
3800
|
+
*
|
|
3801
|
+
* @event PLAYBACK_FRAGMENT_LOADED
|
|
3802
|
+
* @param {Object} data Data
|
|
3803
|
+
* fragment metadata, its shape depends on the playback implementation
|
|
3804
|
+
*/
|
|
3793
3805
|
Events$1.PLAYBACK_FRAGMENT_LOADED = 'playback:fragment:loaded';
|
|
3794
3806
|
/**
|
|
3795
3807
|
* Fired when a fragment has been appended into buffer
|
|
@@ -3799,7 +3811,13 @@
|
|
|
3799
3811
|
*
|
|
3800
3812
|
*/
|
|
3801
3813
|
Events$1.PLAYBACK_FRAGMENT_BUFFERED = 'playback:fragment:buffered';
|
|
3802
|
-
|
|
3814
|
+
/**
|
|
3815
|
+
* Fired when the playback switches to a different quality level.
|
|
3816
|
+
*
|
|
3817
|
+
* @event PLAYBACK_LEVEL_SWITCH
|
|
3818
|
+
* @param {Object} data Data
|
|
3819
|
+
* level switch metadata, its shape depends on the playback implementation
|
|
3820
|
+
*/
|
|
3803
3821
|
Events$1.PLAYBACK_LEVEL_SWITCH = 'playback:level:switch';
|
|
3804
3822
|
/**
|
|
3805
3823
|
* Fired when subtitle is available on playback for display
|
|
@@ -4339,7 +4357,7 @@
|
|
|
4339
4357
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
4340
4358
|
baseUrl: ''
|
|
4341
4359
|
};
|
|
4342
|
-
return
|
|
4360
|
+
return Zepto('<style class="clappr-style"></style>').html(tmpl(style.toString())(options));
|
|
4343
4361
|
}
|
|
4344
4362
|
};
|
|
4345
4363
|
var delegateEventSplitter = /^(\S+)\s*(.*)$/;
|
|
@@ -4492,9 +4510,9 @@
|
|
|
4492
4510
|
* the dom element wrapped by `$`
|
|
4493
4511
|
*
|
|
4494
4512
|
* @property $el
|
|
4495
|
-
* @type
|
|
4513
|
+
* @type {Object}
|
|
4496
4514
|
*/
|
|
4497
|
-
this.$el =
|
|
4515
|
+
this.$el = Zepto.zepto.isZ(element) ? element : Zepto(element);
|
|
4498
4516
|
/**
|
|
4499
4517
|
* the dom element itself
|
|
4500
4518
|
*
|
|
@@ -4555,10 +4573,10 @@
|
|
|
4555
4573
|
key: "_ensureElement",
|
|
4556
4574
|
value: function _ensureElement() {
|
|
4557
4575
|
if (!this.el) {
|
|
4558
|
-
var attrs =
|
|
4576
|
+
var attrs = Zepto.extend(true, {}, this.attributes);
|
|
4559
4577
|
if (this.id) attrs.id = this.id;
|
|
4560
4578
|
if (this.className) attrs["class"] = this.className;
|
|
4561
|
-
var $el =
|
|
4579
|
+
var $el = Zepto(DomRecycler.create(this.tagName)).attr(attrs);
|
|
4562
4580
|
this.setElement($el, false);
|
|
4563
4581
|
} else {
|
|
4564
4582
|
this.setElement(this.el, false);
|
|
@@ -4741,8 +4759,10 @@
|
|
|
4741
4759
|
var css_248z$5$1 = ".container[data-container] {\n position: absolute;\n background-color: black;\n height: 100%;\n width: 100%;\n max-width: 100%;\n}\n.container[data-container] .chromeless {\n cursor: default;\n}\n\n[data-player]:not(.nocursor) .container[data-container]:not(.chromeless).pointer-enabled {\n cursor: pointer;\n}";
|
|
4742
4760
|
|
|
4743
4761
|
/**
|
|
4744
|
-
* An abstraction to represent a container for a given playback
|
|
4745
|
-
*
|
|
4762
|
+
* An abstraction to represent a container for a given playback.
|
|
4763
|
+
* It wraps a playback instance, forwards its events, and exposes
|
|
4764
|
+
* playback controls (play, pause, seek, volume, fullscreen, etc.)
|
|
4765
|
+
* to the rest of the player.
|
|
4746
4766
|
* @class Container
|
|
4747
4767
|
* @constructor
|
|
4748
4768
|
* @extends UIObject
|
|
@@ -4764,7 +4784,7 @@
|
|
|
4764
4784
|
_this.volume = 100;
|
|
4765
4785
|
_this.playback = options.playback;
|
|
4766
4786
|
_this.playerError = playerError;
|
|
4767
|
-
_this.settings =
|
|
4787
|
+
_this.settings = Zepto.extend(true, {}, _this.playback.settings);
|
|
4768
4788
|
_this.isReady = false;
|
|
4769
4789
|
_this.mediaControlDisabled = false;
|
|
4770
4790
|
_this.plugins = [_this.playback];
|
|
@@ -5459,7 +5479,7 @@
|
|
|
5459
5479
|
key: "configure",
|
|
5460
5480
|
value: function configure(options, oldOptions) {
|
|
5461
5481
|
this.trigger(Events$1.CONTAINER_OPTIONS_WILL_CHANGE, oldOptions);
|
|
5462
|
-
this._options =
|
|
5482
|
+
this._options = Zepto.extend(true, this._options, options);
|
|
5463
5483
|
this.updateStyle();
|
|
5464
5484
|
this.playback.configure(this.options);
|
|
5465
5485
|
this.trigger(Events$1.CONTAINER_OPTIONS_CHANGE);
|
|
@@ -5858,7 +5878,7 @@
|
|
|
5858
5878
|
}, {
|
|
5859
5879
|
key: "configure",
|
|
5860
5880
|
value: function configure(options) {
|
|
5861
|
-
this._options =
|
|
5881
|
+
this._options = Zepto.extend(true, this._options, options);
|
|
5862
5882
|
}
|
|
5863
5883
|
|
|
5864
5884
|
/**
|
|
@@ -5983,7 +6003,7 @@
|
|
|
5983
6003
|
key: "createContainers",
|
|
5984
6004
|
value: function createContainers() {
|
|
5985
6005
|
var _this2 = this;
|
|
5986
|
-
return
|
|
6006
|
+
return Zepto.Deferred(function (promise) {
|
|
5987
6007
|
promise.resolve(_this2.options.sources.map(function (source) {
|
|
5988
6008
|
return _this2.createContainer(source);
|
|
5989
6009
|
}));
|
|
@@ -6021,7 +6041,7 @@
|
|
|
6021
6041
|
playback: playback
|
|
6022
6042
|
});
|
|
6023
6043
|
var container = new Container(options, this._i18n, this.playerError);
|
|
6024
|
-
var defer =
|
|
6044
|
+
var defer = Zepto.Deferred();
|
|
6025
6045
|
defer.promise(container);
|
|
6026
6046
|
this.addContainerPlugins(container);
|
|
6027
6047
|
this.listenToOnce(container, Events$1.CONTAINER_READY, function () {
|
|
@@ -6071,10 +6091,10 @@
|
|
|
6071
6091
|
_this._boundHandleWindowResize = function (o) {
|
|
6072
6092
|
return _this.handleWindowResize(o);
|
|
6073
6093
|
};
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
Browser.isMobile &&
|
|
6094
|
+
Zepto(document).bind('fullscreenchange', _this._boundFullscreenHandler);
|
|
6095
|
+
Zepto(document).bind('MSFullscreenChange', _this._boundFullscreenHandler);
|
|
6096
|
+
Zepto(document).bind('mozfullscreenchange', _this._boundFullscreenHandler);
|
|
6097
|
+
Browser.isMobile && Zepto(window).bind('resize', _this._boundHandleWindowResize);
|
|
6078
6098
|
return _this;
|
|
6079
6099
|
}
|
|
6080
6100
|
_inherits$2(Core, _UIObject);
|
|
@@ -6195,7 +6215,7 @@
|
|
|
6195
6215
|
}, {
|
|
6196
6216
|
key: "createContainers",
|
|
6197
6217
|
value: function createContainers(options) {
|
|
6198
|
-
this.defer =
|
|
6218
|
+
this.defer = Zepto.Deferred();
|
|
6199
6219
|
this.defer.promise(this);
|
|
6200
6220
|
this.containerFactory = new ContainerFactory(options, options.loader, this.i18n, this.playerError);
|
|
6201
6221
|
this.prepareContainers();
|
|
@@ -6226,8 +6246,8 @@
|
|
|
6226
6246
|
height: this.options.height
|
|
6227
6247
|
};
|
|
6228
6248
|
this.currentSize = {
|
|
6229
|
-
width:
|
|
6230
|
-
height:
|
|
6249
|
+
width: Zepto(window).width(),
|
|
6250
|
+
height: Zepto(window).height()
|
|
6231
6251
|
};
|
|
6232
6252
|
}
|
|
6233
6253
|
}
|
|
@@ -6237,8 +6257,8 @@
|
|
|
6237
6257
|
this.$el.removeClass('fullscreen');
|
|
6238
6258
|
this.currentSize = this.previousSize;
|
|
6239
6259
|
this.previousSize = {
|
|
6240
|
-
width:
|
|
6241
|
-
height:
|
|
6260
|
+
width: Zepto(window).width(),
|
|
6261
|
+
height: Zepto(window).height()
|
|
6242
6262
|
};
|
|
6243
6263
|
this.resize(this.currentSize);
|
|
6244
6264
|
}
|
|
@@ -6299,7 +6319,7 @@
|
|
|
6299
6319
|
key: "resolveOnContainersReady",
|
|
6300
6320
|
value: function resolveOnContainersReady(containers) {
|
|
6301
6321
|
var _this4 = this;
|
|
6302
|
-
|
|
6322
|
+
Zepto.when.apply(Zepto, containers).done(function () {
|
|
6303
6323
|
_this4.defer.resolve(_this4);
|
|
6304
6324
|
_this4.ready = true;
|
|
6305
6325
|
_this4.trigger(Events$1.CORE_READY);
|
|
@@ -6331,7 +6351,7 @@
|
|
|
6331
6351
|
this.containers.forEach(function (container) {
|
|
6332
6352
|
return container.destroy();
|
|
6333
6353
|
});
|
|
6334
|
-
this.containerFactory.options =
|
|
6354
|
+
this.containerFactory.options = Zepto.extend(true, this.options, {
|
|
6335
6355
|
sources: sources
|
|
6336
6356
|
});
|
|
6337
6357
|
this.prepareContainers();
|
|
@@ -6347,10 +6367,10 @@
|
|
|
6347
6367
|
return plugin.destroy();
|
|
6348
6368
|
});
|
|
6349
6369
|
this.$el.remove();
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
Browser.isMobile &&
|
|
6370
|
+
Zepto(document).unbind('fullscreenchange', this._boundFullscreenHandler);
|
|
6371
|
+
Zepto(document).unbind('MSFullscreenChange', this._boundFullscreenHandler);
|
|
6372
|
+
Zepto(document).unbind('mozfullscreenchange', this._boundFullscreenHandler);
|
|
6373
|
+
Browser.isMobile && Zepto(window).unbind('resize', this._boundHandleWindowResize);
|
|
6354
6374
|
this.stopListening();
|
|
6355
6375
|
this.undelegateEvents();
|
|
6356
6376
|
}
|
|
@@ -6508,9 +6528,9 @@
|
|
|
6508
6528
|
key: "configure",
|
|
6509
6529
|
value: function configure(options) {
|
|
6510
6530
|
var _this7 = this;
|
|
6511
|
-
var oldOptions =
|
|
6531
|
+
var oldOptions = Zepto.extend(true, {}, this._options);
|
|
6512
6532
|
this.trigger(Events$1.CORE_OPTIONS_WILL_CHANGE, oldOptions);
|
|
6513
|
-
this._options =
|
|
6533
|
+
this._options = Zepto.extend(true, this._options, options);
|
|
6514
6534
|
this.configureDomRecycler();
|
|
6515
6535
|
var sources = options.source || options.sources;
|
|
6516
6536
|
sources && this.load(sources, options.mimeType || this.options.mimeType);
|
|
@@ -6702,7 +6722,7 @@
|
|
|
6702
6722
|
plugins: {},
|
|
6703
6723
|
playbacks: []
|
|
6704
6724
|
};
|
|
6705
|
-
var currentVersion = "0.14.
|
|
6725
|
+
var currentVersion = "0.14.4";
|
|
6706
6726
|
return /*#__PURE__*/function () {
|
|
6707
6727
|
/**
|
|
6708
6728
|
* builds the loader
|
|
@@ -7086,7 +7106,7 @@
|
|
|
7086
7106
|
includeResetStyle: true,
|
|
7087
7107
|
playback: playbackDefaultOptions
|
|
7088
7108
|
};
|
|
7089
|
-
_this._options =
|
|
7109
|
+
_this._options = Zepto.extend(true, defaultOptions, options);
|
|
7090
7110
|
_this.options.sources = _this._normalizeSources(options);
|
|
7091
7111
|
if (!_this.options.chromeless) {
|
|
7092
7112
|
// "allowUserInteraction" cannot be false if not in chromeless mode.
|
|
@@ -7841,7 +7861,7 @@
|
|
|
7841
7861
|
posterUrl = _this.options.poster.url;
|
|
7842
7862
|
}
|
|
7843
7863
|
}
|
|
7844
|
-
|
|
7864
|
+
Zepto.extend(true, _this.el, {
|
|
7845
7865
|
muted: _this.options.mute,
|
|
7846
7866
|
defaultMuted: _this.options.mute,
|
|
7847
7867
|
loop: _this.options.loop,
|
|
@@ -7880,7 +7900,7 @@
|
|
|
7880
7900
|
key: "supportedVersion",
|
|
7881
7901
|
get: function get() {
|
|
7882
7902
|
return {
|
|
7883
|
-
min: "0.14.
|
|
7903
|
+
min: "0.14.4"
|
|
7884
7904
|
};
|
|
7885
7905
|
}
|
|
7886
7906
|
}, {
|
|
@@ -8684,7 +8704,7 @@
|
|
|
8684
8704
|
key: "supportedVersion",
|
|
8685
8705
|
get: function get() {
|
|
8686
8706
|
return {
|
|
8687
|
-
min: "0.14.
|
|
8707
|
+
min: "0.14.4"
|
|
8688
8708
|
};
|
|
8689
8709
|
}
|
|
8690
8710
|
}, {
|
|
@@ -8739,7 +8759,7 @@
|
|
|
8739
8759
|
key: "supportedVersion",
|
|
8740
8760
|
get: function get() {
|
|
8741
8761
|
return {
|
|
8742
|
-
min: "0.14.
|
|
8762
|
+
min: "0.14.4"
|
|
8743
8763
|
};
|
|
8744
8764
|
}
|
|
8745
8765
|
}, {
|
|
@@ -8819,7 +8839,7 @@
|
|
|
8819
8839
|
key: "supportedVersion",
|
|
8820
8840
|
get: function get() {
|
|
8821
8841
|
return {
|
|
8822
|
-
min: "0.14.
|
|
8842
|
+
min: "0.14.4"
|
|
8823
8843
|
};
|
|
8824
8844
|
}
|
|
8825
8845
|
}, {
|
|
@@ -8951,7 +8971,7 @@
|
|
|
8951
8971
|
key: "supportedVersion",
|
|
8952
8972
|
get: function get() {
|
|
8953
8973
|
return {
|
|
8954
|
-
min: "0.14.
|
|
8974
|
+
min: "0.14.4"
|
|
8955
8975
|
};
|
|
8956
8976
|
}
|
|
8957
8977
|
}, {
|
|
@@ -9062,7 +9082,7 @@
|
|
|
9062
9082
|
'default_error_message': '在尝试加载视频时出现了问题。'
|
|
9063
9083
|
}
|
|
9064
9084
|
};
|
|
9065
|
-
this._messages =
|
|
9085
|
+
this._messages = Zepto.extend(true, defaultMessages, this.core.options.strings || {});
|
|
9066
9086
|
this._messages['de-DE'] = this._messages.de;
|
|
9067
9087
|
this._messages['pt-BR'] = this._messages.pt;
|
|
9068
9088
|
this._messages['en-US'] = this._messages.en;
|
|
@@ -9092,7 +9112,7 @@
|
|
|
9092
9112
|
key: "supportedVersion",
|
|
9093
9113
|
get: function get() {
|
|
9094
9114
|
return {
|
|
9095
|
-
min: "0.14.
|
|
9115
|
+
min: "0.14.4"
|
|
9096
9116
|
};
|
|
9097
9117
|
}
|
|
9098
9118
|
}, {
|
|
@@ -9121,7 +9141,7 @@
|
|
|
9121
9141
|
@type {string}
|
|
9122
9142
|
@default
|
|
9123
9143
|
*/
|
|
9124
|
-
var version$2 = "0.14.
|
|
9144
|
+
var version$2 = "0.14.4";
|
|
9125
9145
|
|
|
9126
9146
|
// Built-in Plugins/Playbacks
|
|
9127
9147
|
|
|
@@ -9154,7 +9174,7 @@
|
|
|
9154
9174
|
Styler: Styler,
|
|
9155
9175
|
version: version$2,
|
|
9156
9176
|
template: tmpl,
|
|
9157
|
-
$:
|
|
9177
|
+
$: Zepto
|
|
9158
9178
|
};
|
|
9159
9179
|
|
|
9160
9180
|
function _assertThisInitialized$1(e) {
|
|
@@ -9270,7 +9290,7 @@
|
|
|
9270
9290
|
key: "supportedVersion",
|
|
9271
9291
|
get: function get() {
|
|
9272
9292
|
return {
|
|
9273
|
-
min: "0.14.
|
|
9293
|
+
min: "0.14.4"
|
|
9274
9294
|
};
|
|
9275
9295
|
}
|
|
9276
9296
|
}, {
|
|
@@ -9333,7 +9353,7 @@
|
|
|
9333
9353
|
key: "supportedVersion",
|
|
9334
9354
|
get: function get() {
|
|
9335
9355
|
return {
|
|
9336
|
-
min: "0.14.
|
|
9356
|
+
min: "0.14.4"
|
|
9337
9357
|
};
|
|
9338
9358
|
}
|
|
9339
9359
|
}, {
|
|
@@ -9498,7 +9518,7 @@
|
|
|
9498
9518
|
key: "supportedVersion",
|
|
9499
9519
|
get: function get() {
|
|
9500
9520
|
return {
|
|
9501
|
-
min: "0.14.
|
|
9521
|
+
min: "0.14.4"
|
|
9502
9522
|
};
|
|
9503
9523
|
}
|
|
9504
9524
|
}, {
|
|
@@ -9629,7 +9649,7 @@
|
|
|
9629
9649
|
key: "supportedVersion",
|
|
9630
9650
|
get: function get() {
|
|
9631
9651
|
return {
|
|
9632
|
-
min: "0.14.
|
|
9652
|
+
min: "0.14.4"
|
|
9633
9653
|
};
|
|
9634
9654
|
}
|
|
9635
9655
|
}, {
|
|
@@ -9679,7 +9699,7 @@
|
|
|
9679
9699
|
key: "supportedVersion",
|
|
9680
9700
|
get: function get() {
|
|
9681
9701
|
return {
|
|
9682
|
-
min: "0.14.
|
|
9702
|
+
min: "0.14.4"
|
|
9683
9703
|
};
|
|
9684
9704
|
}
|
|
9685
9705
|
}, {
|
|
@@ -9779,7 +9799,7 @@
|
|
|
9779
9799
|
}(UICorePlugin);
|
|
9780
9800
|
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>";
|
|
9781
9801
|
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>";
|
|
9782
|
-
var oldIcon =
|
|
9802
|
+
var oldIcon = Zepto('link[rel="shortcut icon"]');
|
|
9783
9803
|
var Favicon$1 = /*#__PURE__*/function (_CorePlugin) {
|
|
9784
9804
|
function Favicon(core) {
|
|
9785
9805
|
var _this;
|
|
@@ -9799,7 +9819,7 @@
|
|
|
9799
9819
|
key: "supportedVersion",
|
|
9800
9820
|
get: function get() {
|
|
9801
9821
|
return {
|
|
9802
|
-
min: "0.14.
|
|
9822
|
+
min: "0.14.4"
|
|
9803
9823
|
};
|
|
9804
9824
|
}
|
|
9805
9825
|
}, {
|
|
@@ -9854,15 +9874,15 @@
|
|
|
9854
9874
|
}, {
|
|
9855
9875
|
key: "createIcon",
|
|
9856
9876
|
value: function createIcon(svg) {
|
|
9857
|
-
var canvas =
|
|
9877
|
+
var canvas = Zepto('<canvas/>');
|
|
9858
9878
|
canvas[0].width = 16;
|
|
9859
9879
|
canvas[0].height = 16;
|
|
9860
9880
|
var ctx = canvas[0].getContext('2d');
|
|
9861
9881
|
ctx.fillStyle = '#000';
|
|
9862
|
-
var d =
|
|
9882
|
+
var d = Zepto(svg).find('path').attr('d');
|
|
9863
9883
|
var path = new Path2D(d);
|
|
9864
9884
|
ctx.fill(path);
|
|
9865
|
-
var icon =
|
|
9885
|
+
var icon = Zepto('<link rel="shortcut icon" type="image/png"/>');
|
|
9866
9886
|
icon.attr('href', canvas[0].toDataURL('image/png'));
|
|
9867
9887
|
return icon;
|
|
9868
9888
|
}
|
|
@@ -9885,15 +9905,15 @@
|
|
|
9885
9905
|
}, {
|
|
9886
9906
|
key: "resetIcon",
|
|
9887
9907
|
value: function resetIcon() {
|
|
9888
|
-
|
|
9889
|
-
|
|
9908
|
+
Zepto('link[rel="shortcut icon"]').remove();
|
|
9909
|
+
Zepto('head').append(this.oldIcon);
|
|
9890
9910
|
}
|
|
9891
9911
|
}, {
|
|
9892
9912
|
key: "changeIcon",
|
|
9893
9913
|
value: function changeIcon(icon) {
|
|
9894
9914
|
if (icon) {
|
|
9895
|
-
|
|
9896
|
-
|
|
9915
|
+
Zepto('link[rel="shortcut icon"]').remove();
|
|
9916
|
+
Zepto('head').append(icon);
|
|
9897
9917
|
}
|
|
9898
9918
|
}
|
|
9899
9919
|
}]);
|
|
@@ -9922,7 +9942,7 @@
|
|
|
9922
9942
|
key: "supportedVersion",
|
|
9923
9943
|
get: function get() {
|
|
9924
9944
|
return {
|
|
9925
|
-
min: "0.14.
|
|
9945
|
+
min: "0.14.4"
|
|
9926
9946
|
};
|
|
9927
9947
|
}
|
|
9928
9948
|
}, {
|
|
@@ -10393,8 +10413,8 @@
|
|
|
10393
10413
|
_this.kibo = new Kibo(_this.options.focusElement);
|
|
10394
10414
|
_this.bindKeyEvents();
|
|
10395
10415
|
if (_this.container) {
|
|
10396
|
-
if (
|
|
10397
|
-
_this.settings =
|
|
10416
|
+
if (!Zepto.isEmptyObject(_this.container.settings)) {
|
|
10417
|
+
_this.settings = Zepto.extend({}, _this.container.settings);
|
|
10398
10418
|
}
|
|
10399
10419
|
} else {
|
|
10400
10420
|
_this.settings = {};
|
|
@@ -10409,8 +10429,8 @@
|
|
|
10409
10429
|
_this.updateDragHandler = function (event) {
|
|
10410
10430
|
return _this.updateDrag(event);
|
|
10411
10431
|
};
|
|
10412
|
-
|
|
10413
|
-
|
|
10432
|
+
Zepto(document).bind('mouseup', _this.stopDragHandler);
|
|
10433
|
+
Zepto(document).bind('mousemove', _this.updateDragHandler);
|
|
10414
10434
|
return _this;
|
|
10415
10435
|
}
|
|
10416
10436
|
_inherits$1(MediaControl, _UICorePlugin);
|
|
@@ -10423,7 +10443,7 @@
|
|
|
10423
10443
|
key: "supportedVersion",
|
|
10424
10444
|
get: function get() {
|
|
10425
10445
|
return {
|
|
10426
|
-
min: "0.14.
|
|
10446
|
+
min: "0.14.4"
|
|
10427
10447
|
};
|
|
10428
10448
|
}
|
|
10429
10449
|
}, {
|
|
@@ -10988,7 +11008,7 @@
|
|
|
10988
11008
|
}, {
|
|
10989
11009
|
key: "getSettings",
|
|
10990
11010
|
value: function getSettings() {
|
|
10991
|
-
return
|
|
11011
|
+
return Zepto.extend(true, {}, this.container && this.container.settings);
|
|
10992
11012
|
}
|
|
10993
11013
|
}, {
|
|
10994
11014
|
key: "highDefinitionUpdate",
|
|
@@ -11138,13 +11158,13 @@
|
|
|
11138
11158
|
}, {
|
|
11139
11159
|
key: "applyButtonStyle",
|
|
11140
11160
|
value: function applyButtonStyle(element) {
|
|
11141
|
-
this.buttonsColor && element &&
|
|
11161
|
+
this.buttonsColor && element && Zepto(element).find('svg path').css('fill', this.buttonsColor);
|
|
11142
11162
|
}
|
|
11143
11163
|
}, {
|
|
11144
11164
|
key: "destroy",
|
|
11145
11165
|
value: function destroy() {
|
|
11146
|
-
|
|
11147
|
-
|
|
11166
|
+
Zepto(document).unbind('mouseup', this.stopDragHandler);
|
|
11167
|
+
Zepto(document).unbind('mousemove', this.updateDragHandler);
|
|
11148
11168
|
this.unbindKeyEvents();
|
|
11149
11169
|
this.stopListening();
|
|
11150
11170
|
_superPropGet$1(MediaControl, "destroy", this, 3)([]);
|
|
@@ -11253,7 +11273,7 @@
|
|
|
11253
11273
|
key: "supportedVersion",
|
|
11254
11274
|
get: function get() {
|
|
11255
11275
|
return {
|
|
11256
|
-
min: "0.14.
|
|
11276
|
+
min: "0.14.4"
|
|
11257
11277
|
};
|
|
11258
11278
|
}
|
|
11259
11279
|
}, {
|
|
@@ -11472,7 +11492,7 @@
|
|
|
11472
11492
|
key: "supportedVersion",
|
|
11473
11493
|
get: function get() {
|
|
11474
11494
|
return {
|
|
11475
|
-
min: "0.14.
|
|
11495
|
+
min: "0.14.4"
|
|
11476
11496
|
};
|
|
11477
11497
|
}
|
|
11478
11498
|
}, {
|
|
@@ -11676,7 +11696,7 @@
|
|
|
11676
11696
|
key: "supportedVersion",
|
|
11677
11697
|
get: function get() {
|
|
11678
11698
|
return {
|
|
11679
|
-
min: "0.14.
|
|
11699
|
+
min: "0.14.4"
|
|
11680
11700
|
};
|
|
11681
11701
|
}
|
|
11682
11702
|
}, {
|
|
@@ -11758,7 +11778,7 @@
|
|
|
11758
11778
|
key: "supportedVersion",
|
|
11759
11779
|
get: function get() {
|
|
11760
11780
|
return {
|
|
11761
|
-
min: "0.14.
|
|
11781
|
+
min: "0.14.4"
|
|
11762
11782
|
};
|
|
11763
11783
|
}
|
|
11764
11784
|
}, {
|
|
@@ -11844,7 +11864,7 @@
|
|
|
11844
11864
|
}, {
|
|
11845
11865
|
key: "onStatsAdd",
|
|
11846
11866
|
value: function onStatsAdd(metric) {
|
|
11847
|
-
|
|
11867
|
+
Zepto.extend(this.externalMetrics, metric);
|
|
11848
11868
|
}
|
|
11849
11869
|
}, {
|
|
11850
11870
|
key: "getStats",
|
|
@@ -11855,7 +11875,7 @@
|
|
|
11855
11875
|
rebufferingTime: this.isRebuffering() ? this.rebufferingTime + this.getRebufferingTime() : this.rebufferingTime,
|
|
11856
11876
|
watchingTime: this.isRebuffering() ? this.getWatchingTime() - this.getRebufferingTime() : this.getWatchingTime()
|
|
11857
11877
|
};
|
|
11858
|
-
|
|
11878
|
+
Zepto.extend(metrics, this.externalMetrics);
|
|
11859
11879
|
return metrics;
|
|
11860
11880
|
}
|
|
11861
11881
|
}, {
|
|
@@ -11885,7 +11905,7 @@
|
|
|
11885
11905
|
key: "supportedVersion",
|
|
11886
11906
|
get: function get() {
|
|
11887
11907
|
return {
|
|
11888
|
-
min: "0.14.
|
|
11908
|
+
min: "0.14.4"
|
|
11889
11909
|
};
|
|
11890
11910
|
}
|
|
11891
11911
|
}, {
|
|
@@ -11959,7 +11979,7 @@
|
|
|
11959
11979
|
WaterMark: WaterMarkPlugin
|
|
11960
11980
|
};
|
|
11961
11981
|
|
|
11962
|
-
var version$1 = "0.12.
|
|
11982
|
+
var version$1 = "0.12.4";
|
|
11963
11983
|
for (var _i = 0, _Object$values = Object.values(Plugins); _i < _Object$values.length; _i++) {
|
|
11964
11984
|
var plugin = _Object$values[_i];
|
|
11965
11985
|
Loader.registerPlugin(plugin);
|
|
@@ -48717,7 +48737,7 @@ Schedule: ${scheduleItems.map(seg => segmentToString(seg))} pos: ${this.timeline
|
|
|
48717
48737
|
key: "supportedVersion",
|
|
48718
48738
|
get: function get() {
|
|
48719
48739
|
return {
|
|
48720
|
-
min: "0.14.
|
|
48740
|
+
min: "0.14.4"
|
|
48721
48741
|
};
|
|
48722
48742
|
}
|
|
48723
48743
|
}, {
|