Skip to content

Commit

Permalink
mention fix
Browse files Browse the repository at this point in the history
  • Loading branch information
trinkey committed Oct 19, 2024
1 parent 529e55a commit e9bbe2d
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions smiggins/templates/js/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ function getPostHTML(postJSON, isComment = false, includeUserLink = true, includ
${includePostLink ? `<a aria-hidden="true" href="/${isComment ? "c" : "p"}/${postJSON.post_id}" tabindex="-1" class="text no-underline">` : ""}
${linkifyHtml(escapeHTML(postJSON.content), {
formatHref: {
mention: (href) => fakeMentions ? "javascript:void(0);" : "/u" + href,
mention: (href) => fakeMentions ? "javascript:void(0);" : "/u/" + href.slice(1),
hashtag: (href) => "/hashtag/" + href.slice(1)
}
}).replaceAll("\n", "<br>\n")
Expand Down Expand Up @@ -252,7 +252,7 @@ function getPostHTML(postJSON, isComment = false, includeUserLink = true, includ
<a aria-hidden="true" href="/${postJSON.quote.comment ? "c" : "p"}/${postJSON.quote.post_id}" class="text no-underline">
${linkifyHtml(escapeHTML(postJSON.quote.content), {
formatHref: {
mention: (href) => fakeMentions ? "javascript:void(0);" : "/u" + href,
mention: (href) => fakeMentions ? "javascript:void(0);" : "/u/" + href.slice(1),
hashtag: (href) => "/hashtag/" + href.slice(1)
}
}).replaceAll("\n", "<br>")
Expand Down
2 changes: 1 addition & 1 deletion smiggins/templates/js/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function refreshMessages(start = false, forward = true) {
y.setAttribute("class", `message ${message.from_self ? "send" : "receive"}`);
y.innerHTML = `<div>${linkifyHtml(escapeHTML(message.content), {
formatHref: {
mention: (href) => "/u" + href,
mention: (href) => "/u/" + href.slice(1),
hashtag: (href) => "/hashtag/" + href.slice(1)
},
})}</div><span class="timestamp">${timeSince(message.timestamp)}</span>`;
Expand Down
2 changes: 1 addition & 1 deletion smiggins/templates/js/pending.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function refreshPendingList(fromStart = false) {
<div class="main-content">
${user.bio ? linkifyHtml(escapeHTML(user.bio), {
formatHref: {
mention: (href) => "/u" + href,
mention: (href) => "/u/" + href.slice(1),
hashtag: (href) => "/hashtag/" + href.slice(1)
}
}) : `<i>${lang.user_page.lists_no_bio}</i>`}
Expand Down
2 changes: 1 addition & 1 deletion smiggins/templates/js/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function extra(json) {
ENABLE_USER_BIOS && dom("user-bio").removeAttribute("hidden");
ENABLE_USER_BIOS && (dom("user-bio").innerHTML = linkifyHtml(escapeHTML(json.bio), {
formatHref: {
mention: (href) => "/u" + href,
mention: (href) => "/u/" + href.slice(1),
hashtag: (href) => "/hashtag/" + href.slice(1)
}
}));
Expand Down
2 changes: 1 addition & 1 deletion smiggins/templates/user_lists.html
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ <h2>{{ lang.user_page.lists_followers }}</h2>
[...document.querySelectorAll("[data-linkify]")].forEach((val, index) => {
val.innerHTML = linkifyHtml(val.innerHTML, {
formatHref: {
mention: (href) => "/u" + href,
mention: (href) => "/u/" + href.slice(1),
hashtag: (href) => "/hashtag/" + href.slice(1)
}
});
Expand Down
4 changes: 2 additions & 2 deletions smiggins/ts/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ function getPostHTML(
${
linkifyHtml(escapeHTML(postJSON.content), {
formatHref: {
mention: (href: string): string => fakeMentions ? "javascript:void(0);" : "/u" + href,
mention: (href: string): string => fakeMentions ? "javascript:void(0);" : "/u/" + href.slice(1),
hashtag: (href: string): string => "/hashtag/" + href.slice(1)
}
}).replaceAll("\n", "<br>\n")
Expand Down Expand Up @@ -294,7 +294,7 @@ function getPostHTML(
${
linkifyHtml(escapeHTML(postJSON.quote.content), {
formatHref: {
mention: (href: string): string => fakeMentions ? "javascript:void(0);" : "/u" + href,
mention: (href: string): string => fakeMentions ? "javascript:void(0);" : "/u/" + href.slice(1),
hashtag: (href: string): string => "/hashtag/" + href.slice(1)
}
}).replaceAll("\n", "<br>")
Expand Down
2 changes: 1 addition & 1 deletion smiggins/ts/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function refreshMessages(start=false, forward=true): void {
y.setAttribute("class", `message ${message.from_self ? "send" : "receive"}`);
y.innerHTML = `<div>${linkifyHtml(escapeHTML(message.content), {
formatHref: {
mention: (href: string): string => "/u" + href,
mention: (href: string): string => "/u/" + href.slice(1),
hashtag: (href: string): string => "/hashtag/" + href.slice(1)
},
})}</div><span class="timestamp">${timeSince(message.timestamp)}</span>`;
Expand Down
2 changes: 1 addition & 1 deletion smiggins/ts/pending.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function refreshPendingList(fromStart=false): void {
${
user.bio ? linkifyHtml(escapeHTML(user.bio), {
formatHref: {
mention: (href: string): string => "/u" + href,
mention: (href: string): string => "/u/" + href.slice(1),
hashtag: (href: string): string => "/hashtag/" + href.slice(1)
}
}) : `<i>${lang.user_page.lists_no_bio}</i>`
Expand Down
2 changes: 1 addition & 1 deletion smiggins/ts/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function extra(json: {
ENABLE_USER_BIOS && dom("user-bio").removeAttribute("hidden");
ENABLE_USER_BIOS && (dom("user-bio").innerHTML = linkifyHtml(escapeHTML(json.bio), {
formatHref: {
mention: (href: string): string => "/u" + href,
mention: (href: string): string => "/u/" + href.slice(1),
hashtag: (href: string): string => "/hashtag/" + href.slice(1)
}
}));
Expand Down

0 comments on commit e9bbe2d

Please sign in to comment.