mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Remove duplicate implementations of parentWithClass()
This commit is contained in:
parent
44aa8e5ccb
commit
db5dac8f22
6 changed files with 19 additions and 118 deletions
|
@ -1,18 +1,7 @@
|
||||||
define(["dialogHelper", "loading", "connectionManager", "globalize", "actionsheet", "emby-input", "paper-icon-button-light", "emby-button", "listViewStyle", "material-icons", "formDialogStyle"], function (dialogHelper, loading, connectionManager, globalize, actionsheet) {
|
define(["dom", "dialogHelper", "loading", "connectionManager", "globalize", "actionsheet", "emby-input", "paper-icon-button-light", "emby-button", "listViewStyle", "material-icons", "formDialogStyle"], function (dom, dialogHelper, loading, connectionManager, globalize, actionsheet) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
return function (options) {
|
return function (options) {
|
||||||
function parentWithClass(elem, className) {
|
|
||||||
while (!elem.classList || !elem.classList.contains(className)) {
|
|
||||||
elem = elem.parentNode;
|
|
||||||
if (!elem) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
|
|
||||||
function mapChannel(button, channelId, providerChannelId) {
|
function mapChannel(button, channelId, providerChannelId) {
|
||||||
loading.show();
|
loading.show();
|
||||||
var providerId = options.providerId;
|
var providerId = options.providerId;
|
||||||
|
@ -26,7 +15,7 @@ define(["dialogHelper", "loading", "connectionManager", "globalize", "actionshee
|
||||||
},
|
},
|
||||||
dataType: "json"
|
dataType: "json"
|
||||||
}).then(function (mapping) {
|
}).then(function (mapping) {
|
||||||
var listItem = parentWithClass(button, "listItem");
|
var listItem = dom.parentWithClass(button, "listItem");
|
||||||
button.setAttribute("data-providerid", mapping.ProviderChannelId);
|
button.setAttribute("data-providerid", mapping.ProviderChannelId);
|
||||||
listItem.querySelector(".secondary").innerHTML = getMappingSecondaryName(mapping, currentMappingOptions.ProviderName);
|
listItem.querySelector(".secondary").innerHTML = getMappingSecondaryName(mapping, currentMappingOptions.ProviderName);
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
@ -34,7 +23,7 @@ define(["dialogHelper", "loading", "connectionManager", "globalize", "actionshee
|
||||||
}
|
}
|
||||||
|
|
||||||
function onChannelsElementClick(e) {
|
function onChannelsElementClick(e) {
|
||||||
var btnMap = parentWithClass(e.target, "btnMap");
|
var btnMap = dom.parentWithClass(e.target, "btnMap");
|
||||||
|
|
||||||
if (btnMap) {
|
if (btnMap) {
|
||||||
var channelId = btnMap.getAttribute("data-id");
|
var channelId = btnMap.getAttribute("data-id");
|
||||||
|
|
|
@ -1,25 +1,12 @@
|
||||||
define(['dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectionManager', 'appRouter', 'globalize', 'emby-checkbox', 'emby-input', 'paper-icon-button-light', 'emby-select', 'material-icons', 'css!./../formdialog', 'emby-button', 'flexStyles'], function (dialogHelper, loading, appHost, layoutManager, connectionManager, appRouter, globalize) {
|
define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectionManager', 'appRouter', 'globalize', 'emby-checkbox', 'emby-input', 'paper-icon-button-light', 'emby-select', 'material-icons', 'css!./../formdialog', 'emby-button', 'flexStyles'], function (dom, dialogHelper, loading, appHost, layoutManager, connectionManager, appRouter, globalize) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var currentServerId;
|
var currentServerId;
|
||||||
|
|
||||||
function parentWithClass(elem, className) {
|
|
||||||
|
|
||||||
while (!elem.classList || !elem.classList.contains(className)) {
|
|
||||||
elem = elem.parentNode;
|
|
||||||
|
|
||||||
if (!elem) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSubmit(e) {
|
function onSubmit(e) {
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
var panel = parentWithClass(this, 'dialog');
|
var panel = dom.parentWithClass(this, 'dialog');
|
||||||
|
|
||||||
var collectionId = panel.querySelector('#selectCollectionToAddTo').value;
|
var collectionId = panel.querySelector('#selectCollectionToAddTo').value;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(["dialogHelper", "globalize", "connectionManager", "events", "browser", "require", "emby-checkbox", "emby-collapse", "css!./style"], function (dialogHelper, globalize, connectionManager, events, browser, require) {
|
define(["dom", "dialogHelper", "globalize", "connectionManager", "events", "browser", "require", "emby-checkbox", "emby-collapse", "css!./style"], function (dom, dialogHelper, globalize, connectionManager, events, browser, require) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function renderOptions(context, selector, cssClass, items, isCheckedFn) {
|
function renderOptions(context, selector, cssClass, items, isCheckedFn) {
|
||||||
|
@ -106,16 +106,6 @@ define(["dialogHelper", "globalize", "connectionManager", "events", "browser", "
|
||||||
events.trigger(instance, "filterchange");
|
events.trigger(instance, "filterchange");
|
||||||
}
|
}
|
||||||
|
|
||||||
function parentWithClass(elem, className) {
|
|
||||||
while (!elem.classList || !elem.classList.contains(className)) {
|
|
||||||
elem = elem.parentNode;
|
|
||||||
if (!elem) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setVisibility(context, options) {
|
function setVisibility(context, options) {
|
||||||
if (options.mode == "livetvchannels" || options.mode == "albums" || options.mode == "artists" || options.mode == "albumartists" || options.mode == "songs") {
|
if (options.mode == "livetvchannels" || options.mode == "albums" || options.mode == "artists" || options.mode == "albumartists" || options.mode == "songs") {
|
||||||
hideByClass(context, "videoStandard");
|
hideByClass(context, "videoStandard");
|
||||||
|
@ -320,7 +310,7 @@ define(["dialogHelper", "globalize", "connectionManager", "events", "browser", "
|
||||||
triggerChange(self);
|
triggerChange(self);
|
||||||
});
|
});
|
||||||
context.addEventListener("change", function (e) {
|
context.addEventListener("change", function (e) {
|
||||||
var chkGenreFilter = parentWithClass(e.target, "chkGenreFilter");
|
var chkGenreFilter = dom.parentWithClass(e.target, "chkGenreFilter");
|
||||||
if (chkGenreFilter) {
|
if (chkGenreFilter) {
|
||||||
var filterName = chkGenreFilter.getAttribute("data-filter");
|
var filterName = chkGenreFilter.getAttribute("data-filter");
|
||||||
var filters = query.Genres || "";
|
var filters = query.Genres || "";
|
||||||
|
@ -334,7 +324,7 @@ define(["dialogHelper", "globalize", "connectionManager", "events", "browser", "
|
||||||
triggerChange(self);
|
triggerChange(self);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var chkTagFilter = parentWithClass(e.target, "chkTagFilter");
|
var chkTagFilter = dom.parentWithClass(e.target, "chkTagFilter");
|
||||||
if (chkTagFilter) {
|
if (chkTagFilter) {
|
||||||
var filterName = chkTagFilter.getAttribute("data-filter");
|
var filterName = chkTagFilter.getAttribute("data-filter");
|
||||||
var filters = query.Tags || "";
|
var filters = query.Tags || "";
|
||||||
|
@ -348,7 +338,7 @@ define(["dialogHelper", "globalize", "connectionManager", "events", "browser", "
|
||||||
triggerChange(self);
|
triggerChange(self);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var chkYearFilter = parentWithClass(e.target, "chkYearFilter");
|
var chkYearFilter = dom.parentWithClass(e.target, "chkYearFilter");
|
||||||
if (chkYearFilter) {
|
if (chkYearFilter) {
|
||||||
var filterName = chkYearFilter.getAttribute("data-filter");
|
var filterName = chkYearFilter.getAttribute("data-filter");
|
||||||
var filters = query.Years || "";
|
var filters = query.Years || "";
|
||||||
|
@ -362,7 +352,7 @@ define(["dialogHelper", "globalize", "connectionManager", "events", "browser", "
|
||||||
triggerChange(self);
|
triggerChange(self);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var chkOfficialRatingFilter = parentWithClass(e.target, "chkOfficialRatingFilter");
|
var chkOfficialRatingFilter = dom.parentWithClass(e.target, "chkOfficialRatingFilter");
|
||||||
if (chkOfficialRatingFilter) {
|
if (chkOfficialRatingFilter) {
|
||||||
var filterName = chkOfficialRatingFilter.getAttribute("data-filter");
|
var filterName = chkOfficialRatingFilter.getAttribute("data-filter");
|
||||||
var filters = query.OfficialRatings || "";
|
var filters = query.OfficialRatings || "";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(['loading', 'apphost', 'dialogHelper', 'connectionManager', 'imageLoader', 'browser', 'layoutManager', 'scrollHelper', 'globalize', 'require', 'emby-checkbox', 'paper-icon-button-light', 'emby-button', 'formDialogStyle', 'cardStyle'], function (loading, appHost, dialogHelper, connectionManager, imageLoader, browser, layoutManager, scrollHelper, globalize, require) {
|
define(['dom', 'loading', 'apphost', 'dialogHelper', 'connectionManager', 'imageLoader', 'browser', 'layoutManager', 'scrollHelper', 'globalize', 'require', 'emby-checkbox', 'paper-icon-button-light', 'emby-button', 'formDialogStyle', 'cardStyle'], function (dom, loading, appHost, dialogHelper, connectionManager, imageLoader, browser, layoutManager, scrollHelper, globalize, require) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var enableFocusTransform = !browser.slow && !browser.edge;
|
var enableFocusTransform = !browser.slow && !browser.edge;
|
||||||
|
@ -126,21 +126,7 @@ define(['loading', 'apphost', 'dialogHelper', 'connectionManager', 'imageLoader'
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
function parentWithClass(elem, className) {
|
|
||||||
|
|
||||||
while (!elem.classList || !elem.classList.contains(className)) {
|
|
||||||
elem = elem.parentNode;
|
|
||||||
|
|
||||||
if (!elem) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
|
|
||||||
function downloadRemoteImage(page, apiClient, url, type, provider) {
|
function downloadRemoteImage(page, apiClient, url, type, provider) {
|
||||||
|
|
||||||
var options = getBaseRemoteOptions();
|
var options = getBaseRemoteOptions();
|
||||||
|
|
||||||
options.Type = type;
|
options.Type = type;
|
||||||
|
@ -152,7 +138,7 @@ define(['loading', 'apphost', 'dialogHelper', 'connectionManager', 'imageLoader'
|
||||||
apiClient.downloadRemoteImage(options).then(function () {
|
apiClient.downloadRemoteImage(options).then(function () {
|
||||||
|
|
||||||
hasChanges = true;
|
hasChanges = true;
|
||||||
var dlg = parentWithClass(page, 'dialog');
|
var dlg = dom.parentWithClass(page, 'dialog');
|
||||||
dialogHelper.close(dlg);
|
dialogHelper.close(dlg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -162,7 +148,6 @@ define(['loading', 'apphost', 'dialogHelper', 'connectionManager', 'imageLoader'
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRemoteImageHtml(image, imageType, apiClient) {
|
function getRemoteImageHtml(image, imageType, apiClient) {
|
||||||
|
|
||||||
var tagName = layoutManager.tv ? 'button' : 'div';
|
var tagName = layoutManager.tv ? 'button' : 'div';
|
||||||
var enableFooterButtons = !layoutManager.tv;
|
var enableFooterButtons = !layoutManager.tv;
|
||||||
|
|
||||||
|
@ -293,7 +278,6 @@ define(['loading', 'apphost', 'dialogHelper', 'connectionManager', 'imageLoader'
|
||||||
}
|
}
|
||||||
|
|
||||||
function initEditor(page, apiClient) {
|
function initEditor(page, apiClient) {
|
||||||
|
|
||||||
page.querySelector('#selectBrowsableImageType').addEventListener('change', function () {
|
page.querySelector('#selectBrowsableImageType').addEventListener('change', function () {
|
||||||
browsableImageType = this.value;
|
browsableImageType = this.value;
|
||||||
browsableImageStartIndex = 0;
|
browsableImageStartIndex = 0;
|
||||||
|
@ -319,14 +303,14 @@ define(['loading', 'apphost', 'dialogHelper', 'connectionManager', 'imageLoader'
|
||||||
|
|
||||||
page.addEventListener('click', function (e) {
|
page.addEventListener('click', function (e) {
|
||||||
|
|
||||||
var btnDownloadRemoteImage = parentWithClass(e.target, 'btnDownloadRemoteImage');
|
var btnDownloadRemoteImage = dom.parentWithClass(e.target, 'btnDownloadRemoteImage');
|
||||||
if (btnDownloadRemoteImage) {
|
if (btnDownloadRemoteImage) {
|
||||||
var card = parentWithClass(btnDownloadRemoteImage, 'card');
|
var card = dom.parentWithClass(btnDownloadRemoteImage, 'card');
|
||||||
downloadRemoteImage(page, apiClient, card.getAttribute('data-imageurl'), card.getAttribute('data-imagetype'), card.getAttribute('data-imageprovider'));
|
downloadRemoteImage(page, apiClient, card.getAttribute('data-imageurl'), card.getAttribute('data-imagetype'), card.getAttribute('data-imageprovider'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var btnImageCard = parentWithClass(e.target, 'btnImageCard');
|
var btnImageCard = dom.parentWithClass(e.target, 'btnImageCard');
|
||||||
if (btnImageCard) {
|
if (btnImageCard) {
|
||||||
downloadRemoteImage(page, apiClient, btnImageCard.getAttribute('data-imageurl'), btnImageCard.getAttribute('data-imagetype'), btnImageCard.getAttribute('data-imageprovider'));
|
downloadRemoteImage(page, apiClient, btnImageCard.getAttribute('data-imageurl'), btnImageCard.getAttribute('data-imagetype'), btnImageCard.getAttribute('data-imageprovider'));
|
||||||
}
|
}
|
||||||
|
@ -334,7 +318,6 @@ define(['loading', 'apphost', 'dialogHelper', 'connectionManager', 'imageLoader'
|
||||||
}
|
}
|
||||||
|
|
||||||
function showEditor(itemId, serverId, itemType) {
|
function showEditor(itemId, serverId, itemType) {
|
||||||
|
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
require(['text!./imagedownloader.template.html'], function (template) {
|
require(['text!./imagedownloader.template.html'], function (template) {
|
||||||
|
@ -380,7 +363,6 @@ define(['loading', 'apphost', 'dialogHelper', 'connectionManager', 'imageLoader'
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDialogClosed() {
|
function onDialogClosed() {
|
||||||
|
|
||||||
var dlg = this;
|
var dlg = this;
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
|
@ -397,9 +379,7 @@ define(['loading', 'apphost', 'dialogHelper', 'connectionManager', 'imageLoader'
|
||||||
|
|
||||||
return {
|
return {
|
||||||
show: function (itemId, serverId, itemType, imageType) {
|
show: function (itemId, serverId, itemType, imageType) {
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
|
|
||||||
currentResolve = resolve;
|
currentResolve = resolve;
|
||||||
currentReject = reject;
|
currentReject = reject;
|
||||||
hasChanges = false;
|
hasChanges = false;
|
||||||
|
|
|
@ -1,24 +1,10 @@
|
||||||
define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackManager', 'connectionManager', 'userSettings', 'appRouter', 'globalize', 'emby-input', 'paper-icon-button-light', 'emby-select', 'material-icons', 'css!./../formdialog', 'emby-button'], function (shell, dialogHelper, loading, layoutManager, playbackManager, connectionManager, userSettings, appRouter, globalize) {
|
define(['dom', 'shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackManager', 'connectionManager', 'userSettings', 'appRouter', 'globalize', 'emby-input', 'paper-icon-button-light', 'emby-select', 'material-icons', 'css!./../formdialog', 'emby-button'], function (dom, shell, dialogHelper, loading, layoutManager, playbackManager, connectionManager, userSettings, appRouter, globalize) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var currentServerId;
|
var currentServerId;
|
||||||
|
|
||||||
function parentWithClass(elem, className) {
|
|
||||||
|
|
||||||
while (!elem.classList || !elem.classList.contains(className)) {
|
|
||||||
elem = elem.parentNode;
|
|
||||||
|
|
||||||
if (!elem) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSubmit(e) {
|
function onSubmit(e) {
|
||||||
|
var panel = dom.parentWithClass(this, 'dialog');
|
||||||
var panel = parentWithClass(this, 'dialog');
|
|
||||||
|
|
||||||
var playlistId = panel.querySelector('#selectPlaylistToAddTo').value;
|
var playlistId = panel.querySelector('#selectPlaylistToAddTo').value;
|
||||||
var apiClient = connectionManager.getApiClient(currentServerId);
|
var apiClient = connectionManager.getApiClient(currentServerId);
|
||||||
|
@ -35,11 +21,9 @@ define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
function createPlaylist(apiClient, dlg) {
|
function createPlaylist(apiClient, dlg) {
|
||||||
|
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
var url = apiClient.getUrl("Playlists", {
|
var url = apiClient.getUrl("Playlists", {
|
||||||
|
|
||||||
Name: dlg.querySelector('#txtNewPlaylistName').value,
|
Name: dlg.querySelector('#txtNewPlaylistName').value,
|
||||||
Ids: dlg.querySelector('.fldSelectedItemIds').value || '',
|
Ids: dlg.querySelector('.fldSelectedItemIds').value || '',
|
||||||
userId: apiClient.getCurrentUserId()
|
userId: apiClient.getCurrentUserId()
|
||||||
|
@ -50,9 +34,7 @@ define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackManager',
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "json"
|
dataType: "json"
|
||||||
|
|
||||||
}).then(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
|
||||||
var id = result.Id;
|
var id = result.Id;
|
||||||
|
@ -63,16 +45,13 @@ define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
function redirectToPlaylist(apiClient, id) {
|
function redirectToPlaylist(apiClient, id) {
|
||||||
|
|
||||||
appRouter.showItem(id, apiClient.serverId());
|
appRouter.showItem(id, apiClient.serverId());
|
||||||
}
|
}
|
||||||
|
|
||||||
function addToPlaylist(apiClient, dlg, id) {
|
function addToPlaylist(apiClient, dlg, id) {
|
||||||
|
|
||||||
var itemIds = dlg.querySelector('.fldSelectedItemIds').value || '';
|
var itemIds = dlg.querySelector('.fldSelectedItemIds').value || '';
|
||||||
|
|
||||||
if (id === 'queue') {
|
if (id === 'queue') {
|
||||||
|
|
||||||
playbackManager.queue({
|
playbackManager.queue({
|
||||||
serverId: apiClient.serverId(),
|
serverId: apiClient.serverId(),
|
||||||
ids: itemIds.split(',')
|
ids: itemIds.split(',')
|
||||||
|
@ -85,7 +64,6 @@ define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackManager',
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
var url = apiClient.getUrl("Playlists/" + id + "/Items", {
|
var url = apiClient.getUrl("Playlists/" + id + "/Items", {
|
||||||
|
|
||||||
Ids: itemIds,
|
Ids: itemIds,
|
||||||
userId: apiClient.getCurrentUserId()
|
userId: apiClient.getCurrentUserId()
|
||||||
});
|
});
|
||||||
|
@ -95,7 +73,6 @@ define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackManager',
|
||||||
url: url
|
url: url
|
||||||
|
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
|
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
|
||||||
dlg.submitted = true;
|
dlg.submitted = true;
|
||||||
|
@ -108,7 +85,6 @@ define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
function populatePlaylists(editorOptions, panel) {
|
function populatePlaylists(editorOptions, panel) {
|
||||||
|
|
||||||
var select = panel.querySelector('#selectPlaylistToAddTo');
|
var select = panel.querySelector('#selectPlaylistToAddTo');
|
||||||
|
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
@ -116,7 +92,6 @@ define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackManager',
|
||||||
panel.querySelector('.newPlaylistInfo').classList.add('hide');
|
panel.querySelector('.newPlaylistInfo').classList.add('hide');
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
|
|
||||||
Recursive: true,
|
Recursive: true,
|
||||||
IncludeItemTypes: "Playlist",
|
IncludeItemTypes: "Playlist",
|
||||||
SortBy: 'SortName',
|
SortBy: 'SortName',
|
||||||
|
@ -125,7 +100,6 @@ define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackManager',
|
||||||
|
|
||||||
var apiClient = connectionManager.getApiClient(currentServerId);
|
var apiClient = connectionManager.getApiClient(currentServerId);
|
||||||
apiClient.getItems(apiClient.getCurrentUserId(), options).then(function (result) {
|
apiClient.getItems(apiClient.getCurrentUserId(), options).then(function (result) {
|
||||||
|
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
if (editorOptions.enableAddToPlayQueue !== false && playbackManager.isPlaying()) {
|
if (editorOptions.enableAddToPlayQueue !== false && playbackManager.isPlaying()) {
|
||||||
|
@ -135,7 +109,6 @@ define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackManager',
|
||||||
html += '<option value="">' + globalize.translate('OptionNew') + '</option>';
|
html += '<option value="">' + globalize.translate('OptionNew') + '</option>';
|
||||||
|
|
||||||
html += result.Items.map(function (i) {
|
html += result.Items.map(function (i) {
|
||||||
|
|
||||||
return '<option value="' + i.Id + '">' + i.Name + '</option>';
|
return '<option value="' + i.Id + '">' + i.Name + '</option>';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -159,7 +132,6 @@ define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEditorHtml(items) {
|
function getEditorHtml(items) {
|
||||||
|
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
html += '<div class="formDialogContent smoothScrollY" style="padding-top:2em;">';
|
html += '<div class="formDialogContent smoothScrollY" style="padding-top:2em;">';
|
||||||
|
@ -195,7 +167,6 @@ define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
function initEditor(content, options, items) {
|
function initEditor(content, options, items) {
|
||||||
|
|
||||||
content.querySelector('#selectPlaylistToAddTo').addEventListener('change', function () {
|
content.querySelector('#selectPlaylistToAddTo').addEventListener('change', function () {
|
||||||
if (this.value) {
|
if (this.value) {
|
||||||
content.querySelector('.newPlaylistInfo').classList.add('hide');
|
content.querySelector('.newPlaylistInfo').classList.add('hide');
|
||||||
|
@ -235,7 +206,6 @@ define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaylistEditor.prototype.show = function (options) {
|
PlaylistEditor.prototype.show = function (options) {
|
||||||
|
|
||||||
var items = options.items || {};
|
var items = options.items || {};
|
||||||
currentServerId = options.serverId;
|
currentServerId = options.serverId;
|
||||||
|
|
||||||
|
@ -272,7 +242,6 @@ define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackManager',
|
||||||
initEditor(dlg, options, items);
|
initEditor(dlg, options, items);
|
||||||
|
|
||||||
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
||||||
|
|
||||||
dialogHelper.close(dlg);
|
dialogHelper.close(dlg);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -281,7 +250,6 @@ define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
return dialogHelper.open(dlg).then(function () {
|
return dialogHelper.open(dlg).then(function () {
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
centerFocus(dlg.querySelector('.formDialogContent'), false, false);
|
centerFocus(dlg.querySelector('.formDialogContent'), false, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,6 @@
|
||||||
define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'connectionManager', 'appRouter', 'globalize', 'emby-input', 'emby-checkbox', 'paper-icon-button-light', 'emby-select', 'material-icons', 'css!./../formdialog', 'emby-button'], function (shell, dialogHelper, loading, layoutManager, connectionManager, appRouter, globalize) {
|
define(['dom', 'shell', 'dialogHelper', 'loading', 'layoutManager', 'connectionManager', 'appRouter', 'globalize', 'emby-input', 'emby-checkbox', 'paper-icon-button-light', 'emby-select', 'material-icons', 'css!./../formdialog', 'emby-button'], function (dom, shell, dialogHelper, loading, layoutManager, connectionManager, appRouter, globalize) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function parentWithClass(elem, className) {
|
|
||||||
|
|
||||||
while (!elem.classList || !elem.classList.contains(className)) {
|
|
||||||
elem = elem.parentNode;
|
|
||||||
|
|
||||||
if (!elem) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getEditorHtml() {
|
function getEditorHtml() {
|
||||||
|
|
||||||
var html = '';
|
var html = '';
|
||||||
|
@ -65,7 +52,7 @@ define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'connectionManager'
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
var instance = this;
|
var instance = this;
|
||||||
var dlg = parentWithClass(e.target, 'dialog');
|
var dlg = dom.parentWithClass(e.target, 'dialog');
|
||||||
var options = instance.options;
|
var options = instance.options;
|
||||||
|
|
||||||
var apiClient = connectionManager.getApiClient(options.serverId);
|
var apiClient = connectionManager.getApiClient(options.serverId);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue