Merge pull request #2122 from thornbill/static-html-imports

Use static imports for html templates
This commit is contained in:
Bill Thornton 2020-11-26 01:41:54 -05:00 committed by GitHub
commit 6235c138e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 1015 additions and 1057 deletions

View File

@ -12,6 +12,7 @@ import globalize from '../../scripts/globalize';
import '../../elements/emby-select/emby-select';
import '../../elements/emby-button/paper-icon-button-light';
import '../formdialog.css';
import template from './accessSchedule.template.html';
function getDisplayTime(hours) {
let minutes = 0;
@ -60,7 +61,6 @@ import '../formdialog.css';
export function show(options) {
return new Promise((resolve, reject) => {
import('./accessSchedule.template.html').then(({default: template}) => {
const dlg = dialogHelper.createDialog({
removeOnClose: true,
size: 'small'
@ -88,7 +88,6 @@ import '../formdialog.css';
return false;
});
});
});
}
/* eslint-enable indent */

View File

@ -9,10 +9,11 @@ import '../../elements/emby-button/paper-icon-button-light';
import '../../elements/emby-input/emby-input';
import '../formdialog.css';
import '../../assets/css/flexstyles.scss';
import template from './dialog.template.html';
/* eslint-disable indent */
function showDialog(options, template) {
function showDialog(options) {
const dialogOptions = {
removeOnClose: true,
scrollY: false
@ -117,7 +118,7 @@ import '../../assets/css/flexstyles.scss';
});
}
export async function show(text, title) {
export function show(text, title) {
let options;
if (typeof text === 'string') {
options = {
@ -128,10 +129,7 @@ import '../../assets/css/flexstyles.scss';
options = text;
}
const { default: template } = await import('./dialog.template.html');
return new Promise((resolve, reject) => {
showDialog(options, template).then(resolve, reject);
});
return showDialog(options);
}
/* eslint-enable indent */

View File

@ -13,6 +13,7 @@ import '../../elements/emby-checkbox/emby-checkbox';
import '../../elements/emby-button/emby-button';
import ServerConnections from '../ServerConnections';
import toast from '../toast/toast';
import template from './displaySettings.template.html';
/* eslint-disable indent */
@ -197,8 +198,7 @@ import toast from '../toast/toast';
return false;
}
async function embed(options, self) {
const { default: template } = await import('./displaySettings.template.html');
function embed(options, self) {
options.element.innerHTML = globalize.translateHtml(template, 'core');
options.element.querySelector('form').addEventListener('submit', onSubmit.bind(self));
if (options.enableSaveButton) {

View File

@ -6,6 +6,7 @@ import '../../elements/emby-checkbox/emby-checkbox';
import '../../elements/emby-collapse/emby-collapse';
import './style.css';
import ServerConnections from '../ServerConnections';
import template from './filterdialog.template.html';
/* eslint-disable indent */
function renderOptions(context, selector, cssClass, items, isCheckedFn) {
@ -402,7 +403,6 @@ import ServerConnections from '../ServerConnections';
}
show() {
return import('./filterdialog.template.html').then(({default: template}) => {
return new Promise((resolve) => {
const dlg = dialogHelper.createDialog({
removeOnClose: true,
@ -424,7 +424,6 @@ import ServerConnections from '../ServerConnections';
loadDynamicFilters(dlg, apiClient, apiClient.getCurrentUserId(), this.options.query);
}
});
});
}
}

View File

@ -14,6 +14,7 @@ import 'material-design-icons-iconfont';
import '../formdialog.css';
import '../../assets/css/flexstyles.scss';
import ServerConnections from '../ServerConnections';
import template from './filtermenu.template.html';
function onSubmit(e) {
e.preventDefault();
@ -210,7 +211,6 @@ function loadDynamicFilters(context, options) {
class FilterMenu {
show(options) {
return new Promise( (resolve, reject) => {
import('./filtermenu.template.html').then(({ default: template }) => {
const dialogOptions = {
removeOnClose: true,
scrollY: false
@ -280,7 +280,6 @@ class FilterMenu {
return resolve();
});
});
});
}
}

View File

@ -7,6 +7,7 @@ import '../../elements/emby-checkbox/emby-checkbox';
import '../../elements/emby-radio/emby-radio';
import '../formdialog.css';
import 'material-design-icons-iconfont';
import template from './guide-settings.template.html';
function saveCategories(context, options) {
const categories = [];
@ -88,7 +89,6 @@ function showEditor(options) {
return new Promise(function (resolve, reject) {
let settingsChanged = false;
import('./guide-settings.template.html').then(({ default: template }) => {
const dialogOptions = {
removeOnClose: true,
scrollY: false
@ -141,7 +141,6 @@ function showEditor(options) {
loadCategories(dlg, options);
dialogHelper.open(dlg);
});
});
}
export default {

View File

@ -25,6 +25,7 @@ import '../../elements/emby-scroller/emby-scroller';
import '../../assets/css/flexstyles.scss';
import 'webcomponents.js/webcomponents-lite';
import ServerConnections from '../ServerConnections';
import template from './tvguide.template.html';
function showViewSettings(instance) {
import('./guide-settings').then(({default: guideSettingsDialog}) => {
@ -142,7 +143,6 @@ function Guide(options) {
let autoRefreshInterval;
let programCells;
let lastFocusDirection;
let programGrid;
self.refresh = function () {
currentDate = null;
@ -772,13 +772,13 @@ function Guide(options) {
let lastGridScroll = 0;
let lastHeaderScroll = 0;
let scrollXPct = 0;
function onProgramGridScroll(context, elem, timeslotHeaders) {
function onProgramGridScroll(context, elem, headers) {
if ((new Date().getTime() - lastHeaderScroll) >= 1000) {
lastGridScroll = new Date().getTime();
const scrollLeft = elem.scrollLeft;
scrollXPct = (scrollLeft * 100) / elem.scrollWidth;
nativeScrollTo(timeslotHeaders, scrollLeft, true);
nativeScrollTo(headers, scrollLeft, true);
}
updateProgramCellsOnScroll(elem, programCells);
@ -1092,18 +1092,17 @@ function Guide(options) {
}
}
import('./tvguide.template.html').then(({default: template}) => {
const context = options.element;
const guideContext = options.element;
context.classList.add('tvguide');
guideContext.classList.add('tvguide');
context.innerHTML = globalize.translateHtml(template, 'core');
guideContext.innerHTML = globalize.translateHtml(template, 'core');
programGrid = context.querySelector('.programGrid');
const timeslotHeaders = context.querySelector('.timeslotHeaders');
const programGrid = guideContext.querySelector('.programGrid');
const timeslotHeaders = guideContext.querySelector('.timeslotHeaders');
if (layoutManager.tv) {
dom.addEventListener(context.querySelector('.guideVerticalScroller'), 'focus', onScrollerFocus, {
dom.addEventListener(guideContext.querySelector('.guideVerticalScroller'), 'focus', onScrollerFocus, {
capture: true,
passive: true
});
@ -1112,43 +1111,43 @@ function Guide(options) {
}
if (browser.iOS || browser.osx) {
context.querySelector('.channelsContainer').classList.add('noRubberBanding');
guideContext.querySelector('.channelsContainer').classList.add('noRubberBanding');
programGrid.classList.add('noRubberBanding');
}
dom.addEventListener(programGrid, 'scroll', function (e) {
onProgramGridScroll(context, this, timeslotHeaders);
onProgramGridScroll(guideContext, this, timeslotHeaders);
}, {
passive: true
});
dom.addEventListener(timeslotHeaders, 'scroll', function () {
onTimeslotHeadersScroll(context, this);
onTimeslotHeadersScroll(guideContext, this);
}, {
passive: true
});
programGrid.addEventListener('click', onProgramGridClick);
context.querySelector('.btnNextPage').addEventListener('click', function () {
guideContext.querySelector('.btnNextPage').addEventListener('click', function () {
currentStartIndex += currentChannelLimit;
reloadPage(context);
reloadPage(guideContext);
restartAutoRefresh();
});
context.querySelector('.btnPreviousPage').addEventListener('click', function () {
guideContext.querySelector('.btnPreviousPage').addEventListener('click', function () {
currentStartIndex = Math.max(currentStartIndex - currentChannelLimit, 0);
reloadPage(context);
reloadPage(guideContext);
restartAutoRefresh();
});
context.querySelector('.btnGuideViewSettings').addEventListener('click', function () {
guideContext.querySelector('.btnGuideViewSettings').addEventListener('click', function () {
showViewSettings(self);
restartAutoRefresh();
});
context.querySelector('.guideDateTabs').addEventListener('tabchange', function (e) {
guideContext.querySelector('.guideDateTabs').addEventListener('tabchange', function (e) {
const allTabButtons = e.target.querySelectorAll('.guide-date-tab-button');
const tabButton = allTabButtons[parseInt(e.detail.selectedTabIndex)];
@ -1177,12 +1176,12 @@ function Guide(options) {
let startTimeOfDayMs = (date.getHours() * 60 * 60 * 1000);
startTimeOfDayMs += (date.getMinutes() * 60 * 1000);
changeDate(context, date, scrollToTimeMs, scrollToTimeMs, startTimeOfDayMs, false);
changeDate(guideContext, date, scrollToTimeMs, scrollToTimeMs, startTimeOfDayMs, false);
}
});
setScrollEvents(context, true);
itemShortcuts.on(context);
setScrollEvents(guideContext, true);
itemShortcuts.on(guideContext);
Events.trigger(self, 'load');
@ -1192,7 +1191,6 @@ function Guide(options) {
Events.on(serverNotifications, 'SeriesTimerCancelled', onSeriesTimerCancelled);
self.refresh();
});
}
export default Guide;

View File

@ -11,6 +11,7 @@ import '../../elements/emby-select/emby-select';
import '../../elements/emby-checkbox/emby-checkbox';
import ServerConnections from '../ServerConnections';
import toast from '../toast/toast';
import template from './homeScreenSettings.template.html';
/* eslint-disable indent */
@ -418,12 +419,12 @@ import toast from '../toast/toast';
}
function embed(options, self) {
return import('./homeScreenSettings.template.html').then(({default: template}) => {
let workingTemplate = template;
for (let i = 1; i <= numConfigurableSections; i++) {
template = template.replace(`{section${i}label}`, globalize.translate('LabelHomeScreenSectionValue', i));
workingTemplate = workingTemplate.replace(`{section${i}label}`, globalize.translate('LabelHomeScreenSectionValue', i));
}
options.element.innerHTML = globalize.translateHtml(template, 'core');
options.element.innerHTML = globalize.translateHtml(workingTemplate, 'core');
options.element.querySelector('.viewOrderList').addEventListener('click', onSectionOrderListClick);
options.element.querySelector('form').addEventListener('submit', onSubmit.bind(self));
@ -440,7 +441,6 @@ import toast from '../toast/toast';
}
self.loadData(options.autoFocus);
});
}
class HomeScreenSettings {

View File

@ -13,6 +13,7 @@ import '../../elements/emby-button/emby-button';
import '../formdialog.css';
import '../cardbuilder/card.css';
import ServerConnections from '../ServerConnections';
import template from './imageDownloader.template.html';
/* eslint-disable indent */
@ -316,7 +317,6 @@ import ServerConnections from '../ServerConnections';
function showEditor(itemId, serverId, itemType) {
loading.show();
import('./imageDownloader.template.html').then(({default: template}) => {
const apiClient = ServerConnections.getApiClient(serverId);
currentItemId = itemId;
@ -353,7 +353,6 @@ import ServerConnections from '../ServerConnections';
});
reloadBrowsableImages(editorContent, apiClient);
});
}
function onDialogClosed() {

View File

@ -17,6 +17,7 @@ import '../formdialog.css';
import './style.css';
import ServerConnections from '../ServerConnections';
import toast from '../toast/toast';
import template from './imageUploader.template.html';
let currentItemId;
let currentServerId;
@ -128,7 +129,6 @@ import toast from '../toast/toast';
function showEditor(options, resolve) {
options = options || {};
return import('./imageUploader.template.html').then(({default: template}) => {
currentItemId = options.itemId;
currentServerId = options.serverId;
@ -171,7 +171,6 @@ import toast from '../toast/toast';
dlg.querySelector('.btnCancel').addEventListener('click', () => {
dialogHelper.close(dlg);
});
});
}
export function show(options) {

View File

@ -16,6 +16,7 @@ import './imageeditor.css';
import ServerConnections from '../ServerConnections';
import alert from '../alert';
import confirm from '../confirm/confirm';
import template from './imageeditor.template.html';
/* eslint-disable indent */
@ -419,7 +420,6 @@ import confirm from '../confirm/confirm';
loading.show();
import('./imageeditor.template.html').then(({default: template}) => {
const apiClient = ServerConnections.getApiClient(serverId);
apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(function (item) {
const dialogOptions = {
@ -467,7 +467,6 @@ import confirm from '../confirm/confirm';
dialogHelper.close(dlg);
});
});
});
}
export function show (options) {

View File

@ -17,6 +17,7 @@ import '../formdialog.css';
import 'material-design-icons-iconfont';
import '../../assets/css/flexstyles.scss';
import ServerConnections from '../ServerConnections';
import template from './itemMediaInfo.template.html';
function setMediaInfo(user, page, item) {
let html = item.MediaSources.map(version => {
@ -162,7 +163,7 @@ import ServerConnections from '../ServerConnections';
return `<span class="mediaInfoLabel">${label}</span><span class="mediaInfoAttribute">${value}</span>`;
}
function loadMediaInfo(itemId, serverId, template) {
function loadMediaInfo(itemId, serverId) {
const apiClient = ServerConnections.getApiClient(serverId);
return apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(item => {
const dialogOptions = {
@ -194,11 +195,7 @@ import ServerConnections from '../ServerConnections';
export function show(itemId, serverId) {
loading.show();
return import('./itemMediaInfo.template.html').then(({default: template}) => {
return new Promise((resolve, reject) => {
loadMediaInfo(itemId, serverId, template).then(resolve, reject);
});
});
return loadMediaInfo(itemId, serverId);
}
/* eslint-enable indent */

View File

@ -20,6 +20,7 @@ import 'material-design-icons-iconfont';
import '../cardbuilder/card.css';
import ServerConnections from '../ServerConnections';
import toast from '../toast/toast';
import template from './itemidentifier.template.html';
const enableFocusTransform = !browser.slow && !browser.edge;
@ -334,7 +335,6 @@ import toast from '../toast/toast';
function showEditor(itemId) {
loading.show();
return import('./itemidentifier.template.html').then(({default: template}) => {
const apiClient = getApiClient();
apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(item => {
@ -399,7 +399,6 @@ import toast from '../toast/toast';
showIdentificationForm(dlg, item);
loading.hide();
});
});
}
function onDialogClosed() {
@ -416,7 +415,6 @@ import toast from '../toast/toast';
currentItem = null;
currentItemType = itemType;
return import('./itemidentifier.template.html').then(({default: template}) => {
const dialogOptions = {
size: 'small',
removeOnClose: true,
@ -463,7 +461,6 @@ import toast from '../toast/toast';
dlg.classList.add('identifyDialog');
showIdentificationFormFindNew(dlg, itemName, itemYear, itemType);
});
}
function showIdentificationFormFindNew(dlg, itemName, itemYear, itemType) {

View File

@ -10,6 +10,7 @@ import dom from '../../scripts/dom';
import '../../elements/emby-checkbox/emby-checkbox';
import '../../elements/emby-select/emby-select';
import '../../elements/emby-input/emby-input';
import template from './libraryoptionseditor.template.html';
function populateLanguages(parent) {
return ApiClient.getCultures().then(languages => {
@ -363,8 +364,6 @@ import '../../elements/emby-input/emby-input';
const isNewLibrary = libraryOptions === null;
isNewLibrary && parent.classList.add('newlibrary');
const { default: template } = await import('./libraryoptionseditor.template.html');
parent.innerHTML = globalize.translateHtml(template);
populateRefreshInterval(parent.querySelector('#selectAutoRefreshInterval'));
const promises = [populateLanguages(parent), populateCountries(parent.querySelector('#selectCountry'))];

View File

@ -21,6 +21,7 @@ import '../formdialog.css';
import '../../assets/css/flexstyles.scss';
import toast from '../toast/toast';
import alert from '../alert';
import template from './mediaLibraryCreator.template.html';
function onAddLibrary() {
if (isCreating) {
@ -191,7 +192,6 @@ export class showEditor {
currentOptions = options;
currentResolve = resolve;
hasChanges = false;
import('./mediaLibraryCreator.template.html').then(({default: template}) => {
const dlg = dialogHelper.createDialog({
size: 'small',
modal: false,
@ -213,7 +213,6 @@ export class showEditor {
renderPaths(dlg);
initLibraryOptions(dlg);
});
});
}
}

View File

@ -19,6 +19,7 @@ import '../../elements/emby-toggle/emby-toggle';
import '../../assets/css/flexstyles.scss';
import toast from '../toast/toast';
import confirm from '../confirm/confirm';
import template from './mediaLibraryEditor.template.html';
function onEditLibrary() {
if (isCreating) {
@ -201,7 +202,6 @@ export class showEditor {
currentOptions = options;
currentDeferred = deferred;
hasChanges = false;
import('./mediaLibraryEditor.template.html').then(({default: template}) => {
const dlg = dialogHelper.createDialog({
size: 'small',
modal: false,
@ -221,7 +221,6 @@ export class showEditor {
dialogHelper.close(dlg);
});
refreshLibraryFromServer(dlg);
});
return deferred.promise();
}
}

View File

@ -19,6 +19,7 @@ import '../../assets/css/flexstyles.scss';
import ServerConnections from '../ServerConnections';
import toast from '../toast/toast';
import { appRouter } from '../appRouter';
import template from './metadataEditor.template.html';
/* eslint-disable indent */
@ -1028,7 +1029,6 @@ import { appRouter } from '../appRouter';
function show(itemId, serverId, resolve, reject) {
loading.show();
import('./metadataEditor.template.html').then(({default: template}) => {
const dialogOptions = {
removeOnClose: true,
scrollY: false
@ -1069,7 +1069,6 @@ import { appRouter } from '../appRouter';
init(dlg, ServerConnections.getApiClient(serverId));
reload(dlg, itemId, serverId);
});
}
export default {
@ -1083,7 +1082,6 @@ import { appRouter } from '../appRouter';
return new Promise(function (resolve, reject) {
loading.show();
import('./metadataEditor.template.html').then(({default: template}) => {
elem.innerHTML = globalize.translateHtml(template, 'core');
elem.querySelector('.formDialogFooter').classList.remove('formDialogFooter');
@ -1098,7 +1096,6 @@ import { appRouter } from '../appRouter';
focusManager.autoFocus(elem);
});
});
}
};

View File

@ -6,6 +6,7 @@ import '../../elements/emby-button/paper-icon-button-light';
import '../../elements/emby-input/emby-input';
import '../../elements/emby-select/emby-select';
import '../formdialog.css';
import template from './personEditor.template.html';
/* eslint-disable indent */
@ -18,7 +19,6 @@ import '../formdialog.css';
function show(person) {
return new Promise(function (resolve, reject) {
import('./personEditor.template.html').then(({default: template}) => {
const dialogOptions = {
removeOnClose: true,
scrollY: false
@ -92,7 +92,6 @@ import '../formdialog.css';
bubbles: true
}));
});
});
}
export default {

View File

@ -10,6 +10,7 @@ import '../../elements/emby-select/emby-select';
import '../../elements/emby-checkbox/emby-checkbox';
import ServerConnections from '../ServerConnections';
import toast from '../toast/toast';
import template from './playbackSettings.template.html';
/* eslint-disable indent */
@ -278,7 +279,6 @@ import toast from '../toast/toast';
}
function embed(options, self) {
return import('./playbackSettings.template.html').then(({default: template}) => {
options.element.innerHTML = globalize.translateHtml(template, 'core');
options.element.querySelector('form').addEventListener('submit', onSubmit.bind(self));
@ -292,7 +292,6 @@ import toast from '../toast/toast';
if (options.autoFocus) {
focusManager.autoFocus(options.element);
}
});
}
class PlaybackSettings {

View File

@ -9,6 +9,7 @@ import '../../elements/emby-button/emby-button';
import '../../elements/emby-button/paper-icon-button-light';
import '../../elements/emby-input/emby-input';
import '../formdialog.css';
import template from './prompt.template.html';
/* eslint-disable indent */
export default (() => {
@ -27,7 +28,7 @@ export default (() => {
txtInput.value = options.value || '';
}
function showDialog(options, template) {
function showDialog(options) {
const dialogOptions = {
removeOnClose: true,
scrollY: false
@ -116,17 +117,13 @@ export default (() => {
};
} else {
return options => {
return new Promise((resolve, reject) => {
import('./prompt.template.html').then(({default: template}) => {
if (typeof options === 'string') {
options = {
title: '',
text: options
};
}
showDialog(options, template).then(resolve, reject);
});
});
return showDialog(options);
};
}
})();

View File

@ -18,6 +18,7 @@ import './recordingcreator.css';
import 'material-design-icons-iconfont';
import ServerConnections from '../ServerConnections';
import { playbackManager } from '../playback/playbackmanager';
import template from './recordingcreator.template.html';
let currentDialog;
let closeAction;
@ -136,7 +137,6 @@ function showEditor(itemId, serverId) {
loading.show();
import('./recordingcreator.template.html').then(({ default: template }) => {
const dialogOptions = {
removeOnClose: true,
scrollY: false
@ -194,7 +194,6 @@ function showEditor(itemId, serverId) {
dialogHelper.open(dlg);
});
});
}
export default {

View File

@ -14,6 +14,7 @@ import './recordingcreator.css';
import 'material-design-icons-iconfont';
import '../../assets/css/flexstyles.scss';
import ServerConnections from '../ServerConnections';
import template from './recordingeditor.template.html';
let currentDialog;
let recordingDeleted = false;
@ -91,7 +92,6 @@ function showEditor(itemId, serverId, options) {
options = options || {};
currentResolve = resolve;
import('./recordingeditor.template.html').then(({default: template}) => {
const dialogOptions = {
removeOnClose: true,
scrollY: false
@ -148,7 +148,6 @@ function showEditor(itemId, serverId, options) {
dialogHelper.open(dlg);
});
});
}
export default {

View File

@ -10,6 +10,7 @@ import './recordingfields.css';
import '../../assets/css/flexstyles.scss';
import ServerConnections from '../ServerConnections';
import toast from '../toast/toast';
import template from './recordingfields.template.html';
/*eslint prefer-const: "error"*/
@ -119,7 +120,6 @@ class RecordingEditor {
embed() {
const self = this;
return new Promise(function (resolve, reject) {
import('./recordingfields.template.html').then(({default: template}) => {
const options = self.options;
const context = options.parent;
context.innerHTML = globalize.translateHtml(template, 'core');
@ -131,7 +131,6 @@ class RecordingEditor {
fetchData(self).then(resolve);
});
});
}
hasChanged() {

View File

@ -15,6 +15,7 @@ import './recordingcreator.css';
import 'material-design-icons-iconfont';
import '../../assets/css/flexstyles.scss';
import ServerConnections from '../ServerConnections';
import template from './seriesrecordingeditor.template.html';
/*eslint prefer-const: "error"*/
@ -151,7 +152,6 @@ function embed(itemId, serverId, options) {
loading.show();
options = options || {};
import('./seriesrecordingeditor.template.html').then(({ default: template }) => {
const dialogOptions = {
removeOnClose: true,
scrollY: false
@ -182,7 +182,6 @@ function embed(itemId, serverId, options) {
init(dlg);
reload(dlg, itemId);
});
}
function showEditor(itemId, serverId, options) {
@ -193,7 +192,6 @@ function showEditor(itemId, serverId, options) {
loading.show();
options = options || {};
import('./seriesrecordingeditor.template.html').then(({ default: template }) => {
const dialogOptions = {
removeOnClose: true,
scrollY: false
@ -253,7 +251,6 @@ function showEditor(itemId, serverId, options) {
dialogHelper.open(dlg);
});
});
}
export default {

View File

@ -7,6 +7,7 @@ import '../../elements/emby-input/emby-input';
import '../../assets/css/flexstyles.scss';
import 'material-design-icons-iconfont';
import './searchfields.css';
import template from './searchfields.template.html';
/* eslint-disable indent */
@ -61,7 +62,6 @@ import './searchfields.css';
}
function embed(elem, instance, options) {
import('./searchfields.template.html').then(({default: template}) => {
let html = globalize.translateHtml(template, 'core');
if (browser.tizen || browser.orsay) {
@ -84,7 +84,6 @@ import './searchfields.css';
txtSearch.addEventListener('input', onSearchInput.bind(instance));
instance.focus();
});
}
class SearchFields {

View File

@ -6,6 +6,7 @@ import '../../elements/emby-scroller/emby-scroller';
import '../../elements/emby-itemscontainer/emby-itemscontainer';
import '../../elements/emby-button/emby-button';
import ServerConnections from '../ServerConnections';
import template from './searchresults.template.html';
/* eslint-disable indent */
@ -585,19 +586,18 @@ import ServerConnections from '../ServerConnections';
}
function embed(elem, instance, options) {
import('./searchresults.template.html').then(({default: template}) => {
let workingTemplate = template;
if (!enableScrollX()) {
template = replaceAll(template, 'data-horizontal="true"', 'data-horizontal="false"');
template = replaceAll(template, 'itemsContainer scrollSlider', 'itemsContainer scrollSlider vertical-wrap');
workingTemplate = replaceAll(workingTemplate, 'data-horizontal="true"', 'data-horizontal="false"');
workingTemplate = replaceAll(workingTemplate, 'itemsContainer scrollSlider', 'itemsContainer scrollSlider vertical-wrap');
}
const html = globalize.translateHtml(template, 'core');
const html = globalize.translateHtml(workingTemplate, 'core');
elem.innerHTML = html;
elem.classList.add('searchResults');
instance.search('');
});
}
class SearchResults {

View File

@ -8,6 +8,7 @@ import 'material-design-icons-iconfont';
import '../formdialog.css';
import '../../elements/emby-button/emby-button';
import '../../assets/css/flexstyles.scss';
import template from './sortmenu.template.html';
function onSubmit(e) {
e.preventDefault();
@ -44,7 +45,6 @@ function saveValues(context, settingsKey) {
class SortMenu {
show(options) {
return new Promise(function (resolve, reject) {
import('./sortmenu.template.html').then(({default: template}) => {
const dialogOptions = {
removeOnClose: true,
scrollY: false
@ -103,7 +103,6 @@ class SortMenu {
reject();
});
});
});
}
}

View File

@ -17,6 +17,7 @@ import '../../assets/css/flexstyles.scss';
import ServerConnections from '../ServerConnections';
import toast from '../toast/toast';
import confirm from '../confirm/confirm';
import template from './subtitleeditor.template.html';
let currentItem;
let hasChanges;
@ -374,7 +375,7 @@ function onOpenUploadMenu(e) {
});
}
function showEditorInternal(itemId, serverId, template) {
function showEditorInternal(itemId, serverId) {
hasChanges = false;
const apiClient = ServerConnections.getApiClient(serverId);
@ -453,11 +454,7 @@ function showEditorInternal(itemId, serverId, template) {
function showEditor(itemId, serverId) {
loading.show();
return new Promise(function (resolve, reject) {
import('./subtitleeditor.template.html').then(({default: template}) => {
showEditorInternal(itemId, serverId, template).then(resolve, reject);
});
});
return showEditorInternal(itemId, serverId);
}
export default {

View File

@ -17,6 +17,7 @@ import '../../assets/css/flexstyles.scss';
import './subtitlesettings.css';
import ServerConnections from '../ServerConnections';
import toast from '../toast/toast';
import template from './subtitlesettings.template.html';
/**
* Subtitle settings.
@ -158,7 +159,6 @@ function hideSubtitlePreview(persistent) {
}
function embed(options, self) {
import('./subtitlesettings.template.html').then(({default: template}) => {
options.element.classList.add('subtitlesettings');
options.element.innerHTML = globalize.translateHtml(template, 'core');
@ -214,7 +214,6 @@ function embed(options, self) {
if (options.autoFocus) {
focusManager.autoFocus(options.element);
}
});
}
export class SubtitleSettings {

View File

@ -10,6 +10,7 @@ import '../../elements/emby-select/emby-select';
import 'material-design-icons-iconfont';
import '../formdialog.css';
import '../../assets/css/flexstyles.scss';
import template from './viewSettings.template.html';
function onSubmit(e) {
e.preventDefault();
@ -59,7 +60,6 @@ class ViewSettings {
}
show(options) {
return new Promise(function (resolve, reject) {
import('./viewSettings.template.html').then(({default: template}) => {
const dialogOptions = {
removeOnClose: true,
scrollY: false
@ -135,7 +135,6 @@ class ViewSettings {
reject();
});
});
});
}
}

View File

@ -1,5 +1,6 @@
import './emby-progressring.css';
import 'webcomponents.js/webcomponents-lite';
import template from './emby-progressring.template.html';
/* eslint-disable indent */
@ -9,7 +10,6 @@ import 'webcomponents.js/webcomponents-lite';
this.classList.add('progressring');
const instance = this;
import('./emby-progressring.template.html').then(({default: template}) => {
instance.innerHTML = template;
if (window.MutationObserver) {
@ -30,7 +30,6 @@ import 'webcomponents.js/webcomponents-lite';
}
instance.setProgress(parseFloat(instance.getAttribute('data-progress') || '0'));
});
};
EmbyProgressRing.setProgress = function (progress) {