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

remove var

This commit is contained in:
Cameron 2020-07-10 18:09:02 +01:00
parent d07a0aa3a9
commit b4e43f2436
3 changed files with 62 additions and 63 deletions

View file

@ -7,13 +7,13 @@ import EmbyButtonPrototype from 'emby-button';
/* eslint-disable indent */
function addNotificationEvent(instance, name, handler) {
var localHandler = handler.bind(instance);
const localHandler = handler.bind(instance);
events.on(serverNotifications, name, localHandler);
instance[name] = localHandler;
}
function removeNotificationEvent(instance, name) {
var handler = instance[name];
const handler = instance[name];
if (handler) {
events.off(serverNotifications, name, handler);
instance[name] = null;
@ -22,10 +22,10 @@ import EmbyButtonPrototype from 'emby-button';
function onClick(e) {
var button = this;
var id = button.getAttribute('data-id');
var serverId = button.getAttribute('data-serverid');
var apiClient = connectionManager.getApiClient(serverId);
const button = this;
const id = button.getAttribute('data-id');
const serverId = button.getAttribute('data-serverid');
const apiClient = connectionManager.getApiClient(serverId);
if (!button.classList.contains('playstatebutton-played')) {
apiClient.markPlayed(apiClient.getCurrentUserId(), id, new Date());
@ -37,14 +37,14 @@ import EmbyButtonPrototype from 'emby-button';
}
function onUserDataChanged(e, apiClient, userData) {
var button = this;
const button = this;
if (userData.ItemId === button.getAttribute('data-id')) {
setState(button, userData.Played);
}
}
function setState(button, played, updateAttribute) {
var icon = button.iconElement;
let icon = button.iconElement;
if (!icon) {
button.iconElement = button.querySelector('.material-icons');
icon = button.iconElement;
@ -77,7 +77,7 @@ import EmbyButtonPrototype from 'emby-button';
button.title = globalize.translate('Played');
}
var text = button.querySelector('.button-text');
let text = button.querySelector('.button-text');
if (text) {
text.innerHTML = button.title;
}
@ -97,7 +97,7 @@ import EmbyButtonPrototype from 'emby-button';
addNotificationEvent(button, 'UserDataChanged', onUserDataChanged);
}
var EmbyPlaystateButtonPrototype = Object.create(EmbyButtonPrototype);
const EmbyPlaystateButtonPrototype = Object.create(EmbyButtonPrototype);
EmbyPlaystateButtonPrototype.createdCallback = function () {
@ -114,8 +114,8 @@ import EmbyButtonPrototype from 'emby-button';
EmbyButtonPrototype.attachedCallback.call(this);
}
var itemId = this.getAttribute('data-id');
var serverId = this.getAttribute('data-serverid');
const itemId = this.getAttribute('data-id');
const serverId = this.getAttribute('data-serverid');
if (itemId && serverId) {
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-serverid', item.ServerId);
var played = item.UserData && item.UserData.Played;
const played = item.UserData && item.UserData.Played;
setState(this, played);
bindEvents(this);