mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Disallow block padding
This commit is contained in:
parent
454b81a037
commit
5e1b6acffe
126 changed files with 2 additions and 2127 deletions
|
@ -15,12 +15,10 @@ import 'emby-checkbox';
|
|||
const numConfigurableSections = 7;
|
||||
|
||||
function renderViews(page, user, result) {
|
||||
|
||||
let folderHtml = '';
|
||||
|
||||
folderHtml += '<div class="checkboxList">';
|
||||
folderHtml += result.map(i => {
|
||||
|
||||
let currentHtml = '';
|
||||
|
||||
const id = `chkGroupFolder${i.Id}`;
|
||||
|
@ -35,7 +33,6 @@ import 'emby-checkbox';
|
|||
currentHtml += '</label>';
|
||||
|
||||
return currentHtml;
|
||||
|
||||
}).join('');
|
||||
|
||||
folderHtml += '</div>';
|
||||
|
@ -44,7 +41,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function getLandingScreenOptions(type) {
|
||||
|
||||
const list = [];
|
||||
|
||||
if (type === 'movies') {
|
||||
|
@ -133,9 +129,7 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function getLandingScreenOptionsHtml(type, userValue) {
|
||||
|
||||
return getLandingScreenOptions(type).map(o => {
|
||||
|
||||
const selected = userValue === o.value || (o.isDefault && !userValue);
|
||||
const selectedHtml = selected ? ' selected' : '';
|
||||
const optionValue = o.isDefault ? '' : o.value;
|
||||
|
@ -145,11 +139,9 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function renderViewOrder(context, user, result) {
|
||||
|
||||
let html = '';
|
||||
|
||||
html += result.Items.map((view) => {
|
||||
|
||||
let currentHtml = '';
|
||||
|
||||
currentHtml += `<div class="listItem viewItem" data-viewid="${view.Id}">`;
|
||||
|
@ -170,16 +162,13 @@ import 'emby-checkbox';
|
|||
currentHtml += '</div>';
|
||||
|
||||
return currentHtml;
|
||||
|
||||
}).join('');
|
||||
|
||||
context.querySelector('.viewOrderList').innerHTML = html;
|
||||
}
|
||||
|
||||
function updateHomeSectionValues(context, userSettings) {
|
||||
|
||||
for (let i = 1; i <= 7; i++) {
|
||||
|
||||
const select = context.querySelector(`#selectHomeSection${i}`);
|
||||
const defaultValue = homeSections.getDefaultSection(i - 1);
|
||||
|
||||
|
@ -200,7 +189,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function getPerLibrarySettingsHtml(item, user, userSettings, apiClient) {
|
||||
|
||||
let html = '';
|
||||
|
||||
let isChecked;
|
||||
|
@ -217,7 +205,6 @@ import 'emby-checkbox';
|
|||
|
||||
const excludeFromLatest = ['playlists', 'livetv', 'boxsets', 'channels'];
|
||||
if (!excludeFromLatest.includes(item.CollectionType || '')) {
|
||||
|
||||
isChecked = !user.Configuration.LatestItemsExcludes.includes(item.Id);
|
||||
html += '<label class="fldIncludeInLatest">';
|
||||
html += `<input type="checkbox" is="emby-checkbox" class="chkIncludeInLatest" data-folderid="${item.Id}"${isChecked ? ' checked="checked"' : ''}/>`;
|
||||
|
@ -226,12 +213,10 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
if (html) {
|
||||
|
||||
html = `<div class="checkboxListContainer">${html}</div>`;
|
||||
}
|
||||
|
||||
if (item.CollectionType === 'movies' || item.CollectionType === 'tvshows' || item.CollectionType === 'music' || item.CollectionType === 'livetv') {
|
||||
|
||||
const idForLanding = item.CollectionType === 'livetv' ? item.CollectionType : item.Id;
|
||||
html += '<div class="selectContainer">';
|
||||
html += `<select is="emby-select" class="selectLanding" data-folderid="${idForLanding}" label="${globalize.translate('LabelDefaultScreen')}">`;
|
||||
|
@ -245,7 +230,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
if (html) {
|
||||
|
||||
let prefix = '';
|
||||
prefix += '<div class="verticalSection">';
|
||||
|
||||
|
@ -261,12 +245,10 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function renderPerLibrarySettings(context, user, userViews, userSettings, apiClient) {
|
||||
|
||||
const elem = context.querySelector('.perLibrarySettings');
|
||||
let html = '';
|
||||
|
||||
for (let i = 0, length = userViews.length; i < length; i++) {
|
||||
|
||||
html += getPerLibrarySettingsHtml(userViews[i], user, userSettings, apiClient);
|
||||
}
|
||||
|
||||
|
@ -274,7 +256,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function loadForm(context, user, userSettings, apiClient) {
|
||||
|
||||
context.querySelector('.chkHidePlayedFromLatest').checked = user.Configuration.HidePlayedInLatest || false;
|
||||
|
||||
updateHomeSectionValues(context, userSettings);
|
||||
|
@ -283,7 +264,6 @@ import 'emby-checkbox';
|
|||
const promise2 = apiClient.getJSON(apiClient.getUrl(`Users/${user.Id}/GroupingOptions`));
|
||||
|
||||
Promise.all([promise1, promise2]).then(responses => {
|
||||
|
||||
renderViewOrder(context, user, responses[0]);
|
||||
|
||||
renderPerLibrarySettings(context, user, responses[0].Items, userSettings, apiClient);
|
||||
|
@ -295,7 +275,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function onSectionOrderListClick(e) {
|
||||
|
||||
const target = dom.parentWithClass(e.target, 'btnViewItemMove');
|
||||
|
||||
if (target) {
|
||||
|
@ -303,7 +282,6 @@ import 'emby-checkbox';
|
|||
|
||||
if (viewItem) {
|
||||
if (target.classList.contains('btnViewItemDown')) {
|
||||
|
||||
const next = viewItem.nextSibling;
|
||||
|
||||
if (next) {
|
||||
|
@ -311,9 +289,7 @@ import 'emby-checkbox';
|
|||
next.parentNode.insertBefore(viewItem, next.nextSibling);
|
||||
focusManager.focus(e.target);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
const prev = viewItem.previousSibling;
|
||||
|
||||
if (prev) {
|
||||
|
@ -327,37 +303,30 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function getCheckboxItems(selector, context, isChecked) {
|
||||
|
||||
const inputs = context.querySelectorAll(selector);
|
||||
const list = [];
|
||||
|
||||
for (let i = 0, length = inputs.length; i < length; i++) {
|
||||
|
||||
if (inputs[i].checked === isChecked) {
|
||||
list.push(inputs[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
function saveUser(context, user, userSettingsInstance, apiClient) {
|
||||
|
||||
user.Configuration.HidePlayedInLatest = context.querySelector('.chkHidePlayedFromLatest').checked;
|
||||
|
||||
user.Configuration.LatestItemsExcludes = getCheckboxItems('.chkIncludeInLatest', context, false).map(i => {
|
||||
|
||||
return i.getAttribute('data-folderid');
|
||||
});
|
||||
|
||||
user.Configuration.MyMediaExcludes = getCheckboxItems('.chkIncludeInMyMedia', context, false).map(i => {
|
||||
|
||||
return i.getAttribute('data-folderid');
|
||||
});
|
||||
|
||||
user.Configuration.GroupedFolders = getCheckboxItems('.chkGroupFolder', context, true).map(i => {
|
||||
|
||||
return i.getAttribute('data-folderid');
|
||||
});
|
||||
|
||||
|
@ -391,13 +360,10 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function save(instance, context, userId, userSettings, apiClient, enableSaveConfirmation) {
|
||||
|
||||
loading.show();
|
||||
|
||||
apiClient.getUser(userId).then(user => {
|
||||
|
||||
saveUser(context, user, userSettings, apiClient).then(() => {
|
||||
|
||||
loading.hide();
|
||||
if (enableSaveConfirmation) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
|
@ -406,7 +372,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
events.trigger(instance, 'saved');
|
||||
|
||||
}, () => {
|
||||
loading.hide();
|
||||
});
|
||||
|
@ -414,14 +379,12 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function onSubmit(e) {
|
||||
|
||||
const self = this;
|
||||
const apiClient = connectionManager.getApiClient(self.options.serverId);
|
||||
const userId = self.options.userId;
|
||||
const userSettings = self.options.userSettings;
|
||||
|
||||
userSettings.setUserInfo(userId, apiClient).then(() => {
|
||||
|
||||
const enableSaveConfirmation = self.options.enableSaveConfirmation;
|
||||
save(self, self.options.element, userId, userSettings, apiClient, enableSaveConfirmation);
|
||||
});
|
||||
|
@ -434,7 +397,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function onChange(e) {
|
||||
|
||||
const chkIncludeInMyMedia = dom.parentWithClass(e.target, 'chkIncludeInMyMedia');
|
||||
if (!chkIncludeInMyMedia) {
|
||||
return;
|
||||
|
@ -452,9 +414,7 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function embed(options, self) {
|
||||
|
||||
return import('text!./homeScreenSettings.template.html').then(({default: template}) => {
|
||||
|
||||
for (let i = 1; i <= numConfigurableSections; i++) {
|
||||
template = template.replace(`{section${i}label}`, globalize.translate('LabelHomeScreenSectionValue', i));
|
||||
}
|
||||
|
@ -486,7 +446,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
loadData(autoFocus) {
|
||||
|
||||
const self = this;
|
||||
const context = self.options.element;
|
||||
|
||||
|
@ -497,9 +456,7 @@ import 'emby-checkbox';
|
|||
const userSettings = self.options.userSettings;
|
||||
|
||||
apiClient.getUser(userId).then(user => {
|
||||
|
||||
userSettings.setUserInfo(userId, apiClient).then(() => {
|
||||
|
||||
self.dataLoaded = true;
|
||||
|
||||
loadForm(context, user, userSettings, apiClient);
|
||||
|
@ -516,7 +473,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
destroy() {
|
||||
|
||||
this.options = null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue