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

Use static imports for html templates

This commit is contained in:
Bill Thornton 2020-11-25 00:17:24 -05:00
parent 75e1fc4605
commit d8f2cc1245
31 changed files with 1010 additions and 1041 deletions

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,30 +62,28 @@ import './searchfields.css';
}
function embed(elem, instance, options) {
import('./searchfields.template.html').then(({default: template}) => {
let html = globalize.translateHtml(template, 'core');
let html = globalize.translateHtml(template, 'core');
if (browser.tizen || browser.orsay) {
html = html.replace('<input ', '<input readonly ');
}
if (browser.tizen || browser.orsay) {
html = html.replace('<input ', '<input readonly ');
}
elem.innerHTML = html;
elem.innerHTML = html;
elem.classList.add('searchFields');
elem.classList.add('searchFields');
const txtSearch = elem.querySelector('.searchfields-txtSearch');
const txtSearch = elem.querySelector('.searchfields-txtSearch');
if (layoutManager.tv) {
const alphaPickerElement = elem.querySelector('.alphaPicker');
if (layoutManager.tv) {
const alphaPickerElement = elem.querySelector('.alphaPicker');
elem.querySelector('.alphaPicker').classList.remove('hide');
initAlphaPicker(alphaPickerElement, instance);
}
elem.querySelector('.alphaPicker').classList.remove('hide');
initAlphaPicker(alphaPickerElement, instance);
}
txtSearch.addEventListener('input', onSearchInput.bind(instance));
txtSearch.addEventListener('input', onSearchInput.bind(instance));
instance.focus();
});
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}) => {
if (!enableScrollX()) {
template = replaceAll(template, 'data-horizontal="true"', 'data-horizontal="false"');
template = replaceAll(template, 'itemsContainer scrollSlider', 'itemsContainer scrollSlider vertical-wrap');
}
let workingTemplate = template;
if (!enableScrollX()) {
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.innerHTML = html;
elem.classList.add('searchResults');
instance.search('');
});
elem.classList.add('searchResults');
instance.search('');
}
class SearchResults {