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

Force the use of single quotes

This commit is contained in:
MrTimscampi 2020-05-04 12:44:12 +02:00
parent 8b6dc05d64
commit 9e3ca706c4
217 changed files with 8541 additions and 8540 deletions

View file

@ -1,11 +1,11 @@
define(["globalize", "dom", "dialogHelper", "emby-checkbox", "emby-select", "emby-input"], function (globalize, dom, dialogHelper) {
"use strict";
define(['globalize', 'dom', 'dialogHelper', 'emby-checkbox', 'emby-select', 'emby-input'], function (globalize, dom, dialogHelper) {
'use strict';
function getDefaultImageConfig(itemType, type) {
return {
Type: type,
MinWidth: 0,
Limit: "Primary" === type ? 1 : 0
Limit: 'Primary' === type ? 1 : 0
};
}
@ -21,27 +21,27 @@ define(["globalize", "dom", "dialogHelper", "emby-checkbox", "emby-select", "emb
function setVisibilityOfBackdrops(elem, visible) {
if (visible) {
elem.classList.remove("hide");
elem.querySelector("input").setAttribute("required", "required");
elem.classList.remove('hide');
elem.querySelector('input').setAttribute('required', 'required');
} else {
elem.classList.add("hide");
elem.querySelector("input").setAttribute("required", "");
elem.querySelector("input").removeAttribute("required");
elem.classList.add('hide');
elem.querySelector('input').setAttribute('required', '');
elem.querySelector('input').removeAttribute('required');
}
}
function loadValues(context, itemType, options, availableOptions) {
var supportedImageTypes = availableOptions.SupportedImageTypes || [];
setVisibilityOfBackdrops(context.querySelector(".backdropFields"), -1 != supportedImageTypes.indexOf("Backdrop"));
setVisibilityOfBackdrops(context.querySelector(".screenshotFields"), -1 != supportedImageTypes.indexOf("Screenshot"));
Array.prototype.forEach.call(context.querySelectorAll(".imageType"), function (i) {
var imageType = i.getAttribute("data-imagetype");
var container = dom.parentWithTag(i, "LABEL");
setVisibilityOfBackdrops(context.querySelector('.backdropFields'), -1 != supportedImageTypes.indexOf('Backdrop'));
setVisibilityOfBackdrops(context.querySelector('.screenshotFields'), -1 != supportedImageTypes.indexOf('Screenshot'));
Array.prototype.forEach.call(context.querySelectorAll('.imageType'), function (i) {
var imageType = i.getAttribute('data-imagetype');
var container = dom.parentWithTag(i, 'LABEL');
if (-1 == supportedImageTypes.indexOf(imageType)) {
container.classList.add("hide");
container.classList.add('hide');
} else {
container.classList.remove("hide");
container.classList.remove('hide');
}
if (getImageConfig(options, availableOptions, imageType, itemType).Limit) {
@ -50,31 +50,31 @@ define(["globalize", "dom", "dialogHelper", "emby-checkbox", "emby-select", "emb
i.checked = false;
}
});
var backdropConfig = getImageConfig(options, availableOptions, "Backdrop", itemType);
context.querySelector("#txtMaxBackdrops").value = backdropConfig.Limit;
context.querySelector("#txtMinBackdropDownloadWidth").value = backdropConfig.MinWidth;
var screenshotConfig = getImageConfig(options, availableOptions, "Screenshot", itemType);
context.querySelector("#txtMaxScreenshots").value = screenshotConfig.Limit;
context.querySelector("#txtMinScreenshotDownloadWidth").value = screenshotConfig.MinWidth;
var backdropConfig = getImageConfig(options, availableOptions, 'Backdrop', itemType);
context.querySelector('#txtMaxBackdrops').value = backdropConfig.Limit;
context.querySelector('#txtMinBackdropDownloadWidth').value = backdropConfig.MinWidth;
var screenshotConfig = getImageConfig(options, availableOptions, 'Screenshot', itemType);
context.querySelector('#txtMaxScreenshots').value = screenshotConfig.Limit;
context.querySelector('#txtMinScreenshotDownloadWidth').value = screenshotConfig.MinWidth;
}
function saveValues(context, options) {
options.ImageOptions = Array.prototype.map.call(context.querySelectorAll(".imageType:not(.hide)"), function (c) {
options.ImageOptions = Array.prototype.map.call(context.querySelectorAll('.imageType:not(.hide)'), function (c) {
return {
Type: c.getAttribute("data-imagetype"),
Type: c.getAttribute('data-imagetype'),
Limit: c.checked ? 1 : 0,
MinWidth: 0
};
});
options.ImageOptions.push({
Type: "Backdrop",
Limit: context.querySelector("#txtMaxBackdrops").value,
MinWidth: context.querySelector("#txtMinBackdropDownloadWidth").value
Type: 'Backdrop',
Limit: context.querySelector('#txtMaxBackdrops').value,
MinWidth: context.querySelector('#txtMinBackdropDownloadWidth').value
});
options.ImageOptions.push({
Type: "Screenshot",
Limit: context.querySelector("#txtMaxScreenshots").value,
MinWidth: context.querySelector("#txtMinScreenshotDownloadWidth").value
Type: 'Screenshot',
Limit: context.querySelector('#txtMaxScreenshots').value,
MinWidth: context.querySelector('#txtMinScreenshotDownloadWidth').value
});
}
@ -82,23 +82,23 @@ define(["globalize", "dom", "dialogHelper", "emby-checkbox", "emby-select", "emb
this.show = function (itemType, options, availableOptions) {
return new Promise(function (resolve, reject) {
var xhr = new XMLHttpRequest();
xhr.open("GET", "components/imageoptionseditor/imageoptionseditor.template.html", true);
xhr.open('GET', 'components/imageoptionseditor/imageoptionseditor.template.html', true);
xhr.onload = function (e) {
var template = this.response;
var dlg = dialogHelper.createDialog({
size: "medium-tall",
size: 'medium-tall',
removeOnClose: true,
scrollY: false
});
dlg.classList.add("formDialog");
dlg.classList.add('formDialog');
dlg.innerHTML = globalize.translateDocument(template);
dlg.addEventListener("close", function () {
dlg.addEventListener('close', function () {
saveValues(dlg, options);
});
loadValues(dlg, itemType, options, availableOptions);
dialogHelper.open(dlg).then(resolve, resolve);
dlg.querySelector(".btnCancel").addEventListener("click", function () {
dlg.querySelector('.btnCancel').addEventListener('click', function () {
dialogHelper.close(dlg);
});
};