add support for donate button
This commit is contained in:
@@ -33,6 +33,7 @@ define([
|
||||
var LIMIT_CLS = Bar.constants.lag = 'cryptpad-limit';
|
||||
var TITLE_CLS = Bar.constants.title = "cryptpad-title";
|
||||
var NEWPAD_CLS = Bar.constants.newpad = "cryptpad-newpad";
|
||||
var UPGRADE_CLS = Bar.constants.upgrade = "cryptpad-upgrade";
|
||||
|
||||
// User admin menu
|
||||
var USERADMIN_CLS = Bar.constants.user = 'cryptpad-user-dropdown';
|
||||
@@ -70,6 +71,7 @@ define([
|
||||
var $userContainer = $('<span>', {
|
||||
'class': USER_CLS
|
||||
}).appendTo($topContainer);
|
||||
$('<button>', {'class': UPGRADE_CLS}).hide().appendTo($userContainer);
|
||||
$('<span>', {'class': SPINNER_CLS}).hide().appendTo($userContainer);
|
||||
$('<span>', {'class': STATE_CLS}).hide().appendTo($userContainer);
|
||||
$('<span>', {'class': LAG_CLS}).hide().appendTo($userContainer);
|
||||
@@ -595,7 +597,6 @@ define([
|
||||
'class': 'synced fa fa-check',
|
||||
title: Messages.synced
|
||||
}).appendTo($spin);
|
||||
toolbar.$userAdmin.prepend($spin);
|
||||
if (config.realtime) {
|
||||
config.realtime.onPatch(ks(toolbar, config));
|
||||
config.realtime.onMessage(ks(toolbar, config, true));
|
||||
@@ -696,6 +697,22 @@ define([
|
||||
return $userAdmin;
|
||||
};
|
||||
|
||||
var createUpgrade = function (toolbar) {
|
||||
if (ApiConfig.removeDonateButton) { return; }
|
||||
if (Cryptpad.account.plan) { return; }
|
||||
|
||||
var text;
|
||||
if (ApiConfig.allowSubscriptions && Cryptpad.isLoggedIn()) {
|
||||
text = Messages.upgradeAccount;
|
||||
} else { text = Messages.supportCryptpad; }
|
||||
|
||||
var $upgrade = toolbar.$top.find('.' + UPGRADE_CLS).attr({
|
||||
'title': Messages.supportCryptpad
|
||||
}).text(text).show()
|
||||
.click(function () { window.open(Cryptpad.donateURL,'_blank'); });
|
||||
return $upgrade;
|
||||
};
|
||||
|
||||
// Events
|
||||
var initClickEvents = function (toolbar, config) {
|
||||
var removeDropdowns = function () {
|
||||
@@ -853,10 +870,10 @@ define([
|
||||
tb['spinner'] = createSpinner;
|
||||
tb['state'] = createState;
|
||||
tb['limit'] = createLimit;
|
||||
tb['upgrade'] = createUpgrade;
|
||||
tb['newpad'] = createNewPad;
|
||||
tb['useradmin'] = createUserAdmin;
|
||||
|
||||
|
||||
var addElement = toolbar.addElement = function (arr, additionnalCfg, init) {
|
||||
if (typeof additionnalCfg === "object") { $.extend(true, config, additionnalCfg); }
|
||||
arr.forEach(function (el) {
|
||||
|
||||
Reference in New Issue
Block a user