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

View File

@ -1246,7 +1246,7 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p>This will delete all your local documents.</p> <p>This will delete all your local documents.</p>
<blockquote>Are you sure?</blockquote> <blockquote><b>Are you sure?</b></blockquote>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a href="#" class="btn btn-default" data-dismiss="modal">Cancel</a> <a href="#" class="btn btn-default" data-dismiss="modal">Cancel</a>
@ -1267,7 +1267,7 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p>This will delete all existing local documents.</p> <p>This will delete all existing local documents.</p>
<blockquote>Are you sure?</blockquote> <blockquote><b>Are you sure?</b></blockquote>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a href="#" class="btn btn-default" data-dismiss="modal">Cancel</a> <a href="#" class="btn btn-default" data-dismiss="modal">Cancel</a>
@ -1301,16 +1301,18 @@
</div> </div>
<div class="modal fade modal-sponsorship-required"> <div class="modal fade modal-sponsor-only">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h2 class="modal-title">Sponsorship required</h2> <h2 class="modal-title">Sponsor only!</h2>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p>This feature is restricted to sponsors only as it's a web service hosted on Amazon EC2. <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> 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>
<div class="modal-footer"> <div class="modal-footer">
<a href="#" class="btn btn-primary" <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")); utils.saveAs(content, fileDesc.title + (settings.template.indexOf("documentHTML") === -1 ? ".md" : ".html"));
}); });
var monetize = new MonetizeJS({ var monetize = new MonetizeJS({
applicationID: 'iklMbzDI7dvMEScb' applicationID: 'ESTHdCYOi18iLhhO'
}); });
$(".action-download-pdf").click(function() { $(".action-download-pdf").click(function() {
var fileDesc = fileMgr.currentFile; var fileDesc = fileMgr.currentFile;
@ -351,7 +351,7 @@ define([
return task.chain(); return task.chain();
} }
if(!eventMgr.isSponsor) { if(!eventMgr.isSponsor) {
$('.modal-sponsorship-required').modal('show'); $('.modal-sponsor-only').modal('show');
return task.chain(); return task.chain();
} }
monetize.getTokenImmediate(function(err, result) { monetize.getTokenImmediate(function(err, result) {