|
|
@ -33,6 +33,7 @@ define([
|
|
|
|
var LIMIT_CLS = Bar.constants.lag = 'cryptpad-limit';
|
|
|
|
var LIMIT_CLS = Bar.constants.lag = 'cryptpad-limit';
|
|
|
|
var TITLE_CLS = Bar.constants.title = "cryptpad-title";
|
|
|
|
var TITLE_CLS = Bar.constants.title = "cryptpad-title";
|
|
|
|
var NEWPAD_CLS = Bar.constants.newpad = "cryptpad-newpad";
|
|
|
|
var NEWPAD_CLS = Bar.constants.newpad = "cryptpad-newpad";
|
|
|
|
|
|
|
|
var UPGRADE_CLS = Bar.constants.upgrade = "cryptpad-upgrade";
|
|
|
|
|
|
|
|
|
|
|
|
// User admin menu
|
|
|
|
// User admin menu
|
|
|
|
var USERADMIN_CLS = Bar.constants.user = 'cryptpad-user-dropdown';
|
|
|
|
var USERADMIN_CLS = Bar.constants.user = 'cryptpad-user-dropdown';
|
|
|
@ -70,6 +71,7 @@ define([
|
|
|
|
var $userContainer = $('<span>', {
|
|
|
|
var $userContainer = $('<span>', {
|
|
|
|
'class': USER_CLS
|
|
|
|
'class': USER_CLS
|
|
|
|
}).appendTo($topContainer);
|
|
|
|
}).appendTo($topContainer);
|
|
|
|
|
|
|
|
$('<button>', {'class': UPGRADE_CLS}).hide().appendTo($userContainer);
|
|
|
|
$('<span>', {'class': SPINNER_CLS}).hide().appendTo($userContainer);
|
|
|
|
$('<span>', {'class': SPINNER_CLS}).hide().appendTo($userContainer);
|
|
|
|
$('<span>', {'class': STATE_CLS}).hide().appendTo($userContainer);
|
|
|
|
$('<span>', {'class': STATE_CLS}).hide().appendTo($userContainer);
|
|
|
|
$('<span>', {'class': LAG_CLS}).hide().appendTo($userContainer);
|
|
|
|
$('<span>', {'class': LAG_CLS}).hide().appendTo($userContainer);
|
|
|
@ -595,7 +597,6 @@ define([
|
|
|
|
'class': 'synced fa fa-check',
|
|
|
|
'class': 'synced fa fa-check',
|
|
|
|
title: Messages.synced
|
|
|
|
title: Messages.synced
|
|
|
|
}).appendTo($spin);
|
|
|
|
}).appendTo($spin);
|
|
|
|
toolbar.$userAdmin.prepend($spin);
|
|
|
|
|
|
|
|
if (config.realtime) {
|
|
|
|
if (config.realtime) {
|
|
|
|
config.realtime.onPatch(ks(toolbar, config));
|
|
|
|
config.realtime.onPatch(ks(toolbar, config));
|
|
|
|
config.realtime.onMessage(ks(toolbar, config, true));
|
|
|
|
config.realtime.onMessage(ks(toolbar, config, true));
|
|
|
@ -696,6 +697,22 @@ define([
|
|
|
|
return $userAdmin;
|
|
|
|
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
|
|
|
|
// Events
|
|
|
|
var initClickEvents = function (toolbar, config) {
|
|
|
|
var initClickEvents = function (toolbar, config) {
|
|
|
|
var removeDropdowns = function () {
|
|
|
|
var removeDropdowns = function () {
|
|
|
@ -853,10 +870,10 @@ define([
|
|
|
|
tb['spinner'] = createSpinner;
|
|
|
|
tb['spinner'] = createSpinner;
|
|
|
|
tb['state'] = createState;
|
|
|
|
tb['state'] = createState;
|
|
|
|
tb['limit'] = createLimit;
|
|
|
|
tb['limit'] = createLimit;
|
|
|
|
|
|
|
|
tb['upgrade'] = createUpgrade;
|
|
|
|
tb['newpad'] = createNewPad;
|
|
|
|
tb['newpad'] = createNewPad;
|
|
|
|
tb['useradmin'] = createUserAdmin;
|
|
|
|
tb['useradmin'] = createUserAdmin;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var addElement = toolbar.addElement = function (arr, additionnalCfg, init) {
|
|
|
|
var addElement = toolbar.addElement = function (arr, additionnalCfg, init) {
|
|
|
|
if (typeof additionnalCfg === "object") { $.extend(true, config, additionnalCfg); }
|
|
|
|
if (typeof additionnalCfg === "object") { $.extend(true, config, additionnalCfg); }
|
|
|
|
arr.forEach(function (el) {
|
|
|
|
arr.forEach(function (el) {
|
|
|
|