add mentions and tags
This commit is contained in:
parent
c780197d35
commit
f7c948b4ac
2 changed files with 18 additions and 0 deletions
14
lib.js
14
lib.js
|
@ -22,6 +22,20 @@ function splitUp(content) {
|
|||
out[i] = ['link',res];
|
||||
continue;
|
||||
}
|
||||
let urlThing = "";
|
||||
if (res[0] == '@' || res[0] == '#') {
|
||||
let type = res[0] == '@' ? '/users/' : '/walls/get/hub/';
|
||||
let type2 = res[0] == '@' ? '' : '/0';
|
||||
urlThing = new URL(type + res.slice(1) + type2, 'https://tbg.dervland.net/').pathname
|
||||
}
|
||||
if (res[0] == '@') {
|
||||
out[i] = ['curl',res, urlThing];
|
||||
continue;
|
||||
}
|
||||
if (res[0] == '#') {
|
||||
out[i] = ['curl',res, urlThing];
|
||||
continue;
|
||||
}
|
||||
out[i] = [res];
|
||||
}
|
||||
return out;
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
</a>
|
||||
<% } else if (contentN[0] == 'link') { %>
|
||||
<a class='link' href='<%= contentN[1] %>'><%= contentN[1] %></a>
|
||||
<% } else if (contentN[0] == 'curl') { %>
|
||||
<a class='link' href='<%= contentN[2] %>'><%= contentN[1] %></a>
|
||||
<% } else if (contentN[0].replaceAll(' ','').length > 0) { %>
|
||||
<span class='commentbox'><%= contentN[0] %></span>
|
||||
<% } } %>
|
||||
|
@ -30,6 +32,8 @@
|
|||
<% if (!isNaN(date * 1)) { %>
|
||||
<div class='sub'><b>Posted on</b> <%= new Date(date).toISOString() %> </div>
|
||||
<% } %>
|
||||
<% if (type != 'hub') { %>
|
||||
<%- include ('vblock.ejs', {link: `/${type}/${id}`, icon: '/icon.svg', name: 'Original'}) %>
|
||||
<% } %>
|
||||
<%- include ('vblock.ejs', {link: `/walls/get/${type}/${id}/0`, icon: '/walls.svg', name: 'Replies'}) %>
|
||||
</div>
|
Loading…
Reference in a new issue