aboutsummaryrefslogtreecommitdiff
path: root/shardweb/assets
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2018-11-05 16:03:56 +0100
committerAlex Auvolat <alex@adnab.me>2018-11-05 16:03:56 +0100
commit0e5b82f3348508eb7f4291a08722522a49edd752 (patch)
tree40bf4c9aa8d5b1920369c176665f5a4e7285de55 /shardweb/assets
parent0b27af3dab56b667b50fd80590cdfd9df0feffbd (diff)
downloadshard-0.0.4.tar.gz
shard-0.0.4.zip
Facilitate file sending in chat0.0.4
Diffstat (limited to 'shardweb/assets')
-rw-r--r--shardweb/assets/js/app.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/shardweb/assets/js/app.js b/shardweb/assets/js/app.js
index 1e5ea62..f3372f1 100644
--- a/shardweb/assets/js/app.js
+++ b/shardweb/assets/js/app.js
@@ -20,7 +20,9 @@ import "phoenix_html"
import socket from "./socket"
-import routes from './phoenix-jsroutes'
+function parse_links(msg) {
+ return msg.replace(/shard:file:([0-9A-F]{64})/gi, '<a href="/raw/$1">$&</a>');
+}
var chat_channel = window.Gon.getAsset('chat_channel');
if (chat_channel != undefined)
@@ -30,7 +32,7 @@ if (chat_channel != undefined)
channel.on('shout', function (payload) { // listen to the 'shout' event
var li = document.createElement("li"); // creaet new list item DOM element
var name = payload.name || 'guest'; // get name from payload or set default
- li.innerHTML = '<b>&lt;' + name + '</b> <a href="' + routes.identityView(payload.fullpk) + '"><small>' + payload.pk16 + '</small></a><b>&gt;</b> ' + payload.message; // set li contents
+ li.innerHTML = '<b>&lt;' + name + '</b> <a href="/people/' + payload.fullpk + '"><small>' + payload.pk16 + '</small></a><b>&gt;</b> ' + parse_links(payload.message); // set li contents
// console.log(ul.scrollTop + ' ' + ul.scrollHeight + ' ' + ul.clientHeight);
var must_scroll = (ul.scrollTop >= ul.scrollHeight - ul.clientHeight - 10);