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

@@ -2,12 +2,13 @@ define([
'jquery',
'/bower_components/chainpad-crypto/crypto.js',
'/common/toolbar3.js',
'/common/cryptpad-common.js',
'/bower_components/nthen/index.js',
'/common/sframe-common.js',
'/common/hyperscript.js',
'/contacts/messenger-ui.js',
'/common/sframe-messenger-inner.js',
'/customize/messages.js',
'/common/common-interface.js',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
@@ -16,35 +17,26 @@ define([
$,
Crypto,
Toolbar,
Cryptpad,
nThen,
SFCommon,
h,
UI,
Messenger
MessengerUI,
Messenger,
Messages,
UI
)
{
var Messages = Cryptpad.Messages;
var APP = {};
var onConnectError = function () {
Cryptpad.errorLoadingScreen(Messages.websocketError);
};
var common;
var sFrameChan;
nThen(function (waitFor) {
$(waitFor(Cryptpad.addLoadingScreen));
$(waitFor(UI.addLoadingScreen));
SFCommon.create(waitFor(function (c) { APP.common = common = c; }));
}).nThen(function (waitFor) {
sFrameChan = common.getSframeChannel();
sFrameChan.onReady(waitFor());
}).nThen(function (/*waitFor*/) {
Cryptpad.onError(function (info) {
if (info && info.type === "store") {
onConnectError();
}
});
var toolbarElement = h('div#cp-toolbar.cp-toolbar-container');
document.body.appendChild(toolbarElement);
@@ -71,10 +63,8 @@ define([
var displayed = ['useradmin', 'newpad', 'limit', 'pageTitle'];
var configTb = {
displayed: displayed,
common: Cryptpad,
sfCommon: common,
$container: $(toolbarElement),
network: Cryptpad.getNetwork(),
pageTitle: Messages.contacts_title,
metadataMgr: common.getMetadataMgr(),
};
@@ -83,17 +73,17 @@ define([
var messenger = Messenger.create(sFrameChan);
UI.create(messenger, $(friendList), $(messaging), common);
MessengerUI.create(messenger, $(friendList), $(messaging), common);
Cryptpad.removeLoadingScreen();
UI.removeLoadingScreen();
/*
sFrameChan.query('Q_HEY_BUDDY', null, function (err, data) {
if (!data) { return; }
if (data.error) {
Cryptpad.warn(data.error);
UI.warn(data.error);
} else {
Cryptpad.log(data.response);
UI.log(data.response);
}
});*/
});

View File

@@ -1,14 +1,17 @@
define([
'jquery',
'/common/cryptpad-common.js',
'/customize/messages.js',
'/common/common-util.js',
'/common/common-interface.js',
'/common/common-notifier.js',
'/common/hyperscript.js',
'/bower_components/marked/marked.min.js',
'/common/media-tag.js',
], function ($, Cryptpad, h, Marked, MediaTag) {
], function ($, Cryptpad, Messages, Util, UI, Notifier, h, Marked, MediaTag) {
'use strict';
var UI = {};
var Messages = Cryptpad.Messages;
var MessengerUI = {};
var m = function (md) {
var d = h('div.cp-app-contacts-content');
@@ -18,6 +21,14 @@ define([
// remove potentially malicious elements
$d.find('script, iframe, object, applet, video, audio').remove();
// override link clicking, because we're in an iframe
$d.find('a').each(function () {
var href = $(this).click(function (e) {
e.preventDefault();
window.open(href);
}).attr('href');
});
// activate media-tags
$d.find('media-tag').each(function (i, e) { MediaTag(e); });
} catch (e) {
@@ -40,7 +51,7 @@ define([
};
};
UI.create = function (messenger, $userlist, $messages, common) {
MessengerUI.create = function (messenger, $userlist, $messages, common) {
var origin = common.getMetadataMgr().getPrivateData().origin;
var state = window.state = {
@@ -163,12 +174,13 @@ define([
});
$(removeHistory).click(function () {
Cryptpad.confirm(Messages.contacts_confirmRemoveHistory, function (yes) {
UI.confirm(Messages.contacts_confirmRemoveHistory, function (yes) {
if (!yes) { return; }
Cryptpad.clearOwnedChannel(data.channel, function (e) {
messenger.clearOwnedChannel(data.channel, function (e) {
if (e) {
console.error(e);
Cryptpad.alert(Messages.contacts_removeHistoryServerError);
UI.alert(Messages.contacts_removeHistoryServerError);
return;
}
});
@@ -355,8 +367,8 @@ define([
$(remove).click(function (e) {
e.stopPropagation();
Cryptpad.confirm(Messages._getKey('contacts_confirmRemove', [
Cryptpad.fixHTML(data.displayName)
UI.confirm(Messages._getKey('contacts_confirmRemove', [
Util.fixHTML(data.displayName)
]), function (yes) {
if (!yes) { return; }
removeFriend(curvePublic, function (e) {
@@ -389,7 +401,7 @@ define([
var initializing = true;
messenger.on('message', function (message) {
if (!initializing) { Cryptpad.notify(); }
if (!initializing) { Notifier.notify(); }
var curvePublic = message.curve;
var name = displayNames[curvePublic];
@@ -514,7 +526,7 @@ define([
count--;
if (count === 0) {
initializing = false;
Cryptpad.removeLoadingScreen();
UI.removeLoadingScreen();
}
};
ready();
@@ -524,5 +536,5 @@ define([
});
};
return UI;
return MessengerUI;
});