Convert server/channel/nick links to irc:// scheme

This commit is contained in:
Simon Ser 2020-06-26 11:07:01 +02:00
parent 6d3621e1be
commit 74b720c131
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
2 changed files with 16 additions and 2 deletions

View File

@ -19,9 +19,22 @@ function BufferItem(props) {
unreadClass = "unread-" + props.buffer.unread; unreadClass = "unread-" + props.buffer.unread;
} }
var url = "#";
switch (props.buffer.type) {
case BufferType.SERVER:
url = "irc:///";
break;
case BufferType.CHANNEL:
url = "irc:///" + encodeURIComponent(props.buffer.name);
break;
case BufferType.NICK:
url = "irc:///" + encodeURIComponent(props.buffer.name) + ",isnick";
break;
}
return html` return html`
<li class="${activeClass} ${unreadClass}"> <li class="${activeClass} ${unreadClass}">
<a href="#" onClick=${handleClick}>${name}</a> <a href=${url} onClick=${handleClick}>${name}</a>
</li> </li>
`; `;
} }

View File

@ -17,8 +17,9 @@ function Nick(props) {
} }
var colorIndex = djb2(props.nick) % 16 + 1; var colorIndex = djb2(props.nick) % 16 + 1;
var url = "irc:///" + encodeURIComponent(props.nick) + ",isnick";
return html` return html`
<a href="#" class="nick nick-${colorIndex}" onClick=${handleClick}>${props.nick}</a> <a href=${url} class="nick nick-${colorIndex}" onClick=${handleClick}>${props.nick}</a>
`; `;
} }