mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update web components
This commit is contained in:
parent
909402537a
commit
fcdd2e4f4b
114 changed files with 1611 additions and 1238 deletions
153
dashboard-ui/bower_components/hammerjs/hammer.js
vendored
153
dashboard-ui/bower_components/hammerjs/hammer.js
vendored
|
@ -1,12 +1,12 @@
|
|||
/*! Hammer.JS - v2.0.4 - 2014-09-28
|
||||
/*! Hammer.JS - v2.0.4 - 2015-12-22
|
||||
* http://hammerjs.github.io/
|
||||
*
|
||||
* Copyright (c) 2014 Jorik Tangelder;
|
||||
* Licensed under the MIT license */
|
||||
* Copyright (c) 2015 Jorik Tangelder;
|
||||
* Licensed under the license */
|
||||
(function(window, document, exportName, undefined) {
|
||||
'use strict';
|
||||
|
||||
var VENDOR_PREFIXES = ['', 'webkit', 'moz', 'MS', 'ms', 'o'];
|
||||
var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];
|
||||
var TEST_ELEMENT = document.createElement('div');
|
||||
|
||||
var TYPE_FUNCTION = 'function';
|
||||
|
@ -320,8 +320,8 @@ function uniqueId() {
|
|||
* @returns {DocumentView|Window}
|
||||
*/
|
||||
function getWindowForElement(element) {
|
||||
var doc = element.ownerDocument;
|
||||
return (doc.defaultView || doc.parentWindow);
|
||||
var doc = element.ownerDocument || element;
|
||||
return (doc.defaultView || doc.parentWindow || window);
|
||||
}
|
||||
|
||||
var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;
|
||||
|
@ -500,9 +500,17 @@ function computeInputData(manager, input) {
|
|||
computeDeltaXY(session, input);
|
||||
input.offsetDirection = getDirection(input.deltaX, input.deltaY);
|
||||
|
||||
var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);
|
||||
input.overallVelocityX = overallVelocity.x;
|
||||
input.overallVelocityY = overallVelocity.y;
|
||||
input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y;
|
||||
|
||||
input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;
|
||||
input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;
|
||||
|
||||
input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length >
|
||||
session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers);
|
||||
|
||||
computeIntervalInputData(session, input);
|
||||
|
||||
// find the correct target
|
||||
|
@ -546,8 +554,8 @@ function computeIntervalInputData(session, input) {
|
|||
velocity, velocityX, velocityY, direction;
|
||||
|
||||
if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {
|
||||
var deltaX = last.deltaX - input.deltaX;
|
||||
var deltaY = last.deltaY - input.deltaY;
|
||||
var deltaX = input.deltaX - last.deltaX;
|
||||
var deltaY = input.deltaY - last.deltaY;
|
||||
|
||||
var v = getVelocity(deltaTime, deltaX, deltaY);
|
||||
velocityX = v.x;
|
||||
|
@ -652,9 +660,9 @@ function getDirection(x, y) {
|
|||
}
|
||||
|
||||
if (abs(x) >= abs(y)) {
|
||||
return x > 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
|
||||
return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
|
||||
}
|
||||
return y > 0 ? DIRECTION_UP : DIRECTION_DOWN;
|
||||
return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -697,7 +705,7 @@ function getAngle(p1, p2, props) {
|
|||
* @return {Number} rotation
|
||||
*/
|
||||
function getRotation(start, end) {
|
||||
return getAngle(end[1], end[0], PROPS_CLIENT_XY) - getAngle(start[1], start[0], PROPS_CLIENT_XY);
|
||||
return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -790,7 +798,7 @@ var POINTER_ELEMENT_EVENTS = 'pointerdown';
|
|||
var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';
|
||||
|
||||
// IE10 has prefixed support, and case-sensitive
|
||||
if (window.MSPointerEvent) {
|
||||
if (window.MSPointerEvent && !window.PointerEvent) {
|
||||
POINTER_ELEMENT_EVENTS = 'MSPointerDown';
|
||||
POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';
|
||||
}
|
||||
|
@ -1114,7 +1122,7 @@ TouchAction.prototype = {
|
|||
value = this.compute();
|
||||
}
|
||||
|
||||
if (NATIVE_TOUCH_ACTION) {
|
||||
if (NATIVE_TOUCH_ACTION && this.manager.element.style) {
|
||||
this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;
|
||||
}
|
||||
this.actions = value.toLowerCase().trim();
|
||||
|
@ -1165,6 +1173,23 @@ TouchAction.prototype = {
|
|||
var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
|
||||
var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
|
||||
|
||||
if (hasNone) {
|
||||
//do not prevent defaults if this is a tap gesture
|
||||
|
||||
var isTapPointer = input.pointers.length === 1;
|
||||
var isTapMovement = input.distance < 2;
|
||||
var isTapTouchTime = input.deltaTime < 250;
|
||||
|
||||
if (isTapPointer && isTapMovement && isTapTouchTime) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasPanX && hasPanY) {
|
||||
// `pan-x pan-y` means browser handles all scrolling/panning, do not prevent
|
||||
return;
|
||||
}
|
||||
|
||||
if (hasNone ||
|
||||
(hasPanY && direction & DIRECTION_HORIZONTAL) ||
|
||||
(hasPanX && direction & DIRECTION_VERTICAL)) {
|
||||
|
@ -1196,9 +1221,12 @@ function cleanTouchActions(actions) {
|
|||
var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
|
||||
var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
|
||||
|
||||
// pan-x and pan-y can be combined
|
||||
// if both pan-x and pan-y are set (different recognizers
|
||||
// for different directions, e.g. horizontal pan but vertical swipe?)
|
||||
// we need none (as otherwise with pan-x pan-y combined none of these
|
||||
// recognizers will work, since the browser would handle all panning
|
||||
if (hasPanX && hasPanY) {
|
||||
return TOUCH_ACTION_PAN_X + ' ' + TOUCH_ACTION_PAN_Y;
|
||||
return TOUCH_ACTION_NONE;
|
||||
}
|
||||
|
||||
// pan-x OR pan-y
|
||||
|
@ -1256,10 +1284,13 @@ var STATE_FAILED = 32;
|
|||
* @param {Object} options
|
||||
*/
|
||||
function Recognizer(options) {
|
||||
// make sure, options are copied over to a new object to prevent leaking it outside
|
||||
options = extend({}, options || {});
|
||||
|
||||
this.id = uniqueId();
|
||||
|
||||
this.manager = null;
|
||||
this.options = merge(options || {}, this.defaults);
|
||||
this.options = merge(options, this.defaults);
|
||||
|
||||
// default is enable true
|
||||
this.options.enable = ifUndefined(this.options.enable, true);
|
||||
|
@ -1387,20 +1418,24 @@ Recognizer.prototype = {
|
|||
var self = this;
|
||||
var state = this.state;
|
||||
|
||||
function emit(withState) {
|
||||
self.manager.emit(self.options.event + (withState ? stateStr(state) : ''), input);
|
||||
function emit(event) {
|
||||
self.manager.emit(event, input);
|
||||
}
|
||||
|
||||
// 'panstart' and 'panmove'
|
||||
if (state < STATE_ENDED) {
|
||||
emit(true);
|
||||
emit(self.options.event + stateStr(state));
|
||||
}
|
||||
|
||||
emit(); // simple 'eventName' events
|
||||
emit(self.options.event); // simple 'eventName' events
|
||||
|
||||
if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...)
|
||||
emit(input.additionalEvent);
|
||||
}
|
||||
|
||||
// panend and pancancel
|
||||
if (state >= STATE_ENDED) {
|
||||
emit(true);
|
||||
emit(self.options.event + stateStr(state));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1665,14 +1700,15 @@ inherit(PanRecognizer, AttrRecognizer, {
|
|||
},
|
||||
|
||||
emit: function(input) {
|
||||
|
||||
this.pX = input.deltaX;
|
||||
this.pY = input.deltaY;
|
||||
|
||||
var direction = directionStr(input.direction);
|
||||
if (direction) {
|
||||
this.manager.emit(this.options.event + direction, input);
|
||||
}
|
||||
|
||||
if (direction) {
|
||||
input.additionalEvent = this.options.event + direction;
|
||||
}
|
||||
this._super.emit.call(this, input);
|
||||
}
|
||||
});
|
||||
|
@ -1708,11 +1744,11 @@ inherit(PinchRecognizer, AttrRecognizer, {
|
|||
},
|
||||
|
||||
emit: function(input) {
|
||||
this._super.emit.call(this, input);
|
||||
if (input.scale !== 1) {
|
||||
var inOut = input.scale < 1 ? 'in' : 'out';
|
||||
this.manager.emit(this.options.event + inOut, input);
|
||||
input.additionalEvent = this.options.event + inOut;
|
||||
}
|
||||
this._super.emit.call(this, input);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1737,8 +1773,8 @@ inherit(PressRecognizer, Recognizer, {
|
|||
defaults: {
|
||||
event: 'press',
|
||||
pointers: 1,
|
||||
time: 500, // minimal time of the pointer to be pressed
|
||||
threshold: 5 // a minimal movement is ok, but keep it low
|
||||
time: 251, // minimal time of the pointer to be pressed
|
||||
threshold: 9 // a minimal movement is ok, but keep it low
|
||||
},
|
||||
|
||||
getTouchAction: function() {
|
||||
|
@ -1836,7 +1872,7 @@ inherit(SwipeRecognizer, AttrRecognizer, {
|
|||
defaults: {
|
||||
event: 'swipe',
|
||||
threshold: 10,
|
||||
velocity: 0.65,
|
||||
velocity: 0.3,
|
||||
direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
|
||||
pointers: 1
|
||||
},
|
||||
|
@ -1850,21 +1886,22 @@ inherit(SwipeRecognizer, AttrRecognizer, {
|
|||
var velocity;
|
||||
|
||||
if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {
|
||||
velocity = input.velocity;
|
||||
velocity = input.overallVelocity;
|
||||
} else if (direction & DIRECTION_HORIZONTAL) {
|
||||
velocity = input.velocityX;
|
||||
velocity = input.overallVelocityX;
|
||||
} else if (direction & DIRECTION_VERTICAL) {
|
||||
velocity = input.velocityY;
|
||||
velocity = input.overallVelocityY;
|
||||
}
|
||||
|
||||
return this._super.attrTest.call(this, input) &&
|
||||
direction & input.direction &&
|
||||
direction & input.offsetDirection &&
|
||||
input.distance > this.options.threshold &&
|
||||
input.maxPointers == this.options.pointers &&
|
||||
abs(velocity) > this.options.velocity && input.eventType & INPUT_END;
|
||||
},
|
||||
|
||||
emit: function(input) {
|
||||
var direction = directionStr(input.direction);
|
||||
var direction = directionStr(input.offsetDirection);
|
||||
if (direction) {
|
||||
this.manager.emit(this.options.event + direction, input);
|
||||
}
|
||||
|
@ -1907,7 +1944,7 @@ inherit(TapRecognizer, Recognizer, {
|
|||
taps: 1,
|
||||
interval: 300, // max time between the multi-tap taps
|
||||
time: 250, // max time of the pointer to be down (like finger on the screen)
|
||||
threshold: 2, // a minimal movement is ok, but keep it low
|
||||
threshold: 9, // a minimal movement is ok, but keep it low
|
||||
posThreshold: 10 // a multi-tap can be a bit off the initial position
|
||||
},
|
||||
|
||||
|
@ -1981,7 +2018,7 @@ inherit(TapRecognizer, Recognizer, {
|
|||
},
|
||||
|
||||
emit: function() {
|
||||
if (this.state == STATE_RECOGNIZED ) {
|
||||
if (this.state == STATE_RECOGNIZED) {
|
||||
this._input.tapCount = this.count;
|
||||
this.manager.emit(this.options.event, this._input);
|
||||
}
|
||||
|
@ -1989,7 +2026,7 @@ inherit(TapRecognizer, Recognizer, {
|
|||
});
|
||||
|
||||
/**
|
||||
* Simple way to create an manager with a default set of recognizers.
|
||||
* Simple way to create a manager with a default set of recognizers.
|
||||
* @param {HTMLElement} element
|
||||
* @param {Object} [options]
|
||||
* @constructor
|
||||
|
@ -2055,12 +2092,12 @@ Hammer.defaults = {
|
|||
*/
|
||||
preset: [
|
||||
// RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]
|
||||
[RotateRecognizer, { enable: false }],
|
||||
[PinchRecognizer, { enable: false }, ['rotate']],
|
||||
[SwipeRecognizer,{ direction: DIRECTION_HORIZONTAL }],
|
||||
[PanRecognizer, { direction: DIRECTION_HORIZONTAL }, ['swipe']],
|
||||
[RotateRecognizer, {enable: false}],
|
||||
[PinchRecognizer, {enable: false}, ['rotate']],
|
||||
[SwipeRecognizer, {direction: DIRECTION_HORIZONTAL}],
|
||||
[PanRecognizer, {direction: DIRECTION_HORIZONTAL}, ['swipe']],
|
||||
[TapRecognizer],
|
||||
[TapRecognizer, { event: 'doubletap', taps: 2 }, ['tap']],
|
||||
[TapRecognizer, {event: 'doubletap', taps: 2}, ['tap']],
|
||||
[PressRecognizer]
|
||||
],
|
||||
|
||||
|
@ -2127,9 +2164,9 @@ var FORCED_STOP = 2;
|
|||
* @constructor
|
||||
*/
|
||||
function Manager(element, options) {
|
||||
options = options || {};
|
||||
var newOptions = options ? extend({}, options) : {};
|
||||
this.options = merge(newOptions, Hammer.defaults);
|
||||
|
||||
this.options = merge(options, Hammer.defaults);
|
||||
this.options.inputTarget = this.options.inputTarget || element;
|
||||
|
||||
this.handlers = {};
|
||||
|
@ -2142,7 +2179,7 @@ function Manager(element, options) {
|
|||
|
||||
toggleCssProps(this, true);
|
||||
|
||||
each(options.recognizers, function(item) {
|
||||
each(this.options.recognizers, function(item) {
|
||||
var recognizer = this.add(new (item[0])(item[1]));
|
||||
item[2] && recognizer.recognizeWith(item[2]);
|
||||
item[3] && recognizer.requireFailure(item[3]);
|
||||
|
@ -2290,11 +2327,19 @@ Manager.prototype = {
|
|||
return this;
|
||||
}
|
||||
|
||||
var recognizers = this.recognizers;
|
||||
recognizer = this.get(recognizer);
|
||||
recognizers.splice(inArray(recognizers, recognizer), 1);
|
||||
|
||||
this.touchAction.update();
|
||||
// let's make sure this recognizer exists
|
||||
if (recognizer) {
|
||||
var recognizers = this.recognizers;
|
||||
var index = inArray(recognizers, recognizer);
|
||||
|
||||
if (index !== -1) {
|
||||
recognizers.splice(index, 1);
|
||||
this.touchAction.update();
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
|
@ -2325,7 +2370,7 @@ Manager.prototype = {
|
|||
if (!handler) {
|
||||
delete handlers[event];
|
||||
} else {
|
||||
handlers[event].splice(inArray(handlers[event], handler), 1);
|
||||
handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);
|
||||
}
|
||||
});
|
||||
return this;
|
||||
|
@ -2381,6 +2426,9 @@ Manager.prototype = {
|
|||
*/
|
||||
function toggleCssProps(manager, add) {
|
||||
var element = manager.element;
|
||||
if (!element.style) {
|
||||
return;
|
||||
}
|
||||
each(manager.options.cssProps, function(value, name) {
|
||||
element.style[prefixed(element.style, name)] = add ? value : '';
|
||||
});
|
||||
|
@ -2450,7 +2498,12 @@ extend(Hammer, {
|
|||
prefixed: prefixed
|
||||
});
|
||||
|
||||
if (typeof define == TYPE_FUNCTION && define.amd) {
|
||||
// this prevents errors when Hammer is loaded in the presence of an AMD
|
||||
// style loader but by script tag, not by the loader.
|
||||
var freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line
|
||||
freeGlobal.Hammer = Hammer;
|
||||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(function() {
|
||||
return Hammer;
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue