mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-16 18:38:25 -07:00
remove var
This commit is contained in:
parent
d07a0aa3a9
commit
b4e43f2436
@ -14,12 +14,12 @@ import 'registerElement';
|
|||||||
|
|
||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
|
|
||||||
var ItemsContainerPrototype = Object.create(HTMLDivElement.prototype);
|
const ItemsContainerPrototype = Object.create(HTMLDivElement.prototype);
|
||||||
|
|
||||||
function onClick(e) {
|
function onClick(e) {
|
||||||
var itemsContainer = this;
|
const itemsContainer = this;
|
||||||
var target = e.target;
|
const target = e.target;
|
||||||
var multiSelect = itemsContainer.multiSelect;
|
let multiSelect = itemsContainer.multiSelect;
|
||||||
|
|
||||||
if (multiSelect) {
|
if (multiSelect) {
|
||||||
if (multiSelect.onContainerClick.call(itemsContainer, e) === false) {
|
if (multiSelect.onContainerClick.call(itemsContainer, e) === false) {
|
||||||
@ -37,9 +37,8 @@ import 'registerElement';
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onContextMenu(e) {
|
function onContextMenu(e) {
|
||||||
var itemsContainer = this;
|
const target = e.target;
|
||||||
var target = e.target;
|
const card = dom.parentWithAttribute(target, 'data-id');
|
||||||
var card = dom.parentWithAttribute(target, 'data-id');
|
|
||||||
|
|
||||||
// check for serverId, it won't be present on selectserver
|
// check for serverId, it won't be present on selectserver
|
||||||
if (card && card.getAttribute('data-serverid')) {
|
if (card && card.getAttribute('data-serverid')) {
|
||||||
@ -60,7 +59,7 @@ import 'registerElement';
|
|||||||
}
|
}
|
||||||
|
|
||||||
ItemsContainerPrototype.enableMultiSelect = function (enabled) {
|
ItemsContainerPrototype.enableMultiSelect = function (enabled) {
|
||||||
var current = this.multiSelect;
|
const current = this.multiSelect;
|
||||||
|
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
if (current) {
|
if (current) {
|
||||||
@ -74,7 +73,7 @@ import 'registerElement';
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var self = this;
|
const self = this;
|
||||||
import('multiSelect').then(({default: MultiSelect}) => {
|
import('multiSelect').then(({default: MultiSelect}) => {
|
||||||
self.multiSelect = new MultiSelect({
|
self.multiSelect = new MultiSelect({
|
||||||
container: self,
|
container: self,
|
||||||
@ -84,14 +83,14 @@ import 'registerElement';
|
|||||||
};
|
};
|
||||||
|
|
||||||
function onDrop(evt, itemsContainer) {
|
function onDrop(evt, itemsContainer) {
|
||||||
var el = evt.item;
|
const el = evt.item;
|
||||||
|
|
||||||
var newIndex = evt.newIndex;
|
const newIndex = evt.newIndex;
|
||||||
var itemId = el.getAttribute('data-playlistitemid');
|
const itemId = el.getAttribute('data-playlistitemid');
|
||||||
var playlistId = el.getAttribute('data-playlistid');
|
const playlistId = el.getAttribute('data-playlistid');
|
||||||
|
|
||||||
if (!playlistId) {
|
if (!playlistId) {
|
||||||
var oldIndex = evt.oldIndex;
|
const oldIndex = evt.oldIndex;
|
||||||
el.dispatchEvent(new CustomEvent('itemdrop', {
|
el.dispatchEvent(new CustomEvent('itemdrop', {
|
||||||
detail: {
|
detail: {
|
||||||
oldIndex: oldIndex,
|
oldIndex: oldIndex,
|
||||||
@ -104,8 +103,8 @@ import 'registerElement';
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var serverId = el.getAttribute('data-serverid');
|
const serverId = el.getAttribute('data-serverid');
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
@ -121,7 +120,7 @@ import 'registerElement';
|
|||||||
}
|
}
|
||||||
|
|
||||||
ItemsContainerPrototype.enableDragReordering = function (enabled) {
|
ItemsContainerPrototype.enableDragReordering = function (enabled) {
|
||||||
var current = this.sortable;
|
const current = this.sortable;
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
if (current) {
|
if (current) {
|
||||||
current.destroy();
|
current.destroy();
|
||||||
@ -134,7 +133,7 @@ import 'registerElement';
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var self = this;
|
const self = this;
|
||||||
import('sortable').then(({default: Sortable}) => {
|
import('sortable').then(({default: Sortable}) => {
|
||||||
self.sortable = new Sortable(self, {
|
self.sortable = new Sortable(self, {
|
||||||
draggable: '.listItem',
|
draggable: '.listItem',
|
||||||
@ -150,13 +149,13 @@ import 'registerElement';
|
|||||||
|
|
||||||
function onUserDataChanged(e, apiClient, userData) {
|
function onUserDataChanged(e, apiClient, userData) {
|
||||||
|
|
||||||
var itemsContainer = this;
|
const itemsContainer = this;
|
||||||
|
|
||||||
import('cardBuilder').then(({default: cardBuilder}) => {
|
import('cardBuilder').then(({default: cardBuilder}) => {
|
||||||
cardBuilder.onUserDataChanged(userData, itemsContainer);
|
cardBuilder.onUserDataChanged(userData, itemsContainer);
|
||||||
});
|
});
|
||||||
|
|
||||||
var eventsToMonitor = getEventsToMonitor(itemsContainer);
|
const eventsToMonitor = getEventsToMonitor(itemsContainer);
|
||||||
|
|
||||||
// TODO: Check user data change reason?
|
// TODO: Check user data change reason?
|
||||||
if (eventsToMonitor.indexOf('markfavorite') !== -1) {
|
if (eventsToMonitor.indexOf('markfavorite') !== -1) {
|
||||||
@ -167,7 +166,7 @@ import 'registerElement';
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getEventsToMonitor(itemsContainer) {
|
function getEventsToMonitor(itemsContainer) {
|
||||||
var monitor = itemsContainer.getAttribute('data-monitor');
|
let monitor = itemsContainer.getAttribute('data-monitor');
|
||||||
if (monitor) {
|
if (monitor) {
|
||||||
return monitor.split(',');
|
return monitor.split(',');
|
||||||
}
|
}
|
||||||
@ -177,16 +176,16 @@ import 'registerElement';
|
|||||||
|
|
||||||
function onTimerCreated(e, apiClient, data) {
|
function onTimerCreated(e, apiClient, data) {
|
||||||
|
|
||||||
var itemsContainer = this;
|
const itemsContainer = this;
|
||||||
|
|
||||||
if (getEventsToMonitor(itemsContainer).indexOf('timers') !== -1) {
|
if (getEventsToMonitor(itemsContainer).indexOf('timers') !== -1) {
|
||||||
itemsContainer.notifyRefreshNeeded();
|
itemsContainer.notifyRefreshNeeded();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var programId = data.ProgramId;
|
const programId = data.ProgramId;
|
||||||
// This could be null, not supported by all tv providers
|
// This could be null, not supported by all tv providers
|
||||||
var newTimerId = data.Id;
|
const newTimerId = data.Id;
|
||||||
|
|
||||||
import('cardBuilder').then(({default: cardBuilder}) => {
|
import('cardBuilder').then(({default: cardBuilder}) => {
|
||||||
cardBuilder.onTimerCreated(programId, newTimerId, itemsContainer);
|
cardBuilder.onTimerCreated(programId, newTimerId, itemsContainer);
|
||||||
@ -194,7 +193,7 @@ import 'registerElement';
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onSeriesTimerCreated(e, apiClient, data) {
|
function onSeriesTimerCreated(e, apiClient, data) {
|
||||||
var itemsContainer = this;
|
const itemsContainer = this;
|
||||||
if (getEventsToMonitor(itemsContainer).indexOf('seriestimers') !== -1) {
|
if (getEventsToMonitor(itemsContainer).indexOf('seriestimers') !== -1) {
|
||||||
itemsContainer.notifyRefreshNeeded();
|
itemsContainer.notifyRefreshNeeded();
|
||||||
return;
|
return;
|
||||||
@ -202,7 +201,7 @@ import 'registerElement';
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onTimerCancelled(e, apiClient, data) {
|
function onTimerCancelled(e, apiClient, data) {
|
||||||
var itemsContainer = this;
|
const itemsContainer = this;
|
||||||
if (getEventsToMonitor(itemsContainer).indexOf('timers') !== -1) {
|
if (getEventsToMonitor(itemsContainer).indexOf('timers') !== -1) {
|
||||||
itemsContainer.notifyRefreshNeeded();
|
itemsContainer.notifyRefreshNeeded();
|
||||||
return;
|
return;
|
||||||
@ -214,7 +213,7 @@ import 'registerElement';
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onSeriesTimerCancelled(e, apiClient, data) {
|
function onSeriesTimerCancelled(e, apiClient, data) {
|
||||||
var itemsContainer = this;
|
const itemsContainer = this;
|
||||||
if (getEventsToMonitor(itemsContainer).indexOf('seriestimers') !== -1) {
|
if (getEventsToMonitor(itemsContainer).indexOf('seriestimers') !== -1) {
|
||||||
itemsContainer.notifyRefreshNeeded();
|
itemsContainer.notifyRefreshNeeded();
|
||||||
return;
|
return;
|
||||||
@ -226,25 +225,25 @@ import 'registerElement';
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onLibraryChanged(e, apiClient, data) {
|
function onLibraryChanged(e, apiClient, data) {
|
||||||
var itemsContainer = this;
|
const itemsContainer = this;
|
||||||
|
|
||||||
var eventsToMonitor = getEventsToMonitor(itemsContainer);
|
const eventsToMonitor = getEventsToMonitor(itemsContainer);
|
||||||
if (eventsToMonitor.indexOf('seriestimers') !== -1 || eventsToMonitor.indexOf('timers') !== -1) {
|
if (eventsToMonitor.indexOf('seriestimers') !== -1 || eventsToMonitor.indexOf('timers') !== -1) {
|
||||||
// yes this is an assumption
|
// yes this is an assumption
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var itemsAdded = data.ItemsAdded || [];
|
const itemsAdded = data.ItemsAdded || [];
|
||||||
var itemsRemoved = data.ItemsRemoved || [];
|
const itemsRemoved = data.ItemsRemoved || [];
|
||||||
if (!itemsAdded.length && !itemsRemoved.length) {
|
if (!itemsAdded.length && !itemsRemoved.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var parentId = itemsContainer.getAttribute('data-parentid');
|
const parentId = itemsContainer.getAttribute('data-parentid');
|
||||||
if (parentId) {
|
if (parentId) {
|
||||||
var foldersAddedTo = data.FoldersAddedTo || [];
|
const foldersAddedTo = data.FoldersAddedTo || [];
|
||||||
var foldersRemovedFrom = data.FoldersRemovedFrom || [];
|
const foldersRemovedFrom = data.FoldersRemovedFrom || [];
|
||||||
var collectionFolders = data.CollectionFolders || [];
|
const collectionFolders = data.CollectionFolders || [];
|
||||||
|
|
||||||
if (foldersAddedTo.indexOf(parentId) === -1 && foldersRemovedFrom.indexOf(parentId) === -1 && collectionFolders.indexOf(parentId) === -1) {
|
if (foldersAddedTo.indexOf(parentId) === -1 && foldersRemovedFrom.indexOf(parentId) === -1 && collectionFolders.indexOf(parentId) === -1) {
|
||||||
return;
|
return;
|
||||||
@ -255,10 +254,10 @@ import 'registerElement';
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onPlaybackStopped(e, stopInfo) {
|
function onPlaybackStopped(e, stopInfo) {
|
||||||
var itemsContainer = this;
|
const itemsContainer = this;
|
||||||
var state = stopInfo.state;
|
const state = stopInfo.state;
|
||||||
|
|
||||||
var eventsToMonitor = getEventsToMonitor(itemsContainer);
|
const eventsToMonitor = getEventsToMonitor(itemsContainer);
|
||||||
if (state.NowPlayingItem && state.NowPlayingItem.MediaType === 'Video') {
|
if (state.NowPlayingItem && state.NowPlayingItem.MediaType === 'Video') {
|
||||||
if (eventsToMonitor.indexOf('videoplayback') !== -1) {
|
if (eventsToMonitor.indexOf('videoplayback') !== -1) {
|
||||||
itemsContainer.notifyRefreshNeeded(true);
|
itemsContainer.notifyRefreshNeeded(true);
|
||||||
@ -273,14 +272,14 @@ import 'registerElement';
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addNotificationEvent(instance, name, handler, owner) {
|
function addNotificationEvent(instance, name, handler, owner) {
|
||||||
var localHandler = handler.bind(instance);
|
const localHandler = handler.bind(instance);
|
||||||
owner = owner || serverNotifications;
|
owner = owner || serverNotifications;
|
||||||
events.on(owner, name, localHandler);
|
events.on(owner, name, localHandler);
|
||||||
instance['event_' + name] = localHandler;
|
instance['event_' + name] = localHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeNotificationEvent(instance, name, owner) {
|
function removeNotificationEvent(instance, name, owner) {
|
||||||
var handler = instance['event_' + name];
|
const handler = instance['event_' + name];
|
||||||
if (handler) {
|
if (handler) {
|
||||||
owner = owner || serverNotifications;
|
owner = owner || serverNotifications;
|
||||||
events.off(owner, name, handler);
|
events.off(owner, name, handler);
|
||||||
@ -360,10 +359,10 @@ import 'registerElement';
|
|||||||
ItemsContainerPrototype.resume = function (options) {
|
ItemsContainerPrototype.resume = function (options) {
|
||||||
this.paused = false;
|
this.paused = false;
|
||||||
|
|
||||||
var refreshIntervalEndTime = this.refreshIntervalEndTime;
|
let refreshIntervalEndTime = this.refreshIntervalEndTime;
|
||||||
if (refreshIntervalEndTime) {
|
if (refreshIntervalEndTime) {
|
||||||
|
|
||||||
var remainingMs = refreshIntervalEndTime - new Date().getTime();
|
const remainingMs = refreshIntervalEndTime - new Date().getTime();
|
||||||
if (remainingMs > 0 && !this.needsRefresh) {
|
if (remainingMs > 0 && !this.needsRefresh) {
|
||||||
resetRefreshInterval(this, remainingMs);
|
resetRefreshInterval(this, remainingMs);
|
||||||
} else {
|
} else {
|
||||||
@ -400,7 +399,7 @@ import 'registerElement';
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var timeout = this.refreshTimeout;
|
let timeout = this.refreshTimeout;
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
}
|
}
|
||||||
@ -437,9 +436,9 @@ import 'registerElement';
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onDataFetched(result) {
|
function onDataFetched(result) {
|
||||||
var items = result.Items || result;
|
const items = result.Items || result;
|
||||||
|
|
||||||
var parentContainer = this.parentContainer;
|
let parentContainer = this.parentContainer;
|
||||||
if (parentContainer) {
|
if (parentContainer) {
|
||||||
if (items.length) {
|
if (items.length) {
|
||||||
parentContainer.classList.remove('hide');
|
parentContainer.classList.remove('hide');
|
||||||
@ -448,9 +447,9 @@ import 'registerElement';
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var activeElement = document.activeElement;
|
const activeElement = document.activeElement;
|
||||||
var focusId;
|
let focusId;
|
||||||
var hasActiveElement;
|
let hasActiveElement;
|
||||||
|
|
||||||
if (this.contains(activeElement)) {
|
if (this.contains(activeElement)) {
|
||||||
hasActiveElement = true;
|
hasActiveElement = true;
|
||||||
@ -474,7 +473,7 @@ import 'registerElement';
|
|||||||
|
|
||||||
function setFocus(itemsContainer, focusId) {
|
function setFocus(itemsContainer, focusId) {
|
||||||
if (focusId) {
|
if (focusId) {
|
||||||
var newElement = itemsContainer.querySelector('[data-id="' + focusId + '"]');
|
const newElement = itemsContainer.querySelector('[data-id="' + focusId + '"]');
|
||||||
if (newElement) {
|
if (newElement) {
|
||||||
try {
|
try {
|
||||||
focusManager.focus(newElement);
|
focusManager.focus(newElement);
|
||||||
|
@ -7,13 +7,13 @@ import EmbyButtonPrototype from 'emby-button';
|
|||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function addNotificationEvent(instance, name, handler) {
|
function addNotificationEvent(instance, name, handler) {
|
||||||
var localHandler = handler.bind(instance);
|
const localHandler = handler.bind(instance);
|
||||||
events.on(serverNotifications, name, localHandler);
|
events.on(serverNotifications, name, localHandler);
|
||||||
instance[name] = localHandler;
|
instance[name] = localHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeNotificationEvent(instance, name) {
|
function removeNotificationEvent(instance, name) {
|
||||||
var handler = instance[name];
|
const handler = instance[name];
|
||||||
if (handler) {
|
if (handler) {
|
||||||
events.off(serverNotifications, name, handler);
|
events.off(serverNotifications, name, handler);
|
||||||
instance[name] = null;
|
instance[name] = null;
|
||||||
@ -22,10 +22,10 @@ import EmbyButtonPrototype from 'emby-button';
|
|||||||
|
|
||||||
function onClick(e) {
|
function onClick(e) {
|
||||||
|
|
||||||
var button = this;
|
const button = this;
|
||||||
var id = button.getAttribute('data-id');
|
const id = button.getAttribute('data-id');
|
||||||
var serverId = button.getAttribute('data-serverid');
|
const serverId = button.getAttribute('data-serverid');
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
if (!button.classList.contains('playstatebutton-played')) {
|
if (!button.classList.contains('playstatebutton-played')) {
|
||||||
apiClient.markPlayed(apiClient.getCurrentUserId(), id, new Date());
|
apiClient.markPlayed(apiClient.getCurrentUserId(), id, new Date());
|
||||||
@ -37,14 +37,14 @@ import EmbyButtonPrototype from 'emby-button';
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onUserDataChanged(e, apiClient, userData) {
|
function onUserDataChanged(e, apiClient, userData) {
|
||||||
var button = this;
|
const button = this;
|
||||||
if (userData.ItemId === button.getAttribute('data-id')) {
|
if (userData.ItemId === button.getAttribute('data-id')) {
|
||||||
setState(button, userData.Played);
|
setState(button, userData.Played);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setState(button, played, updateAttribute) {
|
function setState(button, played, updateAttribute) {
|
||||||
var icon = button.iconElement;
|
let icon = button.iconElement;
|
||||||
if (!icon) {
|
if (!icon) {
|
||||||
button.iconElement = button.querySelector('.material-icons');
|
button.iconElement = button.querySelector('.material-icons');
|
||||||
icon = button.iconElement;
|
icon = button.iconElement;
|
||||||
@ -77,7 +77,7 @@ import EmbyButtonPrototype from 'emby-button';
|
|||||||
button.title = globalize.translate('Played');
|
button.title = globalize.translate('Played');
|
||||||
}
|
}
|
||||||
|
|
||||||
var text = button.querySelector('.button-text');
|
let text = button.querySelector('.button-text');
|
||||||
if (text) {
|
if (text) {
|
||||||
text.innerHTML = button.title;
|
text.innerHTML = button.title;
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ import EmbyButtonPrototype from 'emby-button';
|
|||||||
addNotificationEvent(button, 'UserDataChanged', onUserDataChanged);
|
addNotificationEvent(button, 'UserDataChanged', onUserDataChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
var EmbyPlaystateButtonPrototype = Object.create(EmbyButtonPrototype);
|
const EmbyPlaystateButtonPrototype = Object.create(EmbyButtonPrototype);
|
||||||
|
|
||||||
EmbyPlaystateButtonPrototype.createdCallback = function () {
|
EmbyPlaystateButtonPrototype.createdCallback = function () {
|
||||||
|
|
||||||
@ -114,8 +114,8 @@ import EmbyButtonPrototype from 'emby-button';
|
|||||||
EmbyButtonPrototype.attachedCallback.call(this);
|
EmbyButtonPrototype.attachedCallback.call(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
var itemId = this.getAttribute('data-id');
|
const itemId = this.getAttribute('data-id');
|
||||||
var serverId = this.getAttribute('data-serverid');
|
const serverId = this.getAttribute('data-serverid');
|
||||||
if (itemId && serverId) {
|
if (itemId && serverId) {
|
||||||
|
|
||||||
setState(this, this.getAttribute('data-played') === 'true', false);
|
setState(this, this.getAttribute('data-played') === 'true', false);
|
||||||
@ -142,7 +142,7 @@ import EmbyButtonPrototype from 'emby-button';
|
|||||||
this.setAttribute('data-id', item.Id);
|
this.setAttribute('data-id', item.Id);
|
||||||
this.setAttribute('data-serverid', item.ServerId);
|
this.setAttribute('data-serverid', item.ServerId);
|
||||||
|
|
||||||
var played = item.UserData && item.UserData.Played;
|
const played = item.UserData && item.UserData.Played;
|
||||||
setState(this, played);
|
setState(this, played);
|
||||||
bindEvents(this);
|
bindEvents(this);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
var ProgramCellPrototype = Object.create(HTMLButtonElement.prototype);
|
const ProgramCellPrototype = Object.create(HTMLButtonElement.prototype);
|
||||||
|
|
||||||
ProgramCellPrototype.detachedCallback = function () {
|
ProgramCellPrototype.detachedCallback = function () {
|
||||||
this.posLeft = null;
|
this.posLeft = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user