resolve merge conflicts

This commit is contained in:
ansuz
2017-11-23 16:56:49 +01:00
88 changed files with 2238 additions and 8645 deletions

View File

@@ -3,15 +3,14 @@ define([
'/bower_components/chainpad-crypto/crypto.js',
'/common/toolbar3.js',
'json.sortify',
'/common/cryptpad-common.js',
'/common/common-util.js',
'/common/cryptget.js',
'/bower_components/nthen/index.js',
'/common/sframe-common.js',
'/common/sframe-common-interface.js',
'/common/common-interface.js',
'/api/config',
'/common/common-realtime.js',
'/customize/pages.js',
'/customize/messages.js',
'/customize/application_config.js',
'/common/common-thumbnail.js',
'/whiteboard/colors.js',
@@ -28,25 +27,22 @@ define([
Crypto,
Toolbar,
JSONSortify,
Cryptpad,
Util,
Cryptget,
nThen,
SFCommon,
SFUI,
UI,
ApiConfig,
CommonRealtime,
Pages,
Messages,
AppConfig,
Thumb,
Colors,
ChainPad)
{
var saveAs = window.saveAs;
var Messages = Cryptpad.Messages;
var APP = window.APP = {
Cryptpad: Cryptpad,
$: $
};
var Fabric = APP.Fabric = window.fabric;
@@ -57,10 +53,6 @@ define([
var toolbar;
var onConnectError = function () {
Cryptpad.errorLoadingScreen(Messages.websocketError);
};
var andThen = function (common) {
var config = {};
/* Initialize Fabric */
@@ -126,7 +118,7 @@ define([
var updateBrushWidth = function () {
var val = $width.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');
createCursor();
};
@@ -137,7 +129,7 @@ define([
var val = $opacity.val();
brush.opacity = Number(val);
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) + '%');
createCursor();
};
@@ -225,7 +217,7 @@ define([
var saveImage = APP.saveImage = function () {
var defaultName = "pretty-picture.png";
Cryptpad.prompt(Messages.exportPrompt, defaultName, function (filename) {
UI.prompt(Messages.exportPrompt, defaultName, function (filename) {
if (!(typeof(filename) === 'string' && filename)) { return; }
$canvas[0].toBlob(function (blob) {
saveAs(blob, filename);
@@ -406,7 +398,6 @@ define([
metadataMgr: metadataMgr,
readOnly: readOnly,
realtime: info.realtime,
common: Cryptpad,
sfCommon: common,
$container: $bar,
$contentContainer: $('#cp-app-whiteboard-canvas-area')
@@ -433,7 +424,7 @@ define([
if (common.isLoggedIn()) {
common.createButton('savetodrive', true, {}, function () {})
.click(function () {
Cryptpad.prompt(Messages.exportPrompt, document.title + '.png',
UI.prompt(Messages.exportPrompt, document.title + '.png',
function (name) {
if (name === null || !name.trim()) { return; }
APP.upload(name);
@@ -512,7 +503,7 @@ define([
config.onReady = function (info) {
if (APP.realtime !== info.realtime) {
var realtime = APP.realtime = info.realtime;
APP.realtime = info.realtime;
}
var userDoc = APP.realtime.getUserDoc();
@@ -530,12 +521,12 @@ define([
(hjson.metadata && typeof(hjson.metadata.type) !== 'undefined' &&
hjson.metadata.type !== 'whiteboard')) {
var errorText = Messages.typeError;
Cryptpad.errorLoadingScreen(errorText);
UI.errorLoadingScreen(errorText);
throw new Error(errorText);
}
newDoc = hjson.content;
} else {
Title.updateTitle(Cryptpad.initialName || Title.defaultTitle);
Title.updateTitle(Title.defaultTitle);
}
nThen(function (waitFor) {
@@ -549,7 +540,7 @@ define([
setEditable(!readOnly);
initializing = false;
config.onLocal();
Cryptpad.removeLoadingScreen();
UI.removeLoadingScreen();
initThumbnails();
@@ -585,27 +576,25 @@ define([
// inform of network disconnect
setEditable(false);
toolbar.failed();
Cryptpad.alert(Messages.common_connectionLost, undefined, true);
UI.alert(Messages.common_connectionLost, undefined, true);
};
config.onConnectionChange = function (info) {
setEditable(info.state);
if (info.state) {
initializing = true;
Cryptpad.findOKButton().click();
UI.findOKButton().click();
} else {
Cryptpad.alert(Messages.common_connectionLost, undefined, true);
UI.alert(Messages.common_connectionLost, undefined, true);
}
};
config.onError = onConnectError;
cpNfInner = common.startRealtime(config);
metadataMgr = cpNfInner.metadataMgr;
cpNfInner.onInfiniteSpinner(function () {
setEditable(false);
Cryptpad.confirm(Messages.realtime_unrecoverableError, function (yes) {
UI.confirm(Messages.realtime_unrecoverableError, function (yes) {
if (!yes) { return; }
common.gotoURL();
});
@@ -622,7 +611,7 @@ define([
saveImage();
});
Cryptpad.onLogout(function () { setEditable(false); });
common.onLogout(function () { setEditable(false); });
};
var main = function () {
@@ -630,17 +619,12 @@ define([
nThen(function (waitFor) {
$(waitFor(function () {
Cryptpad.addLoadingScreen();
UI.addLoadingScreen();
var $div = $('<div>').append(Pages['/whiteboard/']());
$('body').append($div.html());
}));
SFCommon.create(waitFor(function (c) { APP.common = common = c; }));
}).nThen(function (/*waitFor*/) {
Cryptpad.onError(function (info) {
if (info && info.type === "store") {
onConnectError();
}
});
andThen(common);
});
};