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
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');
|
||||
}
|
||||
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue