Merge branch 'staging' into pad2
This commit is contained in:
commit
e49a42db18
35 files changed
+577
-301
No files matched your search
@@ -56,12 +56,13 @@ define([
|
||||
$row.find('.upCancel').html('-');
|
||||
var $pv = $row.find('.progressValue');
|
||||
var $pb = $row.find('.progressContainer');
|
||||
var $pc = $row.find('.upProgress');
|
||||
var $link = $row.find('.upLink');
|
||||
|
||||
var updateProgress = function (progressValue) {
|
||||
$pv.text(Math.round(progressValue*100)/100 + '%');
|
||||
$pb.css({
|
||||
width: (progressValue/100)*188+'px'
|
||||
width: (progressValue/100)*$pc.width()+'px'
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -313,6 +313,7 @@ define([
|
||||
position: 'bottom',
|
||||
distance: 0,
|
||||
performance: true,
|
||||
dynamicTitle: true,
|
||||
delay: [delay, 0]
|
||||
});
|
||||
};
|
||||
|
||||
+291
-176
@@ -79,7 +79,132 @@ define([
|
||||
// Messaging tools
|
||||
var avatars = {};
|
||||
|
||||
var addToFriendListUI = function (common, $block, open, remove, f) {
|
||||
// TODO make this internal to the messenger
|
||||
var channels = Msg.channels = window.channels = {};
|
||||
|
||||
var UI = Msg.UI = {};
|
||||
UI.init = function (common, $listContainer, $msgContainer) {
|
||||
var ui = {
|
||||
containers: {
|
||||
friendList: $listContainer,
|
||||
messages: $msgContainer,
|
||||
},
|
||||
};
|
||||
|
||||
ui.setFriendList = function (display, remove) {
|
||||
UI.getFriendList(common, display, remove).appendTo($listContainer);
|
||||
};
|
||||
|
||||
ui.notify = function (curvePublic) {
|
||||
var $friend = $listContainer.find('.friend').filter(function (idx, el) {
|
||||
return $(el).data('key') === curvePublic;
|
||||
});
|
||||
$friend.addClass('notify');
|
||||
};
|
||||
|
||||
ui.unnotify = function (curvePublic) {
|
||||
var $friend = $listContainer.find('.friend').filter(function (idx, el) {
|
||||
return $(el).data('key') === curvePublic;
|
||||
});
|
||||
$friend.removeClass('notify');
|
||||
};
|
||||
|
||||
ui.update = function (curvePublic, types) {
|
||||
var data = getFriend(common, curvePublic);
|
||||
var chan = channels[data.channel];
|
||||
if (!chan.ready) {
|
||||
chan.updateOnReady = (chan.updateOnReady || []).concat(types);
|
||||
return;
|
||||
}
|
||||
var $friend = $listContainer.find('.friend').filter(function (idx, el) {
|
||||
return $(el).data('key') === curvePublic;
|
||||
});
|
||||
if (types.indexOf('displayName') >= 0) {
|
||||
$friend.find('.name').text(data.displayName);
|
||||
}
|
||||
if (types.indexOf('avatar') >= 0) {
|
||||
$friend.find('.default').remove();
|
||||
$friend.find('media-tag').remove();
|
||||
if (data.avatar && avatars[data.avatar]) {
|
||||
$friend.prepend(avatars[data.avatar]);
|
||||
} else {
|
||||
common.displayAvatar($friend, data.avatar, data.displayName, function ($img) {
|
||||
if (data.avatar && $img) {
|
||||
avatars[data.avatar] = $img[0].outerHTML;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ui.updateStatus = function (curvePublic) {
|
||||
var data = getFriend(common, curvePublic);
|
||||
var chan = channels[data.channel];
|
||||
|
||||
// FIXME mixes logic and presentation
|
||||
var $friend = $listContainer.find('.friend').filter(function (idx, el) {
|
||||
return $(el).data('key') === curvePublic;
|
||||
});
|
||||
var status = chan.userList.some(function (nId) {
|
||||
return chan.mapId[nId] === curvePublic;
|
||||
});
|
||||
var statusText = status ? 'online' : 'offline';
|
||||
$friend.find('.status').attr('class', 'status '+statusText);
|
||||
};
|
||||
|
||||
ui.getChannel = function (curvePublic) {
|
||||
// TODO extract into UI method
|
||||
var $chat = $msgContainer.find('.chat').filter(function (idx, el) {
|
||||
return $(el).data('key') === curvePublic;
|
||||
});
|
||||
return $chat.length? $chat: null;
|
||||
};
|
||||
|
||||
ui.hideInfo = function () {
|
||||
$msgContainer.find('.info').hide();
|
||||
};
|
||||
|
||||
ui.showInfo = function () {
|
||||
$msgContainer.find('.info').show();
|
||||
};
|
||||
|
||||
ui.createChat = function (curvePublic) {
|
||||
return $('<div>', {'class':'chat'})
|
||||
.data('key', curvePublic).appendTo($msgContainer);
|
||||
};
|
||||
|
||||
ui.hideChat = function () {
|
||||
$msgContainer.find('.chat').hide();
|
||||
};
|
||||
|
||||
ui.getFriend = function (curvePublic) {
|
||||
return $listContainer.find('.friend').filter(function (idx, el) {
|
||||
return $(el).data('key') === curvePublic;
|
||||
});
|
||||
};
|
||||
|
||||
ui.addToFriendList = function (curvePublic, display, remove) {
|
||||
var $block = $listContainer.find('> div');
|
||||
UI.addToFriendList(common, $block, display, remove, curvePublic);
|
||||
};
|
||||
|
||||
ui.createMessage = function (msg, name) {
|
||||
var $msg = $('<div>', {'class': 'message'})
|
||||
.attr('title', msg.time ? new Date(msg.time).toLocaleString(): '?');
|
||||
|
||||
if (name) {
|
||||
$('<div>', {'class':'sender'}).text(name).appendTo($msg);
|
||||
}
|
||||
|
||||
$('<div>', {'class':'content'}).html(parseMessage(msg.text)).appendTo($msg);
|
||||
return $msg;
|
||||
};
|
||||
|
||||
return ui;
|
||||
};
|
||||
|
||||
// internal
|
||||
UI.addToFriendList = function (common, $block, open, remove, f) {
|
||||
var proxy = common.getProxy();
|
||||
var friends = proxy.friends || {};
|
||||
if (f === "me") { return; }
|
||||
@@ -120,12 +245,14 @@ define([
|
||||
}
|
||||
$('<span>', {'class': 'status'}).appendTo($friend);
|
||||
};
|
||||
Msg.getFriendListUI = function (common, open, remove) {
|
||||
var proxy = common.getProxy();
|
||||
|
||||
// iterate over your friends list and return a dom element containing UI
|
||||
UI.getFriendList = function (common, open, remove) {
|
||||
var proxy = common.getProxy(); // throws
|
||||
var $block = $('<div>');
|
||||
var friends = proxy.friends || {};
|
||||
Object.keys(friends).forEach(function (f) {
|
||||
addToFriendListUI(common, $block, open, remove, f);
|
||||
UI.addToFriendList(common, $block, open, remove, f);
|
||||
});
|
||||
return $block;
|
||||
};
|
||||
@@ -146,7 +273,6 @@ define([
|
||||
});
|
||||
};
|
||||
|
||||
var channels = Msg.channels = window.channels = {};
|
||||
|
||||
var msgAlreadyKnown = function (channel, sig) {
|
||||
return channel.messages.some(function (message) {
|
||||
@@ -162,8 +288,16 @@ define([
|
||||
|
||||
var parsedMsg = JSON.parse(msg);
|
||||
if (parsedMsg[0] === Types.message) {
|
||||
parsedMsg.shift();
|
||||
channel.messages.push([sig, parsedMsg]);
|
||||
// TODO validate messages here
|
||||
var res = {
|
||||
type: parsedMsg[0],
|
||||
sig: sig,
|
||||
channel: parsedMsg[1],
|
||||
time: parsedMsg[2],
|
||||
text: parsedMsg[3],
|
||||
};
|
||||
|
||||
channel.messages.push(res);
|
||||
return true;
|
||||
}
|
||||
var proxy;
|
||||
@@ -192,6 +326,8 @@ define([
|
||||
}
|
||||
};
|
||||
|
||||
/* Broadcast a display name, profile, or avatar change to all contacts
|
||||
*/
|
||||
var updateMyData = function (common) {
|
||||
var friends = getFriendList(common);
|
||||
var mySyncData = friends.me;
|
||||
@@ -218,7 +354,7 @@ define([
|
||||
var onChannelReady = function (common, chanId) {
|
||||
if (ready.indexOf(chanId) !== -1) { return; }
|
||||
ready.push(chanId);
|
||||
channels[chanId].updateStatus();
|
||||
channels[chanId].updateStatus(); // c'est quoi?
|
||||
var friends = getFriendList(common);
|
||||
if (ready.length === Object.keys(friends).length) {
|
||||
// All channels are ready
|
||||
@@ -240,7 +376,29 @@ define([
|
||||
if (!isId) { return; }
|
||||
|
||||
var decryptedMsg = channel.encryptor.decrypt(msg);
|
||||
var parsed = JSON.parse(decryptedMsg);
|
||||
|
||||
if (decryptedMsg === null) {
|
||||
// console.error('unable to decrypt message');
|
||||
// console.error('potentially meant for yourself');
|
||||
|
||||
// message failed to parse, meaning somebody sent it to you but
|
||||
// encrypted it with the wrong key, or you're sending a message to
|
||||
// yourself in a different tab.
|
||||
return;
|
||||
}
|
||||
|
||||
if (!decryptedMsg) {
|
||||
console.error('decrypted message was falsey but not null');
|
||||
return;
|
||||
}
|
||||
|
||||
var parsed;
|
||||
try {
|
||||
parsed = JSON.parse(decryptedMsg);
|
||||
} catch (e) {
|
||||
console.error(decryptedMsg);
|
||||
return;
|
||||
}
|
||||
if (parsed[0] !== Types.mapId && parsed[0] !== Types.mapIdAck) { return; }
|
||||
if (parsed[2] !== sender || !parsed[1]) { return; }
|
||||
channel.mapId[sender] = parsed[1];
|
||||
@@ -293,9 +451,9 @@ define([
|
||||
}
|
||||
};
|
||||
|
||||
// TODO extract into UI method
|
||||
var createChatBox = function (common, $container, curvePublic, messenger) {
|
||||
var data = getFriend(common, curvePublic);
|
||||
var proxy = common.getProxy();
|
||||
|
||||
// Input
|
||||
var channel = channels[data.channel];
|
||||
@@ -343,6 +501,8 @@ define([
|
||||
messenger.input = $input[0];
|
||||
|
||||
var send = function () {
|
||||
// TODO implement sending queue
|
||||
// TODO separate message logic from UI
|
||||
var channel = channels[data.channel];
|
||||
if (channel.sending) {
|
||||
console.error("still sending");
|
||||
@@ -356,42 +516,26 @@ define([
|
||||
console.error("input is disabled");
|
||||
return;
|
||||
}
|
||||
|
||||
var payload = $input.val();
|
||||
// Send the message
|
||||
var msg = [Types.message, proxy.curvePublic, +new Date(), $input.val()];
|
||||
var msgStr = JSON.stringify(msg);
|
||||
var cryptMsg = channel.encryptor.encrypt(msgStr);
|
||||
channel.sending = true;
|
||||
|
||||
console.log(channel.wc);
|
||||
var network = common.getNetwork();
|
||||
if (!network.webChannels.some(function (wc) {
|
||||
if (wc.id === channel.wc.id) {
|
||||
console.error(wc.id, channel.wc.id);
|
||||
return true;
|
||||
channel.send(payload, function (e) {
|
||||
if (e) {
|
||||
channel.sending = false;
|
||||
console.error(e);
|
||||
return;
|
||||
}
|
||||
console.error(wc.id, channel.wc.id);
|
||||
//return wc.id === channel.wc.id;
|
||||
})) {
|
||||
console.error('no such channel:' + channel.wc.id);
|
||||
return;
|
||||
}
|
||||
|
||||
channel.wc.bcast(cryptMsg).then(function () {
|
||||
$input.val('');
|
||||
pushMsg(common, channel, cryptMsg);
|
||||
channel.refresh();
|
||||
channel.sending = false;
|
||||
}, function (err) {
|
||||
channel.sending = false;
|
||||
console.error(err);
|
||||
});
|
||||
};
|
||||
$('<button>', {'class': 'btn btn-primary fa fa-paper-plane'})
|
||||
//.text(common.Messages.contacts_send)
|
||||
.appendTo($inputBlock).click(send);
|
||||
/*$input.on('keypress', function (e) {
|
||||
if (e.which === 13) { send(); }
|
||||
});*/
|
||||
$('<button>', {
|
||||
'class': 'btn btn-primary fa fa-paper-plane',
|
||||
title: common.Messages.contacts_send,
|
||||
}).appendTo($inputBlock).click(send);
|
||||
|
||||
var onKeyDown = function (e) {
|
||||
if (e.keyCode === 13) {
|
||||
if (e.ctrlKey || e.shiftKey) {
|
||||
@@ -441,88 +585,113 @@ define([
|
||||
});
|
||||
};
|
||||
|
||||
Msg.init = function (common, $listContainer, $msgContainer) {
|
||||
var messenger = {};
|
||||
var getMoreHistory = function (network, chan, hash, count) {
|
||||
var msg = [ 'GET_HISTORY_RANGE', chan.id, {
|
||||
from: hash,
|
||||
count: count,
|
||||
}
|
||||
];
|
||||
|
||||
network.sendto(network.historyKeeper, JSON.stringify(msg)).then(function () {
|
||||
}, function (err) {
|
||||
throw new Error(err);
|
||||
});
|
||||
};
|
||||
|
||||
var getChannelMessagesSince = function (network, proxy, chan, data, keys) {
|
||||
var cfg = {
|
||||
validateKey: keys.validateKey,
|
||||
owners: [proxy.edPublic, data.edPublic],
|
||||
lastKnownHash: data.lastKnownHash
|
||||
};
|
||||
var msg = ['GET_HISTORY', chan.id, cfg];
|
||||
network.sendto(network.historyKeeper, JSON.stringify(msg))
|
||||
.then($.noop, function (err) {
|
||||
throw new Error(err);
|
||||
});
|
||||
};
|
||||
|
||||
Msg.init = function (common, ui) {
|
||||
// declare common variables
|
||||
var network = common.getNetwork();
|
||||
var proxy = common.getProxy();
|
||||
Msg.hk = network.historyKeeper;
|
||||
var friends = getFriendList(common);
|
||||
|
||||
// listen for messages...
|
||||
network.on('message', function(msg, sender) {
|
||||
onDirectMessage(common, msg, sender);
|
||||
});
|
||||
|
||||
// declare messenger and common methods
|
||||
var messenger = {
|
||||
ui: ui,
|
||||
};
|
||||
|
||||
messenger.setActive = function (id) {
|
||||
// TODO validate id
|
||||
messenger.active = id;
|
||||
};
|
||||
|
||||
// Refresh the active channel
|
||||
// TODO extract into UI method
|
||||
var refresh = function (curvePublic) {
|
||||
if (Msg.active !== curvePublic) { return; }
|
||||
if (messenger.active !== curvePublic) { return; }
|
||||
var data = friends[curvePublic];
|
||||
if (!data) { return; }
|
||||
var channel = channels[data.channel];
|
||||
if (!channel) { return; }
|
||||
|
||||
var $chat = $msgContainer.find('.chat').filter(function (idx, el) {
|
||||
return $(el).data('key') === curvePublic;
|
||||
});
|
||||
var $chat = ui.getChannel(curvePublic);
|
||||
|
||||
if (!$chat) { return; }
|
||||
|
||||
if (!$chat.length) { return; }
|
||||
// Add new messages
|
||||
var messages = channel.messages;
|
||||
var $messages = $chat.find('.messages');
|
||||
var $msg, msg, date, name;
|
||||
var msg, name;
|
||||
var last = typeof(channel.lastDisplayed) === 'number'? channel.lastDisplayed: -1;
|
||||
for (var i = last + 1; i<messages.length; i++) {
|
||||
msg = messages[i][1]; // 0 is the hash, 1 the array
|
||||
$msg = $('<div>', {'class': 'message'}).appendTo($messages);
|
||||
msg = messages[i];
|
||||
name = (msg.channel !== channel.lastSender)?
|
||||
getFriend(common, msg.channel).displayName: undefined;
|
||||
|
||||
// date
|
||||
date = msg[1] ? new Date(msg[1]).toLocaleString() : '?';
|
||||
//$('<div>', {'class':'date'}).text(date).appendTo($msg);
|
||||
$msg.attr('title', date);
|
||||
|
||||
// name
|
||||
if (msg[0] !== channel.lastSender) {
|
||||
name = getFriend(common, msg[0]).displayName;
|
||||
$('<div>', {'class':'sender'}).text(name).appendTo($msg);
|
||||
}
|
||||
channel.lastSender = msg[0];
|
||||
|
||||
// content
|
||||
//$('<div>', {'class':'content'}).text(msg[2]).appendTo($msg);
|
||||
$('<div>', {'class':'content'}).html(parseMessage(msg[2])).appendTo($msg);
|
||||
ui.createMessage(msg, name).appendTo($messages);
|
||||
channel.lastSender = msg.channel;
|
||||
}
|
||||
$messages.scrollTop($messages[0].scrollHeight);
|
||||
channel.lastDisplayed = i-1;
|
||||
channel.unnotify();
|
||||
|
||||
// return void channel.notify();
|
||||
if (messages.length > 10) {
|
||||
var lastKnownMsg = messages[messages.length - 11];
|
||||
data.lastKnownHash = lastKnownMsg[0];
|
||||
channel.setLastMessageRead(lastKnownMsg.sig);
|
||||
}
|
||||
};
|
||||
// Display a new channel
|
||||
// TODO extract into UI method
|
||||
var display = function (curvePublic) {
|
||||
$msgContainer.find('.info').hide();
|
||||
ui.hideInfo();
|
||||
var isNew = false;
|
||||
var $chat = $msgContainer.find('.chat').filter(function (idx, el) {
|
||||
return $(el).data('key') === curvePublic;
|
||||
});
|
||||
if (!$chat.length) {
|
||||
$chat = $('<div>', {'class':'chat'})
|
||||
.data('key', curvePublic).appendTo($msgContainer);
|
||||
var $chat = ui.getChannel(curvePublic);
|
||||
if (!$chat) {
|
||||
$chat = ui.createChat(curvePublic);
|
||||
createChatBox(common, $chat, curvePublic, messenger);
|
||||
isNew = true;
|
||||
}
|
||||
// Show the correct div
|
||||
$msgContainer.find('.chat').hide();
|
||||
ui.hideChat();
|
||||
$chat.show();
|
||||
|
||||
Msg.active = curvePublic;
|
||||
// TODO set this attr per-messenger
|
||||
messenger.setActive(curvePublic);
|
||||
// TODO don't mark messages as read unless you have displayed them
|
||||
|
||||
refresh(curvePublic);
|
||||
};
|
||||
|
||||
// TODO take a callback
|
||||
var remove = function (curvePublic) {
|
||||
var data = getFriend(common, curvePublic);
|
||||
var channel = channels[data.channel];
|
||||
@@ -541,106 +710,20 @@ define([
|
||||
};
|
||||
|
||||
// Display friend list
|
||||
common.getFriendListUI(common, display, remove).appendTo($listContainer);
|
||||
ui.setFriendList(display, remove);
|
||||
|
||||
// Notify on new messages
|
||||
var notify = function (curvePublic) {
|
||||
//if (Msg.active === curvePublic) { return; }
|
||||
var $friend = $listContainer.find('.friend').filter(function (idx, el) {
|
||||
return $(el).data('key') === curvePublic;
|
||||
});
|
||||
$friend.addClass('notify');
|
||||
common.notify();
|
||||
};
|
||||
var unnotify = function (curvePublic) {
|
||||
var $friend = $listContainer.find('.friend').filter(function (idx, el) {
|
||||
return $(el).data('key') === curvePublic;
|
||||
});
|
||||
$friend.removeClass('notify');
|
||||
};
|
||||
// TODO extract into UI method...
|
||||
var removeUI = function (curvePublic) {
|
||||
var $friend = $listContainer.find('.friend').filter(function (idx, el) {
|
||||
return $(el).data('key') === curvePublic;
|
||||
});
|
||||
var $chat = $msgContainer.find('.chat').filter(function (idx, el) {
|
||||
return $(el).data('key') === curvePublic;
|
||||
});
|
||||
var $friend = ui.getFriend(curvePublic);
|
||||
var $chat = ui.getChannel(curvePublic);
|
||||
$friend.remove();
|
||||
$chat.remove();
|
||||
$msgContainer.find('.info').show();
|
||||
};
|
||||
var updateUI = function (curvePublic, types) {
|
||||
var data = getFriend(common, curvePublic);
|
||||
var chan = channels[data.channel];
|
||||
if (!chan.ready) {
|
||||
chan.updateOnReady = (chan.updateOnReady || []).concat(types);
|
||||
return;
|
||||
}
|
||||
var $friend = $listContainer.find('.friend').filter(function (idx, el) {
|
||||
return $(el).data('key') === curvePublic;
|
||||
});
|
||||
if (types.indexOf('displayName') >= 0) {
|
||||
$friend.find('.name').text(data.displayName);
|
||||
}
|
||||
if (types.indexOf('avatar') >= 0) {
|
||||
$friend.find('.default').remove();
|
||||
$friend.find('media-tag').remove();
|
||||
if (data.avatar && avatars[data.avatar]) {
|
||||
$friend.prepend(avatars[data.avatar]);
|
||||
} else {
|
||||
common.displayAvatar($friend, data.avatar, data.displayName, function ($img) {
|
||||
if (data.avatar && $img) {
|
||||
avatars[data.avatar] = $img[0].outerHTML;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
var updateStatus = function (curvePublic) {
|
||||
var data = getFriend(common, curvePublic);
|
||||
var chan = channels[data.channel];
|
||||
var $friend = $listContainer.find('.friend').filter(function (idx, el) {
|
||||
return $(el).data('key') === curvePublic;
|
||||
});
|
||||
var status = chan.userList.some(function (nId) {
|
||||
return chan.mapId[nId] === curvePublic;
|
||||
});
|
||||
var statusText = status ? 'online' : 'offline';
|
||||
$friend.find('.status').attr('class', 'status '+statusText);
|
||||
};
|
||||
var getMoreHistory = function (network, chan, hash, count) {
|
||||
var msg = [
|
||||
'GET_HISTORY_RANGE',
|
||||
chan.id,
|
||||
{
|
||||
from: hash,
|
||||
count: count,
|
||||
}
|
||||
];
|
||||
|
||||
console.log(msg);
|
||||
|
||||
network.sendto(network.historyKeeper, JSON.stringify(msg)).then(function (a, b, c) {
|
||||
console.log(a, b, c);
|
||||
}, function (err) {
|
||||
throw new Error(err);
|
||||
});
|
||||
};
|
||||
|
||||
var getChannelMessagesSince = function (network, chan, data, keys) {
|
||||
var cfg = {
|
||||
validateKey: keys.validateKey,
|
||||
owners: [proxy.edPublic, data.edPublic],
|
||||
lastKnownHash: data.lastKnownHash
|
||||
};
|
||||
var msg = ['GET_HISTORY', chan.id, cfg];
|
||||
network.sendto(network.historyKeeper, JSON.stringify(msg))
|
||||
.then($.noop, function (err) {
|
||||
throw new Error(err);
|
||||
});
|
||||
ui.showInfo();
|
||||
};
|
||||
|
||||
// Open the channels
|
||||
|
||||
// TODO extract this into an external function
|
||||
var openFriendChannel = function (f) {
|
||||
if (f === "me") { return; }
|
||||
var data = friends[f];
|
||||
@@ -654,13 +737,25 @@ define([
|
||||
encryptor: encryptor,
|
||||
messages: [],
|
||||
refresh: function () { refresh(data.curvePublic); },
|
||||
notify: function () { notify(data.curvePublic); },
|
||||
unnotify: function () { unnotify(data.curvePublic); },
|
||||
notify: function () {
|
||||
ui.notify(data.curvePublic);
|
||||
common.notify();
|
||||
},
|
||||
unnotify: function () { ui.unnotify(data.curvePublic); },
|
||||
removeUI: function () { removeUI(data.curvePublic); },
|
||||
updateUI: function (types) { updateUI(data.curvePublic, types); },
|
||||
updateStatus: function () { updateStatus(data.curvePublic); },
|
||||
updateUI: function (types) { ui.update(data.curvePublic, types); },
|
||||
updateStatus: function () { ui.updateStatus(data.curvePublic); },
|
||||
setLastMessageRead: function (hash) {
|
||||
data.lastKnownHash = hash;
|
||||
},
|
||||
getLastMessageRead: function () {
|
||||
return data.lastKnownHash;
|
||||
},
|
||||
isActive: function () {
|
||||
return data.curvePublic === messenger.active;
|
||||
},
|
||||
getMessagesSinceDisconnect: function () {
|
||||
getChannelMessagesSince(network, chan, data, keys);
|
||||
getChannelMessagesSince(network, proxy, chan, data, keys);
|
||||
},
|
||||
wc: chan,
|
||||
userList: [],
|
||||
@@ -680,6 +775,24 @@ define([
|
||||
var messageHash = oldestMessage[0];
|
||||
getMoreHistory(network, chan, messageHash, 10);
|
||||
},
|
||||
send: function (payload, cb) {
|
||||
if (!network.webChannels.some(function (wc) {
|
||||
if (wc.id === channel.wc.id) { return true; }
|
||||
})) {
|
||||
return void cb('NO_SUCH_CHANNEL');
|
||||
}
|
||||
|
||||
var msg = [Types.message, proxy.curvePublic, +new Date(), payload];
|
||||
var msgStr = JSON.stringify(msg);
|
||||
var cryptMsg = channel.encryptor.encrypt(msgStr);
|
||||
|
||||
channel.wc.bcast(cryptMsg).then(function () {
|
||||
pushMsg(common, channel, cryptMsg);
|
||||
cb();
|
||||
}, function (err) {
|
||||
cb(err);
|
||||
});
|
||||
},
|
||||
};
|
||||
chan.on('message', function (msg, sender) {
|
||||
onMessage(common, msg, sender, chan);
|
||||
@@ -710,7 +823,7 @@ define([
|
||||
channel.updateStatus();
|
||||
});
|
||||
|
||||
getChannelMessagesSince(network, chan, data, keys);
|
||||
getChannelMessagesSince(network, proxy, chan, data, keys);
|
||||
}, function (err) {
|
||||
console.error(err);
|
||||
});
|
||||
@@ -726,6 +839,7 @@ define([
|
||||
Object.keys(friends).forEach(openFriendChannel);
|
||||
};
|
||||
|
||||
// TODO split out into UI
|
||||
messenger.setEditable = function (bool) {
|
||||
bool = !bool;
|
||||
var input = messenger.input;
|
||||
@@ -748,14 +862,14 @@ define([
|
||||
|
||||
openFriendChannels();
|
||||
|
||||
// TODO split loop innards into ui methods
|
||||
var checkNewFriends = function () {
|
||||
Object.keys(friends).forEach(function (f) {
|
||||
var $friend = $listContainer.find('.friend').filter(function (idx, el) {
|
||||
return $(el).data('key') === f;
|
||||
});
|
||||
var $friend = ui.getFriend(f);
|
||||
|
||||
if (!$friend.length) {
|
||||
openFriendChannel(f);
|
||||
addToFriendListUI(common, $listContainer.find('> div'), display, remove, f);
|
||||
ui.addToFriendList(f, display, remove);
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -897,6 +1011,7 @@ define([
|
||||
if (pendingRequests.indexOf(netfluxId) === -1) {
|
||||
pendingRequests.push(netfluxId);
|
||||
var proxy = common.getProxy();
|
||||
// FIXME this name doesn't indicate what it does
|
||||
common.changeDisplayName(proxy[common.displayNameKey]);
|
||||
}
|
||||
network.sendto(netfluxId, msgStr);
|
||||
|
||||
@@ -125,10 +125,10 @@ define([
|
||||
common.createOwnedChannel = Messaging.createOwnedChannel;
|
||||
common.getFriendList = Messaging.getFriendList;
|
||||
common.getFriendChannelsList = Messaging.getFriendChannelsList;
|
||||
common.getFriendListUI = Messaging.getFriendListUI;
|
||||
common.createData = Messaging.createData;
|
||||
common.getPendingInvites = Messaging.getPending;
|
||||
common.getLatestMessages = Messaging.getLatestMessages;
|
||||
common.initMessagingUI = Messaging.UI.init;
|
||||
|
||||
// Userlist
|
||||
common.createUserList = UserList.create;
|
||||
|
||||
@@ -35,6 +35,7 @@ define([
|
||||
var nonce = decodeBase64(unpacked[0]);
|
||||
var box = decodeBase64(unpacked[1]);
|
||||
var message = Nacl.box.open.after(box, nonce, secret);
|
||||
if (message === false) { return null; }
|
||||
return encodeUTF8(message);
|
||||
};
|
||||
|
||||
|
||||
@@ -60,6 +60,10 @@ define([
|
||||
return out;
|
||||
};
|
||||
|
||||
renderer.paragraph = function (p) {
|
||||
return /<media\-tag[\s\S]*>/i.test(p)? p + '\n': '<p>' + p + '</p>\n';
|
||||
};
|
||||
|
||||
var MutationObserver = window.MutationObserver;
|
||||
var forbiddenTags = [
|
||||
'SCRIPT',
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
border: 0;
|
||||
padding: 8px 12px;
|
||||
margin: 1em;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
.close {
|
||||
@@ -60,6 +61,7 @@
|
||||
.fileContainer {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
.tippy-touch{cursor:pointer!important}.tippy-notransition{-webkit-transition:none!important;transition:none!important}.tippy-popper{max-width:400px;-webkit-perspective:800px;perspective:800px;z-index:9999;outline:0;-webkit-transition-timing-function:cubic-bezier(.165,.84,.44,1);transition-timing-function:cubic-bezier(.165,.84,.44,1)}.tippy-popper.html-template{max-width:96%;max-width:calc(100% - 20px)}.tippy-popper[x-placement^=top] [x-arrow]{border-top:7px solid #333;border-right:7px solid transparent;border-left:7px solid transparent;bottom:-7px;margin:0 9px}.tippy-popper[x-placement^=top] [x-arrow].arrow-small{border-top:5px solid #333;border-right:5px solid transparent;border-left:5px solid transparent;bottom:-5px}.tippy-popper[x-placement^=top] [x-arrow].arrow-big{border-top:10px solid #333;border-right:10px solid transparent;border-left:10px solid transparent;bottom:-10px}.tippy-popper[x-placement^=top] [x-circle]{-webkit-transform-origin:0 33%;transform-origin:0 33%}.tippy-popper[x-placement^=top] [x-circle].enter{-webkit-transform:scale(1) translate(-50%,-55%);transform:scale(1) translate(-50%,-55%);opacity:1}.tippy-popper[x-placement^=top] [x-circle].leave{-webkit-transform:scale(.15) translate(-50%,-50%);transform:scale(.15) translate(-50%,-50%);opacity:0}.tippy-popper[x-placement^=top] .tippy-tooltip.light-theme [x-circle]{background-color:#fff}.tippy-popper[x-placement^=top] .tippy-tooltip.light-theme [x-arrow]{border-top:7px solid #fff;border-right:7px solid transparent;border-left:7px solid transparent}.tippy-popper[x-placement^=top] .tippy-tooltip.light-theme [x-arrow].arrow-small{border-top:5px solid #fff;border-right:5px solid transparent;border-left:5px solid transparent}.tippy-popper[x-placement^=top] .tippy-tooltip.light-theme [x-arrow].arrow-big{border-top:10px solid #fff;border-right:10px solid transparent;border-left:10px solid transparent}.tippy-popper[x-placement^=top] .tippy-tooltip.transparent-theme [x-circle]{background-color:rgba(0,0,0,.7)}.tippy-popper[x-placement^=top] .tippy-tooltip.transparent-theme [x-arrow]{border-top:7px solid rgba(0,0,0,.7);border-right:7px solid transparent;border-left:7px solid transparent}.tippy-popper[x-placement^=top] .tippy-tooltip.transparent-theme [x-arrow].arrow-small{border-top:5px solid rgba(0,0,0,.7);border-right:5px solid transparent;border-left:5px solid transparent}.tippy-popper[x-placement^=top] .tippy-tooltip.transparent-theme [x-arrow].arrow-big{border-top:10px solid rgba(0,0,0,.7);border-right:10px solid transparent;border-left:10px solid transparent}.tippy-popper[x-placement^=top] [data-animation=perspective]{-webkit-transform-origin:bottom;transform-origin:bottom}.tippy-popper[x-placement^=top] [data-animation=perspective].enter{opacity:1;-webkit-transform:translateY(-10px) rotateX(0);transform:translateY(-10px) rotateX(0)}.tippy-popper[x-placement^=top] [data-animation=perspective].leave{opacity:0;-webkit-transform:translateY(0) rotateX(90deg);transform:translateY(0) rotateX(90deg)}.tippy-popper[x-placement^=top] [data-animation=fade].enter{opacity:1;-webkit-transform:translateY(-10px);transform:translateY(-10px)}.tippy-popper[x-placement^=top] [data-animation=fade].leave{opacity:0;-webkit-transform:translateY(-10px);transform:translateY(-10px)}.tippy-popper[x-placement^=top] [data-animation=shift].enter{opacity:1;-webkit-transform:translateY(-10px);transform:translateY(-10px)}.tippy-popper[x-placement^=top] [data-animation=shift].leave{opacity:0;-webkit-transform:translateY(0);transform:translateY(0)}.tippy-popper[x-placement^=top] [data-animation=scale].enter{opacity:1;-webkit-transform:translateY(-10px) scale(1);transform:translateY(-10px) scale(1)}.tippy-popper[x-placement^=top] [data-animation=scale].leave{opacity:0;-webkit-transform:translateY(0) scale(0);transform:translateY(0) scale(0)}.tippy-popper[x-placement^=bottom] [x-arrow]{border-bottom:7px solid #333;border-right:7px solid transparent;border-left:7px solid transparent;top:-7px;margin:0 9px}.tippy-popper[x-placement^=bottom] [x-arrow].arrow-small{border-bottom:5px solid #333;border-right:5px solid transparent;border-left:5px solid transparent;top:-5px}.tippy-popper[x-placement^=bottom] [x-arrow].arrow-big{border-bottom:10px solid #333;border-right:10px solid transparent;border-left:10px solid transparent;top:-10px}.tippy-popper[x-placement^=bottom] [x-circle]{-webkit-transform-origin:0 -50%;transform-origin:0 -50%}.tippy-popper[x-placement^=bottom] [x-circle].enter{-webkit-transform:scale(1) translate(-50%,-45%);transform:scale(1) translate(-50%,-45%);opacity:1}.tippy-popper[x-placement^=bottom] [x-circle].leave{-webkit-transform:scale(.15) translate(-50%,-5%);transform:scale(.15) translate(-50%,-5%);opacity:0}.tippy-popper[x-placement^=bottom] .tippy-tooltip.light-theme [x-circle]{background-color:#fff}.tippy-popper[x-placement^=bottom] .tippy-tooltip.light-theme [x-arrow]{border-bottom:7px solid #fff;border-right:7px solid transparent;border-left:7px solid transparLine truncated
|
||||
.tippy-touch{cursor:pointer!important}.tippy-notransition{transition:none!important}.tippy-popper{max-width:400px;-webkit-perspective:800px;perspective:800px;z-index:9999;outline:0;transition-timing-function:cubic-bezier(.165,.84,.44,1);pointer-events:none}.tippy-popper.html-template{max-width:96%;max-width:calc(100% - 20px)}.tippy-popper[x-placement^=top] [x-arrow]{border-top:7px solid #333;border-right:7px solid transparent;border-left:7px solid transparent;bottom:-7px;margin:0 9px}.tippy-popper[x-placement^=top] [x-arrow].arrow-small{border-top:5px solid #333;border-right:5px solid transparent;border-left:5px solid transparent;bottom:-5px}.tippy-popper[x-placement^=top] [x-arrow].arrow-big{border-top:10px solid #333;border-right:10px solid transparent;border-left:10px solid transparent;bottom:-10px}.tippy-popper[x-placement^=top] [x-circle]{-webkit-transform-origin:0 33%;transform-origin:0 33%}.tippy-popper[x-placement^=top] [x-circle].enter{-webkit-transform:scale(1) translate(-50%,-55%);transform:scale(1) translate(-50%,-55%);opacity:1}.tippy-popper[x-placement^=top] [x-circle].leave{-webkit-transform:scale(.15) translate(-50%,-50%);transform:scale(.15) translate(-50%,-50%);opacity:0}.tippy-popper[x-placement^=top] .tippy-tooltip.light-theme [x-circle]{background-color:#fff}.tippy-popper[x-placement^=top] .tippy-tooltip.light-theme [x-arrow]{border-top:7px solid #fff;border-right:7px solid transparent;border-left:7px solid transparent}.tippy-popper[x-placement^=top] .tippy-tooltip.light-theme [x-arrow].arrow-small{border-top:5px solid #fff;border-right:5px solid transparent;border-left:5px solid transparent}.tippy-popper[x-placement^=top] .tippy-tooltip.light-theme [x-arrow].arrow-big{border-top:10px solid #fff;border-right:10px solid transparent;border-left:10px solid transparent}.tippy-popper[x-placement^=top] .tippy-tooltip.transparent-theme [x-circle]{background-color:rgba(0,0,0,.7)}.tippy-popper[x-placement^=top] .tippy-tooltip.transparent-theme [x-arrow]{border-top:7px solid rgba(0,0,0,.7);border-right:7px solid transparent;border-left:7px solid transparent}.tippy-popper[x-placement^=top] .tippy-tooltip.transparent-theme [x-arrow].arrow-small{border-top:5px solid rgba(0,0,0,.7);border-right:5px solid transparent;border-left:5px solid transparent}.tippy-popper[x-placement^=top] .tippy-tooltip.transparent-theme [x-arrow].arrow-big{border-top:10px solid rgba(0,0,0,.7);border-right:10px solid transparent;border-left:10px solid transparent}.tippy-popper[x-placement^=top] [data-animation=perspective]{-webkit-transform-origin:bottom;transform-origin:bottom}.tippy-popper[x-placement^=top] [data-animation=perspective].enter{opacity:1;-webkit-transform:translateY(-10px) rotateX(0);transform:translateY(-10px) rotateX(0)}.tippy-popper[x-placement^=top] [data-animation=perspective].leave{opacity:0;-webkit-transform:translateY(0) rotateX(90deg);transform:translateY(0) rotateX(90deg)}.tippy-popper[x-placement^=top] [data-animation=fade].enter{opacity:1;-webkit-transform:translateY(-10px);transform:translateY(-10px)}.tippy-popper[x-placement^=top] [data-animation=fade].leave{opacity:0;-webkit-transform:translateY(-10px);transform:translateY(-10px)}.tippy-popper[x-placement^=top] [data-animation=shift].enter{opacity:1;-webkit-transform:translateY(-10px);transform:translateY(-10px)}.tippy-popper[x-placement^=top] [data-animation=shift].leave{opacity:0;-webkit-transform:translateY(0);transform:translateY(0)}.tippy-popper[x-placement^=top] [data-animation=scale].enter{opacity:1;-webkit-transform:translateY(-10px) scale(1);transform:translateY(-10px) scale(1)}.tippy-popper[x-placement^=top] [data-animation=scale].leave{opacity:0;-webkit-transform:translateY(0) scale(0);transform:translateY(0) scale(0)}.tippy-popper[x-placement^=bottom] [x-arrow]{border-bottom:7px solid #333;border-right:7px solid transparent;border-left:7px solid transparent;top:-7px;margin:0 9px}.tippy-popper[x-placement^=bottom] [x-arrow].arrow-small{border-bottom:5px solid #333;border-right:5px solid transparent;border-left:5px solid transparent;top:-5px}.tippy-popper[x-placement^=bottom] [x-arrow].arrow-big{border-bottom:10px solid #333;border-right:10px solid transparent;border-left:10px solid transparent;top:-10px}.tippy-popper[x-placement^=bottom] [x-circle]{-webkit-transform-origin:0 -50%;transform-origin:0 -50%}.tippy-popper[x-placement^=bottom] [x-circle].enter{-webkit-transform:scale(1) translate(-50%,-45%);transform:scale(1) translate(-50%,-45%);opacity:1}.tippy-popper[x-placement^=bottom] [x-circle].leave{-webkit-transform:scale(.15) translate(-50%,-5%);transform:scale(.15) translate(-50%,-5%);opacity:0}.tippy-popper[x-placement^=bottom] .tippy-tooltip.light-theme [x-circle]{background-color:#fff}.tippy-popper[x-placement^=bottom] .tippy-tooltip.light-theme [x-arrow]{border-bottom:7px solid #fff;border-right:7px solid transparent;border-left:7px solid transparent}.tippy-popper[x-placement^=bottom] .tippy-tooltip.light-theme [x-arrow].arLine truncated
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
(function(e,t){'object'==typeof exports&&'undefined'!=typeof module?module.exports=t():'function'==typeof define&&define.amd?define(t):e.tippy=t()})(this,function(){'use strict';function e(e){Pe.forEach(function(t){var o=t.popper,i=t.tippyInstance,n=t.settings,r=n.appendTo,s=n.hideOnClick,a=n.trigger;if(r.contains(o)){var p=!0===s||-1!==a.indexOf('focus'),l=!e||o!==e.popper;p&&l&&i.hide(o)}})}function t(e,t){var o=Element.prototype.closest||function(e){for(var t=this;t;){if(Ie.call(t,e))return t;t=t.parentElement}};return o.call(e,t)}function o(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function n(){var i=function(){xe.touch=!0,xe.iOS()&&document.body.classList.add('tippy-touch'),xe.dynamicInputDetection&&document.addEventListener('mousemove',n)},n=function(){var e;return function(){var t=performance&&performance.now();t&&10>t-e&&(xe.touch=!1,document.removeEventListener('mousemove',n),!xe.iOS()&&document.body.classList.contains('tippy-touch')&&document.body.classList.remove('tippy-touch')),e=t}}();document.addEventListener('click',function(i){if(!(i.target instanceof Element))return e();var n=t(i.target,Ce.TOOLTIPPED_EL),r=t(i.target,Ce.POPPER);if(r){var s=o(Pe,function(e){return e.popper===r}),a=s.settings.interactive;if(a)return}if(n){var p=o(Pe,function(e){return e.el===n}),l=p.settings,d=l.hideOnClick,c=l.multiple,f=l.trigger;if(!c&&xe.touch||!c&&-1!==f.indexOf('click'))return e(p);if(!0!==d||-1!==f.indexOf('click'))return}t(i.target,Ce.CONTROLLER)||!document.querySelector(Ce.POPPER)||e()}),document.addEventListener('touchstart',i),window.addEventListener('blur',function(){var e=document,t=e.activeElement;t&&t.blur&&Ie.call(t,Ce.TOOLTIPPED_EL)&&t.blur()}),!xe.SUPPORTS_TOUCH&&(0<navigator.maxTouchPoints||0<navigator.msMaxTouchPoints)&&document.addEventListener('pointerdown',i)}function r(){return!r.done&&(r.done=!0,Ae.appendTo=document.body,n(),!0)}function s(e){window.requestAnimationFrame(function(){setTimeout(e,0)})}function a(e){for(var t=[!1,'webkit'],o=e.charAt(0).toUpperCase()+e.slice(1),n=0;n<t.length;n++){var i=t[n],r=i?''+i+o:e;if('undefined'!=typeof window.document.body.style[r])return r}return null}function p(e,t){return Array.prototype.findIndex?e.findIndex(t):e.indexOf(o(e,t))}function l(e){var t=e.getAttribute('title');e.setAttribute('data-original-title',t||'html'),e.removeAttribute('title')}function d(e){var t=e.getBoundingClientRect();return 0<=t.top&&0<=t.left&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}function c(e,t){t?window.getComputedStyle(t)[a('transform')]:window.getComputedStyle(e).opacity}function f(e,t){e.forEach(function(e){e&&t(e.classList)})}function m(e,t){e.forEach(function(e){if(e){var o=Ie.call(e,Ce.CONTENT),i=o?Se(t/1.3):t;e.style[a('transitionDuration')]=i+'ms'}})}function h(e){return'visible'===e.style.visibility}function u(){}function g(e){return e.replace(/-.+/,'')}function b(t){var e,i,n=this,r=o(Pe,function(e){return e.el===n}),s=r.popper,p=r.settings.offset,l=g(s.getAttribute('x-placement')),d=Se(s.offsetWidth/2),c=Se(s.offsetHeight/2),f=5,m=document.documentElement.offsetWidth||document.body.offsetWidth,h=t.pageX,u=t.pageY;'top'===l?(e=h-d+p,i=u-2.25*c):'left'===l?(e=h-2*d-10,i=u-c+p):'right'===l?(e=h+c,i=u-c+p):'bottom'===l?(e=h-d+p,i=u+c/1.5):void 0;('top'===l||'bottom'===l)&&(h+f+d+p>m&&(e=m-f-2*d),0>h-f-d+p&&(e=f)),s.style[a('transform')]='translate3d('+e+'px, '+i+'px, 0)'}function y(e){return e instanceof Element||/Element/.test(Object.prototype.toString.call(e))?[e]:[].slice.call(document.querySelectorAll(e))}function v(e,t,o){if(!t)return o();var i=e.popper.querySelector(Ce.TOOLTIP),n=!1,r=function t(r){r.target!==i||(n=!0,i.removeEventListener('webkitTransitionEnd',t),i.removeEventListener('transitionend',t),o())};i.addEventListener('webkitTransitionEnd',r),i.addEventListener('transitionend',r),clearTimeout(e._transitionendTimeout),e._transitionendTimeout=setTimeout(function(){n||o()},t)}function E(e){return e&&'[object Function]'==={}.toString.call(e)}function O(e,t){if(1!==e.nodeType)return[];var o=window.getComputedStyle(e,null);return t?o[t]:o}function w(e){return'HTML'===e.nodeName?e:e.parentNode||e.host}function L(e){if(!e||-1!==['HTML','BODY','#document'].indexOf(e.nodeName))return window.document.body;var t=O(e),o=t.overflow,i=t.overflowX,n=t.overflowY;return /(auto|scroll)/.test(o+n+i)?e:L(w(e))}function T(e){var t=e.nodeName;return'BODY'!==t&&('HTML'===t||e.firstElementChild.offsetParent===e)}function S(e){return null===e.parentNode?e:S(e.parentNode)}function P(e){var t=e&&e.offsetParent,o=t&&t.nodeName;return o&&'BODY'!==o&&'HTML'!==o?t:window.document.documentElement}function x(e,t){if(!e||!e.nodeType||!t||!t.nodeType)return window.document.documentElement;var o=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,i=o?e:t,n=o?t:e,r=document.createRange();r.setStart(i,0),r.setEnd(n,0);var s=r.commonAncestorContainer;if(e!=Line truncated
|
||||
(function(e,t){'object'==typeof exports&&'undefined'!=typeof module?module.exports=t():'function'==typeof define&&define.amd?define(t):e.tippy=t()})(this,function(){'use strict';function t(e){Pe.forEach(function(t){var i=t.popper,o=t.tippyInstance,n=t.settings,r=n.appendTo,s=n.hideOnClick,a=n.trigger;if(r.contains(i)){var p=!0===s||-1!==a.indexOf('focus'),d=!e||i!==e.popper;p&&d&&o.hide(i)}})}function o(t,i){var o=Element.prototype.closest||function(t){for(var i=this;i;){if(e.call(i,t))return i;i=i.parentElement}};return o.call(t,i)}function n(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function r(){var i=function(){Ae.touch=!0,Ae.iOS()&&document.body.classList.add('tippy-touch'),Ae.dynamicInputDetection&&window.performance&&document.addEventListener('mousemove',r)},r=function(){var e;return function(){var t=performance.now();20>t-e&&(Ae.touch=!1,document.removeEventListener('mousemove',r),!Ae.iOS()&&document.body.classList.remove('tippy-touch')),e=t}}();document.addEventListener('click',function(e){if(!(e.target instanceof Element))return t();var i=o(e.target,Ce.TOOLTIPPED_EL),r=o(e.target,Ce.POPPER);if(r){var s=n(Pe,function(e){return e.popper===r}),a=s.settings.interactive;if(a)return}if(i){var p=n(Pe,function(e){return e.el===i}),d=p.settings,l=d.hideOnClick,c=d.multiple,f=d.trigger;if(!c&&Ae.touch||!c&&-1!==f.indexOf('click'))return t(p);if(!0!==l||-1!==f.indexOf('click'))return}o(e.target,Ce.CONTROLLER)||!document.querySelector(Ce.POPPER)||t()}),document.addEventListener('touchstart',i),window.addEventListener('blur',function(){var t=document,i=t.activeElement;i&&i.blur&&e.call(i,Ce.TOOLTIPPED_EL)&&i.blur()}),!Ae.SUPPORTS_TOUCH&&(0<navigator.maxTouchPoints||0<navigator.msMaxTouchPoints)&&document.addEventListener('pointerdown',i)}function s(){return!s.done&&(s.done=!0,ke.appendTo=document.body,r(),!0)}function a(e){window.requestAnimationFrame(function(){setTimeout(e,0)})}function p(e){for(var t=[!1,'webkit'],o=e.charAt(0).toUpperCase()+e.slice(1),n=0;n<t.length;n++){var i=t[n],r=i?''+i+o:e;if('undefined'!=typeof window.document.body.style[r])return r}return null}function d(e,t){return Array.prototype.findIndex?e.findIndex(t):e.indexOf(n(e,t))}function l(e){var t=e.getAttribute('title');e.setAttribute('data-original-title',t||'html'),e.removeAttribute('title')}function c(e){var t=e.getBoundingClientRect();return 0<=t.top&&0<=t.left&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}function f(e,t){t?window.getComputedStyle(t)[p('transform')]:window.getComputedStyle(e).opacity}function m(e,t){e.forEach(function(e){e&&t(e.classList)})}function h(t,i){t.forEach(function(t){if(t){var o=e.call(t,Ce.CONTENT),n=o?xe(i/1.3):i;t.style[p('transitionDuration')]=n+'ms'}})}function u(e){return'visible'===e.style.visibility}function g(){}function b(e){return e.replace(/-.+/,'')}function y(t){var e,i,o=this,r=n(Pe,function(e){return e.el===o}),s=r.popper,a=r.settings.offset,d=b(s.getAttribute('x-placement')),l=xe(s.offsetWidth/2),c=xe(s.offsetHeight/2),f=5,m=document.documentElement.offsetWidth||document.body.offsetWidth,h=t.pageX,u=t.pageY;'top'===d?(e=h-l+a,i=u-2.25*c):'left'===d?(e=h-2*l-10,i=u-c+a):'right'===d?(e=h+c,i=u-c+a):'bottom'===d?(e=h-l+a,i=u+c/1.5):void 0;('top'===d||'bottom'===d)&&(h+f+l+a>m&&(e=m-f-2*l),0>h-f-l+a&&(e=f)),s.style[p('transform')]='translate3d('+e+'px, '+i+'px, 0)'}function v(e){return e instanceof Element||/Element/.test(Object.prototype.toString.call(e))?[e]:Array.isArray(e)?e:[].slice.call(document.querySelectorAll(e))}function E(e,t,i){if(!t)return i();var o=e.popper.querySelector(Ce.TOOLTIP),n=!1,r=function t(r){r.target!==o||(n=!0,o.removeEventListener('webkitTransitionEnd',t),o.removeEventListener('transitionend',t),i())};o.addEventListener('webkitTransitionEnd',r),o.addEventListener('transitionend',r),clearTimeout(e._transitionendTimeout),e._transitionendTimeout=setTimeout(function(){n||i()},t)}function O(e){return e&&'[object Function]'==={}.toString.call(e)}function w(e,t){if(1!==e.nodeType)return[];var i=window.getComputedStyle(e,null);return t?i[t]:i}function T(e){return'HTML'===e.nodeName?e:e.parentNode||e.host}function L(e){if(!e||-1!==['HTML','BODY','#document'].indexOf(e.nodeName))return window.document.body;var t=w(e),i=t.overflow,o=t.overflowX,n=t.overflowY;return /(auto|scroll)/.test(i+n+o)?e:L(T(e))}function S(e){var t=e&&e.offsetParent,i=t&&t.nodeName;return i&&'BODY'!==i&&'HTML'!==i?-1!==['TD','TABLE'].indexOf(t.nodeName)&&'static'===w(t,'position')?S(t):t:window.document.documentElement}function x(e){var t=e.nodeName;return'BODY'!==t&&('HTML'===t||S(e.firstElementChild)===e)}function A(e){return null===e.parentNode?e:A(e.parentNode)}function P(e,t){if(!e||!e.nodeType||!t||!t.nodeType)return window.document.documentElement;var i=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,o=i?e:t,n=i?t:e,r=document.createRange();r.setStart(o,0),r.setEnd(n,0);var
Line truncated
|
||||
@@ -308,7 +308,7 @@ define([
|
||||
|
||||
toolbar.userlistContent = $content;
|
||||
|
||||
var $container = $('<span>', {id: 'userButtons'});
|
||||
var $container = $('<span>', {id: 'userButtons', title: Messages.userListButton});
|
||||
|
||||
var $button = $('<button>').appendTo($container);
|
||||
$('<span>',{'class': 'buttonTitle'}).appendTo($button);
|
||||
@@ -446,6 +446,7 @@ define([
|
||||
//$shareBlock.find('button').attr('id', 'shareButton');
|
||||
$shareBlock.find('.dropdown-bar-content').addClass(SHARE_CLS).addClass(EDITSHARE_CLS).addClass(VIEWSHARE_CLS);
|
||||
$shareBlock.addClass('shareButton');
|
||||
$shareBlock.find('button').attr('title', Messages.shareButton);
|
||||
|
||||
if (hashes.editHash) {
|
||||
$shareBlock.find('a.editShare').click(function () {
|
||||
@@ -628,7 +629,7 @@ define([
|
||||
title: Messages.header_logoTitle,
|
||||
'class': "cryptpad-logo"
|
||||
}).append($('<img>', {
|
||||
src: '/customize/images/logo_white.svg'
|
||||
src: '/customize/images/logo_white.png'
|
||||
}));
|
||||
var onClick = function (e) {
|
||||
e.preventDefault();
|
||||
@@ -774,6 +775,7 @@ define([
|
||||
userMenuCfg.displayChangeName = 1;
|
||||
}
|
||||
Cryptpad.createUserAdminMenu(userMenuCfg);
|
||||
$userAdmin.find('button').attr('title', Messages.userAccountButton);
|
||||
|
||||
var $userButton = toolbar.$userNameButton = $userAdmin.find('a.' + USERBUTTON_CLS);
|
||||
$userButton.click(function (e) {
|
||||
|
||||
Reference in new issue
Block a user