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

update var declerations

This commit is contained in:
Cameron 2020-07-11 11:23:28 +01:00
parent f2669cd530
commit 5bc2a439fd
3 changed files with 49 additions and 49 deletions

View file

@ -4,7 +4,7 @@ import 'registerElement';
/* eslint-disable indent */
var EmbyRadioPrototype = Object.create(HTMLInputElement.prototype);
let EmbyRadioPrototype = Object.create(HTMLInputElement.prototype);
function onKeyDown(e) {
@ -26,7 +26,7 @@ import 'registerElement';
}
EmbyRadioPrototype.attachedCallback = function () {
var showFocus = !layoutManager.mobile;
const showFocus = !layoutManager.mobile;
if (this.getAttribute('data-radio') === 'true') {
return;
@ -36,7 +36,7 @@ import 'registerElement';
this.classList.add('mdl-radio__button');
var labelElement = this.parentNode;
let labelElement = this.parentNode;
//labelElement.classList.add('"mdl-radio mdl-js-radio mdl-js-ripple-effect');
labelElement.classList.add('mdl-radio');
labelElement.classList.add('mdl-js-radio');
@ -45,12 +45,12 @@ import 'registerElement';
labelElement.classList.add('show-focus');
}
var labelTextElement = labelElement.querySelector('span');
let labelTextElement = labelElement.querySelector('span');
labelTextElement.classList.add('radioButtonLabel');
labelTextElement.classList.add('mdl-radio__label');
var html = '';
let html = '';
html += '<div class="mdl-radio__circles">';

View file

@ -9,7 +9,7 @@ import 'css!./emby-scroller';
/* eslint-disable indent */
var ScrollerPrototype = Object.create(HTMLDivElement.prototype);
let ScrollerPrototype = Object.create(HTMLDivElement.prototype);
ScrollerPrototype.createdCallback = function () {
this.classList.add('emby-scroller');
@ -17,7 +17,7 @@ import 'css!./emby-scroller';
function initCenterFocus(elem, scrollerInstance) {
dom.addEventListener(elem, 'focus', function (e) {
var focused = focusManager.focusableParent(e.target);
const focused = focusManager.focusableParent(e.target);
if (focused) {
scrollerInstance.toCenter(focused);
}
@ -88,7 +88,7 @@ import 'css!./emby-scroller';
};
function onInputCommand(e) {
var cmd = e.detail.command;
const cmd = e.detail.command;
if (cmd === 'end') {
focusManager.focusLast(this, '.' + this.getAttribute('data-navcommands'));
e.preventDefault();
@ -109,18 +109,18 @@ import 'css!./emby-scroller';
inputManager.on(this, onInputCommand);
}
var horizontal = this.getAttribute('data-horizontal') !== 'false';
const horizontal = this.getAttribute('data-horizontal') !== 'false';
var slider = this.querySelector('.scrollSlider');
const slider = this.querySelector('.scrollSlider');
if (horizontal) {
slider.style['white-space'] = 'nowrap';
}
var scrollFrame = this;
var enableScrollButtons = layoutManager.desktop && horizontal && this.getAttribute('data-scrollbuttons') !== 'false';
const scrollFrame = this;
const enableScrollButtons = layoutManager.desktop && horizontal && this.getAttribute('data-scrollbuttons') !== 'false';
var options = {
const options = {
horizontal: horizontal,
mouseDragging: 1,
mouseWheel: this.getAttribute('data-mousewheel') !== 'false',
@ -162,14 +162,14 @@ import 'css!./emby-scroller';
}
ScrollerPrototype.pause = function () {
var headroom = this.headroom;
const headroom = this.headroom;
if (headroom) {
headroom.pause();
}
};
ScrollerPrototype.resume = function () {
var headroom = this.headroom;
const headroom = this.headroom;
if (headroom) {
headroom.resume();
}
@ -180,13 +180,13 @@ import 'css!./emby-scroller';
inputManager.off(this, onInputCommand);
}
var headroom = this.headroom;
const headroom = this.headroom;
if (headroom) {
headroom.destroy();
this.headroom = null;
}
var scrollerInstance = this.scroller;
const scrollerInstance = this.scroller;
if (scrollerInstance) {
scrollerInstance.destroy();
this.scroller = null;

View file

@ -9,9 +9,9 @@ import 'scrollStyles';
/* eslint-disable indent */
var EmbyTabs = Object.create(HTMLDivElement.prototype);
var buttonClass = 'emby-tab-button';
var activeButtonClass = buttonClass + '-active';
let EmbyTabs = Object.create(HTMLDivElement.prototype);
const buttonClass = 'emby-tab-button';
const activeButtonClass = buttonClass + '-active';
function setActiveTabButton(tabs, newButton, oldButton, animate) {
@ -24,14 +24,14 @@ import 'scrollStyles';
}
function removeActivePanelClass(tabs, index) {
var tabPanel = getTabPanel(tabs, index);
let tabPanel = getTabPanel(tabs, index);
if (tabPanel) {
tabPanel.classList.remove('is-active');
}
}
function addActivePanelClass(tabs, index) {
var tabPanel = getTabPanel(tabs, index);
let tabPanel = getTabPanel(tabs, index);
if (tabPanel) {
tabPanel.classList.add('is-active');
}
@ -39,9 +39,9 @@ import 'scrollStyles';
function fadeInRight(elem) {
var pct = browser.mobile ? '4%' : '0.5%';
const pct = browser.mobile ? '4%' : '0.5%';
var keyframes = [
const keyframes = [
{ opacity: '0', transform: 'translate3d(' + pct + ', 0, 0)', offset: 0 },
{ opacity: '1', transform: 'none', offset: 1 }];
@ -64,7 +64,7 @@ import 'scrollStyles';
removeActivePanelClass(tabs, previousIndex);
}
var newPanel = getTabPanel(tabs, index);
let newPanel = getTabPanel(tabs, index);
if (newPanel) {
// animate new panel ?
@ -78,10 +78,10 @@ import 'scrollStyles';
function onClick(e) {
var tabs = this;
const tabs = this;
var current = tabs.querySelector('.' + activeButtonClass);
var tabButton = dom.parentWithClass(e.target, buttonClass);
const current = tabs.querySelector('.' + activeButtonClass);
const tabButton = dom.parentWithClass(e.target, buttonClass);
if (tabButton && tabButton !== current) {
@ -89,11 +89,11 @@ import 'scrollStyles';
current.classList.remove(activeButtonClass);
}
var previousIndex = current ? parseInt(current.getAttribute('data-index')) : null;
const previousIndex = current ? parseInt(current.getAttribute('data-index')) : null;
setActiveTabButton(tabs, tabButton, current, true);
var index = parseInt(tabButton.getAttribute('data-index'));
const index = parseInt(tabButton.getAttribute('data-index'));
triggerBeforeTabChange(tabs, index, previousIndex);
@ -123,7 +123,7 @@ import 'scrollStyles';
return;
}
var contentScrollSlider = tabs.querySelector('.emby-tabs-slider');
const contentScrollSlider = tabs.querySelector('.emby-tabs-slider');
if (contentScrollSlider) {
tabs.scroller = new scroller(tabs, {
horizontal: 1,
@ -168,7 +168,7 @@ import 'scrollStyles';
EmbyTabs.focus = function () {
var selected = this.querySelector('.' + activeButtonClass);
const selected = this.querySelector('.' + activeButtonClass);
if (selected) {
focusManager.focus(selected);
@ -188,16 +188,16 @@ import 'scrollStyles';
initScroller(this);
var current = this.querySelector('.' + activeButtonClass);
var currentIndex = current ? parseInt(current.getAttribute('data-index')) : parseInt(this.getAttribute('data-index') || '0');
const current = this.querySelector('.' + activeButtonClass);
const currentIndex = current ? parseInt(current.getAttribute('data-index')) : parseInt(this.getAttribute('data-index') || '0');
if (currentIndex !== -1) {
this.selectedTabIndex = currentIndex;
var tabButtons = this.querySelectorAll('.' + buttonClass);
const tabButtons = this.querySelectorAll('.' + buttonClass);
var newTabButton = tabButtons[currentIndex];
const newTabButton = tabButtons[currentIndex];
if (newTabButton) {
setActiveTabButton(this, newTabButton, current, false);
@ -229,18 +229,18 @@ import 'scrollStyles';
EmbyTabs.selectedIndex = function (selected, triggerEvent) {
var tabs = this;
const tabs = this;
if (selected == null) {
return tabs.selectedTabIndex || 0;
}
var current = tabs.selectedIndex();
const current = tabs.selectedIndex();
tabs.selectedTabIndex = selected;
var tabButtons = tabs.querySelectorAll('.' + buttonClass);
const tabButtons = tabs.querySelectorAll('.' + buttonClass);
if (current === selected || triggerEvent === false) {
@ -252,7 +252,7 @@ import 'scrollStyles';
}
}));
var currentTabButton = tabButtons[current];
let currentTabButton = tabButtons[current];
setActiveTabButton(tabs, tabButtons[selected], currentTabButton, false);
if (current !== selected && currentTabButton) {
@ -270,7 +270,7 @@ import 'scrollStyles';
function getSibling(elem, method) {
var sibling = elem[method];
let sibling = elem[method];
while (sibling) {
if (sibling.classList.contains(buttonClass)) {
@ -288,9 +288,9 @@ import 'scrollStyles';
EmbyTabs.selectNext = function () {
var current = getSelectedTabButton(this);
const current = getSelectedTabButton(this);
var sibling = getSibling(current, 'nextSibling');
const sibling = getSibling(current, 'nextSibling');
if (sibling) {
onClick.call(this, {
@ -301,9 +301,9 @@ import 'scrollStyles';
EmbyTabs.selectPrevious = function () {
var current = getSelectedTabButton(this);
const current = getSelectedTabButton(this);
var sibling = getSibling(current, 'previousSibling');
const sibling = getSibling(current, 'previousSibling');
if (sibling) {
onClick.call(this, {
@ -314,14 +314,14 @@ import 'scrollStyles';
EmbyTabs.triggerBeforeTabChange = function (selected) {
var tabs = this;
const tabs = this;
triggerBeforeTabChange(tabs, tabs.selectedIndex());
};
EmbyTabs.triggerTabChange = function (selected) {
var tabs = this;
const tabs = this;
tabs.dispatchEvent(new CustomEvent('tabchange', {
detail: {
@ -332,8 +332,8 @@ import 'scrollStyles';
EmbyTabs.setTabEnabled = function (index, enabled) {
var tabs = this;
var btn = this.querySelector('.emby-tab-button[data-index="' + index + '"]');
const tabs = this;
const btn = this.querySelector('.emby-tab-button[data-index="' + index + '"]');
if (enabled) {
btn.classList.remove('hide');