mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge pull request #8 from cvium/remove_premiere_fix_crashes
Remove premiere stuff and fix crashes caused by earlier removals
This commit is contained in:
commit
a2c008a7cf
9 changed files with 1451 additions and 877 deletions
|
@ -35,44 +35,6 @@
|
|||
</p>
|
||||
<p id="nonServerMsg"></p>
|
||||
</form>
|
||||
|
||||
<div class="premiumPackage" style="display: none; margin-top: 1.5em;">
|
||||
<div>
|
||||
<form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
|
||||
<p id="regStatus">
|
||||
</p>
|
||||
<div class="supporterDescription">
|
||||
|
||||
<p>${MessagePluginRequiresSubscription}</p>
|
||||
|
||||
<p><a is="emby-linkbutton" class="button-link" href="https://github.com/jellyfin/jellyfin" target="_blank">${LinkLearnMoreAboutSubscription}</a></p>
|
||||
|
||||
</div>
|
||||
<div class="premiumDescription">
|
||||
|
||||
<p>${MessagePremiumPluginRequiresMembership}</p>
|
||||
|
||||
<p><a is="emby-linkbutton" class="button-link" href="https://github.com/jellyfin/jellyfin" target="_blank">${LinkLearnMoreAboutSubscription}</a></p>
|
||||
</div>
|
||||
<div class="premiumHasPrice" style="display: none">
|
||||
<p id="regPrice">
|
||||
</p>
|
||||
<input type="hidden" name="cmd" value="_xclick">
|
||||
<input type="hidden" id="payPalEmail" name="business" value="mb_1358534950_biz@reedsplace.com">
|
||||
<input type="hidden" name="currency_code" value="USD">
|
||||
<input type="hidden" id="featureName" name="item_name" value="">
|
||||
<input type="hidden" id="amount" name="amount" value="10">
|
||||
<input type="hidden" id="featureId" name="item_number" value="">
|
||||
<input type="hidden" name="notify_url" value="https://mb3admin.local/admin/service/services/ppipn.php">
|
||||
<input type="hidden" name="return" id="paypalReturnUrl" value="#">
|
||||
<button is="emby-button" type="submit" id="ppButton" class="raised block button-submit" style="background-color: #179BD7;color:#fff;">
|
||||
<span>${RegisterWithPayPal}</span>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
define(["jQuery", "registrationServices", "loading", "emby-checkbox", "emby-input", "listViewStyle", "paper-icon-button-light"], function ($__q, registrationServices, loading) {
|
||||
define(["jQuery", "loading", "emby-checkbox", "emby-input", "listViewStyle", "paper-icon-button-light"], function ($__q, loading) {
|
||||
"use strict";
|
||||
|
||||
return function (page, providerId, options) {
|
||||
function getListingProvider(config, id) {
|
||||
if (config && id) {
|
||||
var result = config.ListingProviders.filter(function (i__w) {
|
||||
return i__w.Id === id;
|
||||
var result = config.ListingProviders.filter(function (provider) {
|
||||
return provider.Id === id;
|
||||
})[0];
|
||||
|
||||
if (result) {
|
||||
|
@ -57,8 +57,8 @@ define(["jQuery", "registrationServices", "loading", "emby-checkbox", "emby-inpu
|
|||
loading.show();
|
||||
var id = providerId;
|
||||
ApiClient.getNamedConfiguration("livetv").then(function (config) {
|
||||
var info = config.ListingProviders.filter(function (i__e) {
|
||||
return i__e.Id === id;
|
||||
var info = config.ListingProviders.filter(function (provider) {
|
||||
return provider.Id === id;
|
||||
})[0] || {};
|
||||
info.Type = "xmltv";
|
||||
info.Path = page.querySelector(".txtPath").value;
|
||||
|
@ -69,10 +69,10 @@ define(["jQuery", "registrationServices", "loading", "emby-checkbox", "emby-inpu
|
|||
info.NewsCategories = getCategories(page.querySelector(".txtNews"));
|
||||
info.SportsCategories = getCategories(page.querySelector(".txtSports"));
|
||||
info.EnableAllTuners = page.querySelector(".chkAllTuners").checked;
|
||||
info.EnabledTuners = info.EnableAllTuners ? [] : $__q(".chkTuner", page).get().filter(function (i__r) {
|
||||
return i__r.checked;
|
||||
}).map(function (i__t) {
|
||||
return i__t.getAttribute("data-id");
|
||||
info.EnabledTuners = info.EnableAllTuners ? [] : $__q(".chkTuner", page).get().filter(function (tuner) {
|
||||
return tuner.checked;
|
||||
}).map(function (tuner) {
|
||||
return tuner.getAttribute("data-id");
|
||||
});
|
||||
ApiClient.ajax({
|
||||
type: "POST",
|
||||
|
@ -102,13 +102,10 @@ define(["jQuery", "registrationServices", "loading", "emby-checkbox", "emby-inpu
|
|||
switch (providerId = providerId.toLowerCase()) {
|
||||
case "m3u":
|
||||
return "M3U Playlist";
|
||||
|
||||
case "hdhomerun":
|
||||
return "HDHomerun";
|
||||
|
||||
case "satip":
|
||||
return "DVB";
|
||||
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
|
@ -117,8 +114,8 @@ define(["jQuery", "registrationServices", "loading", "emby-checkbox", "emby-inpu
|
|||
function refreshTunerDevices(page, providerInfo, devices) {
|
||||
var html = "";
|
||||
|
||||
for (var i__y = 0, length = devices.length; i__y < length; i__y++) {
|
||||
var device = devices[i__y];
|
||||
for (var i = 0, length = devices.length; i < length; i++) {
|
||||
var device = devices[i];
|
||||
html += '<div class="listItem">';
|
||||
var enabledTuners = providerInfo.EnabledTuners || [];
|
||||
var isChecked = providerInfo.EnableAllTuners || -1 !== enabledTuners.indexOf(device.Id);
|
||||
|
@ -151,7 +148,6 @@ define(["jQuery", "registrationServices", "loading", "emby-checkbox", "emby-inpu
|
|||
txtPath.value = path;
|
||||
txtPath.focus();
|
||||
}
|
||||
|
||||
picker.close();
|
||||
}
|
||||
});
|
||||
|
@ -184,8 +180,8 @@ define(["jQuery", "registrationServices", "loading", "emby-checkbox", "emby-inpu
|
|||
return false;
|
||||
});
|
||||
page.querySelector("#btnSelectPath").addEventListener("click", onSelectPathClick);
|
||||
page.querySelector(".chkAllTuners").addEventListener("change", function (e__i) {
|
||||
if (e__i.target.checked) {
|
||||
page.querySelector(".chkAllTuners").addEventListener("change", function (evt) {
|
||||
if (evt.target.checked) {
|
||||
page.querySelector(".selectTunersSection").classList.add("hide");
|
||||
} else {
|
||||
page.querySelector(".selectTunersSection").classList.remove("hide");
|
||||
|
|
|
@ -176,8 +176,7 @@ div[data-role=controlgroup] a.ui-btn-active {
|
|||
flex-grow: 1
|
||||
}
|
||||
|
||||
.activeSession:not(.playingSession) .sessionNowPlayingContent,
|
||||
.supporterMembershipDisabled .tabSupporterMembership {
|
||||
.activeSession:not(.playingSession) .sessionNowPlayingContent {
|
||||
display: none
|
||||
}
|
||||
|
||||
|
|
|
@ -77,42 +77,12 @@ div[data-role=page] {
|
|||
padding-bottom: 2em !important
|
||||
}
|
||||
|
||||
.supporterPromotionContainer {
|
||||
margin: 0 0 2em
|
||||
}
|
||||
|
||||
@media all and (min-width:80em) {
|
||||
.supporterPromotionContainer {
|
||||
margin: 0
|
||||
}
|
||||
}
|
||||
|
||||
@media all and (min-width:50em) {
|
||||
|
||||
.readOnlyContent,
|
||||
form {
|
||||
max-width: 54em
|
||||
}
|
||||
|
||||
.supporterPromotionContainer {
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
-webkit-box-orient: horizontal;
|
||||
-webkit-box-direction: reverse;
|
||||
-webkit-flex-direction: row-reverse;
|
||||
flex-direction: row-reverse
|
||||
}
|
||||
|
||||
.supporterPromotion {
|
||||
text-align: center;
|
||||
padding: 0 2em
|
||||
}
|
||||
|
||||
.supporterPromotion button {
|
||||
padding-left: 2em;
|
||||
padding-right: 2em
|
||||
}
|
||||
}
|
||||
|
||||
.imageDropZone {
|
||||
|
|
|
@ -84,8 +84,37 @@
|
|||
<div class="paperList serverActivityItems" data-activitylimit="4" data-useractivity="false">
|
||||
</div>
|
||||
</div>
|
||||
<div class="dashboardSection">
|
||||
<h3>${HeaderPaths}</h3>
|
||||
<div class="paperList">
|
||||
<div class="listItem listItem-border">
|
||||
<div class="listItemBody two-line">
|
||||
<div class="listItemBodyText secondary" style="margin:0;">${LabelCache}</div>
|
||||
<div class="listItemBodyText" id="cachePath"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="listItem listItem-border">
|
||||
<div class="listItemBody two-line">
|
||||
<div class="listItemBodyText secondary" style="margin:0;">${LabelLogs}</div>
|
||||
<div class="listItemBodyText" id="logPath"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="listItem listItem-border">
|
||||
<div class="listItemBody two-line">
|
||||
<div class="listItemBodyText secondary" style="margin:0;">${LabelMetadata}</div>
|
||||
<div class="listItemBodyText" id="metadataPath"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="listItem listItem-border">
|
||||
<div class="listItemBody two-line">
|
||||
<div class="listItemBodyText secondary" style="margin:0;">${LabelTranscodingTemporaryFiles}</div>
|
||||
<div class="listItemBodyText" id="transcodingTemporaryPath"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
<div id="liveTvSuggestedPage" data-dom-cache="true" data-role="page" class="page libraryPage liveTvPage pageWithAbsoluteTabs withTabs" data-title="${HeaderLiveTv}" data-backdroptype="series,movie">
|
||||
|
||||
<div class="unlockContainer hide padded-left padded-right">
|
||||
<p class="unlockText" style="text-align:center;"></p>
|
||||
<button is="emby-button" type="button" class="raised button-submit block btnUnlock">
|
||||
<span>${HeaderBecomeProjectSupporter}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="hide liveTvContainer">
|
||||
<div class="liveTvContainer">
|
||||
|
||||
<div class="pageTabContent" id="suggestionsTab" data-index="0">
|
||||
<div id="activePrograms" class="verticalSection">
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,197 +1,222 @@
|
|||
define(["layoutManager", "userSettings", "inputManager", "loading", "registrationServices", "globalize", "libraryBrowser", "mainTabsManager", "cardBuilder", "apphost", "imageLoader", "scrollStyles", "emby-itemscontainer", "emby-tabs", "emby-button"], function(layoutManager, userSettings, inputManager, loading, registrationServices, globalize, libraryBrowser, mainTabsManager, cardBuilder, appHost, imageLoader) {
|
||||
define(["layoutManager", "userSettings", "inputManager", "loading", "globalize", "libraryBrowser", "mainTabsManager", "cardBuilder", "apphost", "imageLoader", "scrollStyles", "emby-itemscontainer", "emby-tabs", "emby-button"], function (layoutManager, userSettings, inputManager, loading, globalize, libraryBrowser, mainTabsManager, cardBuilder, appHost, imageLoader) {
|
||||
"use strict";
|
||||
|
||||
function enableScrollX() {
|
||||
return !layoutManager.desktop
|
||||
return !layoutManager.desktop;
|
||||
}
|
||||
|
||||
function getBackdropShape() {
|
||||
return enableScrollX() ? "overflowBackdrop" : "backdrop"
|
||||
if (enableScrollX()) {
|
||||
return "overflowBackdrop";
|
||||
}
|
||||
return "backdrop";
|
||||
}
|
||||
|
||||
function getPortraitShape() {
|
||||
return enableScrollX() ? "overflowPortrait" : "portrait"
|
||||
if (enableScrollX()) {
|
||||
return "overflowPortrait";
|
||||
}
|
||||
return "portrait";
|
||||
}
|
||||
|
||||
function getLimit() {
|
||||
return enableScrollX() ? 12 : 9
|
||||
if (enableScrollX()) {
|
||||
return 12;
|
||||
}
|
||||
return 9;
|
||||
}
|
||||
|
||||
function loadRecommendedPrograms(page) {
|
||||
loading.show();
|
||||
var limit = getLimit();
|
||||
enableScrollX() && (limit *= 2), ApiClient.getLiveTvRecommendedPrograms({
|
||||
|
||||
if (enableScrollX()) {
|
||||
limit *= 2;
|
||||
}
|
||||
|
||||
ApiClient.getLiveTvRecommendedPrograms({
|
||||
userId: Dashboard.getCurrentUserId(),
|
||||
IsAiring: !0,
|
||||
IsAiring: true,
|
||||
limit: limit,
|
||||
ImageTypeLimit: 1,
|
||||
EnableImageTypes: "Primary,Thumb,Backdrop",
|
||||
EnableTotalRecordCount: !1,
|
||||
EnableTotalRecordCount: false,
|
||||
Fields: "ChannelInfo,PrimaryImageAspectRatio"
|
||||
}).then(function (result) {
|
||||
renderItems(page, result.Items, "activeProgramItems", "play", {
|
||||
showAirDateTime: !1,
|
||||
showAirEndTime: !0
|
||||
}), loading.hide()
|
||||
})
|
||||
showAirDateTime: false,
|
||||
showAirEndTime: true
|
||||
});
|
||||
loading.hide();
|
||||
});
|
||||
}
|
||||
|
||||
function reload(page, enableFullRender) {
|
||||
enableFullRender && (loadRecommendedPrograms(page), ApiClient.getLiveTvPrograms({
|
||||
if (enableFullRender) {
|
||||
loadRecommendedPrograms(page);
|
||||
ApiClient.getLiveTvPrograms({
|
||||
userId: Dashboard.getCurrentUserId(),
|
||||
HasAired: !1,
|
||||
HasAired: false,
|
||||
limit: getLimit(),
|
||||
IsMovie: !1,
|
||||
IsSports: !1,
|
||||
IsKids: !1,
|
||||
IsNews: !1,
|
||||
IsSeries: !0,
|
||||
EnableTotalRecordCount: !1,
|
||||
IsMovie: false,
|
||||
IsSports: false,
|
||||
IsKids: false,
|
||||
IsNews: false,
|
||||
IsSeries: true,
|
||||
EnableTotalRecordCount: false,
|
||||
Fields: "ChannelInfo,PrimaryImageAspectRatio",
|
||||
EnableImageTypes: "Primary,Thumb"
|
||||
}).then(function (result) {
|
||||
renderItems(page, result.Items, "upcomingEpisodeItems")
|
||||
}), ApiClient.getLiveTvPrograms({
|
||||
renderItems(page, result.Items, "upcomingEpisodeItems");
|
||||
});
|
||||
ApiClient.getLiveTvPrograms({
|
||||
userId: Dashboard.getCurrentUserId(),
|
||||
HasAired: !1,
|
||||
HasAired: false,
|
||||
limit: getLimit(),
|
||||
IsMovie: !0,
|
||||
EnableTotalRecordCount: !1,
|
||||
IsMovie: true,
|
||||
EnableTotalRecordCount: false,
|
||||
Fields: "ChannelInfo",
|
||||
EnableImageTypes: "Primary,Thumb"
|
||||
}).then(function (result) {
|
||||
renderItems(page, result.Items, "upcomingTvMovieItems", null, {
|
||||
shape: getPortraitShape(),
|
||||
preferThumb: null,
|
||||
showParentTitle: !1
|
||||
})
|
||||
}), ApiClient.getLiveTvPrograms({
|
||||
showParentTitle: false
|
||||
});
|
||||
});
|
||||
ApiClient.getLiveTvPrograms({
|
||||
userId: Dashboard.getCurrentUserId(),
|
||||
HasAired: !1,
|
||||
HasAired: false,
|
||||
limit: getLimit(),
|
||||
IsSports: !0,
|
||||
EnableTotalRecordCount: !1,
|
||||
IsSports: true,
|
||||
EnableTotalRecordCount: false,
|
||||
Fields: "ChannelInfo,PrimaryImageAspectRatio",
|
||||
EnableImageTypes: "Primary,Thumb"
|
||||
}).then(function (result) {
|
||||
renderItems(page, result.Items, "upcomingSportsItems")
|
||||
}), ApiClient.getLiveTvPrograms({
|
||||
renderItems(page, result.Items, "upcomingSportsItems");
|
||||
});
|
||||
ApiClient.getLiveTvPrograms({
|
||||
userId: Dashboard.getCurrentUserId(),
|
||||
HasAired: !1,
|
||||
HasAired: false,
|
||||
limit: getLimit(),
|
||||
IsKids: !0,
|
||||
EnableTotalRecordCount: !1,
|
||||
IsKids: true,
|
||||
EnableTotalRecordCount: false,
|
||||
Fields: "ChannelInfo,PrimaryImageAspectRatio",
|
||||
EnableImageTypes: "Primary,Thumb"
|
||||
}).then(function (result) {
|
||||
renderItems(page, result.Items, "upcomingKidsItems")
|
||||
}), ApiClient.getLiveTvPrograms({
|
||||
renderItems(page, result.Items, "upcomingKidsItems");
|
||||
});
|
||||
ApiClient.getLiveTvPrograms({
|
||||
userId: Dashboard.getCurrentUserId(),
|
||||
HasAired: !1,
|
||||
HasAired: false,
|
||||
limit: getLimit(),
|
||||
IsNews: !0,
|
||||
EnableTotalRecordCount: !1,
|
||||
IsNews: true,
|
||||
EnableTotalRecordCount: false,
|
||||
Fields: "ChannelInfo,PrimaryImageAspectRatio",
|
||||
EnableImageTypes: "Primary,Thumb"
|
||||
}).then(function (result) {
|
||||
renderItems(page, result.Items, "upcomingNewsItems", null, {
|
||||
showParentTitleOrTitle: !0,
|
||||
showTitle: !1,
|
||||
showParentTitle: !1
|
||||
})
|
||||
}))
|
||||
showParentTitleOrTitle: true,
|
||||
showTitle: false,
|
||||
showParentTitle: false
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function renderItems(page, items, sectionClass, overlayButton, cardOptions) {
|
||||
var html = cardBuilder.getCardsHtml(Object.assign({
|
||||
items: items,
|
||||
preferThumb: "auto",
|
||||
inheritThumb: !1,
|
||||
inheritThumb: false,
|
||||
shape: enableScrollX() ? "autooverflow" : "auto",
|
||||
defaultShape: getBackdropShape(),
|
||||
showParentTitle: !0,
|
||||
showTitle: !0,
|
||||
centerText: !0,
|
||||
coverImage: !0,
|
||||
overlayText: !1,
|
||||
lazy: !0,
|
||||
showParentTitle: true,
|
||||
showTitle: true,
|
||||
centerText: true,
|
||||
coverImage: true,
|
||||
overlayText: false,
|
||||
lazy: true,
|
||||
overlayPlayButton: "play" === overlayButton,
|
||||
overlayMoreButton: "more" === overlayButton,
|
||||
overlayInfoButton: "info" === overlayButton,
|
||||
allowBottomPadding: !enableScrollX(),
|
||||
showAirTime: !0,
|
||||
showAirDateTime: !0
|
||||
}, cardOptions || {})),
|
||||
elem = page.querySelector("." + sectionClass);
|
||||
elem.innerHTML = html, imageLoader.lazyChildren(elem)
|
||||
showAirTime: true,
|
||||
showAirDateTime: true
|
||||
}, cardOptions || {}));
|
||||
var elem = page.querySelector("." + sectionClass);
|
||||
elem.innerHTML = html;
|
||||
imageLoader.lazyChildren(elem);
|
||||
}
|
||||
|
||||
function getTabs() {
|
||||
return [{
|
||||
name: globalize.translate("Programs")
|
||||
}, {
|
||||
name: globalize.translate("TabGuide")
|
||||
}, {
|
||||
name: globalize.translate("TabChannels")
|
||||
}, {
|
||||
name: globalize.translate("TabRecordings")
|
||||
}, {
|
||||
name: globalize.translate("HeaderSchedule")
|
||||
}, {
|
||||
name: globalize.translate("TabSeries")
|
||||
}, {
|
||||
name: globalize.translate("ButtonSearch"),
|
||||
cssClass: "searchTabButton"
|
||||
}]
|
||||
}
|
||||
|
||||
function validateUnlock(view, showDialog) {
|
||||
registrationServices.validateFeature("livetv", {
|
||||
showDialog: showDialog,
|
||||
viewOnly: !0
|
||||
}).then(function() {
|
||||
view.querySelector(".liveTvContainer").classList.remove("hide"), view.querySelector(".unlockContainer").classList.add("hide")
|
||||
}, function() {
|
||||
view.querySelector(".liveTvContainer").classList.add("hide"), view.querySelector(".unlockContainer").classList.remove("hide")
|
||||
})
|
||||
return [
|
||||
{ name: globalize.translate("Programs") },
|
||||
{ name: globalize.translate("TabGuide") },
|
||||
{ name: globalize.translate("TabChannels") },
|
||||
{ name: globalize.translate("TabRecordings") },
|
||||
{ name: globalize.translate("HeaderSchedule") },
|
||||
{ name: globalize.translate("TabSeries") },
|
||||
{ name: globalize.translate("ButtonSearch"), cssClass: "searchTabButton" }
|
||||
];
|
||||
}
|
||||
|
||||
function setScrollClasses(elem, scrollX) {
|
||||
scrollX ? (elem.classList.add("hiddenScrollX"), layoutManager.tv && elem.classList.add("smoothScrollX"), elem.classList.add("scrollX"), elem.classList.remove("vertical-wrap")) : (elem.classList.remove("hiddenScrollX"), elem.classList.remove("smoothScrollX"), elem.classList.remove("scrollX"), elem.classList.add("vertical-wrap"))
|
||||
if (scrollX) {
|
||||
elem.classList.add("hiddenScrollX");
|
||||
|
||||
if (layoutManager.tv) {
|
||||
elem.classList.add("smoothScrollX");
|
||||
}
|
||||
|
||||
elem.classList.add("scrollX");
|
||||
elem.classList.remove("vertical-wrap");
|
||||
} else {
|
||||
elem.classList.remove("hiddenScrollX");
|
||||
elem.classList.remove("smoothScrollX");
|
||||
elem.classList.remove("scrollX");
|
||||
elem.classList.add("vertical-wrap");
|
||||
}
|
||||
}
|
||||
|
||||
function getDefaultTabIndex(folderId) {
|
||||
switch (userSettings.get("landing-" + folderId)) {
|
||||
case "guide":
|
||||
if (userSettings.get("landing-" + folderId) === "guide") {
|
||||
return 1;
|
||||
default:
|
||||
return 0
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return function (view, params) {
|
||||
function enableFullRender() {
|
||||
return (new Date).getTime() - lastFullRender > 3e5
|
||||
return new Date().getTime() - lastFullRender > 3e5;
|
||||
}
|
||||
|
||||
function onBeforeTabChange(e) {
|
||||
preLoadTab(view, parseInt(e.detail.selectedTabIndex))
|
||||
function onBeforeTabChange(evt) {
|
||||
preLoadTab(view, parseInt(evt.detail.selectedTabIndex));
|
||||
}
|
||||
|
||||
function onTabChange(e) {
|
||||
var previousTabController = tabControllers[parseInt(e.detail.previousIndex)];
|
||||
previousTabController && previousTabController.onHide && previousTabController.onHide(), loadTab(view, parseInt(e.detail.selectedTabIndex))
|
||||
function onTabChange(evt) {
|
||||
var previousTabController = tabControllers[parseInt(evt.detail.previousIndex)];
|
||||
|
||||
if (previousTabController && previousTabController.onHide) {
|
||||
previousTabController.onHide();
|
||||
}
|
||||
|
||||
loadTab(view, parseInt(evt.detail.selectedTabIndex));
|
||||
}
|
||||
|
||||
function getTabContainers() {
|
||||
return view.querySelectorAll(".pageTabContent")
|
||||
return view.querySelectorAll(".pageTabContent");
|
||||
}
|
||||
|
||||
function initTabs() {
|
||||
mainTabsManager.setTabs(view, currentTabIndex, getTabs, getTabContainers, onBeforeTabChange, onTabChange)
|
||||
mainTabsManager.setTabs(view, currentTabIndex, getTabs, getTabContainers, onBeforeTabChange, onTabChange);
|
||||
}
|
||||
|
||||
function getTabController(page, index, callback) {
|
||||
var depends = [];
|
||||
|
||||
// TODO int is a little hard to read
|
||||
switch (index) {
|
||||
case 0:
|
||||
break;
|
||||
|
@ -211,63 +236,141 @@ define(["layoutManager", "userSettings", "inputManager", "loading", "registratio
|
|||
depends.push("scripts/livetvseriestimers");
|
||||
break;
|
||||
case 6:
|
||||
depends.push("scripts/searchtab")
|
||||
depends.push("scripts/searchtab");
|
||||
}
|
||||
|
||||
require(depends, function (controllerFactory) {
|
||||
var tabContent;
|
||||
0 == index && (tabContent = view.querySelector(".pageTabContent[data-index='" + index + "']"), self.tabContent = tabContent);
|
||||
|
||||
if (0 == index) {
|
||||
tabContent = view.querySelector(".pageTabContent[data-index='" + index + "']");
|
||||
self.tabContent = tabContent;
|
||||
}
|
||||
|
||||
var controller = tabControllers[index];
|
||||
controller || (tabContent = view.querySelector(".pageTabContent[data-index='" + index + "']"), controller = 0 === index ? self : 6 === index ? new controllerFactory(view, tabContent, {
|
||||
|
||||
if (!controller) {
|
||||
tabContent = view.querySelector(".pageTabContent[data-index='" + index + "']");
|
||||
if (0 === index) {
|
||||
controller = self;
|
||||
} else if (6 === index) {
|
||||
controller = new controllerFactory(view, tabContent, {
|
||||
collectionType: "livetv"
|
||||
}) : new controllerFactory(view, params, tabContent), tabControllers[index] = controller, controller.initTab && controller.initTab()), callback(controller)
|
||||
})
|
||||
});
|
||||
} else {
|
||||
controller = new controllerFactory(view, params, tabContent);
|
||||
}
|
||||
tabControllers[index] = controller;
|
||||
|
||||
if (controller.initTab) {
|
||||
controller.initTab();
|
||||
}
|
||||
}
|
||||
|
||||
callback(controller);
|
||||
});
|
||||
}
|
||||
|
||||
function preLoadTab(page, index) {
|
||||
getTabController(page, index, function (controller) {
|
||||
-1 == renderedTabs.indexOf(index) && controller.preRender && controller.preRender()
|
||||
})
|
||||
if (renderedTabs.indexOf(index) === -1 && controller.preRender) {
|
||||
controller.preRender();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadTab(page, index) {
|
||||
currentTabIndex = index, getTabController(page, index, function(controller) {
|
||||
initialTabIndex = null, 1 === index ? document.body.classList.add("autoScrollY") : document.body.classList.remove("autoScrollY"), -1 == renderedTabs.indexOf(index) ? (1 === index && renderedTabs.push(index), controller.renderTab()) : controller.onShow && controller.onShow(), currentTabController = controller
|
||||
})
|
||||
currentTabIndex = index;
|
||||
getTabController(page, index, function (controller) {
|
||||
initialTabIndex = null;
|
||||
|
||||
if (1 === index) {
|
||||
document.body.classList.add("autoScrollY");
|
||||
} else {
|
||||
document.body.classList.remove("autoScrollY");
|
||||
}
|
||||
|
||||
function onInputCommand(e) {
|
||||
switch (e.detail.command) {
|
||||
case "search":
|
||||
e.preventDefault(), Dashboard.navigate("search.html?collectionType=livetv")
|
||||
if (-1 == renderedTabs.indexOf(index)) {
|
||||
if (1 === index) {
|
||||
renderedTabs.push(index);
|
||||
}
|
||||
|
||||
controller.renderTab();
|
||||
} else if (controller.onShow) {
|
||||
controller.onShow();
|
||||
}
|
||||
|
||||
currentTabController = controller;
|
||||
});
|
||||
}
|
||||
|
||||
function onInputCommand(evt) {
|
||||
if (evt.detail.command === "search") {
|
||||
evt.preventDefault();
|
||||
Dashboard.navigate("search.html?collectionType=livetv");
|
||||
}
|
||||
}
|
||||
var isViewRestored, self = this,
|
||||
currentTabIndex = parseInt(params.tab || getDefaultTabIndex("livetv")),
|
||||
initialTabIndex = currentTabIndex,
|
||||
lastFullRender = 0;
|
||||
|
||||
var isViewRestored;
|
||||
var self = this;
|
||||
var currentTabIndex = parseInt(params.tab || getDefaultTabIndex("livetv"));
|
||||
var initialTabIndex = currentTabIndex;
|
||||
var lastFullRender = 0;
|
||||
[].forEach.call(view.querySelectorAll(".sectionTitleTextButton-programs"), function (link) {
|
||||
var href = link.href;
|
||||
href && (link.href = href + "&serverId=" + ApiClient.serverId())
|
||||
}), view.querySelector(".unlockText").innerHTML = globalize.translate("sharedcomponents#LiveTvRequiresUnlock"), validateUnlock(view, !1), self.initTab = function() {
|
||||
for (var tabContent = view.querySelector(".pageTabContent[data-index='0']"), containers = tabContent.querySelectorAll(".itemsContainer"), i = 0, length = containers.length; i < length; i++) setScrollClasses(containers[i], enableScrollX())
|
||||
}, self.renderTab = function() {
|
||||
var tabContent = view.querySelector(".pageTabContent[data-index='0']");
|
||||
enableFullRender() ? (reload(tabContent, !0), lastFullRender = (new Date).getTime()) : reload(tabContent)
|
||||
};
|
||||
var currentTabController, tabControllers = [],
|
||||
renderedTabs = [];
|
||||
view.querySelector(".btnUnlock").addEventListener("click", function() {
|
||||
validateUnlock(view, !0)
|
||||
}), view.addEventListener("viewbeforeshow", function(e) {
|
||||
isViewRestored = e.detail.isRestored, initTabs()
|
||||
}), view.addEventListener("viewshow", function(e) {
|
||||
isViewRestored = e.detail.isRestored, isViewRestored || mainTabsManager.selectedTabIndex(initialTabIndex), inputManager.on(window, onInputCommand)
|
||||
}), view.addEventListener("viewbeforehide", function(e) {
|
||||
currentTabController && currentTabController.onHide && currentTabController.onHide(), document.body.classList.remove("autoScrollY"), inputManager.off(window, onInputCommand)
|
||||
}), view.addEventListener("viewdestroy", function(e) {
|
||||
tabControllers.forEach(function(t) {
|
||||
t.destroy && t.destroy()
|
||||
})
|
||||
})
|
||||
|
||||
if (href) {
|
||||
link.href = href + "&serverId=" + ApiClient.serverId();
|
||||
}
|
||||
});
|
||||
|
||||
self.initTab = function () {
|
||||
var tabContent = view.querySelector(".pageTabContent[data-index='0']");
|
||||
var containers = tabContent.querySelectorAll(".itemsContainer");
|
||||
|
||||
for (var i = 0, length = containers.length; i < length; i++) {
|
||||
setScrollClasses(containers[i], enableScrollX());
|
||||
}
|
||||
};
|
||||
|
||||
self.renderTab = function () {
|
||||
var tabContent = view.querySelector(".pageTabContent[data-index='0']");
|
||||
|
||||
if (enableFullRender()) {
|
||||
reload(tabContent, true);
|
||||
lastFullRender = new Date().getTime();
|
||||
} else {
|
||||
reload(tabContent);
|
||||
}
|
||||
};
|
||||
|
||||
var currentTabController;
|
||||
var tabControllers = [];
|
||||
var renderedTabs = [];
|
||||
view.addEventListener("viewbeforeshow", function (evt) {
|
||||
isViewRestored = evt.detail.isRestored;
|
||||
initTabs();
|
||||
});
|
||||
view.addEventListener("viewshow", function (evt) {
|
||||
isViewRestored = evt.detail.isRestored;
|
||||
if (!isViewRestored) {
|
||||
mainTabsManager.selectedTabIndex(initialTabIndex);
|
||||
}
|
||||
inputManager.on(window, onInputCommand);
|
||||
});
|
||||
view.addEventListener("viewbeforehide", function (e__u) {
|
||||
if (currentTabController && currentTabController.onHide) {
|
||||
currentTabController.onHide();
|
||||
}
|
||||
document.body.classList.remove("autoScrollY");
|
||||
inputManager.off(window, onInputCommand);
|
||||
});
|
||||
view.addEventListener("viewdestroy", function (evt) {
|
||||
tabControllers.forEach(function (tabController) {
|
||||
if (tabController.destroy) {
|
||||
tabController.destroy();
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
||||
|
|
|
@ -2,77 +2,205 @@ define(["loading", "libraryMenu", "globalize", "cardStyle", "emby-linkbutton", "
|
|||
"use strict";
|
||||
|
||||
function reloadList(page) {
|
||||
loading.show(), query.IsAppStoreSafe = !0;
|
||||
var promise1 = ApiClient.getAvailablePlugins(query),
|
||||
promise2 = ApiClient.getInstalledPlugins();
|
||||
loading.show();
|
||||
query.IsAppStoreSafe = true;
|
||||
var promise1 = ApiClient.getAvailablePlugins(query);
|
||||
var promise2 = ApiClient.getInstalledPlugins();
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
populateList({
|
||||
catalogElement: page.querySelector("#pluginTiles"),
|
||||
noItemsElement: page.querySelector("#noPlugins"),
|
||||
availablePlugins: responses[0],
|
||||
installedPlugins: responses[1]
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function populateList(options) {
|
||||
populateListInternal(options)
|
||||
populateListInternal(options);
|
||||
}
|
||||
|
||||
function getHeaderText(category) {
|
||||
category.replace(" ", "").replace(" ", "");
|
||||
return "Channel" === category ? category = "Channels" : "Theme" === category ? category = "Themes" : "LiveTV" === category ? category = "HeaderLiveTV" : "ScreenSaver" === category && (category = "HeaderScreenSavers"), globalize.translate(category)
|
||||
category = category.replace(" ", "");
|
||||
|
||||
if ("Channel" === category) {
|
||||
category = "Channels";
|
||||
} else if ("Theme" === category) {
|
||||
category = "Themes";
|
||||
} else if ("LiveTV" === category) {
|
||||
category = "HeaderLiveTV";
|
||||
} else if ("ScreenSaver" === category) {
|
||||
category = "HeaderScreenSavers";
|
||||
}
|
||||
|
||||
return globalize.translate(category);
|
||||
}
|
||||
|
||||
function isUserInstalledPlugin(plugin) {
|
||||
return -1 === ["02528C96-F727-44D7-BE87-9EEF040758C3", "0277E613-3EC0-4360-A3DE-F8AF0AABB5E9", "4DCB591C-0FA2-4C5D-A7E5-DABE37164C8B"].indexOf(plugin.guid)
|
||||
return -1 === ["02528C96-F727-44D7-BE87-9EEF040758C3", "0277E613-3EC0-4360-A3DE-F8AF0AABB5E9", "4DCB591C-0FA2-4C5D-A7E5-DABE37164C8B"].indexOf(plugin.guid);
|
||||
}
|
||||
|
||||
function populateListInternal(options) {
|
||||
var availablePlugins = options.availablePlugins,
|
||||
installedPlugins = options.installedPlugins,
|
||||
allPlugins = availablePlugins.filter(function(p) {
|
||||
return p.category = p.category || "General", p.categoryDisplayName = getHeaderText(p.category), (!options.categories || -1 != options.categories.indexOf(p.category)) && ((!options.targetSystem || p.targetSystem == options.targetSystem) && "UserInstalled" == p.type)
|
||||
var availablePlugins = options.availablePlugins;
|
||||
var installedPlugins = options.installedPlugins;
|
||||
var allPlugins = availablePlugins.filter(function (plugin) {
|
||||
plugin.category = plugin.category || "General";
|
||||
plugin.categoryDisplayName = getHeaderText(plugin.category);
|
||||
|
||||
if (!options.categories || -1 != options.categories.indexOf(plugin.category)) {
|
||||
if (!options.targetSystem || plugin.targetSystem == options.targetSystem) {
|
||||
return "UserInstalled" == plugin.type;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
availablePlugins = allPlugins.sort(function(a, b) {
|
||||
var aName = a.category,
|
||||
bName = b.category;
|
||||
return aName > bName ? 1 : bName > aName ? -1 : (aName = a.name, bName = b.name, aName > bName ? 1 : bName > aName ? -1 : 0)
|
||||
availablePlugins = allPlugins.sort(function (a__e, b__r) {
|
||||
var aName = a__e.category;
|
||||
var bName = b__r.category;
|
||||
|
||||
if (aName > bName) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (bName > aName) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
aName = a__e.name;
|
||||
bName = b__r.name;
|
||||
|
||||
if (aName > bName) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (bName > aName) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
var i, length, plugin, currentCategory, html = "";
|
||||
var i__q;
|
||||
var length;
|
||||
var plugin;
|
||||
var currentCategory;
|
||||
var html = "";
|
||||
|
||||
if (!options.categories) {
|
||||
currentCategory = globalize.translate("HeaderTopPlugins"), html += '<div class="verticalSection">', html += '<h2 class="sectionTitle sectionTitle-cards">' + currentCategory + "</h2>";
|
||||
var topPlugins = allPlugins.slice(0).sort(function(a, b) {
|
||||
if (a.installs > b.installs) return -1;
|
||||
if (b.installs > a.installs) return 1;
|
||||
var aName = a.name,
|
||||
bName = b.name;
|
||||
return aName > bName ? 1 : bName > aName ? -1 : 0
|
||||
currentCategory = globalize.translate("HeaderTopPlugins");
|
||||
html += '<div class="verticalSection">';
|
||||
html += '<h2 class="sectionTitle sectionTitle-cards">' + currentCategory + "</h2>";
|
||||
var topPlugins = allPlugins.slice(0).sort(function (a__t, b__y) {
|
||||
if (a__t.installs > b__y.installs) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (b__y.installs > a__t.installs) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
var aName = a__t.name;
|
||||
var bName = b__y.name;
|
||||
|
||||
if (aName > bName) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (bName > aName) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}).filter(isUserInstalledPlugin);
|
||||
html += '<div class="itemsContainer vertical-wrap">';
|
||||
var limit = screen.availWidth >= 1920 ? 15 : 12;
|
||||
for (i = 0, length = Math.min(topPlugins.length, limit); i < length; i++) html += getPluginHtml(topPlugins[i], options, installedPlugins);
|
||||
html += "</div>", html += "</div>"
|
||||
|
||||
for (i__q = 0, length = Math.min(topPlugins.length, limit); i__q < length; i__q++) {
|
||||
html += getPluginHtml(topPlugins[i__q], options, installedPlugins);
|
||||
}
|
||||
var hasOpenTag = !1;
|
||||
for (currentCategory = null, !1 === options.showCategory && (html += '<div class="itemsContainer vertical-wrap">', hasOpenTag = !0), i = 0, length = availablePlugins.length; i < length; i++) {
|
||||
plugin = availablePlugins[i];
|
||||
|
||||
html += "</div>";
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
var hasOpenTag = false;
|
||||
|
||||
for (currentCategory = null, false === options.showCategory && (html += '<div class="itemsContainer vertical-wrap">', hasOpenTag = true), i__q = 0, length = availablePlugins.length; i__q < length; i__q++) {
|
||||
plugin = availablePlugins[i__q];
|
||||
var category = plugin.categoryDisplayName;
|
||||
category != currentCategory && (!1 !== options.showCategory && (currentCategory && (hasOpenTag = !1, html += "</div>", html += "</div>"), html += '<div class="verticalSection">', html += '<h2 class="sectionTitle sectionTitle-cards">' + category + "</h2>", html += '<div class="itemsContainer vertical-wrap">', hasOpenTag = !0), currentCategory = category), html += getPluginHtml(plugin, options, installedPlugins)
|
||||
|
||||
if (category != currentCategory) {
|
||||
if (false !== options.showCategory) {
|
||||
if (currentCategory) {
|
||||
hasOpenTag = false;
|
||||
html += "</div>";
|
||||
html += "</div>";
|
||||
}
|
||||
hasOpenTag && (html += "</div>", html += "</div>"), !availablePlugins.length && options.noItemsElement && options.noItemsElement.classList.add("hide"), options.catalogElement.innerHTML = html, loading.hide()
|
||||
|
||||
html += '<div class="verticalSection">';
|
||||
html += '<h2 class="sectionTitle sectionTitle-cards">' + category + "</h2>";
|
||||
html += '<div class="itemsContainer vertical-wrap">';
|
||||
hasOpenTag = true;
|
||||
}
|
||||
|
||||
currentCategory = category;
|
||||
}
|
||||
|
||||
html += getPluginHtml(plugin, options, installedPlugins);
|
||||
}
|
||||
|
||||
if (hasOpenTag) {
|
||||
html += "</div>";
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
if (!availablePlugins.length && options.noItemsElement) {
|
||||
options.noItemsElement.classList.add("hide");
|
||||
}
|
||||
|
||||
options.catalogElement.innerHTML = html;
|
||||
loading.hide();
|
||||
}
|
||||
|
||||
function getPluginHtml(plugin, options, installedPlugins) {
|
||||
var html = "",
|
||||
href = plugin.externalUrl ? plugin.externalUrl : "addplugin.html?name=" + encodeURIComponent(plugin.name) + "&guid=" + plugin.guid;
|
||||
options.context && (href += "&context=" + options.context);
|
||||
var html = "";
|
||||
var href = plugin.externalUrl ? plugin.externalUrl : "addplugin.html?name=" + encodeURIComponent(plugin.name) + "&guid=" + plugin.guid;
|
||||
|
||||
if (options.context) {
|
||||
href += "&context=" + options.context;
|
||||
}
|
||||
|
||||
var target = plugin.externalUrl ? ' target="_blank"' : "";
|
||||
html += "<div class='card backdropCard'>", html += '<div class="cardBox visualCardBox">', html += '<div class="cardScalable visualCardBox-cardScalable">', html += '<div class="cardPadder cardPadder-backdrop"></div>', html += '<a class="cardContent cardImageContainer" is="emby-linkbutton" href="' + href + '"' + target + ">", plugin.thumbImage ? (html += '<div class="cardImage coveredImage" style="background-image:url(\'' + plugin.thumbImage + "');\">", html += "</div>") : html += '<i class="cardImageIcon md-icon"></i>', plugin.isPremium && (plugin.price > 0 ? html += "<div class='premiumBanner'><img src='css/images/supporter/premiumflag.png' /></div>" : html += "<div class='premiumBanner'><img src='css/images/supporter/supporterflag.png' /></div>"), html += "</a>", html += "</div>", html += '<div class="cardFooter">', html += "<div class='cardText'>", html += plugin.name, html += "</div>";
|
||||
html += "<div class='card backdropCard'>";
|
||||
html += '<div class="cardBox visualCardBox">';
|
||||
html += '<div class="cardScalable visualCardBox-cardScalable">';
|
||||
html += '<div class="cardPadder cardPadder-backdrop"></div>';
|
||||
html += '<a class="cardContent cardImageContainer" is="emby-linkbutton" href="' + href + '"' + target + ">";
|
||||
|
||||
if (plugin.thumbImage) {
|
||||
html += '<div class="cardImage coveredImage" style="background-image:url(\'' + plugin.thumbImage + "');\">";
|
||||
html += "</div>";
|
||||
} else {
|
||||
html += '<i class="cardImageIcon md-icon"></i>';
|
||||
}
|
||||
|
||||
html += "</a>";
|
||||
html += "</div>";
|
||||
html += '<div class="cardFooter">';
|
||||
html += "<div class='cardText'>";
|
||||
html += plugin.name;
|
||||
html += "</div>";
|
||||
var installedPlugin = plugin.isApp ? null : installedPlugins.filter(function (ip) {
|
||||
return ip.Id == plugin.guid
|
||||
return ip.Id == plugin.guid;
|
||||
})[0];
|
||||
return html += "<div class='cardText cardText-secondary'>", html += installedPlugin ? globalize.translate("LabelVersionInstalled").replace("{0}", installedPlugin.Version) : " ", html += "</div>", html += "</div>", html += "</div>", html += "</div>"
|
||||
html += "<div class='cardText cardText-secondary'>";
|
||||
html += installedPlugin ? globalize.translate("LabelVersionInstalled").replace("{0}", installedPlugin.Version) : " ";
|
||||
html += "</div>";
|
||||
html += "</div>";
|
||||
html += "</div>";
|
||||
return html += "</div>";
|
||||
}
|
||||
|
||||
function getTabs() {
|
||||
|
@ -82,20 +210,24 @@ define(["loading", "libraryMenu", "globalize", "cardStyle", "emby-linkbutton", "
|
|||
}, {
|
||||
href: "plugincatalog.html",
|
||||
name: globalize.translate("TabCatalog")
|
||||
}]
|
||||
}];
|
||||
}
|
||||
|
||||
var query = {
|
||||
TargetSystems: "Server",
|
||||
IsAdult: !1
|
||||
IsAdult: false
|
||||
};
|
||||
return window.PluginCatalog = {
|
||||
window.PluginCatalog = {
|
||||
renderCatalog: populateList
|
||||
},
|
||||
function(view, params) {
|
||||
};
|
||||
return function (view, params) {
|
||||
view.querySelector("#selectSystem").addEventListener("change", function () {
|
||||
query.TargetSystems = this.value, reloadList(view)
|
||||
}), view.addEventListener("viewshow", function() {
|
||||
libraryMenu.setTabs("plugins", 1, getTabs), reloadList(this)
|
||||
})
|
||||
}
|
||||
query.TargetSystems = this.value;
|
||||
reloadList(view);
|
||||
});
|
||||
view.addEventListener("viewshow", function () {
|
||||
libraryMenu.setTabs("plugins", 1, getTabs);
|
||||
reloadList(this);
|
||||
});
|
||||
};
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue