Added sponsor only dialog

This commit is contained in:
benweet 2014-08-19 09:16:07 +01:00
parent 7e0444524a
commit 143e90cedd
4 changed files with 17 additions and 14 deletions

BIN
public/Welcome document.pdf Normal file

Binary file not shown.

View File

@ -205,7 +205,7 @@ define([
}
$.extend(settings, newSettings);
storage.settings = JSON.stringify(settings);
storage.themeV3 = theme;
storage.themeV4 = theme;
}
}
@ -327,13 +327,14 @@ define([
eventMgr.onReady();
};
var appId = 'ESTHdCYOi18iLhhO';
var monetize = new MonetizeJS({
applicationID: 'iklMbzDI7dvMEScb'
applicationID: appId
});
var $alerts = $();
function isSponsor(payments) {
var result = payments && (
var result = payments && payments.app == appId && (
(payments.chargeOption && payments.chargeOption.alias == 'once') ||
(payments.subscriptionOption && payments.subscriptionOption.alias == 'yearly'));
eventMgr.isSponsor = result;
@ -506,11 +507,11 @@ define([
});
$(".action-import-docs-settings-confirm").click(function() {
storage.clear();
var allowedKeys = /^file\.|^folder\.|^publish\.|^settings$|^sync\.|^google\.|^author\.|^themeV3$|^version$/;
var allowedKeys = /^file\.|^folder\.|^publish\.|^settings$|^sync\.|^google\.|^author\.|^themeV4$|^version$/;
_.each(newstorage, function(value, key) {
if(allowedKeys.test(key)) {
//if(allowedKeys.test(key)) {
storage[key] = value;
}
//}
});
window.location.reload();
});

View File

@ -1246,7 +1246,7 @@
</div>
<div class="modal-body">
<p>This will delete all your local documents.</p>
<blockquote>Are you sure?</blockquote>
<blockquote><b>Are you sure?</b></blockquote>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-default" data-dismiss="modal">Cancel</a>
@ -1267,7 +1267,7 @@
</div>
<div class="modal-body">
<p>This will delete all existing local documents.</p>
<blockquote>Are you sure?</blockquote>
<blockquote><b>Are you sure?</b></blockquote>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-default" data-dismiss="modal">Cancel</a>
@ -1301,16 +1301,18 @@
</div>
<div class="modal fade modal-sponsorship-required">
<div class="modal fade modal-sponsor-only">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title">Sponsorship required</h2>
<h2 class="modal-title">Sponsor only!</h2>
</div>
<div class="modal-body">
<p>This feature is restricted to sponsors only as it's a web service hosted on Amazon EC2.
Note that sponsoring StackEdit would cost you only <b>$5/year</b>...</p>
<p>This feature is restricted to sponsor users as it's a web service hosted on Amazon EC2.
Note that sponsoring StackEdit would cost you only <b>$5/year</b>.</p>
<p>To see how a PDF looks like <a target="_blank" href="/Welcome%20document.pdf">click here</a>.</p>
<blockquote><b>Tip:</b> PDFs are fully customizable via Settings>Advanced>PDF template/options.</blockquote>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-primary"

View File

@ -336,7 +336,7 @@ define([
utils.saveAs(content, fileDesc.title + (settings.template.indexOf("documentHTML") === -1 ? ".md" : ".html"));
});
var monetize = new MonetizeJS({
applicationID: 'iklMbzDI7dvMEScb'
applicationID: 'ESTHdCYOi18iLhhO'
});
$(".action-download-pdf").click(function() {
var fileDesc = fileMgr.currentFile;
@ -351,7 +351,7 @@ define([
return task.chain();
}
if(!eventMgr.isSponsor) {
$('.modal-sponsorship-required').modal('show');
$('.modal-sponsor-only').modal('show');
return task.chain();
}
monetize.getTokenImmediate(function(err, result) {