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

View file

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

View file

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