lib/irc: add formatURL

This commit is contained in:
Simon Ser 2023-04-19 11:43:45 +02:00
parent 57809be989
commit 57f64e9cc2
4 changed files with 18 additions and 16 deletions

View file

@ -2,7 +2,7 @@ import { html, Component } from "../lib/index.js";
import linkify from "../lib/linkify.js";
import * as irc from "../lib/irc.js";
import { strip as stripANSI } from "../lib/ansi.js";
import { BufferType, ServerStatus, BufferEventsDisplayMode, getNickURL, getChannelURL, getMessageURL, isMessageBeforeReceipt, SettingsContext } from "../state.js";
import { BufferType, ServerStatus, BufferEventsDisplayMode, getMessageURL, isMessageBeforeReceipt, SettingsContext } from "../state.js";
import * as store from "../store.js";
import Membership from "./membership.js";
@ -23,7 +23,7 @@ function Nick(props) {
let colorIndex = djb2(props.nick) % 16 + 1;
return html`
<a href=${getNickURL(props.nick)} class="nick nick-${colorIndex}" onClick=${handleClick}>${props.nick}</a>
<a href=${irc.formatURL({ entity: props.nick })} class="nick nick-${colorIndex}" onClick=${handleClick}>${props.nick}</a>
`;
}
@ -103,7 +103,7 @@ class LogLine extends Component {
}
function createChannel(channel) {
return html`
<a href=${getChannelURL(channel)} onClick=${onChannelClick}>
<a href=${irc.formatURL({ entity: channel })} onClick=${onChannelClick}>
${channel}
</a>
`;

View file

@ -1,5 +1,4 @@
import { html, Component } from "../lib/index.js";
import { getNickURL } from "../state.js";
import { strip as stripANSI } from "../lib/ansi.js";
import Membership from "./membership.js";
import * as irc from "../lib/irc.js";
@ -73,7 +72,7 @@ class MemberItem extends Component {
return html`
<li>
<a
href=${getNickURL(this.props.nick)}
href=${irc.formatURL({ entity: this.props.nick, enttype: "user" })}
class=${classes.join(" ")}
title=${title}
onClick=${this.handleClick}