Merge pull request #1536 from Camc314/migrate-to-ES6-5
Migration of emby-ratingbutton, emby-scrollbuttons and emby-select to ES6 modules
This commit is contained in:
commit
09aa721e3d
4 changed files with 89 additions and 71 deletions
13
package.json
13
package.json
|
@ -143,14 +143,17 @@
|
||||||
"src/controllers/dashboard/logs.js",
|
"src/controllers/dashboard/logs.js",
|
||||||
"src/controllers/user/subtitles.js",
|
"src/controllers/user/subtitles.js",
|
||||||
"src/controllers/dashboard/plugins/repositories.js",
|
"src/controllers/dashboard/plugins/repositories.js",
|
||||||
"src/elements/emby-tabs/emby-tabs.js",
|
"src/elements/emby-checkbox/emby-checkbox.js",
|
||||||
"src/elements/emby-scroller/emby-scroller.js",
|
"src/elements/emby-itemrefreshindicator/emby-itemrefreshindicator.js",
|
||||||
"src/elements/emby-radio/emby-radio.js",
|
|
||||||
"src/elements/emby-progressbar/emby-progressbar.js",
|
"src/elements/emby-progressbar/emby-progressbar.js",
|
||||||
"src/elements/emby-progressring/emby-progressring.js",
|
"src/elements/emby-progressring/emby-progressring.js",
|
||||||
"src/elements/emby-itemrefreshindicator/emby-itemrefreshindicator.js",
|
"src/elements/emby-radio/emby-radio.js",
|
||||||
|
"src/elements/emby-ratingbutton/emby-ratingbutton.js",
|
||||||
|
"src/elements/emby-scrollbuttons/emby-scrollbuttons.js",
|
||||||
|
"src/elements/emby-scroller/emby-scroller.js",
|
||||||
|
"src/elements/emby-select/emby-select.js",
|
||||||
"src/elements/emby-slider/emby-slider.js",
|
"src/elements/emby-slider/emby-slider.js",
|
||||||
"src/elements/emby-checkbox/emby-checkbox.js",
|
"src/elements/emby-tabs/emby-tabs.js",
|
||||||
"src/elements/emby-textarea/emby-textarea.js",
|
"src/elements/emby-textarea/emby-textarea.js",
|
||||||
"src/elements/emby-toggle/emby-toggle.js",
|
"src/elements/emby-toggle/emby-toggle.js",
|
||||||
"src/plugins/bookPlayer/plugin.js",
|
"src/plugins/bookPlayer/plugin.js",
|
||||||
|
|
|
@ -1,16 +1,21 @@
|
||||||
define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby-button'], function (connectionManager, serverNotifications, events, globalize, EmbyButtonPrototype) {
|
import connectionManager from 'connectionManager';
|
||||||
'use strict';
|
import serverNotifications from 'serverNotifications';
|
||||||
|
import events from 'events';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import EmbyButtonPrototype from 'emby-button';
|
||||||
|
|
||||||
|
/* 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;
|
||||||
|
@ -24,13 +29,13 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
var likes = this.getAttribute('data-likes');
|
let likes = this.getAttribute('data-likes');
|
||||||
var isFavorite = this.getAttribute('data-isfavorite') === 'true';
|
const isFavorite = this.getAttribute('data-isfavorite') === 'true';
|
||||||
if (likes === 'true') {
|
if (likes === 'true') {
|
||||||
likes = true;
|
likes = true;
|
||||||
} else if (likes === 'false') {
|
} else if (likes === 'false') {
|
||||||
|
@ -47,7 +52,7 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
|
||||||
|
|
||||||
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')) {
|
||||||
|
|
||||||
|
@ -57,7 +62,7 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
|
||||||
|
|
||||||
function setState(button, likes, isFavorite, updateAttribute) {
|
function setState(button, likes, isFavorite, updateAttribute) {
|
||||||
|
|
||||||
var icon = button.querySelector('.material-icons');
|
const icon = button.querySelector('.material-icons');
|
||||||
|
|
||||||
if (isFavorite) {
|
if (isFavorite) {
|
||||||
|
|
||||||
|
@ -106,7 +111,7 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
|
||||||
function setTitle(button) {
|
function setTitle(button) {
|
||||||
button.title = globalize.translate('Favorite');
|
button.title = globalize.translate('Favorite');
|
||||||
|
|
||||||
var text = button.querySelector('.button-text');
|
const text = button.querySelector('.button-text');
|
||||||
if (text) {
|
if (text) {
|
||||||
text.innerHTML = button.title;
|
text.innerHTML = button.title;
|
||||||
}
|
}
|
||||||
|
@ -126,7 +131,7 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
|
||||||
addNotificationEvent(button, 'UserDataChanged', onUserDataChanged);
|
addNotificationEvent(button, 'UserDataChanged', onUserDataChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
var EmbyRatingButtonPrototype = Object.create(EmbyButtonPrototype);
|
const EmbyRatingButtonPrototype = Object.create(EmbyButtonPrototype);
|
||||||
|
|
||||||
EmbyRatingButtonPrototype.createdCallback = function () {
|
EmbyRatingButtonPrototype.createdCallback = function () {
|
||||||
|
|
||||||
|
@ -143,12 +148,12 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
|
||||||
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) {
|
||||||
|
|
||||||
var likes = this.getAttribute('data-likes');
|
let likes = this.getAttribute('data-likes');
|
||||||
var isFavorite = this.getAttribute('data-isfavorite') === 'true';
|
const isFavorite = this.getAttribute('data-isfavorite') === 'true';
|
||||||
if (likes === 'true') {
|
if (likes === 'true') {
|
||||||
likes = true;
|
likes = true;
|
||||||
} else if (likes === 'false') {
|
} else if (likes === 'false') {
|
||||||
|
@ -181,7 +186,7 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
|
||||||
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 userData = item.UserData || {};
|
const userData = item.UserData || {};
|
||||||
setState(this, userData.Likes, userData.IsFavorite);
|
setState(this, userData.Likes, userData.IsFavorite);
|
||||||
bindEvents(this);
|
bindEvents(this);
|
||||||
|
|
||||||
|
@ -199,4 +204,5 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
|
||||||
prototype: EmbyRatingButtonPrototype,
|
prototype: EmbyRatingButtonPrototype,
|
||||||
extends: 'button'
|
extends: 'button'
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
define(['layoutManager', 'dom', 'css!./emby-scrollbuttons', 'registerElement', 'paper-icon-button-light'], function (layoutManager, dom) {
|
import layoutManager from 'layoutManager';
|
||||||
'use strict';
|
import dom from 'dom';
|
||||||
|
import 'css!./emby-scrollbuttons';
|
||||||
|
import 'registerElement';
|
||||||
|
import 'paper-icon-button-light';
|
||||||
|
|
||||||
var EmbyScrollButtonsPrototype = Object.create(HTMLDivElement.prototype);
|
/* eslint-disable indent */
|
||||||
|
|
||||||
|
const EmbyScrollButtonsPrototype = Object.create(HTMLDivElement.prototype);
|
||||||
|
|
||||||
EmbyScrollButtonsPrototype.createdCallback = function () {};
|
EmbyScrollButtonsPrototype.createdCallback = function () {};
|
||||||
|
|
||||||
function getScrollButtonHtml(direction) {
|
function getScrollButtonHtml(direction) {
|
||||||
var html = '';
|
let html = '';
|
||||||
var icon = direction === 'left' ? 'chevron_left' : 'chevron_right';
|
const icon = direction === 'left' ? 'chevron_left' : 'chevron_right';
|
||||||
|
|
||||||
html += '<button type="button" is="paper-icon-button-light" data-ripple="false" data-direction="' + direction + '" class="emby-scrollbuttons-button">';
|
html += '<button type="button" is="paper-icon-button-light" data-ripple="false" data-direction="' + direction + '" class="emby-scrollbuttons-button">';
|
||||||
html += '<span class="material-icons ' + icon + '"></span>';
|
html += '<span class="material-icons ' + icon + '"></span>';
|
||||||
|
@ -45,7 +50,7 @@ define(['layoutManager', 'dom', 'css!./emby-scrollbuttons', 'registerElement', '
|
||||||
scrollButtons.scrollButtonsLeft.disabled = true;
|
scrollButtons.scrollButtonsLeft.disabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var scrollPosEnd = scrollPos + scrollSize;
|
const scrollPosEnd = scrollPos + scrollSize;
|
||||||
if (scrollWidth > 0 && scrollPosEnd >= scrollWidth) {
|
if (scrollWidth > 0 && scrollPosEnd >= scrollWidth) {
|
||||||
scrollButtons.scrollButtonsRight.disabled = true;
|
scrollButtons.scrollButtonsRight.disabled = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -54,18 +59,18 @@ define(['layoutManager', 'dom', 'css!./emby-scrollbuttons', 'registerElement', '
|
||||||
}
|
}
|
||||||
|
|
||||||
function onScroll(e) {
|
function onScroll(e) {
|
||||||
var scrollButtons = this;
|
const scrollButtons = this;
|
||||||
var scroller = this.scroller;
|
const scroller = this.scroller;
|
||||||
|
|
||||||
var scrollSize = getScrollSize(scroller);
|
const scrollSize = getScrollSize(scroller);
|
||||||
var scrollPos = getScrollPosition(scroller);
|
const scrollPos = getScrollPosition(scroller);
|
||||||
var scrollWidth = getScrollWidth(scroller);
|
const scrollWidth = getScrollWidth(scroller);
|
||||||
|
|
||||||
updateScrollButtons(scrollButtons, scrollSize, scrollPos, scrollWidth);
|
updateScrollButtons(scrollButtons, scrollSize, scrollPos, scrollWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getStyleValue(style, name) {
|
function getStyleValue(style, name) {
|
||||||
var value = style.getPropertyValue(name);
|
let value = style.getPropertyValue(name);
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -84,20 +89,20 @@ define(['layoutManager', 'dom', 'css!./emby-scrollbuttons', 'registerElement', '
|
||||||
}
|
}
|
||||||
|
|
||||||
function getScrollSize(elem) {
|
function getScrollSize(elem) {
|
||||||
var scrollSize = elem.offsetWidth;
|
let scrollSize = elem.offsetWidth;
|
||||||
var style = window.getComputedStyle(elem, null);
|
let style = window.getComputedStyle(elem, null);
|
||||||
|
|
||||||
var paddingLeft = getStyleValue(style, 'padding-left');
|
let paddingLeft = getStyleValue(style, 'padding-left');
|
||||||
if (paddingLeft) {
|
if (paddingLeft) {
|
||||||
scrollSize -= paddingLeft;
|
scrollSize -= paddingLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
var paddingRight = getStyleValue(style, 'padding-right');
|
let paddingRight = getStyleValue(style, 'padding-right');
|
||||||
if (paddingRight) {
|
if (paddingRight) {
|
||||||
scrollSize -= paddingRight;
|
scrollSize -= paddingRight;
|
||||||
}
|
}
|
||||||
|
|
||||||
var slider = elem.getScrollSlider();
|
const slider = elem.getScrollSlider();
|
||||||
style = window.getComputedStyle(slider, null);
|
style = window.getComputedStyle(slider, null);
|
||||||
|
|
||||||
paddingLeft = getStyleValue(style, 'padding-left');
|
paddingLeft = getStyleValue(style, 'padding-left');
|
||||||
|
@ -114,14 +119,14 @@ define(['layoutManager', 'dom', 'css!./emby-scrollbuttons', 'registerElement', '
|
||||||
}
|
}
|
||||||
|
|
||||||
function onScrollButtonClick(e) {
|
function onScrollButtonClick(e) {
|
||||||
var scroller = this.parentNode.nextSibling;
|
let scroller = this.parentNode.nextSibling;
|
||||||
|
|
||||||
var direction = this.getAttribute('data-direction');
|
const direction = this.getAttribute('data-direction');
|
||||||
var scrollSize = getScrollSize(scroller);
|
const scrollSize = getScrollSize(scroller);
|
||||||
var scrollPos = getScrollPosition(scroller);
|
const scrollPos = getScrollPosition(scroller);
|
||||||
var scrollWidth = getScrollWidth(scroller);
|
const scrollWidth = getScrollWidth(scroller);
|
||||||
|
|
||||||
var newPos;
|
let newPos;
|
||||||
if (direction === 'left') {
|
if (direction === 'left') {
|
||||||
newPos = Math.max(0, scrollPos - scrollSize);
|
newPos = Math.max(0, scrollPos - scrollSize);
|
||||||
} else {
|
} else {
|
||||||
|
@ -132,21 +137,21 @@ define(['layoutManager', 'dom', 'css!./emby-scrollbuttons', 'registerElement', '
|
||||||
}
|
}
|
||||||
|
|
||||||
EmbyScrollButtonsPrototype.attachedCallback = function () {
|
EmbyScrollButtonsPrototype.attachedCallback = function () {
|
||||||
var scroller = this.nextSibling;
|
const scroller = this.nextSibling;
|
||||||
this.scroller = scroller;
|
this.scroller = scroller;
|
||||||
|
|
||||||
var parent = this.parentNode;
|
const parent = this.parentNode;
|
||||||
parent.classList.add('emby-scroller-container');
|
parent.classList.add('emby-scroller-container');
|
||||||
|
|
||||||
this.innerHTML = getScrollButtonHtml('left') + getScrollButtonHtml('right');
|
this.innerHTML = getScrollButtonHtml('left') + getScrollButtonHtml('right');
|
||||||
|
|
||||||
var buttons = this.querySelectorAll('.emby-scrollbuttons-button');
|
const buttons = this.querySelectorAll('.emby-scrollbuttons-button');
|
||||||
buttons[0].addEventListener('click', onScrollButtonClick);
|
buttons[0].addEventListener('click', onScrollButtonClick);
|
||||||
buttons[1].addEventListener('click', onScrollButtonClick);
|
buttons[1].addEventListener('click', onScrollButtonClick);
|
||||||
this.scrollButtonsLeft = buttons[0];
|
this.scrollButtonsLeft = buttons[0];
|
||||||
this.scrollButtonsRight = buttons[1];
|
this.scrollButtonsRight = buttons[1];
|
||||||
|
|
||||||
var scrollHandler = onScroll.bind(this);
|
const scrollHandler = onScroll.bind(this);
|
||||||
this.scrollHandler = scrollHandler;
|
this.scrollHandler = scrollHandler;
|
||||||
scroller.addScrollEventListener(scrollHandler, {
|
scroller.addScrollEventListener(scrollHandler, {
|
||||||
capture: false,
|
capture: false,
|
||||||
|
@ -155,10 +160,10 @@ define(['layoutManager', 'dom', 'css!./emby-scrollbuttons', 'registerElement', '
|
||||||
};
|
};
|
||||||
|
|
||||||
EmbyScrollButtonsPrototype.detachedCallback = function () {
|
EmbyScrollButtonsPrototype.detachedCallback = function () {
|
||||||
var parent = this.scroller;
|
const parent = this.scroller;
|
||||||
this.scroller = null;
|
this.scroller = null;
|
||||||
|
|
||||||
var scrollHandler = this.scrollHandler;
|
let scrollHandler = this.scrollHandler;
|
||||||
if (parent && scrollHandler) {
|
if (parent && scrollHandler) {
|
||||||
parent.removeScrollEventListener(scrollHandler, {
|
parent.removeScrollEventListener(scrollHandler, {
|
||||||
capture: false,
|
capture: false,
|
||||||
|
@ -175,4 +180,5 @@ define(['layoutManager', 'dom', 'css!./emby-scrollbuttons', 'registerElement', '
|
||||||
prototype: EmbyScrollButtonsPrototype,
|
prototype: EmbyScrollButtonsPrototype,
|
||||||
extends: 'div'
|
extends: 'div'
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
define(['layoutManager', 'browser', 'actionsheet', 'css!./emby-select', 'registerElement'], function (layoutManager, browser, actionsheet) {
|
import layoutManager from 'layoutManager';
|
||||||
'use strict';
|
import browser from 'browser';
|
||||||
|
import actionsheet from 'actionsheet';
|
||||||
|
import 'css!./emby-select';
|
||||||
|
import 'registerElement';
|
||||||
|
|
||||||
var EmbySelectPrototype = Object.create(HTMLSelectElement.prototype);
|
/* eslint-disable indent */
|
||||||
|
|
||||||
|
const EmbySelectPrototype = Object.create(HTMLSelectElement.prototype);
|
||||||
|
|
||||||
function enableNativeMenu() {
|
function enableNativeMenu() {
|
||||||
|
|
||||||
|
@ -27,7 +32,7 @@ define(['layoutManager', 'browser', 'actionsheet', 'css!./emby-select', 'registe
|
||||||
}
|
}
|
||||||
|
|
||||||
function triggerChange(select) {
|
function triggerChange(select) {
|
||||||
var evt = document.createEvent('HTMLEvents');
|
const evt = document.createEvent('HTMLEvents');
|
||||||
evt.initEvent('change', false, true);
|
evt.initEvent('change', false, true);
|
||||||
select.dispatchEvent(evt);
|
select.dispatchEvent(evt);
|
||||||
}
|
}
|
||||||
|
@ -39,8 +44,8 @@ define(['layoutManager', 'browser', 'actionsheet', 'css!./emby-select', 'registe
|
||||||
|
|
||||||
function showActionSheet(select) {
|
function showActionSheet(select) {
|
||||||
|
|
||||||
var labelElem = getLabel(select);
|
const labelElem = getLabel(select);
|
||||||
var title = labelElem ? (labelElem.textContent || labelElem.innerText) : null;
|
const title = labelElem ? (labelElem.textContent || labelElem.innerText) : null;
|
||||||
|
|
||||||
actionsheet.show({
|
actionsheet.show({
|
||||||
items: select.options,
|
items: select.options,
|
||||||
|
@ -54,7 +59,7 @@ define(['layoutManager', 'browser', 'actionsheet', 'css!./emby-select', 'registe
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLabel(select) {
|
function getLabel(select) {
|
||||||
var elem = select.previousSibling;
|
let elem = select.previousSibling;
|
||||||
while (elem && elem.tagName !== 'LABEL') {
|
while (elem && elem.tagName !== 'LABEL') {
|
||||||
elem = elem.previousSibling;
|
elem = elem.previousSibling;
|
||||||
}
|
}
|
||||||
|
@ -62,21 +67,20 @@ define(['layoutManager', 'browser', 'actionsheet', 'css!./emby-select', 'registe
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFocus(e) {
|
function onFocus(e) {
|
||||||
var label = getLabel(this);
|
const label = getLabel(this);
|
||||||
if (label) {
|
if (label) {
|
||||||
label.classList.add('selectLabelFocused');
|
label.classList.add('selectLabelFocused');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onBlur(e) {
|
function onBlur(e) {
|
||||||
var label = getLabel(this);
|
const label = getLabel(this);
|
||||||
if (label) {
|
if (label) {
|
||||||
label.classList.remove('selectLabelFocused');
|
label.classList.remove('selectLabelFocused');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMouseDown(e) {
|
function onMouseDown(e) {
|
||||||
|
|
||||||
// e.button=0 for primary (left) mouse button click
|
// e.button=0 for primary (left) mouse button click
|
||||||
if (!e.button && !enableNativeMenu()) {
|
if (!e.button && !enableNativeMenu()) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -85,9 +89,7 @@ define(['layoutManager', 'browser', 'actionsheet', 'css!./emby-select', 'registe
|
||||||
}
|
}
|
||||||
|
|
||||||
function onKeyDown(e) {
|
function onKeyDown(e) {
|
||||||
|
|
||||||
switch (e.keyCode) {
|
switch (e.keyCode) {
|
||||||
|
|
||||||
case 13:
|
case 13:
|
||||||
if (!enableNativeMenu()) {
|
if (!enableNativeMenu()) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -107,7 +109,7 @@ define(['layoutManager', 'browser', 'actionsheet', 'css!./emby-select', 'registe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var inputId = 0;
|
let inputId = 0;
|
||||||
|
|
||||||
EmbySelectPrototype.createdCallback = function () {
|
EmbySelectPrototype.createdCallback = function () {
|
||||||
|
|
||||||
|
@ -137,7 +139,7 @@ define(['layoutManager', 'browser', 'actionsheet', 'css!./emby-select', 'registe
|
||||||
|
|
||||||
this.classList.add('emby-select');
|
this.classList.add('emby-select');
|
||||||
|
|
||||||
var label = this.ownerDocument.createElement('label');
|
const label = this.ownerDocument.createElement('label');
|
||||||
label.innerHTML = this.getAttribute('label') || '';
|
label.innerHTML = this.getAttribute('label') || '';
|
||||||
label.classList.add('selectLabel');
|
label.classList.add('selectLabel');
|
||||||
label.htmlFor = this.id;
|
label.htmlFor = this.id;
|
||||||
|
@ -150,7 +152,7 @@ define(['layoutManager', 'browser', 'actionsheet', 'css!./emby-select', 'registe
|
||||||
|
|
||||||
EmbySelectPrototype.setLabel = function (text) {
|
EmbySelectPrototype.setLabel = function (text) {
|
||||||
|
|
||||||
var label = this.parentNode.querySelector('label');
|
const label = this.parentNode.querySelector('label');
|
||||||
|
|
||||||
label.innerHTML = text;
|
label.innerHTML = text;
|
||||||
};
|
};
|
||||||
|
@ -159,4 +161,5 @@ define(['layoutManager', 'browser', 'actionsheet', 'css!./emby-select', 'registe
|
||||||
prototype: EmbySelectPrototype,
|
prototype: EmbySelectPrototype,
|
||||||
extends: 'select'
|
extends: 'select'
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue