Merge pull request #506 from grafixeyehero/deminify-2

Deminify
This commit is contained in:
dkanada 2019-10-25 22:22:13 +09:00 committed by GitHub
commit 0d8bc6fb46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 1018 additions and 493 deletions

View File

@ -1,8 +1,9 @@
define(["loading"], function(loading) {
define(["loading"], function (loading) {
"use strict";
function onFinish() {
loading.show(), ApiClient.ajax({
loading.show();
ApiClient.ajax({
url: ApiClient.getUrl("Startup/Complete"),
type: "POST"
}).then(function() {
@ -10,7 +11,8 @@ define(["loading"], function(loading) {
window.location.href = "index.html";
});
}
return function(view, params) {
return function (view, params) {
view.querySelector(".btnWizardNext").addEventListener("click", onFinish);
};
});

View File

@ -1,31 +1,39 @@
define(["loading", "emby-checkbox", "emby-button", "emby-select"], function(loading) {
define(["loading", "emby-checkbox", "emby-button", "emby-select"], function (loading) {
"use strict";
function save(page) {
loading.show();
var apiClient = ApiClient,
config = {};
config.EnableRemoteAccess = page.querySelector("#chkRemoteAccess").checked, config.EnableAutomaticPortMapping = page.querySelector("#chkEnableUpnp").checked, apiClient.ajax({
var apiClient = ApiClient;
var config = {};
config.EnableRemoteAccess = page.querySelector("#chkRemoteAccess").checked;
config.EnableAutomaticPortMapping = page.querySelector("#chkEnableUpnp").checked;
apiClient.ajax({
type: "POST",
data: config,
url: apiClient.getUrl("Startup/RemoteAccess")
}).then(function() {
loading.hide(), navigateToNextPage()
})
}).then(function () {
loading.hide();
navigateToNextPage();
});
}
function navigateToNextPage() {
Dashboard.navigate("wizardfinish.html")
Dashboard.navigate("wizardfinish.html");
}
function onSubmit(e) {
return save(this), e.preventDefault(), !1
}
return function(view, params) {
view.querySelector(".wizardSettingsForm").addEventListener("submit", onSubmit), view.addEventListener("viewshow", function() {
document.querySelector(".skinHeader").classList.add("noHomeButtonHeader")
}), view.addEventListener("viewhide", function() {
document.querySelector(".skinHeader").classList.remove("noHomeButtonHeader")
})
save(this);
e.preventDefault();
return false;
}
return function (view, params) {
view.querySelector(".wizardSettingsForm").addEventListener("submit", onSubmit);
view.addEventListener("viewshow", function () {
document.querySelector(".skinHeader").classList.add("noHomeButtonHeader");
});
view.addEventListener("viewhide", function () {
document.querySelector(".skinHeader").classList.remove("noHomeButtonHeader");
});
};
});

View File

@ -1,67 +1,84 @@
define(["loading", "emby-checkbox", "emby-button", "emby-select"], function(loading) {
define(["loading", "emby-checkbox", "emby-button", "emby-select"], function (loading) {
"use strict";
function save(page) {
loading.show();
var apiClient = ApiClient;
apiClient.getJSON(apiClient.getUrl("Startup/Configuration")).then(function(config) {
config.PreferredMetadataLanguage = page.querySelector("#selectLanguage").value, config.MetadataCountryCode = page.querySelector("#selectCountry").value, apiClient.ajax({
apiClient.getJSON(apiClient.getUrl("Startup/Configuration")).then(function (config) {
config.PreferredMetadataLanguage = page.querySelector("#selectLanguage").value;
config.MetadataCountryCode = page.querySelector("#selectCountry").value;
apiClient.ajax({
type: "POST",
data: config,
url: apiClient.getUrl("Startup/Configuration")
}).then(function() {
loading.hide(), navigateToNextPage()
})
})
}).then(function () {
loading.hide();
navigateToNextPage();
});
});
}
function populateLanguages(select, languages) {
var html = "";
html += "<option value=''></option>";
for (var i = 0, length = languages.length; i < length; i++) {
var culture = languages[i];
html += "<option value='" + culture.TwoLetterISOLanguageName + "'>" + culture.DisplayName + "</option>"
html += "<option value='" + culture.TwoLetterISOLanguageName + "'>" + culture.DisplayName + "</option>";
}
select.innerHTML = html
select.innerHTML = html;
}
function populateCountries(select, allCountries) {
var html = "";
html += "<option value=''></option>";
for (var i = 0, length = allCountries.length; i < length; i++) {
var culture = allCountries[i];
html += "<option value='" + culture.TwoLetterISORegionName + "'>" + culture.DisplayName + "</option>"
html += "<option value='" + culture.TwoLetterISORegionName + "'>" + culture.DisplayName + "</option>";
}
select.innerHTML = html
select.innerHTML = html;
}
function reloadData(page, config, cultures, countries) {
populateLanguages(page.querySelector("#selectLanguage"), cultures), populateCountries(page.querySelector("#selectCountry"), countries), page.querySelector("#selectLanguage").value = config.PreferredMetadataLanguage, page.querySelector("#selectCountry").value = config.MetadataCountryCode, loading.hide()
populateLanguages(page.querySelector("#selectLanguage"), cultures);
populateCountries(page.querySelector("#selectCountry"), countries);
page.querySelector("#selectLanguage").value = config.PreferredMetadataLanguage;
page.querySelector("#selectCountry").value = config.MetadataCountryCode;
loading.hide();
}
function reload(page) {
loading.show();
var apiClient = ApiClient,
promise1 = apiClient.getJSON(apiClient.getUrl("Startup/Configuration")),
promise2 = apiClient.getCultures(),
promise3 = apiClient.getCountries();
Promise.all([promise1, promise2, promise3]).then(function(responses) {
reloadData(page, responses[0], responses[1], responses[2])
})
var apiClient = ApiClient;
var promise1 = apiClient.getJSON(apiClient.getUrl("Startup/Configuration"));
var promise2 = apiClient.getCultures();
var promise3 = apiClient.getCountries();
Promise.all([promise1, promise2, promise3]).then(function (responses) {
reloadData(page, responses[0], responses[1], responses[2]);
});
}
function navigateToNextPage() {
Dashboard.navigate("wizardremoteaccess.html")
Dashboard.navigate("wizardremoteaccess.html");
}
function onSubmit(e) {
return save(this), e.preventDefault(), !1
save(this);
e.preventDefault();
return false;
}
return function(view, params) {
view.querySelector(".wizardSettingsForm").addEventListener("submit", onSubmit), view.addEventListener("viewshow", function() {
document.querySelector(".skinHeader").classList.add("noHomeButtonHeader"), reload(this)
}), view.addEventListener("viewhide", function() {
document.querySelector(".skinHeader").classList.remove("noHomeButtonHeader")
})
}
});
return function (view, params) {
view.querySelector(".wizardSettingsForm").addEventListener("submit", onSubmit);
view.addEventListener("viewshow", function () {
document.querySelector(".skinHeader").classList.add("noHomeButtonHeader");
reload(this);
});
view.addEventListener("viewhide", function () {
document.querySelector(".skinHeader").classList.remove("noHomeButtonHeader");
});
};
});

View File

@ -1,41 +1,48 @@
define(["jQuery", "loading", "emby-button", "emby-select"], function($, loading) {
define(["jQuery", "loading", "emby-button", "emby-select"], function ($, loading) {
"use strict";
function loadPage(page, config, languageOptions) {
$("#selectLocalizationLanguage", page).html(languageOptions.map(function(l) {
return '<option value="' + l.Value + '">' + l.Name + "</option>"
})).val(config.UICulture), loading.hide()
$("#selectLocalizationLanguage", page).html(languageOptions.map(function (l) {
return '<option value="' + l.Value + '">' + l.Name + "</option>";
})).val(config.UICulture);
loading.hide();
}
function save(page) {
loading.show();
var apiClient = ApiClient;
apiClient.getJSON(apiClient.getUrl("Startup/Configuration")).then(function(config) {
config.UICulture = $("#selectLocalizationLanguage", page).val(), apiClient.ajax({
apiClient.getJSON(apiClient.getUrl("Startup/Configuration")).then(function (config) {
config.UICulture = $("#selectLocalizationLanguage", page).val();
apiClient.ajax({
type: "POST",
data: config,
url: apiClient.getUrl("Startup/Configuration")
}).then(function() {
Dashboard.navigate("wizarduser.html")
})
})
}).then(function () {
Dashboard.navigate("wizarduser.html");
});
});
}
function onSubmit() {
return save($(this).parents(".page")), !1
save($(this).parents(".page"));
return false;
}
return function(view, params) {
$(".wizardStartForm", view).on("submit", onSubmit), view.addEventListener("viewshow", function() {
document.querySelector(".skinHeader").classList.add("noHomeButtonHeader"), loading.show();
var page = this,
apiClient = ApiClient,
promise1 = apiClient.getJSON(apiClient.getUrl("Startup/Configuration")),
promise2 = apiClient.getJSON(apiClient.getUrl("Localization/Options"));
Promise.all([promise1, promise2]).then(function(responses) {
loadPage(page, responses[0], responses[1])
})
}), view.addEventListener("viewhide", function() {
document.querySelector(".skinHeader").classList.remove("noHomeButtonHeader")
})
}
});
return function (view, params) {
$(".wizardStartForm", view).on("submit", onSubmit);
view.addEventListener("viewshow", function () {
document.querySelector(".skinHeader").classList.add("noHomeButtonHeader");
loading.show();
var page = this;
var apiClient = ApiClient;
var promise1 = apiClient.getJSON(apiClient.getUrl("Startup/Configuration"));
var promise2 = apiClient.getJSON(apiClient.getUrl("Localization/Options"));
Promise.all([promise1, promise2]).then(function (responses) {
loadPage(page, responses[0], responses[1]);
});
});
view.addEventListener("viewhide", function () {
document.querySelector(".skinHeader").classList.remove("noHomeButtonHeader");
});
};
});

View File

@ -1,4 +1,4 @@
define(["loading", "globalize", "dashboardcss", "emby-input", "emby-button", "emby-button"], function(loading, globalize) {
define(["loading", "globalize", "dashboardcss", "emby-input", "emby-button", "emby-button"], function (loading, globalize) {
"use strict";
function getApiClient() {
@ -30,13 +30,15 @@ define(["loading", "globalize", "dashboardcss", "emby-input", "emby-button", "em
function onSubmit(e) {
var form = this;
if (form.querySelector("#txtManualPassword").value != form.querySelector("#txtPasswordConfirm").value) {
require(["toast"], function(toast) {
require(["toast"], function (toast) {
toast(Globalize.translate("PasswordMatchError"));
});
} else {
submit(form);
}
e.preventDefault();
return false;
}
@ -45,20 +47,21 @@ define(["loading", "globalize", "dashboardcss", "emby-input", "emby-button", "em
loading.show();
var page = this;
var apiClient = getApiClient();
apiClient.getJSON(apiClient.getUrl("Startup/User")).then(function(user) {
apiClient.getJSON(apiClient.getUrl("Startup/User")).then(function (user) {
page.querySelector("#txtUsername").value = user.Name || "";
page.querySelector("#txtManualPassword").value = user.Password || "";
loading.hide();
})
}
return function(view, params) {
view.querySelector(".wizardUserForm").addEventListener("submit", onSubmit);
view.addEventListener("viewshow", function() {
document.querySelector(".skinHeader").classList.add("noHomeButtonHeader")
});
view.addEventListener("viewhide", function() {
document.querySelector(".skinHeader").classList.remove("noHomeButtonHeader")
}
return function (view, params) {
view.querySelector(".wizardUserForm").addEventListener("submit", onSubmit);
view.addEventListener("viewshow", function () {
document.querySelector(".skinHeader").classList.add("noHomeButtonHeader");
});
view.addEventListener("viewhide", function () {
document.querySelector(".skinHeader").classList.remove("noHomeButtonHeader");
});
view.addEventListener("viewshow", onViewShow);
}
};
});

View File

@ -1,53 +1,76 @@
define(["backdrop", "userSettings", "libraryMenu"], function(backdrop, userSettings, libraryMenu) {
define(["backdrop", "userSettings", "libraryMenu"], function (backdrop, userSettings, libraryMenu) {
"use strict";
function enabled() {
return userSettings.enableBackdrops()
return userSettings.enableBackdrops();
}
function getBackdropItemIds(apiClient, userId, types, parentId) {
var key = "backdrops2_" + userId + (types || "") + (parentId || ""),
data = cache[key];
if (data) return console.log("Found backdrop id list in cache. Key: " + key), data = JSON.parse(data), Promise.resolve(data);
var key = "backdrops2_" + userId + (types || "") + (parentId || "");
var data = cache[key];
if (data) {
console.log("Found backdrop id list in cache. Key: " + key);
data = JSON.parse(data);
return Promise.resolve(data);
}
var options = {
SortBy: "IsFavoriteOrLiked,Random",
Limit: 20,
Recursive: !0,
Recursive: true,
IncludeItemTypes: types,
ImageTypes: "Backdrop",
ParentId: parentId,
EnableTotalRecordCount: !1
EnableTotalRecordCount: false
};
return apiClient.getItems(apiClient.getCurrentUserId(), options).then(function(result) {
var images = result.Items.map(function(i) {
return apiClient.getItems(apiClient.getCurrentUserId(), options).then(function (result) {
var images = result.Items.map(function (i) {
return {
Id: i.Id,
tag: i.BackdropImageTags[0],
ServerId: i.ServerId
}
};
});
return cache[key] = JSON.stringify(images), images
})
cache[key] = JSON.stringify(images);
return images;
});
}
function showBackdrop(type, parentId) {
var apiClient = window.ApiClient;
apiClient && getBackdropItemIds(apiClient, apiClient.getCurrentUserId(), type, parentId).then(function(images) {
images.length ? backdrop.setBackdrops(images.map(function(i) {
return i.BackdropImageTags = [i.tag], i
})) : backdrop.clear()
})
if (apiClient) {
getBackdropItemIds(apiClient, apiClient.getCurrentUserId(), type, parentId).then(function (images) {
if (images.length) {
backdrop.setBackdrops(images.map(function (i) {
i.BackdropImageTags = [i.tag];
return i;
}));
} else {
backdrop.clear();
}
});
}
}
var cache = {};
pageClassOn("pageshow", "page", function() {
pageClassOn("pageshow", "page", function () {
var page = this;
if (!page.classList.contains("selfBackdropPage"))
if (page.classList.contains("backdropPage"))
if (!page.classList.contains("selfBackdropPage")) {
if (page.classList.contains("backdropPage")) {
if (enabled()) {
var type = page.getAttribute("data-backdroptype"),
parentId = page.classList.contains("globalBackdropPage") ? "" : libraryMenu.getTopParentId();
showBackdrop(type, parentId)
} else page.classList.remove("backdropPage"), backdrop.clear();
else backdrop.clear()
})
});
var type = page.getAttribute("data-backdroptype");
var parentId = page.classList.contains("globalBackdropPage") ? "" : libraryMenu.getTopParentId();
showBackdrop(type, parentId);
} else {
page.classList.remove("backdropPage");
backdrop.clear();
}
} else {
backdrop.clear();
}
}
});
});

View File

@ -1,40 +1,90 @@
define(["connectionManager", "listView", "cardBuilder", "imageLoader", "libraryBrowser", "emby-itemscontainer", "emby-button"], function(connectionManager, listView, cardBuilder, imageLoader, libraryBrowser) {
define(["connectionManager", "listView", "cardBuilder", "imageLoader", "libraryBrowser", "emby-itemscontainer", "emby-button"], function (connectionManager, listView, cardBuilder, imageLoader, libraryBrowser) {
"use strict";
function renderItems(page, item) {
var sections = [];
item.ArtistCount && sections.push({
name: Globalize.translate("TabArtists"),
type: "MusicArtist"
}), item.ProgramCount && "Person" == item.Type && sections.push({
name: Globalize.translate("HeaderUpcomingOnTV"),
type: "Program"
}), item.MovieCount && sections.push({
name: Globalize.translate("TabMovies"),
type: "Movie"
}), item.SeriesCount && sections.push({
name: Globalize.translate("TabShows"),
type: "Series"
}), item.EpisodeCount && sections.push({
name: Globalize.translate("TabEpisodes"),
type: "Episode"
}), item.TrailerCount && sections.push({
name: Globalize.translate("TabTrailers"),
type: "Trailer"
}), item.AlbumCount && sections.push({
name: Globalize.translate("TabAlbums"),
type: "MusicAlbum"
}), item.MusicVideoCount && sections.push({
name: Globalize.translate("TabMusicVideos"),
type: "MusicVideo"
});
if (item.ArtistCount) {
sections.push({
name: Globalize.translate("TabArtists"),
type: "MusicArtist"
});
}
if (item.ProgramCount && "Person" == item.Type) {
sections.push({
name: Globalize.translate("HeaderUpcomingOnTV"),
type: "Program"
});
}
if (item.MovieCount) {
sections.push({
name: Globalize.translate("TabMovies"),
type: "Movie"
});
}
if (item.SeriesCount) {
sections.push({
name: Globalize.translate("TabShows"),
type: "Series"
});
}
if (item.EpisodeCount) {
sections.push({
name: Globalize.translate("TabEpisodes"),
type: "Episode"
});
}
if (item.TrailerCount) {
sections.push({
name: Globalize.translate("TabTrailers"),
type: "Trailer"
});
}
if (item.AlbumCount) {
sections.push({
name: Globalize.translate("TabAlbums"),
type: "MusicAlbum"
});
}
if (item.MusicVideoCount) {
sections.push({
name: Globalize.translate("TabMusicVideos"),
type: "MusicVideo"
});
}
var elem = page.querySelector("#childrenContent");
elem.innerHTML = sections.map(function(section) {
var html = "",
sectionClass = "verticalSection";
return "Audio" === section.type && (sectionClass += " verticalSection-extrabottompadding"), html += '<div class="' + sectionClass + '" data-type="' + section.type + '">', html += '<div class="sectionTitleContainer sectionTitleContainer-cards">', html += '<h2 class="sectionTitle sectionTitle-cards padded-left">', html += section.name, html += "</h2>", html += '<a is="emby-linkbutton" href="#" class="clearLink hide" style="margin-left:1em;vertical-align:middle;"><button is="emby-button" type="button" class="raised more raised-mini noIcon">' + Globalize.translate("ButtonMore") + "</button></a>", html += "</div>", html += '<div is="emby-itemscontainer" class="itemsContainer padded-left padded-right">', html += "</div>", html += "</div>"
elem.innerHTML = sections.map(function (section) {
var html = "";
var sectionClass = "verticalSection";
if ("Audio" === section.type) {
sectionClass += " verticalSection-extrabottompadding";
}
html += '<div class="' + sectionClass + '" data-type="' + section.type + '">';
html += '<div class="sectionTitleContainer sectionTitleContainer-cards">';
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">';
html += section.name;
html += "</h2>";
html += '<a is="emby-linkbutton" href="#" class="clearLink hide" style="margin-left:1em;vertical-align:middle;"><button is="emby-button" type="button" class="raised more raised-mini noIcon">' + Globalize.translate("ButtonMore") + "</button></a>";
html += "</div>";
html += '<div is="emby-itemscontainer" class="itemsContainer padded-left padded-right">';
html += "</div>";
return html += "</div>";
}).join("");
for (var sectionElems = elem.querySelectorAll(".verticalSection"), i = 0, length = sectionElems.length; i < length; i++) renderSection(page, item, sectionElems[i], sectionElems[i].getAttribute("data-type"))
var sectionElems = elem.querySelectorAll(".verticalSection");
for (var i = 0, length = sectionElems.length; i < length; i++) {
renderSection(page, item, sectionElems[i], sectionElems[i].getAttribute("data-type"));
}
}
function renderSection(page, item, element, type) {
@ -50,16 +100,17 @@ define(["connectionManager", "listView", "cardBuilder", "imageLoader", "libraryB
SortBy: "StartDate"
}, {
shape: "backdrop",
showTitle: !0,
centerText: !0,
overlayMoreButton: !0,
preferThumb: !0,
overlayText: !1,
showAirTime: !0,
showAirDateTime: !0,
showChannelName: !0
showTitle: true,
centerText: true,
overlayMoreButton: true,
preferThumb: true,
overlayText: false,
showAirTime: true,
showAirDateTime: true,
showChannelName: true
});
break;
case "Movie":
loadItems(element, item, type, {
MediaTypes: "",
@ -71,13 +122,14 @@ define(["connectionManager", "listView", "cardBuilder", "imageLoader", "libraryB
SortBy: "SortName"
}, {
shape: "portrait",
showTitle: !0,
centerText: !0,
overlayMoreButton: !0,
overlayText: !1,
showYear: !0
showTitle: true,
centerText: true,
overlayMoreButton: true,
overlayText: false,
showYear: true
});
break;
case "MusicVideo":
loadItems(element, item, type, {
MediaTypes: "",
@ -89,11 +141,12 @@ define(["connectionManager", "listView", "cardBuilder", "imageLoader", "libraryB
SortBy: "SortName"
}, {
shape: "portrait",
showTitle: !0,
centerText: !0,
overlayPlayButton: !0
showTitle: true,
centerText: true,
overlayPlayButton: true
});
break;
case "Trailer":
loadItems(element, item, type, {
MediaTypes: "",
@ -105,11 +158,12 @@ define(["connectionManager", "listView", "cardBuilder", "imageLoader", "libraryB
SortBy: "SortName"
}, {
shape: "portrait",
showTitle: !0,
centerText: !0,
overlayPlayButton: !0
showTitle: true,
centerText: true,
overlayPlayButton: true
});
break;
case "Series":
loadItems(element, item, type, {
MediaTypes: "",
@ -121,11 +175,12 @@ define(["connectionManager", "listView", "cardBuilder", "imageLoader", "libraryB
SortBy: "SortName"
}, {
shape: "portrait",
showTitle: !0,
centerText: !0,
overlayMoreButton: !0
showTitle: true,
centerText: true,
overlayMoreButton: true
});
break;
case "MusicAlbum":
loadItems(element, item, type, {
MediaTypes: "",
@ -137,14 +192,15 @@ define(["connectionManager", "listView", "cardBuilder", "imageLoader", "libraryB
SortBy: "ProductionYear,Sortname"
}, {
shape: "square",
playFromHere: !0,
showTitle: !0,
showYear: !0,
coverImage: !0,
centerText: !0,
overlayPlayButton: !0
playFromHere: true,
showTitle: true,
showYear: true,
coverImage: true,
centerText: true,
overlayPlayButton: true
});
break;
case "MusicArtist":
loadItems(element, item, type, {
MediaTypes: "",
@ -156,14 +212,15 @@ define(["connectionManager", "listView", "cardBuilder", "imageLoader", "libraryB
SortBy: "SortName"
}, {
shape: "square",
playFromHere: !0,
showTitle: !0,
showParentTitle: !0,
coverImage: !0,
centerText: !0,
overlayPlayButton: !0
playFromHere: true,
showTitle: true,
showParentTitle: true,
coverImage: true,
centerText: true,
overlayPlayButton: true
});
break;
case "Episode":
loadItems(element, item, type, {
MediaTypes: "",
@ -175,12 +232,13 @@ define(["connectionManager", "listView", "cardBuilder", "imageLoader", "libraryB
SortBy: "SortName"
}, {
shape: "backdrop",
showTitle: !0,
showParentTitle: !0,
centerText: !0,
overlayPlayButton: !0
showTitle: true,
showParentTitle: true,
centerText: true,
overlayPlayButton: true
});
break;
case "Audio":
loadItems(element, item, type, {
MediaTypes: "",
@ -190,57 +248,122 @@ define(["connectionManager", "listView", "cardBuilder", "imageLoader", "libraryB
AlbumArtistIds: "",
SortBy: "AlbumArtist,Album,SortName"
}, {
playFromHere: !0,
playFromHere: true,
action: "playallfromhere",
smallIcon: !0,
artist: !0
})
smallIcon: true,
artist: true
});
}
}
function loadItems(element, item, type, query, listOptions) {
query = getQuery(query, item), getItemsFunction(query, item)(query.StartIndex, query.Limit, query.Fields).then(function(result) {
query = getQuery(query, item);
getItemsFunction(query, item)(query.StartIndex, query.Limit, query.Fields).then(function (result) {
var html = "";
if (query.Limit && result.TotalRecordCount > query.Limit) {
var link = element.querySelector("a");
link.classList.remove("hide"), link.setAttribute("href", getMoreItemsHref(item, type))
} else element.querySelector("a").classList.add("hide");
link.classList.remove("hide");
link.setAttribute("href", getMoreItemsHref(item, type));
} else {
element.querySelector("a").classList.add("hide");
}
listOptions.items = result.Items;
var itemsContainer = element.querySelector(".itemsContainer");
"Audio" == type ? (html = listView.getListViewHtml(listOptions), itemsContainer.classList.remove("vertical-wrap"), itemsContainer.classList.add("vertical-list")) : (html = cardBuilder.getCardsHtml(listOptions), itemsContainer.classList.add("vertical-wrap"), itemsContainer.classList.remove("vertical-list")), itemsContainer.innerHTML = html, imageLoader.lazyChildren(itemsContainer)
})
if ("Audio" == type) {
html = listView.getListViewHtml(listOptions);
itemsContainer.classList.remove("vertical-wrap");
itemsContainer.classList.add("vertical-list");
} else {
html = cardBuilder.getCardsHtml(listOptions);
itemsContainer.classList.add("vertical-wrap");
itemsContainer.classList.remove("vertical-list");
}
itemsContainer.innerHTML = html;
imageLoader.lazyChildren(itemsContainer);
});
}
function getMoreItemsHref(item, type) {
return "Genre" == item.Type ? "list.html?type=" + type + "&genreId=" + item.Id + "&serverId=" + item.ServerId : "MusicGenre" == item.Type ? "list.html?type=" + type + "&musicGenreId=" + item.Id + "&serverId=" + item.ServerId : "Studio" == item.Type ? "list.html?type=" + type + "&studioId=" + item.Id + "&serverId=" + item.ServerId : "MusicArtist" == item.Type ? "list.html?type=" + type + "&artistId=" + item.Id + "&serverId=" + item.ServerId : "Person" == item.Type ? "list.html?type=" + type + "&personId=" + item.Id + "&serverId=" + item.ServerId : "list.html?type=" + type + "&parentId=" + item.Id + "&serverId=" + item.ServerId
if ("Genre" == item.Type) {
return "list.html?type=" + type + "&genreId=" + item.Id + "&serverId=" + item.ServerId;
}
if ("MusicGenre" == item.Type) {
return "list.html?type=" + type + "&musicGenreId=" + item.Id + "&serverId=" + item.ServerId;
}
if ("Studio" == item.Type) {
return "list.html?type=" + type + "&studioId=" + item.Id + "&serverId=" + item.ServerId;
}
if ("MusicArtist" == item.Type) {
return "list.html?type=" + type + "&artistId=" + item.Id + "&serverId=" + item.ServerId;
}
if ("Person" == item.Type) {
return "list.html?type=" + type + "&personId=" + item.Id + "&serverId=" + item.ServerId;
}
return "list.html?type=" + type + "&parentId=" + item.Id + "&serverId=" + item.ServerId;
}
function addCurrentItemToQuery(query, item) {
"Person" == item.Type ? query.PersonIds = item.Id : "Genre" == item.Type ? query.GenreIds = item.Id : "MusicGenre" == item.Type ? query.GenreIds = item.Id : "Studio" == item.Type ? query.StudioIds = item.Id : "MusicArtist" == item.Type && (connectionManager.getApiClient(item.ServerId).isMinServerVersion("3.4.1.18") ? query.AlbumArtistIds = item.Id : query.ArtistIds = item.Id)
if (item.Type == "Person") {
query.PersonIds = item.Id;
} else if (item.Type == "Genre") {
query.Genres = item.Name;
} else if (item.Type == "MusicGenre") {
query.Genres = item.Name;
} else if (item.Type == "GameGenre") {
query.Genres = item.Name;
} else if (item.Type == "Studio") {
query.StudioIds = item.Id;
} else if (item.Type == "MusicArtist") {
query.AlbumArtistIds = item.Id;
}
}
function getQuery(options, item) {
var query = {
SortOrder: "Ascending",
IncludeItemTypes: "",
Recursive: !0,
Recursive: true,
Fields: "AudioInfo,SeriesInfo,ParentId,PrimaryImageAspectRatio,BasicSyncInfo",
Limit: 100,
StartIndex: 0,
CollapseBoxSetItems: !1
CollapseBoxSetItems: false
};
return query = Object.assign(query, options || {}), addCurrentItemToQuery(query, item), query
query = Object.assign(query, options || {});
addCurrentItemToQuery(query, item);
return query;
}
function getItemsFunction(options, item) {
var query = getQuery(options, item);
return function(index, limit, fields) {
query.StartIndex = index, query.Limit = limit, fields && (query.Fields += "," + fields);
return function (index, limit, fields) {
query.StartIndex = index;
query.Limit = limit;
if (fields) {
query.Fields += "," + fields;
}
var apiClient = connectionManager.getApiClient(item.ServerId);
return "MusicArtist" === query.IncludeItemTypes ? (query.IncludeItemTypes = null, apiClient.getAlbumArtists(apiClient.getCurrentUserId(), query)) : apiClient.getItems(apiClient.getCurrentUserId(), query)
}
if ("MusicArtist" === query.IncludeItemTypes) {
query.IncludeItemTypes = null;
return apiClient.getAlbumArtists(apiClient.getCurrentUserId(), query);
}
return apiClient.getItems(apiClient.getCurrentUserId(), query);
};
}
window.ItemsByName = {
renderItems: renderItems
}
};
});

View File

@ -1,101 +1,198 @@
define(["userSettings"], function(userSettings) {
define(["userSettings"], function (userSettings) {
"use strict";
var libraryBrowser = {
getSavedQueryKey: function(modifier) {
return window.location.href.split("#")[0] + (modifier || "")
getSavedQueryKey: function (modifier) {
return window.location.href.split("#")[0] + (modifier || "");
},
loadSavedQueryValues: function(key, query) {
loadSavedQueryValues: function (key, query) {
var values = userSettings.get(key);
return values ? (values = JSON.parse(values), Object.assign(query, values)) : query
if (values) {
values = JSON.parse(values);
return Object.assign(query, values);
}
return query;
},
saveQueryValues: function(key, query) {
saveQueryValues: function (key, query) {
var values = {};
query.SortBy && (values.SortBy = query.SortBy), query.SortOrder && (values.SortOrder = query.SortOrder), userSettings.set(key, JSON.stringify(values))
if (query.SortBy) {
values.SortBy = query.SortBy;
}
if (query.SortOrder) {
values.SortOrder = query.SortOrder;
}
userSettings.set(key, JSON.stringify(values));
},
saveViewSetting: function(key, value) {
userSettings.set(key + "-_view", value)
saveViewSetting: function (key, value) {
userSettings.set(key + "-_view", value);
},
getSavedView: function(key) {
return userSettings.get(key + "-_view")
getSavedView: function (key) {
return userSettings.get(key + "-_view");
},
showLayoutMenu: function(button, currentLayout, views) {
var dispatchEvent = !0;
views || (dispatchEvent = !1, views = button.getAttribute("data-layouts"), views = views ? views.split(",") : ["List", "Poster", "PosterCard", "Thumb", "ThumbCard"]);
var menuItems = views.map(function(v) {
showLayoutMenu: function (button, currentLayout, views) {
var dispatchEvent = true;
if (!views) {
dispatchEvent = false;
views = button.getAttribute("data-layouts");
views = views ? views.split(",") : ["List", "Poster", "PosterCard", "Thumb", "ThumbCard"];
}
var menuItems = views.map(function (v) {
return {
name: Globalize.translate("Option" + v),
id: v,
selected: currentLayout == v
}
};
});
require(["actionsheet"], function(actionsheet) {
require(["actionsheet"], function (actionsheet) {
actionsheet.show({
items: menuItems,
positionTo: button,
callback: function(id) {
callback: function (id) {
button.dispatchEvent(new CustomEvent("layoutchange", {
detail: {
viewStyle: id
},
bubbles: !0,
cancelable: !1
})), dispatchEvent || window.$ && $(button).trigger("layoutchange", [id])
bubbles: true,
cancelable: false
}));
if (!dispatchEvent) {
if (window.$) {
$(button).trigger("layoutchange", [id]);
}
}
}
})
})
});
});
},
getQueryPagingHtml: function(options) {
var startIndex = options.startIndex,
limit = options.limit,
totalRecordCount = options.totalRecordCount,
html = "",
recordsEnd = Math.min(startIndex + limit, totalRecordCount),
showControls = limit < totalRecordCount;
getQueryPagingHtml: function (options) {
var startIndex = options.startIndex;
var limit = options.limit;
var totalRecordCount = options.totalRecordCount;
var html = "";
var recordsEnd = Math.min(startIndex + limit, totalRecordCount);
var showControls = limit < totalRecordCount;
if (html += '<div class="listPaging">', showControls) {
html += '<span style="vertical-align:middle;">';
html += (totalRecordCount ? startIndex + 1 : 0) + "-" + recordsEnd + " of " + totalRecordCount, html += "</span>"
html += (totalRecordCount ? startIndex + 1 : 0) + "-" + recordsEnd + " of " + totalRecordCount;
html += "</span>";
}
return (showControls || options.viewButton || options.filterButton || options.sortButton || options.addLayoutButton) && (html += '<div style="display:inline-block;">', showControls && (html += '<button is="paper-icon-button-light" class="btnPreviousPage autoSize" ' + (startIndex ? "" : "disabled") + '><i class="md-icon">&#xE5C4;</i></button>', html += '<button is="paper-icon-button-light" class="btnNextPage autoSize" ' + (startIndex + limit >= totalRecordCount ? "disabled" : "") + '><i class="md-icon">&#xE5C8;</i></button>'), options.addLayoutButton && (html += '<button is="paper-icon-button-light" title="' + Globalize.translate("ButtonSelectView") + '" class="btnChangeLayout autoSize" data-layouts="' + (options.layouts || "") + '" onclick="LibraryBrowser.showLayoutMenu(this, \'' + (options.currentLayout || "") + '\');"><i class="md-icon">&#xE42A;</i></button>'), options.sortButton && (html += '<button is="paper-icon-button-light" class="btnSort autoSize" title="' + Globalize.translate("ButtonSort") + '"><i class="md-icon">&#xE053;</i></button>'), options.filterButton && (html += '<button is="paper-icon-button-light" class="btnFilter autoSize" title="' + Globalize.translate("ButtonFilter") + '"><i class="md-icon">&#xE152;</i></button>'), html += "</div>"), html += "</div>"
if (showControls || options.viewButton || options.filterButton || options.sortButton || options.addLayoutButton) {
html += '<div style="display:inline-block;">';
if (showControls) {
html += '<button is="paper-icon-button-light" class="btnPreviousPage autoSize" ' + (startIndex ? "" : "disabled") + '><i class="md-icon">&#xE5C4;</i></button>';
html += '<button is="paper-icon-button-light" class="btnNextPage autoSize" ' + (startIndex + limit >= totalRecordCount ? "disabled" : "") + '><i class="md-icon">&#xE5C8;</i></button>';
}
if (options.addLayoutButton) {
html += '<button is="paper-icon-button-light" title="' + Globalize.translate("ButtonSelectView") + '" class="btnChangeLayout autoSize" data-layouts="' + (options.layouts || "") + '" onclick="LibraryBrowser.showLayoutMenu(this, \'' + (options.currentLayout || "") + '\');"><i class="md-icon">&#xE42A;</i></button>';
}
if (options.sortButton) {
html += '<button is="paper-icon-button-light" class="btnSort autoSize" title="' + Globalize.translate("ButtonSort") + '"><i class="md-icon">&#xE053;</i></button>';
}
if (options.filterButton) {
html += '<button is="paper-icon-button-light" class="btnFilter autoSize" title="' + Globalize.translate("ButtonFilter") + '"><i class="md-icon">&#xE152;</i></button>';
}
html += "</div>";
}
return html += "</div>";
},
showSortMenu: function(options) {
require(["dialogHelper", "emby-radio"], function(dialogHelper) {
showSortMenu: function (options) {
require(["dialogHelper", "emby-radio"], function (dialogHelper) {
function onSortByChange() {
var newValue = this.value;
if (this.checked) {
var changed = options.query.SortBy != newValue;
options.query.SortBy = newValue.replace("_", ","), options.query.StartIndex = 0, options.callback && changed && options.callback()
options.query.SortBy = newValue.replace("_", ",");
options.query.StartIndex = 0;
if (options.callback && changed) {
options.callback();
}
}
}
function onSortOrderChange() {
var newValue = this.value;
if (this.checked) {
var changed = options.query.SortOrder != newValue;
options.query.SortOrder = newValue, options.query.StartIndex = 0, options.callback && changed && options.callback()
options.query.SortOrder = newValue;
options.query.StartIndex = 0;
if (options.callback && changed) {
options.callback();
}
}
}
var dlg = dialogHelper.createDialog({
removeOnClose: !0,
modal: !1,
removeOnClose: true,
modal: false,
entryAnimationDuration: 160,
exitAnimationDuration: 200
});
dlg.classList.add("ui-body-a"), dlg.classList.add("background-theme-a"), dlg.classList.add("formDialog");
dlg.classList.add("ui-body-a");
dlg.classList.add("background-theme-a");
dlg.classList.add("formDialog");
var html = "";
html += '<div style="margin:0;padding:1.25em 1.5em 1.5em;">', html += '<h2 style="margin:0 0 .5em;">', html += Globalize.translate("HeaderSortBy"), html += "</h2>";
var i, length, isChecked;
for (html += "<div>", i = 0, length = options.items.length; i < length; i++) {
var option = options.items[i],
radioValue = option.id.replace(",", "_");
isChecked = (options.query.SortBy || "").replace(",", "_") == radioValue ? " checked" : "", html += '<label class="radio-label-block"><input type="radio" is="emby-radio" name="SortBy" data-id="' + option.id + '" value="' + radioValue + '" class="menuSortBy" ' + isChecked + " /><span>" + option.name + "</span></label>"
html += '<div style="margin:0;padding:1.25em 1.5em 1.5em;">';
html += '<h2 style="margin:0 0 .5em;">';
html += Globalize.translate("HeaderSortBy");
html += "</h2>";
var i, length;
var isChecked;
html += '<div>';
for (i = 0, length = options.items.length; i < length; i++) {
var option = options.items[i];
var radioValue = option.id.replace(",", "_");
isChecked = (options.query.SortBy || "").replace(",", "_") == radioValue ? " checked" : "";
html += '<label class="radio-label-block"><input type="radio" is="emby-radio" name="SortBy" data-id="' + option.id + '" value="' + radioValue + '" class="menuSortBy" ' + isChecked + " /><span>" + option.name + "</span></label>";
}
html += "</div>", html += '<h2 style="margin: 1em 0 .5em;">', html += Globalize.translate("HeaderSortOrder"), html += "</h2>", html += "<div>", isChecked = "Ascending" == options.query.SortOrder ? " checked" : "", html += '<label class="radio-label-block"><input type="radio" is="emby-radio" name="SortOrder" value="Ascending" class="menuSortOrder" ' + isChecked + " /><span>" + Globalize.translate("OptionAscending") + "</span></label>", isChecked = "Descending" == options.query.SortOrder ? " checked" : "", html += '<label class="radio-label-block"><input type="radio" is="emby-radio" name="SortOrder" value="Descending" class="menuSortOrder" ' + isChecked + " /><span>" + Globalize.translate("OptionDescending") + "</span></label>", html += "</div>", html += "</div>", dlg.innerHTML = html, dialogHelper.open(dlg);
html += "</div>";
html += '<h2 style="margin: 1em 0 .5em;">';
html += Globalize.translate("HeaderSortOrder");
html += "</h2>";
html += "<div>";
isChecked = "Ascending" == options.query.SortOrder ? " checked" : "";
html += '<label class="radio-label-block"><input type="radio" is="emby-radio" name="SortOrder" value="Ascending" class="menuSortOrder" ' + isChecked + " /><span>" + Globalize.translate("OptionAscending") + "</span></label>";
isChecked = "Descending" == options.query.SortOrder ? " checked" : "";
html += '<label class="radio-label-block"><input type="radio" is="emby-radio" name="SortOrder" value="Descending" class="menuSortOrder" ' + isChecked + " /><span>" + Globalize.translate("OptionDescending") + "</span></label>";
html += "</div>";
html += "</div>";
dlg.innerHTML = html;
dialogHelper.open(dlg);
var sortBys = dlg.querySelectorAll(".menuSortBy");
for (i = 0, length = sortBys.length; i < length; i++) sortBys[i].addEventListener("change", onSortByChange);
for (i = 0, length = sortBys.length; i < length; i++) {
sortBys[i].addEventListener("change", onSortByChange);
}
var sortOrders = dlg.querySelectorAll(".menuSortOrder");
for (i = 0, length = sortOrders.length; i < length; i++) sortOrders[i].addEventListener("change", onSortOrderChange)
})
for (i = 0, length = sortOrders.length; i < length; i++) {
sortOrders[i].addEventListener("change", onSortOrderChange);
}
});
}
};
return window.LibraryBrowser = libraryBrowser, libraryBrowser
});
window.LibraryBrowser = libraryBrowser;
return libraryBrowser;
});

View File

@ -105,6 +105,7 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "
function bindMenuEvents() {
mainDrawerButton = document.querySelector(".mainDrawerButton");
if (mainDrawerButton) {
mainDrawerButton.addEventListener("click", toggleMainDrawer);
}
@ -198,18 +199,21 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "
html += '<h3 class="sidebarHeader">';
html += globalize.translate("HeaderUser");
html += "</h3>";
if (appHost.supports("multiserver")) {
html += '<a is="emby-linkbutton" class="navMenuOption lnkMediaFolder" data-itemid="selectserver" href="selectserver.html?showuser=1"><i class="md-icon navMenuOptionIcon">wifi</i><span class="navMenuOptionText">' + globalize.translate("ButtonSelectServer") + "</span></a>";
}
html += '<a is="emby-linkbutton" class="navMenuOption lnkMediaFolder btnLogout" data-itemid="logout" href="#"><i class="md-icon navMenuOptionIcon">exit_to_app</i><span class="navMenuOptionText">' + globalize.translate("ButtonSignOut") + "</span></a>";
html += "</div>";
}
// add buttons to navigation drawer
navDrawerScrollContainer.innerHTML = html;
// bind logout button click to method
var btnLogout = navDrawerScrollContainer.querySelector(".btnLogout");
if (btnLogout) {
btnLogout.addEventListener("click", onLogoutClick);
}
@ -250,6 +254,7 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "
pageUrls = pageUrls.split("|");
selected = pageUrls.filter(isUrlInCurrentView).length > 0;
}
if (selected) {
link.classList.add("navMenuOption-selected");
var title = "";
@ -377,6 +382,7 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "
function addPluginPagesToMainMenu(links, pluginItems, section) {
for (var i = 0, length = pluginItems.length; i < length; i++) {
var pluginItem = pluginItems[i];
if (pluginItem.EnableInMainMenu && pluginItem.MenuSection === section) {
links.push({
name: pluginItem.DisplayName,
@ -416,15 +422,14 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "
return getToolsMenuLinks(apiClient).then(function (items) {
var item;
var menuHtml = "";
menuHtml += '<div class="drawerContent">';
for (var i = 0; i < items.length; i++) {
item = items[i];
if (item.href) {
menuHtml += getToolsLinkHtml(item);
}
else if (item.name) {
} else if (item.name) {
menuHtml += '<h3 class="sidebarHeader">';
menuHtml += item.name;
menuHtml += "</h3>";
@ -460,8 +465,8 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "
for (var i = 0, length = items.length; i < length; i++) {
var view = items[i];
list.push(view);
if ("livetv" == view.CollectionType) {
view.ImageTags = {};
view.icon = "live_tv";
@ -484,8 +489,7 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "
if (elem) {
if (show) {
elem.classList.remove("hide");
}
else {
} else {
elem.classList.add("hide");
}
}
@ -503,15 +507,13 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "
// FIXME: Potentially the same as above
if (user.Policy.EnableContentDownloading) {
showBySelector(".lnkSyncToOtherDevices", true);
}
else {
} else {
showBySelector(".lnkSyncToOtherDevices", false);
}
if (user.Policy.EnableContentDownloading && appHost.supports("sync")) {
showBySelector(".libraryMenuDownloads", true);
}
else {
} else {
showBySelector(".libraryMenuDownloads", false);
}
@ -529,9 +531,11 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "
html += items.map(function (i) {
var icon = i.icon || imageHelper.getLibraryIcon(i.CollectionType);
var itemId = i.Id;
if (i.onclick) {
i.onclick;
}
return '<a is="emby-linkbutton" data-itemid="' + itemId + '" class="lnkMediaFolder navMenuOption" href="' + getItemHref(i, i.CollectionType) + '"><i class="md-icon navMenuOptionIcon">' + icon + '</i><span class="sectionName navMenuOptionText">' + i.Name + "</span></a>";
}).join("");
libraryMenuOptions.innerHTML = html;
@ -592,23 +596,17 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "
if (isChannelsPage && "channels" === itemId) {
lnkMediaFolder.classList.add("navMenuOption-selected");
}
else if (isLiveTvPage && "livetv" === itemId) {
} else if (isLiveTvPage && "livetv" === itemId) {
lnkMediaFolder.classList.add("navMenuOption-selected");
}
else if (isEditorPage && "editor" === itemId) {
} else if (isEditorPage && "editor" === itemId) {
lnkMediaFolder.classList.add("navMenuOption-selected");
}
else if (isMySyncPage && "manageoffline" === itemId && -1 != window.location.href.toString().indexOf("mode=download")) {
} else if (isMySyncPage && "manageoffline" === itemId && -1 != window.location.href.toString().indexOf("mode=download")) {
lnkMediaFolder.classList.add("navMenuOption-selected");
}
else if (isMySyncPage && "syncotherdevices" === itemId && -1 == window.location.href.toString().indexOf("mode=download")) {
} else if (isMySyncPage && "syncotherdevices" === itemId && -1 == window.location.href.toString().indexOf("mode=download")) {
lnkMediaFolder.classList.add("navMenuOption-selected");
}
else if (id && itemId == id) {
} else if (id && itemId == id) {
lnkMediaFolder.classList.add("navMenuOption-selected");
}
else {
} else {
lnkMediaFolder.classList.remove("navMenuOption-selected");
}
}
@ -667,8 +665,7 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "
if (title) {
LibraryMenu.setTitle(title);
}
else if (page.classList.contains("standalonePage")) {
} else if (page.classList.contains("standalonePage")) {
LibraryMenu.setDefaultTitle();
}
}
@ -697,6 +694,7 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "
function refreshLibraryDrawer(user) {
loadNavDrawer();
currentDrawerType = "library";
if (user) {
Promise.resolve(user);
} else {
@ -729,9 +727,11 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "
return new Promise(function (resolve, reject) {
require(["navdrawer"], function (navdrawer) {
navDrawerInstance = new navdrawer(getNavDrawerOptions());
if (!layoutManager.tv) {
navDrawerElement.classList.remove("hide");
}
resolve(navDrawerInstance);
});
});

View File

@ -1,57 +1,95 @@
define(["layoutManager", "datetime", "cardBuilder", "apphost"], function(layoutManager, datetime, cardBuilder, appHost) {
define(["layoutManager", "datetime", "cardBuilder", "apphost"], function (layoutManager, datetime, cardBuilder, appHost) {
"use strict";
function enableScrollX() {
return !layoutManager.desktop
return !layoutManager.desktop;
}
function getBackdropShape() {
return enableScrollX() ? "overflowBackdrop" : "backdrop"
return enableScrollX() ? "overflowBackdrop" : "backdrop";
}
function getTimersHtml(timers, options) {
options = options || {};
var i, length, items = timers.map(function(t) {
return t.Type = "Timer", t
}),
groups = [],
currentGroupName = "",
currentGroup = [];
var i;
var length;
var items = timers.map(function (t) {
t.Type = "Timer";
return t;
});
var groups = [];
var currentGroupName = "";
var currentGroup = [];
for (i = 0, length = items.length; i < length; i++) {
var item = items[i],
dateText = "";
if (!1 !== options.indexByDate && item.StartDate) try {
var premiereDate = datetime.parseISO8601Date(item.StartDate, !0);
dateText = datetime.toLocaleDateString(premiereDate, {
weekday: "long",
month: "short",
day: "numeric"
})
} catch (err) {}
dateText != currentGroupName ? (currentGroup.length && groups.push({
var item = items[i];
var dateText = "";
if (options.indexByDate !== false && item.StartDate) {
try {
var premiereDate = datetime.parseISO8601Date(item.StartDate, true);
dateText = datetime.toLocaleDateString(premiereDate, {
weekday: "long",
month: "short",
day: "numeric"
});
} catch (err) {
console.log("Error parsing premiereDate:" + item.StartDate + "; error: " + err);
}
}
if (dateText != currentGroupName) {
if (currentGroup.length) {
groups.push({
name: currentGroupName,
items: currentGroup
});
}
currentGroupName = dateText;
currentGroup = [item];
} else {
currentGroup.push(item);
}
}
if (currentGroup.length) {
groups.push({
name: currentGroupName,
items: currentGroup
}), currentGroupName = dateText, currentGroup = [item]) : currentGroup.push(item)
});
}
currentGroup.length && groups.push({
name: currentGroupName,
items: currentGroup
});
var html = "";
for (i = 0, length = groups.length; i < length; i++) {
var group = groups[i],
supportsImageAnalysis = appHost.supports("imageanalysis"),
cardLayout = appHost.preferVisualCards || supportsImageAnalysis;
if (cardLayout = !0, group.name && (html += '<div class="verticalSection">', html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + group.name + "</h2>"), enableScrollX()) {
var group = groups[i];
var supportsImageAnalysis = appHost.supports("imageanalysis");
var cardLayout = appHost.preferVisualCards || supportsImageAnalysis;
cardLayout = true;
if (group.name) {
html += '<div class="verticalSection">';
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + group.name + "</h2>";
}
if (enableScrollX()) {
var scrollXClass = "scrollX hiddenScrollX";
layoutManager.tv && (scrollXClass += " smoothScrollX"), html += '<div is="emby-itemscontainer" class="itemsContainer ' + scrollXClass + ' padded-left padded-right">'
} else html += '<div is="emby-itemscontainer" class="itemsContainer vertical-wrap padded-left padded-right">';
if (layoutManager.tv) {
scrollXClass += " smoothScrollX";
}
html += '<div is="emby-itemscontainer" class="itemsContainer ' + scrollXClass + ' padded-left padded-right">';
} else {
html += '<div is="emby-itemscontainer" class="itemsContainer vertical-wrap padded-left padded-right">';
}
html += cardBuilder.getCardsHtml({
items: group.items,
shape: cardLayout ? getBackdropShape() : enableScrollX() ? "autoOverflow" : "autoVertical",
showParentTitleOrTitle: !0,
showAirTime: !0,
showAirEndTime: !0,
showParentTitleOrTitle: true,
showAirTime: true,
showAirEndTime: true,
showChannelName: !cardLayout,
cardLayout: cardLayout,
centerText: !cardLayout,
@ -59,15 +97,22 @@ define(["layoutManager", "datetime", "cardBuilder", "apphost"], function(layoutM
cardFooterAside: "none",
preferThumb: !!cardLayout || "auto",
defaultShape: cardLayout ? null : "portrait",
coverImage: !0,
allowBottomPadding: !1,
overlayText: !1,
coverImage: true,
allowBottomPadding: false,
overlayText: false,
showChannelLogo: cardLayout
}), html += "</div>", group.name && (html += "</div>")
});
html += "</div>";
if (group.name) {
html += "</div>";
}
}
return Promise.resolve(html)
return Promise.resolve(html);
}
window.LiveTvHelpers = {
getTimersHtml: getTimersHtml
}
});
};
});

View File

@ -1,39 +1,50 @@
define(["listView"], function(listView) {
define(["listView"], function (listView) {
"use strict";
function getFetchPlaylistItemsFn(itemId) {
return function() {
return function () {
var query = {
Fields: "PrimaryImageAspectRatio,UserData",
EnableImageTypes: "Primary,Backdrop,Banner,Thumb",
UserId: ApiClient.getCurrentUserId()
};
return ApiClient.getJSON(ApiClient.getUrl("Playlists/" + itemId + "/Items", query))
}
return ApiClient.getJSON(ApiClient.getUrl("Playlists/" + itemId + "/Items", query));
};
}
function getItemsHtmlFn(itemId) {
return function(items) {
return function (items) {
return listView.getListViewHtml({
items: items,
showIndex: !1,
showRemoveFromPlaylist: !0,
playFromHere: !0,
showIndex: false,
showRemoveFromPlaylist: true,
playFromHere: true,
action: "playallfromhere",
smallIcon: !0,
dragHandle: !0,
smallIcon: true,
dragHandle: true,
playlistId: itemId
})
}
});
};
}
function init(page, item) {
var elem = page.querySelector("#childrenContent .itemsContainer");
elem.classList.add("vertical-list"), elem.classList.remove("vertical-wrap"), elem.enableDragReordering(!0), elem.fetchData = getFetchPlaylistItemsFn(item.Id), elem.getItemsHtml = getItemsHtmlFn(item.Id)
elem.classList.add("vertical-list");
elem.classList.remove("vertical-wrap");
elem.enableDragReordering(true);
elem.fetchData = getFetchPlaylistItemsFn(item.Id);
elem.getItemsHtml = getItemsHtmlFn(item.Id);
}
window.PlaylistViewer = {
render: function(page, item) {
page.playlistInit || (page.playlistInit = !0, init(page, item)), page.querySelector("#childrenContent").classList.add("verticalSection-extrabottompadding"), page.querySelector("#childrenContent .itemsContainer").refreshItems()
render: function (page, item) {
if (!page.playlistInit) {
page.playlistInit = true;
init(page, item);
}
page.querySelector("#childrenContent").classList.add("verticalSection-extrabottompadding");
page.querySelector("#childrenContent .itemsContainer").refreshItems();
}
}
});
};
});

View File

@ -1,124 +1,186 @@
define(["loading", "listView", "cardBuilder", "libraryMenu", "libraryBrowser", "apphost", "imageLoader", "emby-itemscontainer"], function(loading, listView, cardBuilder, libraryMenu, libraryBrowser, appHost, imageLoader) {
define(["loading", "listView", "cardBuilder", "libraryMenu", "libraryBrowser", "apphost", "imageLoader", "emby-itemscontainer"], function (loading, listView, cardBuilder, libraryMenu, libraryBrowser, appHost, imageLoader) {
"use strict";
return function(view, params) {
return function (view, params) {
function getPageData(context) {
var key = getSavedQueryKey(context),
pageData = data[key];
return pageData || (pageData = data[key] = {
query: {
SortBy: "SortName",
SortOrder: "Ascending",
IncludeItemTypes: "Playlist",
Recursive: !0,
Fields: "PrimaryImageAspectRatio,SortName,CumulativeRunTimeTicks,CanDelete",
StartIndex: 0,
Limit: 100
},
view: libraryBrowser.getSavedView(key) || "Poster"
}, pageData.query.ParentId = libraryMenu.getTopParentId(), libraryBrowser.loadSavedQueryValues(key, pageData.query)), pageData
var key = getSavedQueryKey(context);
var pageData = data[key];
if (!pageData) {
pageData = data[key] = {
query: {
SortBy: "SortName",
SortOrder: "Ascending",
IncludeItemTypes: "Playlist",
Recursive: true,
Fields: "PrimaryImageAspectRatio,SortName,CumulativeRunTimeTicks,CanDelete",
StartIndex: 0,
Limit: 100
},
view: libraryBrowser.getSavedView(key) || "Poster"
};
pageData.query.ParentId = libraryMenu.getTopParentId();
libraryBrowser.loadSavedQueryValues(key, pageData.query);
}
return pageData;
}
function getQuery(context) {
return getPageData(context).query
return getPageData(context).query;
}
function getSavedQueryKey(context) {
return context.savedQueryKey || (context.savedQueryKey = libraryBrowser.getSavedQueryKey()), context.savedQueryKey
if (!context.savedQueryKey) {
context.savedQueryKey = libraryBrowser.getSavedQueryKey();
}
return context.savedQueryKey;
}
function showLoadingMessage() {
loading.show()
loading.show();
}
function hideLoadingMessage() {
loading.hide()
loading.hide();
}
function onViewStyleChange() {
var viewStyle = getPageData(view).view,
itemsContainer = view.querySelector(".itemsContainer");
"List" == viewStyle ? (itemsContainer.classList.add("vertical-list"), itemsContainer.classList.remove("vertical-wrap")) : (itemsContainer.classList.remove("vertical-list"), itemsContainer.classList.add("vertical-wrap")), itemsContainer.innerHTML = ""
var viewStyle = getPageData(view).view;
var itemsContainer = view.querySelector(".itemsContainer");
if ("List" == viewStyle) {
itemsContainer.classList.add("vertical-list");
itemsContainer.classList.remove("vertical-wrap");
} else {
itemsContainer.classList.remove("vertical-list");
itemsContainer.classList.add("vertical-wrap");
}
itemsContainer.innerHTML = "";
}
function reloadItems() {
showLoadingMessage();
var query = getQuery(view),
promise1 = ApiClient.getItems(Dashboard.getCurrentUserId(), query),
promise2 = Dashboard.getCurrentUser();
Promise.all([promise1, promise2]).then(function(responses) {
var query = getQuery(view);
var promise1 = ApiClient.getItems(Dashboard.getCurrentUserId(), query);
var promise2 = Dashboard.getCurrentUser();
Promise.all([promise1, promise2]).then(function (responses) {
var result = responses[0];
responses[1];
window.scrollTo(0, 0);
var html = "",
viewStyle = getPageData(view).view;
var html = "";
var viewStyle = getPageData(view).view;
view.querySelector(".listTopPaging").innerHTML = libraryBrowser.getQueryPagingHtml({
startIndex: query.StartIndex,
limit: query.Limit,
totalRecordCount: result.TotalRecordCount,
viewButton: !1,
showLimit: !1,
updatePageSizeSetting: !1,
addLayoutButton: !0,
viewButton: false,
showLimit: false,
updatePageSizeSetting: false,
addLayoutButton: true,
layouts: "List,Poster,PosterCard,Thumb,ThumbCard",
currentLayout: viewStyle
}), result.TotalRecordCount ? (html = "List" == viewStyle ? listView.getListViewHtml({
items: result.Items,
sortBy: query.SortBy
}) : "PosterCard" == viewStyle ? cardBuilder.getCardsHtml({
items: result.Items,
shape: "square",
coverImage: !0,
showTitle: !0,
cardLayout: !0
}) : "Thumb" == viewStyle ? cardBuilder.getCardsHtml({
items: result.Items,
shape: "backdrop",
showTitle: !0,
centerText: !0,
preferThumb: !0,
overlayPlayButton: !0
}) : "ThumbCard" == viewStyle ? cardBuilder.getCardsHtml({
items: result.Items,
shape: "backdrop",
showTitle: !0,
preferThumb: !0,
cardLayout: !0
}) : cardBuilder.getCardsHtml({
items: result.Items,
shape: "square",
showTitle: !0,
coverImage: !0,
centerText: !0,
overlayPlayButton: !0
}), view.querySelector(".noItemsMessage").classList.add("hide")) : view.querySelector(".noItemsMessage").classList.remove("hide");
});
if (result.TotalRecordCount) {
if (viewStyle == "List") {
html = listView.getListViewHtml({
items: result.Items,
sortBy: query.SortBy
});
} else if (viewStyle == "PosterCard") {
html = cardBuilder.getCardsHtml({
items: result.Items,
shape: "square",
coverImage: true,
showTitle: true,
cardLayout: true
});
} else if (viewStyle == "Thumb") {
html = cardBuilder.getCardsHtml({
items: result.Items,
shape: "backdrop",
showTitle: true,
centerText: true,
preferThumb: true,
overlayPlayButton: true
});
} else if (viewStyle == "ThumbCard") {
html = cardBuilder.getCardsHtml({
items: result.Items,
shape: "backdrop",
showTitle: true,
preferThumb: true,
cardLayout: true
});
} else {
html = cardBuilder.getCardsHtml({
items: result.Items,
shape: "square",
showTitle: true,
coverImage: true,
centerText: true,
overlayPlayButton: true
});
}
view.querySelector(".noItemsMessage").classList.add("hide");
} else {
view.querySelector(".noItemsMessage").classList.remove("hide");
}
var elem = view.querySelector(".itemsContainer");
elem.innerHTML = html, imageLoader.lazyChildren(elem);
elem.innerHTML = html;
imageLoader.lazyChildren(elem);
var btnNextPage = view.querySelector(".btnNextPage");
btnNextPage && btnNextPage.addEventListener("click", function() {
query.StartIndex += query.Limit, reloadItems()
});
if (btnNextPage) {
btnNextPage.addEventListener("click", function () {
query.StartIndex += query.Limit;
reloadItems();
});
}
var btnPreviousPage = view.querySelector(".btnPreviousPage");
btnPreviousPage && btnPreviousPage.addEventListener("click", function() {
query.StartIndex -= query.Limit, reloadItems()
});
if (btnPreviousPage) {
btnPreviousPage.addEventListener("click", function () {
query.StartIndex -= query.Limit;
reloadItems();
});
}
var btnChangeLayout = view.querySelector(".btnChangeLayout");
btnChangeLayout && btnChangeLayout.addEventListener("layoutchange", function(e) {
var layout = e.detail.viewStyle;
getPageData(view).view = layout, libraryBrowser.saveViewSetting(getSavedQueryKey(view), layout), onViewStyleChange(), reloadItems()
}), libraryBrowser.saveQueryValues(getSavedQueryKey(view), query), hideLoadingMessage()
})
if (btnChangeLayout) {
btnChangeLayout.addEventListener("layoutchange", function (e) {
var layout = e.detail.viewStyle;
getPageData(view).view = layout;
libraryBrowser.saveViewSetting(getSavedQueryKey(view), layout);
onViewStyleChange();
reloadItems();
});
}
libraryBrowser.saveQueryValues(getSavedQueryKey(view), query);
hideLoadingMessage();
});
}
var data = {};
view.addEventListener("viewbeforeshow", function() {
reloadItems()
}), view.querySelector(".btnNewPlaylist").addEventListener("click", function() {
require(["playlistEditor"], function(playlistEditor) {
view.addEventListener("viewbeforeshow", function () {
reloadItems();
});
view.querySelector(".btnNewPlaylist").addEventListener("click", function () {
require(["playlistEditor"], function (playlistEditor) {
var serverId = ApiClient.serverInfo().Id;
(new playlistEditor).show({
new playlistEditor().show({
items: [],
serverId: serverId
})
})
}), onViewStyleChange()
}
});
});
});
});
onViewStyleChange();
};
});

View File

@ -1,30 +1,54 @@
define(["searchFields", "searchResults", "events"], function(SearchFields, SearchResults, events) {
define(["searchFields", "searchResults", "events"], function (SearchFields, SearchResults, events) {
"use strict";
function init(instance, tabContent, options) {
tabContent.innerHTML = '<div class="padded-left padded-right searchFields"></div><div class="searchResults padded-top" style="padding-top:1.5em;"></div>', instance.searchFields = new SearchFields({
tabContent.innerHTML = '<div class="padded-left padded-right searchFields"></div><div class="searchResults padded-top" style="padding-top:1.5em;"></div>';
instance.searchFields = new SearchFields({
element: tabContent.querySelector(".searchFields")
}), instance.searchResults = new SearchResults({
});
instance.searchResults = new SearchResults({
element: tabContent.querySelector(".searchResults"),
serverId: ApiClient.serverId(),
parentId: options.parentId,
collectionType: options.collectionType
}), events.on(instance.searchFields, "search", function(e, value) {
instance.searchResults.search(value)
})
});
events.on(instance.searchFields, "search", function (e, value) {
instance.searchResults.search(value);
});
}
function SearchTab(view, tabContent, options) {
var self = this;
options = options || {}, init(this, tabContent, options), self.preRender = function() {}, self.renderTab = function() {
options = options || {};
init(this, tabContent, options);
self.preRender = function () {};
self.renderTab = function () {
var searchFields = this.searchFields;
searchFields && searchFields.focus()
}
if (searchFields) {
searchFields.focus();
}
};
}
return SearchTab.prototype.destroy = function() {
SearchTab.prototype.destroy = function () {
var searchFields = this.searchFields;
searchFields && searchFields.destroy(), this.searchFields = null;
if (searchFields) {
searchFields.destroy();
}
this.searchFields = null;
var searchResults = this.searchResults;
searchResults && searchResults.destroy(), this.searchResults = null
}, SearchTab
});
if (searchResults) {
searchResults.destroy();
}
this.searchResults = null;
};
return SearchTab;
});

View File

@ -1,48 +1,119 @@
define(["events", "userSettings", "serverNotifications", "connectionManager", "emby-button"], function(events, userSettings, serverNotifications, connectionManager) {
define(["events", "userSettings", "serverNotifications", "connectionManager", "emby-button"], function (events, userSettings, serverNotifications, connectionManager) {
"use strict";
return function(options) {
return function (options) {
function pollTasks() {
connectionManager.getApiClient(serverId).getScheduledTasks({
IsEnabled: !0
}).then(updateTasks)
IsEnabled: true
}).then(updateTasks);
}
function updateTasks(tasks) {
var task = tasks.filter(function(t) {
return t.Key == options.taskKey
var task = tasks.filter(function (t) {
return t.Key == options.taskKey;
})[0];
if (options.panel && (task ? options.panel.classList.remove("hide") : options.panel.classList.add("hide")), task) {
"Idle" == task.State ? button.removeAttribute("disabled") : button.setAttribute("disabled", "disabled"), button.setAttribute("data-taskid", task.Id);
var progress = (task.CurrentProgressPercentage || 0).toFixed(1);
if (options.progressElem && (options.progressElem.value = progress, "Running" == task.State ? options.progressElem.classList.remove("hide") : options.progressElem.classList.add("hide")), options.lastResultElem) {
var lastResult = task.LastExecutionResult ? task.LastExecutionResult.Status : "";
"Failed" == lastResult ? options.lastResultElem.html('<span style="color:#FF0000;">(' + Globalize.translate("LabelFailed") + ")</span>") : "Cancelled" == lastResult ? options.lastResultElem.html('<span style="color:#0026FF;">(' + Globalize.translate("LabelCancelled") + ")</span>") : "Aborted" == lastResult ? options.lastResultElem.html('<span style="color:#FF0000;">' + Globalize.translate("LabelAbortedByServerShutdown") + "</span>") : options.lastResultElem.html(lastResult)
if (options.panel) {
if (task) {
options.panel.classList.remove('hide');
} else {
options.panel.classList.add('hide');
}
}
if (!task) {
return;
}
if (task.State == 'Idle') {
button.removeAttribute("disabled");
} else {
button.setAttribute("disabled", "disabled");
}
button.setAttribute("data-taskid", task.Id);
var progress = (task.CurrentProgressPercentage || 0).toFixed(1);
if (options.progressElem) {
options.progressElem.value = progress;
if (task.State == 'Running') {
options.progressElem.classList.remove('hide');
} else {
options.progressElem.classList.add('hide');
}
}
if (options.lastResultElem) {
var lastResult = task.LastExecutionResult ? task.LastExecutionResult.Status : '';
if (lastResult == "Failed") {
options.lastResultElem.html('<span style="color:#FF0000;">(' + Globalize.translate('LabelFailed') + ')</span>');
} else if (lastResult == "Cancelled") {
options.lastResultElem.html('<span style="color:#0026FF;">(' + Globalize.translate('LabelCancelled') + ')</span>');
} else if (lastResult == "Aborted") {
options.lastResultElem.html('<span style="color:#FF0000;">' + Globalize.translate('LabelAbortedByServerShutdown') + '</span>');
} else {
options.lastResultElem.html(lastResult);
}
}
}
function onScheduledTaskMessageConfirmed(id) {
connectionManager.getApiClient(serverId).startScheduledTask(id).then(pollTasks)
connectionManager.getApiClient(serverId).startScheduledTask(id).then(pollTasks);
}
function onButtonClick() {
onScheduledTaskMessageConfirmed(this.getAttribute("data-taskid"))
onScheduledTaskMessageConfirmed(this.getAttribute("data-taskid"));
}
function onScheduledTasksUpdate(e, apiClient, info) {
apiClient.serverId() === serverId && updateTasks(info)
if (apiClient.serverId() === serverId) {
updateTasks(info);
}
}
var pollInterval;
var button = options.button;
var serverId = ApiClient.serverId();
function onPollIntervalFired() {
connectionManager.getApiClient(serverId).isMessageChannelOpen() || pollTasks()
if (!connectionManager.getApiClient(serverId).isMessageChannelOpen()) {
pollTasks();
}
}
var pollInterval, button = options.button,
serverId = ApiClient.serverId();
options.panel && options.panel.classList.add("hide"), "off" == options.mode ? (button.removeEventListener("click", onButtonClick), events.off(serverNotifications, "ScheduledTasksInfo", onScheduledTasksUpdate), function() {
connectionManager.getApiClient(serverId).sendMessage("ScheduledTasksInfoStop"), pollInterval && clearInterval(pollInterval)
}()) : (button.addEventListener("click", onButtonClick), pollTasks(), function() {
function startInterval() {
var apiClient = connectionManager.getApiClient(serverId);
pollInterval && clearInterval(pollInterval), apiClient.sendMessage("ScheduledTasksInfoStart", "1000,1000"), pollInterval = setInterval(onPollIntervalFired, 1e4)
}(), events.on(serverNotifications, "ScheduledTasksInfo", onScheduledTasksUpdate))
}
});
if (pollInterval) {
clearInterval(pollInterval);
}
apiClient.sendMessage("ScheduledTasksInfoStart", "1000,1000");
pollInterval = setInterval(onPollIntervalFired, 5000);
}
function stopInterval() {
connectionManager.getApiClient(serverId).sendMessage("ScheduledTasksInfoStop");
if (pollInterval) {
clearInterval(pollInterval);
}
}
if (options.panel) {
options.panel.classList.add("hide");
}
if (options.mode == 'off') {
button.removeEventListener("click", onButtonClick);
events.off(serverNotifications, "ScheduledTasksInfo", onScheduledTasksUpdate);
stopInterval();
} else {
button.addEventListener("click", onButtonClick);
pollTasks();
startInterval();
events.on(serverNotifications, "ScheduledTasksInfo", onScheduledTasksUpdate);
}
};
});

View File

@ -1,15 +1,27 @@
define(["userSettings", "skinManager", "connectionManager", "events"], function(userSettings, skinManager, connectionManager, events) {
define(["userSettings", "skinManager", "connectionManager", "events"], function (userSettings, skinManager, connectionManager, events) {
"use strict";
var currentViewType;
pageClassOn("viewbeforeshow", "page", function() {
var classList = this.classList,
viewType = classList.contains("type-interior") || classList.contains("wizardPage") ? "a" : "b";
pageClassOn("viewbeforeshow", "page", function () {
var classList = this.classList;
var viewType = classList.contains("type-interior") || classList.contains("wizardPage") ? "a" : "b";
if (viewType !== currentViewType) {
currentViewType = viewType;
var theme, context;
"a" === viewType ? (theme = userSettings.dashboardTheme(), context = "serverdashboard") : theme = userSettings.theme(), skinManager.setTheme(theme, context)
var theme;
var context;
if ("a" === viewType) {
theme = userSettings.dashboardTheme();
context = "serverdashboard";
} else {
theme = userSettings.theme();
}
skinManager.setTheme(theme, context);
}
}), events.on(connectionManager, "localusersignedin", function(e, user) {
currentViewType = null
})
});
});
events.on(connectionManager, "localusersignedin", function (e, user) {
currentViewType = null;
});
});

View File

@ -1,20 +1,30 @@
define(["jQuery", "loading", "libraryMenu"], function($, loading, libraryMenu) {
define(["jQuery", "loading", "libraryMenu"], function ($, loading, libraryMenu) {
"use strict";
function loadUser(page, user) {
libraryMenu.setTitle(user.Name), "Guest" == user.ConnectLinkType ? $(".connectMessage", page).show() : $(".connectMessage", page).hide(), loading.hide()
libraryMenu.setTitle(user.Name);
if ("Guest" == user.ConnectLinkType) {
$(".connectMessage", page).show();
} else {
$(".connectMessage", page).hide();
}
loading.hide();
}
function loadData(page) {
loading.show();
var userId = getParameterByName("userId");
ApiClient.getUser(userId).then(function(user) {
loadUser(page, user)
})
ApiClient.getUser(userId).then(function (user) {
loadUser(page, user);
});
}
$(document).on("pageinit", "#userPasswordPage", function() {
$(".adminUpdatePasswordForm").off("submit", UpdatePasswordPage.onSubmit).on("submit", UpdatePasswordPage.onSubmit), $(".adminLocalAccessForm").off("submit", UpdatePasswordPage.onLocalAccessSubmit).on("submit", UpdatePasswordPage.onLocalAccessSubmit)
}).on("pagebeforeshow", "#userPasswordPage", function() {
loadData(this)
})
});
$(document).on("pageinit", "#userPasswordPage", function () {
$(".adminUpdatePasswordForm").off("submit", UpdatePasswordPage.onSubmit).on("submit", UpdatePasswordPage.onSubmit);
$(".adminLocalAccessForm").off("submit", UpdatePasswordPage.onLocalAccessSubmit).on("submit", UpdatePasswordPage.onLocalAccessSubmit);
}).on("pagebeforeshow", "#userPasswordPage", function () {
loadData(this);
});
});

View File

@ -1,17 +1,27 @@
define(["dom", "emby-button"], function(dom) {
define(["dom", "emby-button"], function (dom) {
"use strict";
function onSubmit(e) {
return dom.parentWithClass(this, "page").querySelector(".chkAccept").checked ? Dashboard.navigate("wizardfinish.html") : Dashboard.alert({
message: Globalize.translate("MessagePleaseAcceptTermsOfServiceBeforeContinuing"),
title: ""
}), e.preventDefault(), !1
if (dom.parentWithClass(this, "page").querySelector(".chkAccept").checked) {
Dashboard.navigate("wizardfinish.html");
} else {
Dashboard.alert({
message: Globalize.translate("MessagePleaseAcceptTermsOfServiceBeforeContinuing"),
title: ""
});
}
e.preventDefault();
return false;
}
return function(view, params) {
view.querySelector(".wizardAgreementForm").addEventListener("submit", onSubmit), view.addEventListener("viewshow", function() {
document.querySelector(".skinHeader").classList.add("noHomeButtonHeader")
}), view.addEventListener("viewhide", function() {
document.querySelector(".skinHeader").classList.remove("noHomeButtonHeader")
})
}
});
return function (view, params) {
view.querySelector(".wizardAgreementForm").addEventListener("submit", onSubmit);
view.addEventListener("viewshow", function () {
document.querySelector(".skinHeader").classList.add("noHomeButtonHeader");
});
view.addEventListener("viewhide", function () {
document.querySelector(".skinHeader").classList.remove("noHomeButtonHeader");
});
};
});