1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update Variable declerations for taskbutton and touchHelper

This commit is contained in:
Cameron 2020-07-17 11:32:23 +01:00
parent 0473e549ab
commit 46638fb9a9
2 changed files with 33 additions and 33 deletions

View file

@ -13,7 +13,7 @@ export default function (options) {
} }
function updateTasks(tasks) { function updateTasks(tasks) {
var task = tasks.filter(function (t) { const task = tasks.filter(function (t) {
return t.Key == options.taskKey; return t.Key == options.taskKey;
})[0]; })[0];
@ -36,7 +36,7 @@ export default function (options) {
} }
button.setAttribute('data-taskid', task.Id); button.setAttribute('data-taskid', task.Id);
var progress = (task.CurrentProgressPercentage || 0).toFixed(1); const progress = (task.CurrentProgressPercentage || 0).toFixed(1);
if (options.progressElem) { if (options.progressElem) {
options.progressElem.value = progress; options.progressElem.value = progress;
@ -49,7 +49,7 @@ export default function (options) {
} }
if (options.lastResultElem) { if (options.lastResultElem) {
var lastResult = task.LastExecutionResult ? task.LastExecutionResult.Status : ''; const lastResult = task.LastExecutionResult ? task.LastExecutionResult.Status : '';
if (lastResult == 'Failed') { if (lastResult == 'Failed') {
options.lastResultElem.html('<span style="color:#FF0000;">(' + globalize.translate('LabelFailed') + ')</span>'); options.lastResultElem.html('<span style="color:#FF0000;">(' + globalize.translate('LabelFailed') + ')</span>');
@ -77,9 +77,9 @@ export default function (options) {
} }
} }
var pollInterval; let pollInterval;
var button = options.button; const button = options.button;
var serverId = ApiClient.serverId(); const serverId = ApiClient.serverId();
function onPollIntervalFired() { function onPollIntervalFired() {
if (!connectionManager.getApiClient(serverId).isMessageChannelOpen()) { if (!connectionManager.getApiClient(serverId).isMessageChannelOpen()) {
@ -88,7 +88,7 @@ export default function (options) {
} }
function startInterval() { function startInterval() {
var apiClient = connectionManager.getApiClient(serverId); const apiClient = connectionManager.getApiClient(serverId);
if (pollInterval) { if (pollInterval) {
clearInterval(pollInterval); clearInterval(pollInterval);

View file

@ -9,23 +9,23 @@ class TouchHelper {
constructor(elem, options) { constructor(elem, options) {
options = options || {}; options = options || {};
var touchTarget; let touchTarget;
var touchStartX; let touchStartX;
var touchStartY; let touchStartY;
var lastDeltaX; let lastDeltaX;
var lastDeltaY; let lastDeltaY;
var thresholdYMet; let thresholdYMet;
var self = this; const self = this;
var swipeXThreshold = options.swipeXThreshold || 50; const swipeXThreshold = options.swipeXThreshold || 50;
var swipeYThreshold = options.swipeYThreshold || 50; const swipeYThreshold = options.swipeYThreshold || 50;
var swipeXMaxY = 30; const swipeXMaxY = 30;
var excludeTagNames = options.ignoreTagNames || []; const excludeTagNames = options.ignoreTagNames || [];
var touchStart = function (e) { const touchStart = function (e) {
var touch = getTouches(e)[0]; const touch = getTouches(e)[0];
touchTarget = null; touchTarget = null;
touchStartX = 0; touchStartX = 0;
touchStartY = 0; touchStartY = 0;
@ -35,7 +35,7 @@ class TouchHelper {
if (touch) { if (touch) {
var currentTouchTarget = touch.target; const currentTouchTarget = touch.target;
if (dom.parentWithTag(currentTouchTarget, excludeTagNames)) { if (dom.parentWithTag(currentTouchTarget, excludeTagNames)) {
return; return;
@ -47,18 +47,18 @@ class TouchHelper {
} }
}; };
var touchEnd = function (e) { const touchEnd = function (e) {
var isTouchMove = e.type === 'touchmove'; const isTouchMove = e.type === 'touchmove';
if (touchTarget) { if (touchTarget) {
var touch = getTouches(e)[0]; const touch = getTouches(e)[0];
var deltaX; let deltaX;
var deltaY; let deltaY;
var clientX; let clientX;
var clientY; let clientY;
if (touch) { if (touch) {
clientX = touch.clientX || 0; clientX = touch.clientX || 0;
@ -70,8 +70,8 @@ class TouchHelper {
deltaY = 0; deltaY = 0;
} }
var currentDeltaX = lastDeltaX == null ? deltaX : (deltaX - lastDeltaX); const currentDeltaX = lastDeltaX == null ? deltaX : (deltaX - lastDeltaX);
var currentDeltaY = lastDeltaY == null ? deltaY : (deltaY - lastDeltaY); const currentDeltaY = lastDeltaY == null ? deltaY : (deltaY - lastDeltaY);
lastDeltaX = deltaX; lastDeltaX = deltaX;
lastDeltaY = deltaY; lastDeltaY = deltaY;
@ -140,11 +140,11 @@ class TouchHelper {
} }
destroy() { destroy() {
var elem = this.elem; const elem = this.elem;
if (elem) { if (elem) {
var touchStart = this.touchStart; const touchStart = this.touchStart;
var touchEnd = this.touchEnd; const touchEnd = this.touchEnd;
dom.removeEventListener(elem, 'touchstart', touchStart, { dom.removeEventListener(elem, 'touchstart', touchStart, {
passive: true passive: true