change single quote to double quote for itemidentifier

This commit is contained in:
grafixeyehero 2019-10-25 18:24:49 +03:00
parent 9954eec88d
commit a36663da43
2 changed files with 88 additions and 88 deletions

View File

@ -1,5 +1,5 @@
define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize', 'scrollHelper', 'layoutManager', 'focusManager', 'browser', 'emby-input', 'emby-checkbox', 'paper-icon-button-light', 'css!./../formdialog', 'material-icons', 'cardStyle'], function (dialogHelper, loading, connectionManager, require, globalize, scrollHelper, layoutManager, focusManager, browser) { define(["dialogHelper", "loading", "connectionManager", "require", "globalize", "scrollHelper", "layoutManager", "focusManager", "browser", "emby-input", "emby-checkbox", "paper-icon-button-light", "css!./../formdialog", "material-icons", "cardStyle"], function (dialogHelper, loading, connectionManager, require, globalize, scrollHelper, layoutManager, focusManager, browser) {
'use strict'; "use strict";
var currentItem; var currentItem;
var currentItemType; var currentItemType;
@ -20,7 +20,7 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
}; };
var i, length; var i, length;
var identifyField = page.querySelectorAll('.identifyField'); var identifyField = page.querySelectorAll(".identifyField");
var value; var value;
for (i = 0, length = identifyField.length; i < length; i++) { for (i = 0, length = identifyField.length; i < length; i++) {
@ -28,17 +28,17 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
if (value) { if (value) {
if (identifyField[i].type === 'number') { if (identifyField[i].type === "number") {
value = parseInt(value); value = parseInt(value);
} }
lookupInfo[identifyField[i].getAttribute('data-lookup')] = value; lookupInfo[identifyField[i].getAttribute("data-lookup")] = value;
} }
} }
var hasId = false; var hasId = false;
var txtLookupId = page.querySelectorAll('.txtLookupId'); var txtLookupId = page.querySelectorAll(".txtLookupId");
for (i = 0, length = txtLookupId.length; i < length; i++) { for (i = 0, length = txtLookupId.length; i < length; i++) {
value = txtLookupId[i].value; value = txtLookupId[i].value;
@ -46,12 +46,12 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
if (value) { if (value) {
hasId = true; hasId = true;
} }
lookupInfo.ProviderIds[txtLookupId[i].getAttribute('data-providerkey')] = value; lookupInfo.ProviderIds[txtLookupId[i].getAttribute("data-providerkey")] = value;
} }
if (!hasId && !lookupInfo.Name) { if (!hasId && !lookupInfo.Name) {
require(['toast'], function (toast) { require(["toast"], function (toast) {
toast(globalize.translate('PleaseEnterNameOrId')); toast(globalize.translate("PleaseEnterNameOrId"));
}); });
return; return;
} }
@ -76,7 +76,7 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
url: apiClient.getUrl("Items/RemoteSearch/" + currentItemType), url: apiClient.getUrl("Items/RemoteSearch/" + currentItemType),
data: JSON.stringify(lookupInfo), data: JSON.stringify(lookupInfo),
contentType: "application/json", contentType: "application/json",
dataType: 'json' dataType: "json"
}).then(function (results) { }).then(function (results) {
@ -87,14 +87,14 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
function showIdentificationSearchResults(page, results) { function showIdentificationSearchResults(page, results) {
var identificationSearchResults = page.querySelector('.identificationSearchResults'); var identificationSearchResults = page.querySelector(".identificationSearchResults");
page.querySelector('.popupIdentifyForm').classList.add('hide'); page.querySelector(".popupIdentifyForm").classList.add("hide");
identificationSearchResults.classList.remove('hide'); identificationSearchResults.classList.remove("hide");
page.querySelector('.identifyOptionsForm').classList.add('hide'); page.querySelector(".identifyOptionsForm").classList.add("hide");
page.querySelector('.dialogContentInner').classList.remove('dialog-content-centered'); page.querySelector(".dialogContentInner").classList.remove("dialog-content-centered");
var html = ''; var html = "";
var i, length; var i, length;
for (i = 0, length = results.length; i < length; i++) { for (i = 0, length = results.length; i < length; i++) {
@ -102,11 +102,11 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
html += getSearchResultHtml(result, i); html += getSearchResultHtml(result, i);
} }
var elem = page.querySelector('.identificationSearchResultList'); var elem = page.querySelector(".identificationSearchResultList");
elem.innerHTML = html; elem.innerHTML = html;
function onSearchImageClick() { function onSearchImageClick() {
var index = parseInt(this.getAttribute('data-index')); var index = parseInt(this.getAttribute("data-index"));
var currentResult = results[index]; var currentResult = results[index];
@ -119,10 +119,10 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
} }
} }
var searchImages = elem.querySelectorAll('.card'); var searchImages = elem.querySelectorAll(".card");
for (i = 0, length = searchImages.length; i < length; i++) { for (i = 0, length = searchImages.length; i < length; i++) {
searchImages[i].addEventListener('click', onSearchImageClick); searchImages[i].addEventListener("click", onSearchImageClick);
} }
if (layoutManager.tv) { if (layoutManager.tv) {
@ -140,13 +140,13 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
function showIdentifyOptions(page, identifyResult) { function showIdentifyOptions(page, identifyResult) {
var identifyOptionsForm = page.querySelector('.identifyOptionsForm'); var identifyOptionsForm = page.querySelector(".identifyOptionsForm");
page.querySelector('.popupIdentifyForm').classList.add('hide'); page.querySelector(".popupIdentifyForm").classList.add("hide");
page.querySelector('.identificationSearchResults').classList.add('hide'); page.querySelector(".identificationSearchResults").classList.add("hide");
identifyOptionsForm.classList.remove('hide'); identifyOptionsForm.classList.remove("hide");
page.querySelector('#chkIdentifyReplaceImages').checked = true; page.querySelector("#chkIdentifyReplaceImages").checked = true;
page.querySelector('.dialogContentInner').classList.add('dialog-content-centered'); page.querySelector(".dialogContentInner").classList.add("dialog-content-centered");
currentSearchResult = identifyResult; currentSearchResult = identifyResult;
@ -157,47 +157,47 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
lines.push(identifyResult.ProductionYear); lines.push(identifyResult.ProductionYear);
} }
var resultHtml = lines.join('<br/>'); var resultHtml = lines.join("<br/>");
if (identifyResult.ImageUrl) { if (identifyResult.ImageUrl) {
var displayUrl = getSearchImageDisplayUrl(identifyResult.ImageUrl, identifyResult.SearchProviderName); var displayUrl = getSearchImageDisplayUrl(identifyResult.ImageUrl, identifyResult.SearchProviderName);
resultHtml = '<div style="display:flex;align-items:center;"><img src="' + displayUrl + '" style="max-height:240px;" /><div style="margin-left:1em;">' + resultHtml + '</div>'; resultHtml = '<div style="display:flex;align-items:center;"><img src="' + displayUrl + '" style="max-height:240px;" /><div style="margin-left:1em;">' + resultHtml + "</div>";
} }
page.querySelector('.selectedSearchResult').innerHTML = resultHtml; page.querySelector(".selectedSearchResult").innerHTML = resultHtml;
focusManager.focus(identifyOptionsForm.querySelector('.btnSubmit')); focusManager.focus(identifyOptionsForm.querySelector(".btnSubmit"));
} }
function getSearchResultHtml(result, index) { function getSearchResultHtml(result, index) {
var html = ''; var html = "";
var cssClass = "card scalableCard"; var cssClass = "card scalableCard";
var cardBoxCssClass = 'cardBox'; var cardBoxCssClass = "cardBox";
var padderClass; var padderClass;
if (currentItemType === "Episode") { if (currentItemType === "Episode") {
cssClass += " backdropCard backdropCard-scalable"; cssClass += " backdropCard backdropCard-scalable";
padderClass = 'cardPadder-backdrop'; padderClass = "cardPadder-backdrop";
} }
else if (currentItemType === "MusicAlbum" || currentItemType === "MusicArtist") { else if (currentItemType === "MusicAlbum" || currentItemType === "MusicArtist") {
cssClass += " squareCard squareCard-scalable"; cssClass += " squareCard squareCard-scalable";
padderClass = 'cardPadder-square'; padderClass = "cardPadder-square";
} }
else { else {
cssClass += " portraitCard portraitCard-scalable"; cssClass += " portraitCard portraitCard-scalable";
padderClass = 'cardPadder-portrait'; padderClass = "cardPadder-portrait";
} }
if (layoutManager.tv && !browser.slow) { if (layoutManager.tv && !browser.slow) {
cardBoxCssClass += ' cardBox-focustransform'; cardBoxCssClass += " cardBox-focustransform";
} }
cardBoxCssClass += ' cardBox-bottompadded'; cardBoxCssClass += " cardBox-bottompadded";
if (layoutManager.tv) { if (layoutManager.tv) {
cardBoxCssClass += ' card-focuscontent cardBox-withfocuscontent'; cardBoxCssClass += " card-focuscontent cardBox-withfocuscontent";
} }
html += '<button type="button" class="' + cssClass + '" data-index="' + index + '">'; html += '<button type="button" class="' + cssClass + '" data-index="' + index + '">';
@ -215,8 +215,8 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
html += '<div class="cardImageContainer coveredImage defaultCardBackground defaultCardBackground1"><div class="cardText cardCenteredText">' + result.Name + '</div></div>'; html += '<div class="cardImageContainer coveredImage defaultCardBackground defaultCardBackground1"><div class="cardText cardCenteredText">' + result.Name + '</div></div>';
} }
html += '</div>'; html += "</div>";
html += '</div>'; html += "</div>";
var numLines = 2; var numLines = 2;
if (currentItemType === "MusicAlbum") { if (currentItemType === "MusicAlbum") {
@ -239,12 +239,12 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
} else { } else {
html += '<div class="cardText cardText-secondary cardTextCentered">'; html += '<div class="cardText cardText-secondary cardTextCentered">';
} }
html += lines[i] || '&nbsp;'; html += lines[i] || "&nbsp;";
html += '</div>'; html += "</div>";
} }
html += '</div>'; html += "</div>";
html += '</button>'; html += "</button>";
return html; return html;
} }
@ -259,7 +259,7 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
loading.show(); loading.show();
var options = { var options = {
ReplaceAllImages: page.querySelector('#chkIdentifyReplaceImages').checked ReplaceAllImages: page.querySelector("#chkIdentifyReplaceImages").checked
}; };
var apiClient = getApiClient(); var apiClient = getApiClient();
@ -291,7 +291,7 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
apiClient.getJSON(apiClient.getUrl("Items/" + item.Id + "/ExternalIdInfos")).then(function (idList) { apiClient.getJSON(apiClient.getUrl("Items/" + item.Id + "/ExternalIdInfos")).then(function (idList) {
var html = ''; var html = "";
var providerIds = item.ProviderIds || {}; var providerIds = item.ProviderIds || {};
@ -303,30 +303,30 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
html += '<div class="inputContainer">'; html += '<div class="inputContainer">';
var idLabel = globalize.translate('LabelDynamicExternalId').replace('{0}', idInfo.Name); var idLabel = globalize.translate("LabelDynamicExternalId").replace("{0}", idInfo.Name);
var value = providerIds[idInfo.Key] || ''; var value = providerIds[idInfo.Key] || "";
html += '<input is="emby-input" class="txtLookupId" data-providerkey="' + idInfo.Key + '" id="' + id + '" label="' + idLabel + '"/>'; html += '<input is="emby-input" class="txtLookupId" data-providerkey="' + idInfo.Key + '" id="' + id + '" label="' + idLabel + '"/>';
html += '</div>'; html += "</div>";
} }
page.querySelector('#txtLookupName').value = ''; page.querySelector("#txtLookupName").value = "";
if (item.Type === "Person" || item.Type === "BoxSet") { if (item.Type === "Person" || item.Type === "BoxSet") {
page.querySelector('.fldLookupYear').classList.add('hide'); page.querySelector(".fldLookupYear").classList.add("hide");
page.querySelector('#txtLookupYear').value = ''; page.querySelector("#txtLookupYear").value = "";
} else { } else {
page.querySelector('.fldLookupYear').classList.remove('hide'); page.querySelector(".fldLookupYear").classList.remove("hide");
page.querySelector('#txtLookupYear').value = ''; page.querySelector("#txtLookupYear").value = "";
} }
page.querySelector('.identifyProviderIds').innerHTML = html; page.querySelector(".identifyProviderIds").innerHTML = html;
page.querySelector('.formDialogHeaderTitle').innerHTML = globalize.translate('Identify'); page.querySelector(".formDialogHeaderTitle").innerHTML = globalize.translate("Identify");
}); });
} }
@ -334,7 +334,7 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
loading.show(); loading.show();
require(['text!./itemidentifier.template.html'], function (template) { require(["text!./itemidentifier.template.html"], function (template) {
var apiClient = getApiClient(); var apiClient = getApiClient();
@ -344,54 +344,54 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
currentItemType = currentItem.Type; currentItemType = currentItem.Type;
var dialogOptions = { var dialogOptions = {
size: 'fullscreen-border', size: "fullscreen-border",
removeOnClose: true, removeOnClose: true,
scrollY: false scrollY: false
}; };
if (layoutManager.tv) { if (layoutManager.tv) {
dialogOptions.size = 'fullscreen'; dialogOptions.size = "fullscreen";
} }
var dlg = dialogHelper.createDialog(dialogOptions); var dlg = dialogHelper.createDialog(dialogOptions);
dlg.classList.add('formDialog'); dlg.classList.add("formDialog");
dlg.classList.add('recordingDialog'); dlg.classList.add("recordingDialog");
var html = ''; var html = "";
html += globalize.translateDocument(template, 'core'); html += globalize.translateDocument(template, "core");
dlg.innerHTML = html; dlg.innerHTML = html;
// Has to be assigned a z-index after the call to .open() // Has to be assigned a z-index after the call to .open()
dlg.addEventListener('close', onDialogClosed); dlg.addEventListener("close", onDialogClosed);
if (layoutManager.tv) { if (layoutManager.tv) {
scrollHelper.centerFocus.on(dlg.querySelector('.formDialogContent'), false); scrollHelper.centerFocus.on(dlg.querySelector(".formDialogContent"), false);
} }
dialogHelper.open(dlg); dialogHelper.open(dlg);
dlg.querySelector('.popupIdentifyForm').addEventListener('submit', function (e) { dlg.querySelector(".popupIdentifyForm").addEventListener("submit", function (e) {
e.preventDefault(); e.preventDefault();
searchForIdentificationResults(dlg); searchForIdentificationResults(dlg);
return false; return false;
}); });
dlg.querySelector('.identifyOptionsForm').addEventListener('submit', function (e) { dlg.querySelector(".identifyOptionsForm").addEventListener("submit", function (e) {
e.preventDefault(); e.preventDefault();
submitIdentficationResult(dlg); submitIdentficationResult(dlg);
return false; return false;
}); });
dlg.querySelector('.btnCancel').addEventListener('click', function (e) { dlg.querySelector(".btnCancel").addEventListener("click", function (e) {
dialogHelper.close(dlg); dialogHelper.close(dlg);
}); });
dlg.classList.add('identifyDialog'); dlg.classList.add("identifyDialog");
showIdentificationForm(dlg, item); showIdentificationForm(dlg, item);
loading.hide(); loading.hide();
@ -414,47 +414,47 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
currentItem = null; currentItem = null;
currentItemType = itemType; currentItemType = itemType;
require(['text!./itemidentifier.template.html'], function (template) { require(["text!./itemidentifier.template.html"], function (template) {
var dialogOptions = { var dialogOptions = {
size: 'fullscreen-border', size: "fullscreen-border",
removeOnClose: true, removeOnClose: true,
scrollY: false scrollY: false
}; };
if (layoutManager.tv) { if (layoutManager.tv) {
dialogOptions.size = 'fullscreen'; dialogOptions.size = "fullscreen";
} }
var dlg = dialogHelper.createDialog(dialogOptions); var dlg = dialogHelper.createDialog(dialogOptions);
dlg.classList.add('formDialog'); dlg.classList.add("formDialog");
dlg.classList.add('recordingDialog'); dlg.classList.add("recordingDialog");
var html = ''; var html = "";
html += globalize.translateDocument(template, 'core'); html += globalize.translateDocument(template, "core");
dlg.innerHTML = html; dlg.innerHTML = html;
if (layoutManager.tv) { if (layoutManager.tv) {
scrollHelper.centerFocus.on(dlg.querySelector('.formDialogContent'), false); scrollHelper.centerFocus.on(dlg.querySelector(".formDialogContent"), false);
} }
dialogHelper.open(dlg); dialogHelper.open(dlg);
dlg.querySelector('.btnCancel').addEventListener('click', function (e) { dlg.querySelector(".btnCancel").addEventListener("click", function (e) {
dialogHelper.close(dlg); dialogHelper.close(dlg);
}); });
dlg.querySelector('.popupIdentifyForm').addEventListener('submit', function (e) { dlg.querySelector(".popupIdentifyForm").addEventListener("submit", function (e) {
e.preventDefault(); e.preventDefault();
searchForIdentificationResults(dlg); searchForIdentificationResults(dlg);
return false; return false;
}); });
dlg.addEventListener('close', function () { dlg.addEventListener("close", function () {
loading.hide(); loading.hide();
var foundItem = hasChanges ? currentSearchResult : null; var foundItem = hasChanges ? currentSearchResult : null;
@ -462,7 +462,7 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
resolveFunc(foundItem); resolveFunc(foundItem);
}); });
dlg.classList.add('identifyDialog'); dlg.classList.add("identifyDialog");
showIdentificationFormFindNew(dlg, itemName, itemYear, itemType); showIdentificationFormFindNew(dlg, itemName, itemYear, itemType);
}); });
@ -470,20 +470,20 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
function showIdentificationFormFindNew(dlg, itemName, itemYear, itemType) { function showIdentificationFormFindNew(dlg, itemName, itemYear, itemType) {
dlg.querySelector('#txtLookupName').value = itemName; dlg.querySelector("#txtLookupName").value = itemName;
if (itemType === "Person" || itemType === "BoxSet") { if (itemType === "Person" || itemType === "BoxSet") {
dlg.querySelector('.fldLookupYear').classList.add('hide'); dlg.querySelector(".fldLookupYear").classList.add("hide");
dlg.querySelector('#txtLookupYear').value = ''; dlg.querySelector("#txtLookupYear").value = "";
} else { } else {
dlg.querySelector('.fldLookupYear').classList.remove('hide'); dlg.querySelector(".fldLookupYear").classList.remove("hide");
dlg.querySelector('#txtLookupYear').value = itemYear; dlg.querySelector("#txtLookupYear").value = itemYear;
} }
dlg.querySelector('.formDialogHeaderTitle').innerHTML = globalize.translate('Search'); dlg.querySelector(".formDialogHeaderTitle").innerHTML = globalize.translate("Search");
} }
return { return {