Remove cryptpad-common dependency for some inner apps

pull/1/head
yflory 7 years ago
parent 1514ad5df3
commit 7cfe64fc5b

@ -1,7 +1,6 @@
define([ define([
'jquery', 'jquery',
'/bower_components/textpatcher/TextPatcher.js', '/bower_components/textpatcher/TextPatcher.js',
'/common/cryptpad-common.js',
'/common/diffMarked.js', '/common/diffMarked.js',
'/bower_components/nthen/index.js', '/bower_components/nthen/index.js',
'/common/sframe-common.js', '/common/sframe-common.js',
@ -9,6 +8,7 @@ define([
'/common/common-util.js', '/common/common-util.js',
'/common/common-hash.js', '/common/common-hash.js',
'/common/modes.js', '/common/modes.js',
'/customize/messages.js',
'cm/lib/codemirror', 'cm/lib/codemirror',
'css!cm/lib/codemirror.css', 'css!cm/lib/codemirror.css',
@ -40,7 +40,6 @@ define([
], function ( ], function (
$, $,
TextPatcher, TextPatcher,
Cryptpad,
DiffMd, DiffMd,
nThen, nThen,
SFCommon, SFCommon,
@ -48,10 +47,10 @@ define([
Util, Util,
Hash, Hash,
Modes, Modes,
Messages,
CMeditor) CMeditor)
{ {
window.CodeMirror = CMeditor; window.CodeMirror = CMeditor;
var Messages = Cryptpad.Messages;
var MEDIA_TAG_MODES = Object.freeze([ var MEDIA_TAG_MODES = Object.freeze([
'markdown', 'markdown',

@ -47,7 +47,6 @@ define([
var userNameKey = common.userNameKey = 'User_name'; var userNameKey = common.userNameKey = 'User_name';
var fileHashKey = common.fileHashKey = 'FS_hash'; var fileHashKey = common.fileHashKey = 'FS_hash';
common.displayNameKey = 'cryptpad.username'; common.displayNameKey = 'cryptpad.username';
var newPadNameKey = common.newPadNameKey = "newPadName";
var newPadPathKey = common.newPadPathKey = "newPadPath"; var newPadPathKey = common.newPadPathKey = "newPadPath";
common.oldStorageKey = 'CryptPad_RECENTPADS'; common.oldStorageKey = 'CryptPad_RECENTPADS';
common.storageKey = 'filesData'; common.storageKey = 'filesData';
@ -716,19 +715,6 @@ define([
}); });
}; };
var errorHandlers = [];
common.onError = function (h) {
if (typeof h !== "function") { return; }
errorHandlers.push(h);
};
common.storeError = function () {
errorHandlers.forEach(function (h) {
if (typeof h === "function") {
h({type: "store"});
}
});
};
/* /*
* Buttons * Buttons
*/ */
@ -1145,10 +1131,6 @@ define([
return void setTimeout(function () { f(void 0, env); }); return void setTimeout(function () { f(void 0, env); });
} }
if (sessionStorage[newPadNameKey]) {
common.initialName = sessionStorage[newPadNameKey];
delete sessionStorage[newPadNameKey];
}
if (sessionStorage[newPadPathKey]) { if (sessionStorage[newPadPathKey]) {
common.initialPath = sessionStorage[newPadPathKey]; common.initialPath = sessionStorage[newPadPathKey];
delete sessionStorage[newPadPathKey]; delete sessionStorage[newPadPathKey];

@ -327,15 +327,6 @@ define([
// Drive already exist: return the existing drive, don't load data from legacy store // Drive already exist: return the existing drive, don't load data from legacy store
onReady(f, rt.proxy, Cryptpad, exp); onReady(f, rt.proxy, Cryptpad, exp);
}) })
.on('disconnect', function (info) {
// We only manage errors during the loading screen here. Other websocket errors are handled by the apps
if (info.error) {
if (typeof Cryptpad.storeError === "function") {
Cryptpad.storeError();
}
return;
}
})
.on('change', ['drive', 'migrate'], function () { .on('change', ['drive', 'migrate'], function () {
var path = arguments[2]; var path = arguments[2];
var value = arguments[1]; var value = arguments[1];

@ -5,7 +5,6 @@ define([
'/bower_components/chainpad-json-validator/json-ot.js', '/bower_components/chainpad-json-validator/json-ot.js',
'json.sortify', 'json.sortify',
'/bower_components/textpatcher/TextPatcher.js', '/bower_components/textpatcher/TextPatcher.js',
'/common/cryptpad-common.js',
'/bower_components/nthen/index.js', '/bower_components/nthen/index.js',
'/common/sframe-common.js', '/common/sframe-common.js',
'/customize/messages.js', '/customize/messages.js',
@ -24,7 +23,6 @@ define([
JsonOT, JsonOT,
JSONSortify, JSONSortify,
TextPatcher, TextPatcher,
Cryptpad,
nThen, nThen,
SFCommon, SFCommon,
Messages, Messages,
@ -49,10 +47,6 @@ define([
var badStateTimeout = typeof(AppConfig.badStateTimeout) === 'number' ? var badStateTimeout = typeof(AppConfig.badStateTimeout) === 'number' ?
AppConfig.badStateTimeout : 30000; AppConfig.badStateTimeout : 30000;
var onConnectError = function () {
UI.errorLoadingScreen(Messages.websocketError);
};
var create = function (options, cb) { var create = function (options, cb) {
var evContentUpdate = Util.mkEvent(); var evContentUpdate = Util.mkEvent();
var evEditableStateChange = Util.mkEvent(); var evEditableStateChange = Util.mkEvent();
@ -258,7 +252,7 @@ define([
newContent = normalize(newContent); newContent = normalize(newContent);
contentUpdate(newContent); contentUpdate(newContent);
} else { } else {
title.updateTitle(Cryptpad.initialName || title.defaultTitle); title.updateTitle(title.defaultTitle);
evOnDefaultContentNeeded.fire(); evOnDefaultContentNeeded.fire();
} }
stateChange(STATE.READY); stateChange(STATE.READY);
@ -441,12 +435,6 @@ define([
}, 2000); }, 2000);
//common.onLogout(function () { ... }); //common.onLogout(function () { ... });
Cryptpad.onError(function (info) {
if (info && info.type === "store") {
onConnectError();
}
});
}).nThen(function (waitFor) { }).nThen(function (waitFor) {
if (readOnly) { $('body').addClass('cp-readonly'); } if (readOnly) { $('body').addClass('cp-readonly'); }
@ -478,7 +466,6 @@ define([
metadataMgr: cpNfInner.metadataMgr, metadataMgr: cpNfInner.metadataMgr,
readOnly: readOnly, readOnly: readOnly,
realtime: cpNfInner.chainpad, realtime: cpNfInner.chainpad,
common: Cryptpad,
sfCommon: common, sfCommon: common,
$container: $(toolbarContainer), $container: $(toolbarContainer),
$contentContainer: $(contentContainer) $contentContainer: $(contentContainer)

@ -166,14 +166,6 @@ define([
sframeChan.event('EV_LOGOUT'); sframeChan.event('EV_LOGOUT');
}); });
Cryptpad.onError(function (info) {
console.log('error');
console.log(info);
if (info && info.type === "store") {
//onConnectError();
}
});
sframeChan.on('Q_ANON_RPC_MESSAGE', function (data, cb) { sframeChan.on('Q_ANON_RPC_MESSAGE', function (data, cb) {
Cryptpad.anonRpcMsg(data.msg, data.content, function (err, response) { Cryptpad.anonRpcMsg(data.msg, data.content, function (err, response) {
cb({error: err, response: response}); cb({error: err, response: response});

@ -3,12 +3,12 @@ define([
'/bower_components/chainpad-crypto/crypto.js', '/bower_components/chainpad-crypto/crypto.js',
'/common/toolbar3.js', '/common/toolbar3.js',
'/bower_components/chainpad-json-validator/json-ot.js', '/bower_components/chainpad-json-validator/json-ot.js',
'/common/cryptpad-common.js',
'/bower_components/nthen/index.js', '/bower_components/nthen/index.js',
'/common/sframe-common.js', '/common/sframe-common.js',
'/common/hyperscript.js', '/common/hyperscript.js',
'/contacts/messenger-ui.js', '/contacts/messenger-ui.js',
'/common/sframe-messenger-inner.js', '/common/sframe-messenger-inner.js',
'/customize/messages.js',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css', 'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css', 'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
@ -18,19 +18,15 @@ define([
Crypto, Crypto,
Toolbar, Toolbar,
JsonOT, JsonOT,
Cryptpad,
nThen, nThen,
SFCommon, SFCommon,
h, h,
UI, UI,
Messenger Messenger,
Messages
) )
{ {
var Messages = Cryptpad.Messages;
var APP = {}; var APP = {};
var onConnectError = function () {
UI.errorLoadingScreen(Messages.websocketError);
};
var common; var common;
var sFrameChan; var sFrameChan;
@ -41,12 +37,6 @@ define([
sFrameChan = common.getSframeChannel(); sFrameChan = common.getSframeChannel();
sFrameChan.onReady(waitFor()); sFrameChan.onReady(waitFor());
}).nThen(function (/*waitFor*/) { }).nThen(function (/*waitFor*/) {
Cryptpad.onError(function (info) {
if (info && info.type === "store") {
onConnectError();
}
});
var toolbarElement = h('div#cp-toolbar.cp-toolbar-container'); var toolbarElement = h('div#cp-toolbar.cp-toolbar-container');
document.body.appendChild(toolbarElement); document.body.appendChild(toolbarElement);
@ -73,10 +63,8 @@ define([
var displayed = ['useradmin', 'newpad', 'limit', 'pageTitle']; var displayed = ['useradmin', 'newpad', 'limit', 'pageTitle'];
var configTb = { var configTb = {
displayed: displayed, displayed: displayed,
common: Cryptpad,
sfCommon: common, sfCommon: common,
$container: $(toolbarElement), $container: $(toolbarElement),
network: Cryptpad.getNetwork(),
pageTitle: Messages.contacts_title, pageTitle: Messages.contacts_title,
metadataMgr: common.getMetadataMgr(), metadataMgr: common.getMetadataMgr(),
}; };

@ -15,6 +15,7 @@ define([
'/common/userObject.js', '/common/userObject.js',
'/customize/application_config.js', '/customize/application_config.js',
'/common/sframe-chainpad-listmap.js', '/common/sframe-chainpad-listmap.js',
'/customize/messages.js',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css', 'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css', 'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
@ -35,7 +36,8 @@ define([
CommonRealtime, CommonRealtime,
FO, FO,
AppConfig, AppConfig,
Listmap) Listmap,
Messages)
{ {
var Messages = Cryptpad.Messages; var Messages = Cryptpad.Messages;
@ -49,10 +51,6 @@ define([
return JSONSortify(obj); return JSONSortify(obj);
}; };
var onConnectError = function () {
UI.errorLoadingScreen(Messages.websocketError);
};
var E_OVER_LIMIT = 'E_OVER_LIMIT'; var E_OVER_LIMIT = 'E_OVER_LIMIT';
var SEARCH = "search"; var SEARCH = "search";
@ -1463,7 +1461,7 @@ define([
if (type === 'contacts') { return; } if (type === 'contacts') { return; }
if (type === 'todo') { return; } if (type === 'todo') { return; }
if (type === 'file') { return; } if (type === 'file') { return; }
if (!Cryptpad.isLoggedIn() && AppConfig.registeredOnlyTypes && if (!APP.loggedIn && AppConfig.registeredOnlyTypes &&
AppConfig.registeredOnlyTypes.indexOf(type) !== -1) { AppConfig.registeredOnlyTypes.indexOf(type) !== -1) {
return; return;
} }
@ -2961,7 +2959,6 @@ define([
metadataMgr: metadataMgr, metadataMgr: metadataMgr,
readOnly: readOnly, readOnly: readOnly,
realtime: info.realtime, realtime: info.realtime,
common: Cryptpad,
sfCommon: common, sfCommon: common,
$container: APP.$bar $container: APP.$bar
}; };
@ -3051,12 +3048,6 @@ define([
proxy.on('reconnect', function (info) { proxy.on('reconnect', function (info) {
onReconnect(info); onReconnect(info);
}); });
Cryptpad.onError(function (info) {
if (info && info.type === "store") {
onConnectError();
}
});
common.onLogout(function () { setEditable(false); }); common.onLogout(function () { setEditable(false); });
}); });
}; };

@ -3,7 +3,6 @@ define([
'/bower_components/chainpad-crypto/crypto.js', '/bower_components/chainpad-crypto/crypto.js',
'/bower_components/textpatcher/TextPatcher.js', '/bower_components/textpatcher/TextPatcher.js',
'/bower_components/chainpad-json-validator/json-ot.js', '/bower_components/chainpad-json-validator/json-ot.js',
'/common/cryptpad-common.js',
'/bower_components/nthen/index.js', '/bower_components/nthen/index.js',
'/common/sframe-common.js', '/common/sframe-common.js',
'/common/common-interface.js', '/common/common-interface.js',
@ -11,6 +10,7 @@ define([
'/common/common-util.js', '/common/common-util.js',
'/common/common-hash.js', '/common/common-hash.js',
'json.sortify', 'json.sortify',
'/customize/messages.js',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css', 'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css', 'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
@ -20,24 +20,16 @@ define([
Crypto, Crypto,
TextPatcher, TextPatcher,
JsonOT, JsonOT,
Cryptpad,
nThen, nThen,
SFCommon, SFCommon,
UI, UI,
UIElements, UIElements,
Util, Util,
Hash, Hash,
Sortify) Sortify,
Messages)
{ {
var Messages = Cryptpad.Messages; var APP = window.APP = {};
var APP = window.APP = {
Cryptpad: Cryptpad,
};
var onConnectError = function () {
UI.errorLoadingScreen(Messages.websocketError);
};
var andThen = function (common) { var andThen = function (common) {
var metadataMgr = common.getMetadataMgr(); var metadataMgr = common.getMetadataMgr();
@ -181,11 +173,6 @@ define([
SFCommon.create(waitFor(function (c) { APP.common = common = c; })); SFCommon.create(waitFor(function (c) { APP.common = common = c; }));
}).nThen(function (/*waitFor*/) { }).nThen(function (/*waitFor*/) {
var metadataMgr = common.getMetadataMgr(); var metadataMgr = common.getMetadataMgr();
Cryptpad.onError(function (info) {
if (info && info.type === "store") {
onConnectError();
}
});
if (metadataMgr.getMetadataLazy() !== 'uninitialized') { if (metadataMgr.getMetadataLazy() !== 'uninitialized') {
andThen(common); andThen(common);
return; return;

@ -94,14 +94,6 @@ define([
sframeChan.onReg('EV_METADATA_UPDATE', updateMeta); sframeChan.onReg('EV_METADATA_UPDATE', updateMeta);
proxy.on('change', 'settings', updateMeta); proxy.on('change', 'settings', updateMeta);
Cryptpad.onError(function (info) {
console.log('error');
console.log(info);
if (info && info.type === "store") {
//onConnectError();
}
});
sframeChan.on('Q_ANON_RPC_MESSAGE', function (data, cb) { sframeChan.on('Q_ANON_RPC_MESSAGE', function (data, cb) {
Cryptpad.anonRpcMsg(data.msg, data.content, function (err, response) { Cryptpad.anonRpcMsg(data.msg, data.content, function (err, response) {
cb({error: err, response: response}); cb({error: err, response: response});

@ -2,7 +2,6 @@ define([
'jquery', 'jquery',
'/bower_components/textpatcher/TextPatcher.js', '/bower_components/textpatcher/TextPatcher.js',
'/common/toolbar3.js', '/common/toolbar3.js',
'/common/cryptpad-common.js',
'/common/common-util.js', '/common/common-util.js',
'/common/cryptget.js', '/common/cryptget.js',
'/bower_components/nthen/index.js', '/bower_components/nthen/index.js',
@ -16,6 +15,7 @@ define([
'/common/sframe-common-codemirror.js', '/common/sframe-common-codemirror.js',
'/common/common-thumbnail.js', '/common/common-thumbnail.js',
'/common/common-interface.js', '/common/common-interface.js',
'/customize/messages.js',
'cm/lib/codemirror', 'cm/lib/codemirror',
'cm/addon/display/placeholder', 'cm/addon/display/placeholder',
@ -32,7 +32,6 @@ define([
$, $,
TextPatcher, TextPatcher,
Toolbar, Toolbar,
Cryptpad,
Util, Util,
Cryptget, Cryptget,
nThen, nThen,
@ -46,9 +45,9 @@ define([
SframeCM, SframeCM,
Thumb, Thumb,
UI, UI,
Messages,
CMeditor) CMeditor)
{ {
var Messages = Cryptpad.Messages;
var saveAs = window.saveAs; var saveAs = window.saveAs;
var APP = window.APP = { var APP = window.APP = {
@ -57,7 +56,6 @@ define([
col: [] col: []
}, },
readOnly: false, readOnly: false,
Cryptpad: Cryptpad,
mobile: function () { return $('body').width() <= 600; } // Menu and content area are not inline-block anymore for mobiles mobile: function () { return $('body').width() <= 600; } // Menu and content area are not inline-block anymore for mobiles
}; };
var Render = Renderer(APP); var Render = Renderer(APP);
@ -332,7 +330,7 @@ define([
/* Any time the realtime object changes, call this function */ /* Any time the realtime object changes, call this function */
var change = function (o, n, path, throttle, cb) { var change = function (o, n, path, throttle, cb) {
if (path && !Cryptpad.isArray(path)) { if (path && !Array.isArray(path)) {
return; return;
} }
if (path && path.join) { if (path && path.join) {
@ -1086,7 +1084,6 @@ define([
metadataMgr: metadataMgr, metadataMgr: metadataMgr,
readOnly: APP.readOnly, readOnly: APP.readOnly,
realtime: info.realtime, realtime: info.realtime,
common: Cryptpad,
sfCommon: common, sfCommon: common,
$container: APP.$bar, $container: APP.$bar,
$contentContainer: APP.$content $contentContainer: APP.$content

@ -1,5 +1,4 @@
define([ define([
//'/common/cryptpad-common.js',
'jquery', 'jquery',
'/bower_components/hyperjson/hyperjson.js', '/bower_components/hyperjson/hyperjson.js',
'/bower_components/textpatcher/TextPatcher.js', '/bower_components/textpatcher/TextPatcher.js',

@ -3,14 +3,15 @@ define([
'/bower_components/chainpad-crypto/crypto.js', '/bower_components/chainpad-crypto/crypto.js',
'/common/sframe-chainpad-listmap.js', '/common/sframe-chainpad-listmap.js',
'/common/toolbar3.js', '/common/toolbar3.js',
'/common/cryptpad-common.js',
'/bower_components/nthen/index.js', '/bower_components/nthen/index.js',
'/common/sframe-common.js', '/common/sframe-common.js',
'/common/common-util.js', '/common/common-util.js',
'/common/common-interface.js', '/common/common-interface.js',
'/common/common-realtime.js', '/common/common-realtime.js',
'/customize/messages.js',
'/bower_components/marked/marked.min.js', '/bower_components/marked/marked.min.js',
'cm/lib/codemirror', 'cm/lib/codemirror',
'cm/mode/markdown/markdown', 'cm/mode/markdown/markdown',
'css!/bower_components/codemirror/lib/codemirror.css', 'css!/bower_components/codemirror/lib/codemirror.css',
@ -24,24 +25,19 @@ define([
Crypto, Crypto,
Listmap, Listmap,
Toolbar, Toolbar,
Cryptpad,
nThen, nThen,
SFCommon, SFCommon,
Util, Util,
UI, UI,
Realtime, Realtime,
Messages,
Marked, Marked,
CodeMirror CodeMirror
) )
{ {
var Messages = Cryptpad.Messages;
var APP = window.APP = { var APP = window.APP = {
Cryptpad: Cryptpad,
_onRefresh: [] _onRefresh: []
}; };
var onConnectError = function () {
UI.errorLoadingScreen(Messages.websocketError);
};
// Decryption event for avatar mediatag (TODO not needed anymore?) // Decryption event for avatar mediatag (TODO not needed anymore?)
$(window.document).on('decryption', function (e) { $(window.document).on('decryption', function (e) {
@ -147,7 +143,7 @@ define([
var addCreateInviteLinkButton = function ($container) { var addCreateInviteLinkButton = function ($container) {
return; return;
var obj = APP.lm.proxy; /*var obj = APP.lm.proxy;
var proxy = Cryptpad.getProxy(); var proxy = Cryptpad.getProxy();
var userViewHash = Util.find(proxy, ['profile', 'view']); var userViewHash = Util.find(proxy, ['profile', 'view']);
@ -185,7 +181,7 @@ define([
// TODO copy invite link to clipboard // TODO copy invite link to clipboard
}, null, true); }, null, true);
}) })
.appendTo($container); .appendTo($container);*/
}; };
/* jshint ignore:end */ /* jshint ignore:end */
@ -398,13 +394,13 @@ define([
APP.$container.find('#'+CREATE_ID).remove(); APP.$container.find('#'+CREATE_ID).remove();
var obj = APP.lm && APP.lm.proxy; var obj = APP.lm && APP.lm.proxy;
if (!APP.readOnly) { /*if (!APP.readOnly) {
var pubKeys = Cryptpad.getPublicKeys(); var pubKeys = Cryptpad.getPublicKeys();
if (pubKeys && pubKeys.curve) { if (pubKeys && pubKeys.curve) {
obj.curveKey = pubKeys.curve; obj.curveKey = pubKeys.curve;
obj.edKey = pubKeys.ed; obj.edKey = pubKeys.ed;
} }
} }*/
if (!APP.initialized) { if (!APP.initialized) {
var $header = $('<div>', {id: HEADER_ID}).appendTo(APP.$rightside); var $header = $('<div>', {id: HEADER_ID}).appendTo(APP.$rightside);
@ -426,7 +422,6 @@ define([
var displayed = ['useradmin', 'newpad', 'limit', 'pageTitle']; var displayed = ['useradmin', 'newpad', 'limit', 'pageTitle'];
var configTb = { var configTb = {
displayed: displayed, displayed: displayed,
common: Cryptpad,
sfCommon: common, sfCommon: common,
$container: APP.$toolbar, $container: APP.$toolbar,
pageTitle: Messages.profileButton, pageTitle: Messages.profileButton,
@ -447,12 +442,6 @@ define([
sFrameChan = common.getSframeChannel(); sFrameChan = common.getSframeChannel();
sFrameChan.onReady(waitFor()); sFrameChan.onReady(waitFor());
}).nThen(function (/*waitFor*/) { }).nThen(function (/*waitFor*/) {
Cryptpad.onError(function (info) {
if (info && info.type === "store") {
onConnectError();
}
});
createToolbar(); createToolbar();
var metadataMgr = common.getMetadataMgr(); var metadataMgr = common.getMetadataMgr();
var privateData = metadataMgr.getPrivateData(); var privateData = metadataMgr.getPrivateData();

@ -1,7 +1,6 @@
define([ define([
'jquery', 'jquery',
'/common/toolbar3.js', '/common/toolbar3.js',
'/common/cryptpad-common.js',
'/bower_components/nthen/index.js', '/bower_components/nthen/index.js',
'/common/sframe-common.js', '/common/sframe-common.js',
'/common/common-interface.js', '/common/common-interface.js',
@ -16,7 +15,6 @@ define([
], function ( ], function (
$, $,
Toolbar, Toolbar,
Cryptpad,
nThen, nThen,
SFCommon, SFCommon,
UI, UI,
@ -26,9 +24,7 @@ define([
) )
{ {
var saveAs = window.saveAs; var saveAs = window.saveAs;
var APP = window.APP = { var APP = window.APP = {};
Cryptpad: Cryptpad,
};
var common; var common;
var metadataMgr; var metadataMgr;
@ -509,7 +505,6 @@ define([
var displayed = ['useradmin', 'newpad', 'limit', 'pageTitle']; var displayed = ['useradmin', 'newpad', 'limit', 'pageTitle'];
var configTb = { var configTb = {
displayed: displayed, displayed: displayed,
common: Cryptpad,
sfCommon: common, sfCommon: common,
$container: APP.$toolbar, $container: APP.$toolbar,
pageTitle: Messages.settings_title, pageTitle: Messages.settings_title,

@ -1,7 +1,6 @@
define([ define([
'jquery', 'jquery',
'json.sortify', 'json.sortify',
'/common/cryptpad-common.js',
'/bower_components/nthen/index.js', '/bower_components/nthen/index.js',
'/common/sframe-common.js', '/common/sframe-common.js',
'/slide/slide.js', '/slide/slide.js',
@ -9,6 +8,7 @@ define([
'/common/common-util.js', '/common/common-util.js',
'/common/common-hash.js', '/common/common-hash.js',
'/common/common-interface.js', '/common/common-interface.js',
'/customize/messages.js',
'cm/lib/codemirror', 'cm/lib/codemirror',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css', 'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
@ -44,7 +44,6 @@ define([
], function ( ], function (
$, $,
JSONSortify, JSONSortify,
Cryptpad,
nThen, nThen,
SFCommon, SFCommon,
Slide, Slide,
@ -52,10 +51,10 @@ define([
Util, Util,
Hash, Hash,
UI, UI,
Messages,
CMeditor) CMeditor)
{ {
window.CodeMirror = CMeditor; window.CodeMirror = CMeditor;
var Messages = Cryptpad.Messages;
var SLIDE_BACKCOLOR_ID = "cp-app-slide-toolbar-backcolor"; var SLIDE_BACKCOLOR_ID = "cp-app-slide-toolbar-backcolor";
var SLIDE_COLOR_ID = "cp-app-slide-toolbar-color"; var SLIDE_COLOR_ID = "cp-app-slide-toolbar-color";

@ -3,12 +3,12 @@ define([
'/bower_components/chainpad-crypto/crypto.js', '/bower_components/chainpad-crypto/crypto.js',
'/common/sframe-chainpad-listmap.js', '/common/sframe-chainpad-listmap.js',
'/common/toolbar3.js', '/common/toolbar3.js',
'/common/cryptpad-common.js',
'/bower_components/nthen/index.js', '/bower_components/nthen/index.js',
'/common/sframe-common.js', '/common/sframe-common.js',
'/common/common-interface.js', '/common/common-interface.js',
'/common/common-hash.js', '/common/common-hash.js',
'/todo/todo.js', '/todo/todo.js',
'/customize/messages.js',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css', 'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css', 'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
@ -18,19 +18,15 @@ define([
Crypto, Crypto,
Listmap, Listmap,
Toolbar, Toolbar,
Cryptpad,
nThen, nThen,
SFCommon, SFCommon,
Hash, Hash,
UI, UI,
Todo Todo,
Messages
) )
{ {
var Messages = Cryptpad.Messages;
var APP = window.APP = {}; var APP = window.APP = {};
var onConnectError = function () {
UI.errorLoadingScreen(Messages.websocketError);
};
var common; var common;
var sFrameChan; var sFrameChan;
@ -41,12 +37,6 @@ define([
sFrameChan = common.getSframeChannel(); sFrameChan = common.getSframeChannel();
sFrameChan.onReady(waitFor()); sFrameChan.onReady(waitFor());
}).nThen(function (/*waitFor*/) { }).nThen(function (/*waitFor*/) {
Cryptpad.onError(function (info) {
if (info && info.type === "store") {
onConnectError();
}
});
var $body = $('body'); var $body = $('body');
var $list = $('#cp-app-todo-taskslist'); var $list = $('#cp-app-todo-taskslist');
@ -206,7 +196,6 @@ define([
var displayed = ['useradmin', 'newpad', 'limit', 'pageTitle']; var displayed = ['useradmin', 'newpad', 'limit', 'pageTitle'];
var configTb = { var configTb = {
displayed: displayed, displayed: displayed,
common: Cryptpad,
sfCommon: common, sfCommon: common,
$container: $bar, $container: $bar,
pageTitle: Messages.todo_title, pageTitle: Messages.todo_title,

@ -5,16 +5,14 @@ define([
'/common/toolbar3.js', '/common/toolbar3.js',
'json.sortify', 'json.sortify',
'/bower_components/chainpad-json-validator/json-ot.js', '/bower_components/chainpad-json-validator/json-ot.js',
'/common/cryptpad-common.js',
'/common/common-util.js', '/common/common-util.js',
'/common/cryptget.js',
'/bower_components/nthen/index.js', '/bower_components/nthen/index.js',
'/common/sframe-common.js', '/common/sframe-common.js',
'/common/common-interface.js', '/common/common-interface.js',
'/api/config', '/api/config',
'/common/common-realtime.js', '/common/common-realtime.js',
'/customize/pages.js', '/customize/pages.js',
'/customize/messages.js',
'/customize/application_config.js', '/customize/application_config.js',
'/common/common-thumbnail.js', '/common/common-thumbnail.js',
'/whiteboard/colors.js', '/whiteboard/colors.js',
@ -32,24 +30,21 @@ define([
Toolbar, Toolbar,
JSONSortify, JSONSortify,
JsonOT, JsonOT,
Cryptpad,
Util, Util,
Cryptget,
nThen, nThen,
SFCommon, SFCommon,
UI, UI,
ApiConfig, ApiConfig,
CommonRealtime, CommonRealtime,
Pages, Pages,
Messages,
AppConfig, AppConfig,
Thumb, Thumb,
Colors) Colors)
{ {
var saveAs = window.saveAs; var saveAs = window.saveAs;
var Messages = Cryptpad.Messages;
var APP = window.APP = { var APP = window.APP = {
Cryptpad: Cryptpad,
$: $ $: $
}; };
var Fabric = APP.Fabric = window.fabric; var Fabric = APP.Fabric = window.fabric;
@ -60,10 +55,6 @@ define([
var toolbar; var toolbar;
var onConnectError = function () {
UI.errorLoadingScreen(Messages.websocketError);
};
var andThen = function (common) { var andThen = function (common) {
var config = {}; var config = {};
/* Initialize Fabric */ /* Initialize Fabric */
@ -129,7 +120,7 @@ define([
var updateBrushWidth = function () { var updateBrushWidth = function () {
var val = $width.val(); var val = $width.val();
canvas.freeDrawingBrush.width = Number(val); canvas.freeDrawingBrush.width = Number(val);
$widthLabel.text(Cryptpad.Messages._getKey("canvas_widthLabel", [val])); $widthLabel.text(Messages._getKey("canvas_widthLabel", [val]));
$('#cp-app-whiteboard-width-val').text(val + 'px'); $('#cp-app-whiteboard-width-val').text(val + 'px');
createCursor(); createCursor();
}; };
@ -140,7 +131,7 @@ define([
var val = $opacity.val(); var val = $opacity.val();
brush.opacity = Number(val); brush.opacity = Number(val);
canvas.freeDrawingBrush.color = Colors.hex2rgba(brush.color, brush.opacity); canvas.freeDrawingBrush.color = Colors.hex2rgba(brush.color, brush.opacity);
$opacityLabel.text(Cryptpad.Messages._getKey("canvas_opacityLabel", [val])); $opacityLabel.text(Messages._getKey("canvas_opacityLabel", [val]));
$('#cp-app-whiteboard-opacity-val').text((Number(val) * 100) + '%'); $('#cp-app-whiteboard-opacity-val').text((Number(val) * 100) + '%');
createCursor(); createCursor();
}; };
@ -409,7 +400,6 @@ define([
metadataMgr: metadataMgr, metadataMgr: metadataMgr,
readOnly: readOnly, readOnly: readOnly,
realtime: info.realtime, realtime: info.realtime,
common: Cryptpad,
sfCommon: common, sfCommon: common,
$container: $bar, $container: $bar,
$contentContainer: $('#cp-app-whiteboard-canvas-area') $contentContainer: $('#cp-app-whiteboard-canvas-area')
@ -542,7 +532,7 @@ define([
} }
newDoc = hjson.content; newDoc = hjson.content;
} else { } else {
Title.updateTitle(Cryptpad.initialName || Title.defaultTitle); Title.updateTitle(Title.defaultTitle);
} }
nThen(function (waitFor) { nThen(function (waitFor) {
@ -643,11 +633,6 @@ define([
})); }));
SFCommon.create(waitFor(function (c) { APP.common = common = c; })); SFCommon.create(waitFor(function (c) { APP.common = common = c; }));
}).nThen(function (/*waitFor*/) { }).nThen(function (/*waitFor*/) {
Cryptpad.onError(function (info) {
if (info && info.type === "store") {
onConnectError();
}
});
andThen(common); andThen(common);
}); });
}; };

Loading…
Cancel
Save