mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
lazy load scripts
This commit is contained in:
parent
1f0760df09
commit
89e0515a15
31 changed files with 366 additions and 328 deletions
|
@ -1,6 +1,6 @@
|
|||
(function ($, document) {
|
||||
|
||||
$(document).on('pageshow', "#aboutPage", function () {
|
||||
$(document).on('pageshown', "#aboutPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -131,84 +131,7 @@
|
|||
|
||||
$('#developer', page).html(pkg.owner);
|
||||
|
||||
if (pkg.isPremium) {
|
||||
$('.premiumPackage', page).show();
|
||||
|
||||
// Fill in registration info
|
||||
var regStatus = "";
|
||||
if (pkg.isRegistered) {
|
||||
|
||||
regStatus += "<p style='color:green;'>";
|
||||
|
||||
regStatus += Globalize.translate('MessageFeatureIncludedWithSupporter');
|
||||
|
||||
} else {
|
||||
|
||||
var expDateTime = new Date(pkg.expDate).getTime();
|
||||
var nowTime = new Date().getTime();
|
||||
|
||||
if (expDateTime <= nowTime) {
|
||||
regStatus += "<p style='color:red;'>";
|
||||
regStatus += Globalize.translate('MessageTrialExpired');
|
||||
}
|
||||
else if (expDateTime > new Date(1970, 1, 1).getTime()) {
|
||||
|
||||
regStatus += "<p style='color:blue;'>";
|
||||
regStatus += Globalize.translate('MessageTrialWillExpireIn').replace('{0}', Math.round(expDateTime - nowTime) / (86400000));
|
||||
}
|
||||
}
|
||||
|
||||
regStatus += "</p>";
|
||||
$('#regStatus', page).html(regStatus);
|
||||
|
||||
if (pluginSecurityInfo.IsMBSupporter) {
|
||||
$('#regInfo', page).html(pkg.regInfo || "");
|
||||
|
||||
$('.premiumDescription', page).hide();
|
||||
$('.supporterDescription', page).hide();
|
||||
|
||||
if (pkg.price > 0) {
|
||||
// Fill in PayPal info
|
||||
$('.premiumHasPrice', page).show();
|
||||
$('#featureId', page).val(pkg.featureId);
|
||||
$('#featureName', page).val(pkg.name);
|
||||
$('#amount', page).val(pkg.price);
|
||||
|
||||
$('#regPrice', page).html("<h3>" + Globalize.translate('ValuePriceUSD').replace('{0}', "$" + pkg.price.toFixed(2)) + "</h3>");
|
||||
|
||||
var url = "http://mb3admin.com/admin/service/user/getPayPalEmail?id=" + pkg.owner;
|
||||
|
||||
$.getJSON(url).done(function (dev) {
|
||||
if (dev.payPalEmail) {
|
||||
$('#payPalEmail', page).val(dev.payPalEmail);
|
||||
|
||||
} else {
|
||||
$('#ppButton', page).hide();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Supporter-only feature
|
||||
$('.premiumHasPrice', page).hide();
|
||||
}
|
||||
} else {
|
||||
|
||||
if (pkg.price) {
|
||||
$('.premiumDescription', page).show();
|
||||
$('.supporterDescription', page).hide();
|
||||
$('#regInfo', page).html("");
|
||||
|
||||
} else {
|
||||
$('.premiumDescription', page).hide();
|
||||
$('.supporterDescription', page).show();
|
||||
$('#regInfo', page).html("");
|
||||
}
|
||||
|
||||
$('#ppButton', page).hide();
|
||||
}
|
||||
|
||||
} else {
|
||||
$('.premiumPackage', page).hide();
|
||||
}
|
||||
RegistrationServices.renderPluginInfo(page, pkg, pluginSecurityInfo);
|
||||
|
||||
//Ratings and Reviews
|
||||
var ratingHtml = RatingHelpers.getStoreRatingHtml(pkg.avgRating, pkg.id, pkg.name);
|
||||
|
@ -246,7 +169,7 @@
|
|||
Dashboard.hideLoadingMsg();
|
||||
}
|
||||
|
||||
$(document).on('pageshow', "#addPluginPage", function () {
|
||||
$(document).on('pageshown', "#addPluginPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -60,14 +60,12 @@
|
|||
|
||||
}
|
||||
|
||||
$(document).on('pagebeforeshow', "#channelsPage", function () {
|
||||
$(document).on('pageshown', "#channelsPage", function () {
|
||||
|
||||
LibraryBrowser.loadSavedQueryValues('channels', query);
|
||||
|
||||
reloadItems(this);
|
||||
|
||||
}).on('pageshow', "#channelsPage", function () {
|
||||
|
||||
updateFilterControls(this);
|
||||
});
|
||||
|
||||
|
|
|
@ -1189,7 +1189,7 @@
|
|||
|
||||
var chapters = item.Chapters || [];
|
||||
|
||||
var maxWwidth = LibraryBrowser.getPosterViewInfo().thumbWidth;
|
||||
var maxWidth = LibraryBrowser.getPosterViewInfo().backdropWidth;
|
||||
|
||||
for (var i = 0, length = chapters.length; i < length; i++) {
|
||||
|
||||
|
@ -1212,7 +1212,7 @@
|
|||
if (chapter.ImageTag) {
|
||||
|
||||
imgUrl = ApiClient.getScaledImageUrl(item.Id, {
|
||||
maxWidth: maxWwidth,
|
||||
maxWidth: maxWidth,
|
||||
tag: chapter.ImageTag,
|
||||
type: "Chapter",
|
||||
index: i
|
||||
|
@ -1411,7 +1411,7 @@
|
|||
|
||||
var html = '';
|
||||
|
||||
var maxWwidth = LibraryBrowser.getPosterViewInfo().thumbWidth;
|
||||
var maxWidth = LibraryBrowser.getPosterViewInfo().backdropWidth;
|
||||
|
||||
for (var i = 0, length = items.length; i < length; i++) {
|
||||
|
||||
|
@ -1439,7 +1439,7 @@
|
|||
if (imageTags.Primary) {
|
||||
|
||||
imgUrl = ApiClient.getScaledImageUrl(item.Id, {
|
||||
maxWidth: maxWwidth,
|
||||
maxWidth: maxWidth,
|
||||
tag: imageTags.Primary,
|
||||
type: "primary"
|
||||
});
|
||||
|
|
|
@ -961,6 +961,8 @@
|
|||
return screenWidth;
|
||||
},
|
||||
|
||||
shapes: ['square', 'portrait', 'banner', 'smallBackdrop', 'homePageSmallBackdrop', 'backdrop', 'overflowBackdrop', 'overflowPortrait', 'overflowSquare'],
|
||||
|
||||
getPostersPerRow: function (screenWidth) {
|
||||
|
||||
function getValue(shape) {
|
||||
|
@ -973,14 +975,10 @@
|
|||
|
||||
var info = {};
|
||||
|
||||
info.square = getValue('square');
|
||||
info.smallSquare = getValue('smallSquare');
|
||||
info.thumb = getValue('backdrop');
|
||||
info.portrait = getValue('portrait');
|
||||
info.smallPortrait = getValue('smallPortrait');
|
||||
info.banner = getValue('banner');
|
||||
info.smallThumb = getValue('smallBackdrop');
|
||||
|
||||
for (var i = 0, length = LibraryBrowser.shapes.length; i < length; i++) {
|
||||
var currentShape = LibraryBrowser.shapes[i];
|
||||
info[currentShape] = getValue(currentShape);
|
||||
}
|
||||
return info;
|
||||
},
|
||||
|
||||
|
@ -1010,57 +1008,29 @@
|
|||
|
||||
var imagesPerRow = LibraryBrowser.getPostersPerRow(screenWidth);
|
||||
|
||||
var result = {};
|
||||
result.screenWidth = screenWidth;
|
||||
|
||||
if (!AppInfo.hasLowImageBandwidth) {
|
||||
screenWidth *= 1.25;
|
||||
}
|
||||
|
||||
var thumbWidth = screenWidth / imagesPerRow.thumb;
|
||||
var smallThumbWidth = screenWidth / imagesPerRow.smallThumb;
|
||||
var posterWidth = screenWidth / imagesPerRow.portrait;
|
||||
var smallPosterWidth = screenWidth / imagesPerRow.smallPortrait;
|
||||
var squareSize = screenWidth / imagesPerRow.square;
|
||||
var smallSquareSize = screenWidth / imagesPerRow.smallSquare;
|
||||
var bannerWidth = screenWidth / imagesPerRow.banner;
|
||||
var roundTo = 100;
|
||||
|
||||
if (!AppInfo.isTouchPreferred) {
|
||||
for (var i = 0, length = LibraryBrowser.shapes.length; i < length; i++) {
|
||||
var currentShape = LibraryBrowser.shapes[i];
|
||||
|
||||
var roundTo = 100;
|
||||
var shapeWidth = screenWidth / imagesPerRow[currentShape];
|
||||
|
||||
thumbWidth = Math.round(thumbWidth / roundTo) * roundTo;
|
||||
smallThumbWidth = Math.round(smallThumbWidth / roundTo) * roundTo;
|
||||
posterWidth = Math.round(posterWidth / roundTo) * roundTo;
|
||||
smallPosterWidth = Math.round(smallPosterWidth / roundTo) * roundTo;
|
||||
squareSize = Math.round(squareSize / roundTo) * roundTo;
|
||||
bannerWidth = Math.round(bannerWidth / roundTo) * roundTo;
|
||||
if (!AppInfo.isTouchPreferred) {
|
||||
|
||||
shapeWidth = Math.round(shapeWidth / roundTo) * roundTo;
|
||||
}
|
||||
|
||||
result[currentShape + 'Width'] = Math.round(shapeWidth);
|
||||
}
|
||||
|
||||
var defaultPortait = 'portrait';
|
||||
var defaultThumb = 'backdrop';
|
||||
var defaultSquare = 'square';
|
||||
|
||||
if (AppInfo.hasLowImageBandwidth) {
|
||||
defaultThumb = 'smallBackdrop';
|
||||
defaultSquare = 'smallSquare';
|
||||
defaultPortait = 'smallPortrait';
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
defaultThumb: defaultThumb,
|
||||
smallThumbWidth: Math.round(smallThumbWidth),
|
||||
thumbWidth: Math.round(thumbWidth),
|
||||
|
||||
defaultPortait: defaultPortait,
|
||||
posterWidth: Math.round(posterWidth),
|
||||
smallPosterWidth: Math.round(smallPosterWidth),
|
||||
|
||||
defaultSquare: defaultSquare,
|
||||
squareSize: Math.round(squareSize),
|
||||
smallSquareSize: Math.round(smallSquareSize),
|
||||
|
||||
bannerWidth: Math.round(bannerWidth),
|
||||
screenWidth: screenWidth
|
||||
};
|
||||
return result;
|
||||
},
|
||||
|
||||
getPosterViewHtml: function (options) {
|
||||
|
@ -1096,49 +1066,46 @@
|
|||
|
||||
var posterInfo = LibraryBrowser.getPosterViewInfo();
|
||||
|
||||
var thumbWidth = posterInfo.thumbWidth;
|
||||
var posterWidth = posterInfo.posterWidth;
|
||||
var squareSize = posterInfo.squareSize;
|
||||
var thumbWidth = posterInfo.backdropWidth;
|
||||
var posterWidth = posterInfo.portraitWidth;
|
||||
var squareSize = posterInfo.squareWidth;
|
||||
var bannerWidth = posterInfo.bannerWidth;
|
||||
|
||||
if (isThumbAspectRatio) {
|
||||
posterInfo.smallPosterWidth = posterInfo.smallThumbWidth;
|
||||
posterWidth = thumbWidth;
|
||||
}
|
||||
else if (isSquareAspectRatio) {
|
||||
posterInfo.smallPosterWidth = posterInfo.smallSquareSize;
|
||||
posterWidth = squareSize;
|
||||
}
|
||||
|
||||
if (options.shape == 'backdrop' && posterInfo.defaultThumb == 'smallBackdrop') {
|
||||
options.shape = 'smallBackdrop';
|
||||
if (options.shape == 'overflowBackdrop') {
|
||||
thumbWidth = posterInfo.overflowBackdropWidth;
|
||||
}
|
||||
|
||||
else if (options.shape == 'portrait' && posterInfo.defaultPortait == 'smallPortrait') {
|
||||
options.shape = 'smallPortrait';
|
||||
else if (options.shape == 'overflowPortrait') {
|
||||
posterWidth = posterInfo.overflowPortraitWidth;
|
||||
}
|
||||
|
||||
else if (options.shape == 'square' && posterInfo.defaultSquare == 'smallSquare') {
|
||||
options.shape = 'smallSquare';
|
||||
else if (options.shape == 'overflowSquare') {
|
||||
squareSize = posterInfo.overflowSquareWidth;
|
||||
}
|
||||
|
||||
if (options.shape == 'smallBackdrop') {
|
||||
thumbWidth = posterInfo.smallThumbWidth;
|
||||
else if (options.shape == 'smallBackdrop') {
|
||||
thumbWidth = posterInfo.smallBackdropWidth;
|
||||
}
|
||||
else if (options.shape == 'smallPortrait') {
|
||||
posterWidth = posterInfo.smallPosterWidth;
|
||||
}
|
||||
else if (options.shape == 'smallSquare') {
|
||||
squareSize = posterInfo.smallSquareSize;
|
||||
else if (options.shape == 'homePageSmallBackdrop') {
|
||||
thumbWidth = posterInfo.homePageSmallBackdropWidth;
|
||||
posterWidth = posterInfo.homePageSmallBackdropWidth;
|
||||
}
|
||||
else if (options.shape == 'detailPagePortrait') {
|
||||
posterWidth = 200;
|
||||
}
|
||||
else if (options.shape == 'detailPageSquare') {
|
||||
posterWidth = 200;
|
||||
squareSize = 200;
|
||||
}
|
||||
else if (options.shape == 'detailPage169') {
|
||||
posterWidth = 320;
|
||||
thumbWidth = 320;
|
||||
}
|
||||
|
||||
|
||||
var dateText;
|
||||
|
||||
for (var i = 0, length = items.length; i < length; i++) {
|
||||
|
@ -1679,7 +1646,7 @@
|
|||
},
|
||||
|
||||
getListItemInfo: function (elem) {
|
||||
|
||||
|
||||
var elemWithAttributes = elem;
|
||||
|
||||
while (!elemWithAttributes.getAttribute('data-itemid')) {
|
||||
|
|
|
@ -407,7 +407,7 @@
|
|||
html += '</div>';
|
||||
|
||||
if (item.Chapters && item.Chapters.length) {
|
||||
html += '<div class="tabScenes nowPlayingTab" style="display:none;white-space:nowrap;margin-bottom:2em;">';
|
||||
html += '<div class="tabScenes nowPlayingTab hiddenScrollX" style="display:none;white-space:nowrap;margin-bottom:2em;">';
|
||||
var chapterIndex = 0;
|
||||
html += item.Chapters.map(function (c) {
|
||||
|
||||
|
@ -454,7 +454,7 @@
|
|||
}
|
||||
|
||||
if (item.People && item.People.length) {
|
||||
html += '<div class="tabCast nowPlayingTab" style="display:none;white-space:nowrap;">';
|
||||
html += '<div class="tabCast nowPlayingTab hiddenScrollX" style="display:none;white-space:nowrap;">';
|
||||
html += item.People.map(function (cast) {
|
||||
|
||||
var personHtml = '<div class="tileItem smallPosterTileItem" style="width:300px;">';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
(function ($, document) {
|
||||
|
||||
function getView() {
|
||||
|
||||
|
||||
if (AppInfo.hasLowImageBandwidth) {
|
||||
return 'PosterCard';
|
||||
}
|
||||
|
@ -18,6 +18,18 @@
|
|||
return 'ThumbCard';
|
||||
}
|
||||
|
||||
function enableScrollX() {
|
||||
return AppInfo.isTouchPreferred;
|
||||
}
|
||||
|
||||
function getPortraitShape() {
|
||||
return enableScrollX() ? 'overflowPortrait' : 'portrait';
|
||||
}
|
||||
|
||||
function getThumbShape() {
|
||||
return enableScrollX() ? 'overflowBackdrop' : 'backdrop';
|
||||
}
|
||||
|
||||
function loadLatest(page, userId, parentId) {
|
||||
|
||||
var limit = 18;
|
||||
|
@ -45,7 +57,7 @@
|
|||
html += LibraryBrowser.getPosterViewHtml({
|
||||
items: items,
|
||||
lazy: true,
|
||||
shape: 'portrait',
|
||||
shape: getPortraitShape(),
|
||||
overlayText: false,
|
||||
showTitle: true,
|
||||
showYear: true,
|
||||
|
@ -55,10 +67,10 @@
|
|||
});
|
||||
|
||||
} else if (view == 'Poster') {
|
||||
|
||||
|
||||
html += LibraryBrowser.getPosterViewHtml({
|
||||
items: items,
|
||||
shape: "portrait",
|
||||
shape: getPortraitShape(),
|
||||
centerText: true,
|
||||
lazy: true,
|
||||
overlayText: true
|
||||
|
@ -104,7 +116,7 @@
|
|||
html += LibraryBrowser.getPosterViewHtml({
|
||||
items: result.Items,
|
||||
preferThumb: true,
|
||||
shape: 'backdrop',
|
||||
shape: getThumbShape(),
|
||||
showTitle: true,
|
||||
showYear: true,
|
||||
lazy: true,
|
||||
|
@ -118,7 +130,7 @@
|
|||
html += LibraryBrowser.getPosterViewHtml({
|
||||
items: result.Items,
|
||||
preferThumb: true,
|
||||
shape: 'backdrop',
|
||||
shape: getThumbShape(),
|
||||
overlayText: true,
|
||||
showTitle: true,
|
||||
lazy: true,
|
||||
|
@ -155,9 +167,14 @@
|
|||
break;
|
||||
}
|
||||
|
||||
html += '<div class="homePageSection">';
|
||||
html += '<h1 class="listHeader">' + title + '</h1>';
|
||||
|
||||
html += '<div>';
|
||||
if (enableScrollX()) {
|
||||
html += '<div class="hiddenScrollX">';
|
||||
} else {
|
||||
html += '<div>';
|
||||
}
|
||||
|
||||
var view = getView();
|
||||
|
||||
|
@ -166,7 +183,7 @@
|
|||
html += LibraryBrowser.getPosterViewHtml({
|
||||
items: recommendation.Items,
|
||||
lazy: true,
|
||||
shape: 'portrait',
|
||||
shape: getPortraitShape(),
|
||||
overlayText: false,
|
||||
showTitle: true,
|
||||
showYear: true,
|
||||
|
@ -179,7 +196,7 @@
|
|||
|
||||
html += LibraryBrowser.getPosterViewHtml({
|
||||
items: recommendation.Items,
|
||||
shape: "portrait",
|
||||
shape: getPortraitShape(),
|
||||
centerText: true,
|
||||
lazy: true,
|
||||
overlayText: true,
|
||||
|
@ -187,6 +204,7 @@
|
|||
});
|
||||
}
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
@ -234,14 +252,19 @@
|
|||
var page = this;
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
if (enableScrollX()) {
|
||||
$('.itemsContainer', page).addClass('hiddenScrollX');
|
||||
} else {
|
||||
$('.itemsContainer', page).removeClass('hiddenScrollX');
|
||||
}
|
||||
|
||||
loadResume(page, userId, parentId);
|
||||
loadLatest(page, userId, parentId);
|
||||
|
||||
if (!AppInfo.hasLowImageBandwidth) {
|
||||
if (AppInfo.enableMovieHomeSuggestions) {
|
||||
loadSuggestions(page, userId, parentId);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
})(jQuery, document);
|
|
@ -141,7 +141,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#musicAlbumArtistsPage", function () {
|
||||
$(document).on('pageinitdepends', "#musicAlbumArtistsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -196,7 +196,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pagebeforeshow', "#musicAlbumArtistsPage", function () {
|
||||
}).on('pageshown', "#musicAlbumArtistsPage", function () {
|
||||
|
||||
var page = this;
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
@ -223,8 +223,6 @@
|
|||
}
|
||||
});
|
||||
|
||||
}).on('pageshow', "#musicAlbumArtistsPage", function () {
|
||||
|
||||
updateFilterControls(this);
|
||||
});
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#musicAlbumsPage", function () {
|
||||
$(document).on('pageinitdepends', "#musicAlbumsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -248,7 +248,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pagebeforeshow', "#musicAlbumsPage", function () {
|
||||
}).on('pageshown', "#musicAlbumsPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
@ -274,27 +274,7 @@
|
|||
}
|
||||
});
|
||||
|
||||
}).on('pageshow', "#musicAlbumsPage", function () {
|
||||
|
||||
updateFilterControls(this);
|
||||
|
||||
var updateScheduled = false;
|
||||
function onscreen() {
|
||||
var viewportBottom = $(window).scrollTop() + $(window).height();
|
||||
return ($(document).height() - viewportBottom) < 100;
|
||||
}
|
||||
$(window).on('scroll', function () {
|
||||
console.log('load');
|
||||
if (!updateScheduled) {
|
||||
setTimeout(function () {
|
||||
if (onscreen()) {
|
||||
console.log('load');
|
||||
}
|
||||
updateScheduled = false;
|
||||
}, 500);
|
||||
updateScheduled = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery, document);
|
|
@ -142,7 +142,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#musicArtistsPage", function () {
|
||||
$(document).on('pageinitdepends', "#musicArtistsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -197,7 +197,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pagebeforeshow', "#musicArtistsPage", function () {
|
||||
}).on('pageshown', "#musicArtistsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -225,8 +225,6 @@
|
|||
}
|
||||
});
|
||||
|
||||
}).on('pageshow', "#musicArtistsPage", function () {
|
||||
|
||||
updateFilterControls(this);
|
||||
});
|
||||
|
||||
|
|
|
@ -1,12 +1,20 @@
|
|||
(function ($, document) {
|
||||
|
||||
function itemsPerRow() {
|
||||
|
||||
|
||||
var screenWidth = $(window).width();
|
||||
|
||||
return screenWidth >= 1920 ? 9 : (screenWidth >= 1200 ? 12 : (screenWidth >= 1000 ? 10 : 8));
|
||||
}
|
||||
|
||||
function enableScrollX() {
|
||||
return AppInfo.isTouchPreferred;
|
||||
}
|
||||
|
||||
function getSquareShape() {
|
||||
return enableScrollX() ? 'overflowSquare' : 'square';
|
||||
}
|
||||
|
||||
function loadLatest(page, parentId) {
|
||||
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
@ -27,7 +35,7 @@
|
|||
showUnplayedIndicator: false,
|
||||
showChildCountIndicator: true,
|
||||
showLatestItemsPopup: false,
|
||||
shape: "square",
|
||||
shape: getSquareShape(),
|
||||
showTitle: true,
|
||||
showParentTitle: true,
|
||||
lazy: true,
|
||||
|
@ -65,7 +73,7 @@
|
|||
$('#recentlyPlayedSongs', page).html(LibraryBrowser.getPosterViewHtml({
|
||||
items: result.Items,
|
||||
showUnplayedIndicator: false,
|
||||
shape: "square",
|
||||
shape: getSquareShape(),
|
||||
showTitle: true,
|
||||
showParentTitle: true,
|
||||
defaultAction: 'play',
|
||||
|
@ -105,7 +113,7 @@
|
|||
$('#topPlayedSongs', page).html(LibraryBrowser.getPosterViewHtml({
|
||||
items: result.Items,
|
||||
showUnplayedIndicator: false,
|
||||
shape: "square",
|
||||
shape: getSquareShape(),
|
||||
showTitle: true,
|
||||
showParentTitle: true,
|
||||
defaultAction: 'play',
|
||||
|
@ -144,7 +152,7 @@
|
|||
|
||||
$('.itemsContainer', elem).html(LibraryBrowser.getPosterViewHtml({
|
||||
items: result.Items,
|
||||
shape: "square",
|
||||
shape: getSquareShape(),
|
||||
showTitle: true,
|
||||
lazy: true,
|
||||
defaultAction: 'play',
|
||||
|
@ -155,10 +163,9 @@
|
|||
})).lazyChildren();
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$(document).on('pagebeforeshow', "#musicRecommendedPage", function () {
|
||||
$(document).on('pageshown', "#musicRecommendedPage", function () {
|
||||
|
||||
var parentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
@ -168,6 +175,12 @@
|
|||
loadPlaylists(page, parentId);
|
||||
loadRecentlyPlayed(page, parentId);
|
||||
loadFrequentlyPlayed(page, parentId);
|
||||
|
||||
if (enableScrollX()) {
|
||||
$('.itemsContainer', page).addClass('hiddenScrollX');
|
||||
} else {
|
||||
$('.itemsContainer', page).removeClass('hiddenScrollX');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -10,6 +10,14 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
if (AppInfo.enableAppStorePolicy) {
|
||||
$('.optionAdultContainer', page).hide();
|
||||
} else {
|
||||
$('.optionAdultContainer', page).show();
|
||||
}
|
||||
|
||||
query.IsAppStoreSafe = true;
|
||||
|
||||
var promise1 = ApiClient.getAvailablePlugins(query);
|
||||
|
||||
var promise2 = ApiClient.getInstalledPlugins();
|
||||
|
@ -128,7 +136,7 @@
|
|||
if (!plugin.isExternal) {
|
||||
html += "<div class='cardText packageReviewText'>";
|
||||
html += plugin.price > 0 ? "$" + plugin.price.toFixed(2) : Globalize.translate('LabelFree');
|
||||
html += RatingHelpers.getStoreRatingHtml(plugin.avgRating, plugin.id, plugin.name);
|
||||
html += RatingHelpers.getStoreRatingHtml(plugin.avgRating, plugin.id, plugin.name, true);
|
||||
|
||||
html += "<span class='storeReviewCount'>";
|
||||
html += " " + Globalize.translate('LabelNumberReviews').replace("{0}", plugin.totalRatings);
|
||||
|
|
|
@ -112,7 +112,7 @@
|
|||
for (var i = 1; i <= 5; i++) {
|
||||
var title = noLinks ? rating + " stars" : "Rate " + i + (i > 1 ? " stars" : " star");
|
||||
|
||||
html += noLinks ? "" : "<span data-id=" + id + " data-name='" + name + "' data-rating=" + i + " onclick='RatingHelpers.ratePackage(this);return false;' >";
|
||||
html += noLinks ? "" : "<a href='#' data-id=" + id + " data-name='" + name + "' data-rating=" + i + " onclick='RatingHelpers.ratePackage(this);return false;' >";
|
||||
if (rating <= i - 1) {
|
||||
html += "<div class='storeStarRating emptyStarRating' title='" + title + "'></div>";
|
||||
} else if (rating < i) {
|
||||
|
@ -120,7 +120,7 @@
|
|||
} else {
|
||||
html += "<div class='storeStarRating' title='" + title + "'></div>";
|
||||
}
|
||||
html += noLinks ? "" : "</span>";
|
||||
html += noLinks ? "" : "</a>";
|
||||
}
|
||||
|
||||
html += "</div>";
|
||||
|
|
112
dashboard-ui/scripts/registrationservices.js
Normal file
112
dashboard-ui/scripts/registrationservices.js
Normal file
|
@ -0,0 +1,112 @@
|
|||
window.RegistrationServices = {
|
||||
|
||||
renderPluginInfo: function (page, pkg, pluginSecurityInfo) {
|
||||
|
||||
if (pkg.isPremium) {
|
||||
$('.premiumPackage', page).show();
|
||||
|
||||
// Fill in registration info
|
||||
var regStatus = "";
|
||||
if (pkg.isRegistered) {
|
||||
|
||||
regStatus += "<p style='color:green;'>";
|
||||
|
||||
regStatus += Globalize.translate('MessageFeatureIncludedWithSupporter');
|
||||
|
||||
} else {
|
||||
|
||||
var expDateTime = new Date(pkg.expDate).getTime();
|
||||
var nowTime = new Date().getTime();
|
||||
|
||||
if (expDateTime <= nowTime) {
|
||||
regStatus += "<p style='color:red;'>";
|
||||
regStatus += Globalize.translate('MessageTrialExpired');
|
||||
}
|
||||
else if (expDateTime > new Date(1970, 1, 1).getTime()) {
|
||||
|
||||
regStatus += "<p style='color:blue;'>";
|
||||
regStatus += Globalize.translate('MessageTrialWillExpireIn').replace('{0}', Math.round(expDateTime - nowTime) / (86400000));
|
||||
}
|
||||
}
|
||||
|
||||
regStatus += "</p>";
|
||||
$('#regStatus', page).html(regStatus);
|
||||
|
||||
if (pluginSecurityInfo.IsMBSupporter) {
|
||||
$('#regInfo', page).html(pkg.regInfo || "");
|
||||
|
||||
$('.premiumDescription', page).hide();
|
||||
$('.supporterDescription', page).hide();
|
||||
|
||||
if (pkg.price > 0) {
|
||||
|
||||
$('.premiumHasPrice', page).show();
|
||||
$('#featureId', page).val(pkg.featureId);
|
||||
$('#featureName', page).val(pkg.name);
|
||||
$('#amount', page).val(pkg.price);
|
||||
|
||||
$('#regPrice', page).html("<h3>" + Globalize.translate('ValuePriceUSD').replace('{0}', "$" + pkg.price.toFixed(2)) + "</h3>");
|
||||
|
||||
var url = "http://mb3admin.com/admin/service/user/getPayPalEmail?id=" + pkg.owner;
|
||||
|
||||
$.getJSON(url).done(function (dev) {
|
||||
if (dev.payPalEmail) {
|
||||
$('#payPalEmail', page).val(dev.payPalEmail);
|
||||
|
||||
} else {
|
||||
$('#ppButton', page).hide();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Supporter-only feature
|
||||
$('.premiumHasPrice', page).hide();
|
||||
}
|
||||
} else {
|
||||
|
||||
if (pkg.price) {
|
||||
$('.premiumDescription', page).show();
|
||||
$('.supporterDescription', page).hide();
|
||||
$('#regInfo', page).html("");
|
||||
|
||||
} else {
|
||||
$('.premiumDescription', page).hide();
|
||||
$('.supporterDescription', page).show();
|
||||
$('#regInfo', page).html("");
|
||||
}
|
||||
|
||||
$('#ppButton', page).hide();
|
||||
}
|
||||
|
||||
} else {
|
||||
$('.premiumPackage', page).hide();
|
||||
}
|
||||
},
|
||||
|
||||
addRecurringFields: function(page, period) {
|
||||
|
||||
var formSelector = '.supporterForm';
|
||||
|
||||
// Add recurring fields to form
|
||||
$("<input type='hidden' name='a3' class='pprecurring' />")
|
||||
.attr('value', $('#donateAmt', page).val())
|
||||
.appendTo(formSelector, page);
|
||||
|
||||
$("<input type='hidden' name='p3' value='1' class='pprecurring' />")
|
||||
.appendTo(formSelector, page);
|
||||
|
||||
$("<input type='hidden' name='t3' value='" + period + "' class='pprecurring' />")
|
||||
.appendTo(formSelector, page);
|
||||
|
||||
$("<input type='hidden' name='src' value='1' class='pprecurring' />")
|
||||
.appendTo(formSelector, page);
|
||||
|
||||
$("<input type='hidden' name='sra' value='1' class='pprecurring' />")
|
||||
.appendTo(formSelector, page);
|
||||
|
||||
//change command for subscriptions
|
||||
$('#ppCmd', page).val('_xclick-subscriptions');
|
||||
|
||||
$(formSelector, page).trigger('create');
|
||||
}
|
||||
|
||||
};
|
|
@ -1375,7 +1375,7 @@ var Dashboard = {
|
|||
// The native app can handle a little bit more than safari
|
||||
if (Dashboard.isRunningInCordova()) {
|
||||
|
||||
quality -= 15;
|
||||
quality -= 10;
|
||||
|
||||
if (isBackdrop) {
|
||||
quality -= 20;
|
||||
|
@ -1505,6 +1505,10 @@ var AppInfo = {};
|
|||
AppInfo.enableDetailPageChapters = true;
|
||||
AppInfo.enableDetailsMenuImages = true;
|
||||
AppInfo.enableHeaderImages = true;
|
||||
AppInfo.enableMovieHomeSuggestions = true;
|
||||
|
||||
|
||||
AppInfo.enableAppStorePolicy = isCordova;
|
||||
|
||||
if ($.browser.safari) {
|
||||
|
||||
|
@ -1519,6 +1523,7 @@ var AppInfo = {};
|
|||
AppInfo.enableDetailPageChapters = false;
|
||||
AppInfo.enableDetailsMenuImages = false;
|
||||
AppInfo.enableHeaderImages = false;
|
||||
AppInfo.enableMovieHomeSuggestions = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -1534,7 +1539,6 @@ var AppInfo = {};
|
|||
AppInfo.enableLatestChannelItems = true;
|
||||
AppInfo.enableStudioTabs = true;
|
||||
AppInfo.enablePeopleTabs = true;
|
||||
AppInfo.enableHomeFavoritesTab = true;
|
||||
AppInfo.enableTvEpisodesTab = true;
|
||||
AppInfo.enableMusicArtistsTab = true;
|
||||
AppInfo.enableHomeLatestTab = true;
|
||||
|
@ -1550,6 +1554,8 @@ var AppInfo = {};
|
|||
|
||||
function initializeApiClient(apiClient) {
|
||||
|
||||
apiClient.enableAppStorePolicy = AppInfo.enableAppStorePolicy;
|
||||
|
||||
$(apiClient).off('.dashboard')
|
||||
.on("websocketmessage.dashboard", Dashboard.onWebSocketMessageReceived)
|
||||
.on('requestfail.dashboard', Dashboard.onRequestFail)
|
||||
|
@ -1629,6 +1635,10 @@ var AppInfo = {};
|
|||
|
||||
function onReady() {
|
||||
|
||||
if (AppInfo.isTouchPreferred) {
|
||||
$(document.body).addClass('touch');
|
||||
}
|
||||
|
||||
if ($.browser.safari && $.browser.mobile) {
|
||||
initFastClick();
|
||||
}
|
||||
|
@ -1649,10 +1659,6 @@ var AppInfo = {};
|
|||
$(document.body).addClass('peopleTabDisabled');
|
||||
}
|
||||
|
||||
if (!AppInfo.enableHomeFavoritesTab) {
|
||||
$(document.body).addClass('homeFavoritesTabDisabled');
|
||||
}
|
||||
|
||||
if (!AppInfo.enableTvEpisodesTab) {
|
||||
$(document.body).addClass('tvEpisodesTabDisabled');
|
||||
}
|
||||
|
@ -1863,7 +1869,7 @@ $(document).on('pagecreate', ".page", function () {
|
|||
var require = this.getAttribute('data-require');
|
||||
|
||||
if (require) {
|
||||
requirejs([require], function () {
|
||||
requirejs(require.split(','), function () {
|
||||
|
||||
$(page).trigger('pageinitdepends');
|
||||
});
|
||||
|
@ -1880,7 +1886,7 @@ $(document).on('pagecreate', ".page", function () {
|
|||
var require = this.getAttribute('data-require');
|
||||
|
||||
if (require) {
|
||||
requirejs([require], function () {
|
||||
requirejs(require.split(','), function () {
|
||||
|
||||
$(page).trigger('pageshown');
|
||||
});
|
||||
|
|
|
@ -1,29 +1,7 @@
|
|||
(function () {
|
||||
|
||||
function addRecurringFields(period, page) {
|
||||
|
||||
// Add recurring fields to form
|
||||
$("<input type='hidden' name='a3' class='pprecurring' />")
|
||||
.attr('value', $('#donateAmt', page).val())
|
||||
.appendTo("#payPalSupporterForm", page);
|
||||
|
||||
$("<input type='hidden' name='p3' value='1' class='pprecurring' />")
|
||||
.appendTo("#payPalSupporterForm", page);
|
||||
|
||||
$("<input type='hidden' name='t3' value='" + period + "' class='pprecurring' />")
|
||||
.appendTo("#payPalSupporterForm", page);
|
||||
|
||||
$("<input type='hidden' name='src' value='1' class='pprecurring' />")
|
||||
.appendTo("#payPalSupporterForm", page);
|
||||
|
||||
$("<input type='hidden' name='sra' value='1' class='pprecurring' />")
|
||||
.appendTo("#payPalSupporterForm", page);
|
||||
|
||||
//change command for subscriptions
|
||||
$('#ppCmd', page).val('_xclick-subscriptions');
|
||||
|
||||
$('#payPalSupporterForm', page).trigger('create');
|
||||
console.log($('#payPalSupporterForm', page).html());
|
||||
RegistrationServices.addRecurringFields(page, period);
|
||||
}
|
||||
|
||||
function removeRecurringFields(page) {
|
||||
|
@ -187,7 +165,7 @@
|
|||
$('.dailyAmount', page).html('$' + dailyAmount);
|
||||
$('.yearlyAmount', page).html('$' + yearlyAmount);
|
||||
|
||||
$('#paypalReturnUrl', page).val(ApiClient.getUrl("supporterkey.html"));
|
||||
$('#returnUrl', page).val(ApiClient.getUrl("supporterkey.html"));
|
||||
|
||||
$('.radioDonationType', page).trigger('change');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue