1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update text

This commit is contained in:
Luke Pulverenti 2015-10-02 13:55:26 -04:00
parent 94a5cf7549
commit ee8e4e5e0a
87 changed files with 1815 additions and 2444 deletions

View file

@ -76,7 +76,7 @@
}).map(function (o) {
o.buttonText = Globalize.translate(o.buttonText, o.price);
o.buttonText = Globalize.translate(o.buttonText, getProduct(o.feature).price);
return o;
});

View file

@ -141,7 +141,7 @@
}).map(function (o) {
o.buttonText = Globalize.translate(o.buttonText, o.price);
o.buttonText = Globalize.translate(o.buttonText, getProduct(o.feature).price);
return o;
});

View file

@ -29,12 +29,13 @@
return;
}
var productInfo = {
var unlockableProductInfo = IapManager.isPurchaseAvailable(feature) ? {
enableAppUnlock: IapManager.isPurchaseAvailable(feature),
id: id,
price: info.price,
feature: feature
};
} : null;
var prefix = $.browser.android ? 'android' : 'ios';
@ -49,7 +50,11 @@
IapManager.getSubscriptionOptions().done(function (subscriptionOptions) {
showInAppPurchaseInfo(productInfo, subscriptionOptions, registrationInfo, deferred);
var dialogOptions = {
title: Globalize.translate('HeaderUnlockApp')
};
showInAppPurchaseInfo(subscriptionOptions, unlockableProductInfo, registrationInfo, dialogOptions, deferred);
});
}).fail(function () {
@ -84,14 +89,40 @@
});
}
function getInAppPurchaseElement(info, subscriptionOptions) {
function cancelInAppPurchase() {
var elem = document.querySelector('.inAppPurchaseOverlay');
if (elem) {
PaperDialogHelper.close(elem);
}
}
var isCancelled = true;
var currentDisplayingProductInfos = [];
var currentDisplayingDeferred = null;
function clearCurrentDisplayingInfo() {
currentDisplayingProductInfos = [];
currentDisplayingDeferred = null;
}
function showInAppPurchaseElement(subscriptionOptions, unlockableProductInfo, dialogOptions, deferred) {
cancelInAppPurchase();
// clone
currentDisplayingProductInfos = subscriptionOptions.slice(0);
if (unlockableProductInfo) {
currentDisplayingProductInfos.push(unlockableProductInfo);
}
var dlg = PaperDialogHelper.createDialog();
var html = '';
html += '<h2 class="dialogHeader">';
html += '<paper-fab icon="arrow-back" class="mini btnCloseDialog"></paper-fab>';
html += '<div style="display:inline-block;margin-left:.6em;vertical-align:middle;">' + Globalize.translate('HeaderUnlockApp') + '</div>';
html += '<div style="display:inline-block;margin-left:.6em;vertical-align:middle;">' + dialogOptions.title + '</div>';
html += '</h2>';
html += '<div class="editorContent">';
@ -99,7 +130,7 @@
html += '<form style="max-width: 800px;margin:auto;">';
html += '<p style="margin:2em 0;">';
if (info.enableAppUnlock) {
if (unlockableProductInfo) {
html += Globalize.translate('MessageUnlockAppWithPurchaseOrSupporter');
}
else {
@ -111,14 +142,14 @@
html += Globalize.translate('MessageToValidateSupporter');
html += '</p>';
if (info.enableAppUnlock) {
if (unlockableProductInfo) {
var unlockText = Globalize.translate('ButtonUnlockWithPurchase');
if (info.price) {
unlockText = Globalize.translate('ButtonUnlockPrice', info.price);
if (unlockableProductInfo.price) {
unlockText = Globalize.translate('ButtonUnlockPrice', unlockableProductInfo.price);
}
html += '<p>';
html += '<paper-button raised class="secondary block btnPurchase" data-feature="' + info.feature + '"><iron-icon icon="check"></iron-icon><span>' + unlockText + '</span></paper-button>';
html += '<paper-button raised class="secondary block btnPurchase" data-feature="' + unlockableProductInfo.feature + '"><iron-icon icon="check"></iron-icon><span>' + unlockText + '</span></paper-button>';
html += '</p>';
}
@ -143,7 +174,7 @@
dlg.innerHTML = html;
document.body.appendChild(dlg);
// init dlg content here
initInAppPurchaseElementEvents(dlg, deferred);
PaperDialogHelper.openWithHash(dlg, 'iap');
@ -153,68 +184,47 @@
});
dlg.classList.add('inAppPurchaseOverlay');
return dlg;
}
function cancelInAppPurchase() {
function initInAppPurchaseElementEvents(elem, deferred) {
var elem = document.querySelector('.inAppPurchaseOverlay');
if (elem) {
PaperDialogHelper.close(elem);
}
isCancelled = true;
$('.btnPurchase', elem).on('click', function () {
isCancelled = false;
if (this.getAttribute('data-email') == 'true') {
promptForEmail(this.getAttribute('data-feature'));
} else {
IapManager.beginPurchase(this.getAttribute('data-feature'));
}
});
$('.btnRestorePurchase', elem).on('click', function () {
isCancelled = false;
IapManager.restorePurchase(info.feature);
});
$(elem).on('iron-overlay-closed', function () {
if (isCancelled) {
clearCurrentDisplayingInfo();
deferred.reject();
}
$(this).remove();
});
}
var currentDisplayingProductInfos = [];
var currentDisplayingDeferred = null;
var isCancelled = true;
function clearCurrentDisplayingInfo() {
currentDisplayingProductInfos = [];
currentDisplayingDeferred = null;
}
function showInAppPurchaseInfo(info, subscriptionOptions, serverRegistrationInfo, deferred) {
function showInAppPurchaseInfo(subscriptionOptions, unlockableProductInfo, serverRegistrationInfo, dialogOptions, deferred) {
require(['components/paperdialoghelper'], function () {
cancelInAppPurchase();
isCancelled = true;
var elem = getInAppPurchaseElement(info, subscriptionOptions);
// clone
currentDisplayingProductInfos = subscriptionOptions.slice(0);
currentDisplayingProductInfos.push(info);
showInAppPurchaseElement(subscriptionOptions, unlockableProductInfo, dialogOptions, deferred);
currentDisplayingDeferred = deferred;
$('.btnPurchase', elem).on('click', function () {
isCancelled = false;
if (this.getAttribute('data-email') == 'true') {
promptForEmail(this.getAttribute('data-feature'));
} else {
IapManager.beginPurchase(this.getAttribute('data-feature'));
}
});
$('.btnRestorePurchase', elem).on('click', function () {
isCancelled = false;
IapManager.restorePurchase(info.feature);
});
$(elem).on('iron-overlay-closed', function () {
if (isCancelled) {
clearCurrentDisplayingInfo();
cancelInAppPurchase();
deferred.reject();
}
});
});
}
@ -225,10 +235,10 @@
prompt({
text: Globalize.translate('TextPleaseEnterYourEmailAddressForSubscription'),
title: Globalize.translate('HeaderEmailAddress'),
callback: function(email) {
callback: function (email) {
if (email) {
IapManager.beginPurchase(this.getAttribute('data-feature'), email);
IapManager.beginPurchase(feature, email);
}
}
});
@ -246,6 +256,9 @@
return product.id == p.id;
}).length) {
isCancelled = false;
clearCurrentDisplayingInfo();
cancelInAppPurchase();
deferred.resolve();
@ -262,31 +275,27 @@
return;
}
Dashboard.showLoadingMsg();
ApiClient.getRegistrationInfo('Sync').done(function (registrationInfo) {
Dashboard.hideLoadingMsg();
// Get supporter status
getRegistrationInfo('Sync').done(function (registrationInfo) {
if (registrationInfo.IsRegistered) {
validatedFeatures.push(feature);
deferred.resolve();
return;
}
Dashboard.alert({
message: Globalize.translate('HeaderSyncRequiresSupporterMembershipAppVersion'),
title: Globalize.translate('HeaderSync')
IapManager.getSubscriptionOptions().done(function (subscriptionOptions) {
var dialogOptions = {
title: Globalize.translate('HeaderUnlockSync')
};
showInAppPurchaseInfo(subscriptionOptions, null, registrationInfo, dialogOptions, deferred);
});
}).fail(function () {
Dashboard.hideLoadingMsg();
Dashboard.alert({
message: Globalize.translate('ErrorValidatingSupporterInfo')
});
deferred.reject();
});
});
}
@ -297,15 +306,6 @@
},
addRecurringFields: function (page, period) {
},
initSupporterForm: function (page) {
$('.recurringSubscriptionCancellationHelp', page).html('');
},
validateFeature: function (name) {
var deferred = DeferredBuilder.Deferred();