Separate UI elements from cryptpad-common

This commit is contained in:
yflory
2017-11-13 10:23:18 +01:00
parent 354c63bd64
commit dc207393fd
30 changed files with 424 additions and 1840 deletions

View File

@@ -3,10 +3,12 @@ define([
'/bower_components/chainpad-crypto/crypto.js',
'/common/curve.js',
'/common/common-hash.js',
'/common/common-util.js',
'/customize/messages.js',
'/bower_components/marked/marked.min.js',
'/common/common-realtime.js',
], function ($, Crypto, Curve, Hash, Marked, Realtime) {
], function ($, Crypto, Curve, Hash, Util, Messages, Marked, Realtime) {
var Msg = {
inputs: [],
};
@@ -98,7 +100,7 @@ define([
var msg;
if (sender === network.historyKeeper) { return; }
try {
var parsed = common.parsePadUrl(window.location.href);
var parsed = Hash.parsePadUrl(window.location.href);
if (!parsed.hashData) { return; }
var chan = parsed.hashData.channel;
// Decrypt
@@ -132,11 +134,11 @@ define([
todo(true);
return;
}
var confirmMsg = common.Messages._getKey('contacts_request', [
common.fixHTML(msgData.displayName)
var confirmMsg = Messages._getKey('contacts_request', [
Util.fixHTML(msgData.displayName)
]);
common.onFriendRequest(confirmMsg, todo);
//common.confirm(confirmMsg, todo, null, true);
//UI.confirm(confirmMsg, todo, null, true);
return;
}
if (msg[0] === "FRIEND_REQ_OK") {
@@ -147,12 +149,12 @@ define([
addToFriendList(common, msgData, function (err) {
if (err) {
return void common.onFriendComplete({
logText: common.Messages.contacts_addError,
logText: Messages.contacts_addError,
netfluxId: sender
});
}
common.onFriendComplete({
logText: common.Messages.contacts_added,
logText: Messages.contacts_added,
netfluxId: sender
});
var msg = ["FRIEND_REQ_ACK", chan];
@@ -165,7 +167,7 @@ define([
var i = pendingRequests.indexOf(sender);
if (i !== -1) { pendingRequests.splice(i, 1); }
common.onFriendComplete({
logText: common.Messages.contacts_rejected,
logText: Messages.contacts_rejected,
netfluxId: sender
});
common.changeDisplayName(proxy[common.displayNameKey]);
@@ -177,12 +179,12 @@ define([
addToFriendList(common, data, function (err) {
if (err) {
return void common.onFriendComplete({
logText: common.Messages.contacts_addError,
logText: Messages.contacts_addError,
netfluxId: sender
});
}
common.onFriendComplete({
logText: common.Messages.contacts_added,
logText: Messages.contacts_added,
netfluxId: sender
});
});
@@ -201,7 +203,7 @@ define([
Msg.inviteFromUserlist = function (common, netfluxId) {
var network = common.getNetwork();
var parsed = common.parsePadUrl(window.location.href);
var parsed = Hash.parsePadUrl(window.location.href);
if (!parsed.hashData) { return; }
// Message
var chan = parsed.hashData.channel;