diff options
-rw-r--r-- | src/main/assets/embed.js | 26 | ||||
-rw-r--r-- | src/main/resources/templates/views/partial/message.html | 2 |
2 files changed, 6 insertions, 22 deletions
diff --git a/src/main/assets/embed.js b/src/main/assets/embed.js index 48473764..4c7828a3 100644 --- a/src/main/assets/embed.js +++ b/src/main/assets/embed.js @@ -334,31 +334,15 @@ export function embedLinksToX(x, beforeNodeSelector, allLinksSelector) { } } -function embedLinksToArticles() { - let beforeNodeSelector = 'nav.l'; - let allLinksSelector = 'p:not(.ir) a, pre a'; - Array.from(document.querySelectorAll('#content article')).forEach(article => { - embedLinksToX(article, beforeNodeSelector, allLinksSelector); - }); -} - -function embedLinksToPost() { - let beforeNodeSelector = '.msg-txt + *'; - let allLinksSelector = '.msg-txt a'; - Array.from(document.querySelectorAll('#content .msg-cont')).forEach(msg => { - embedLinksToX(msg, beforeNodeSelector, allLinksSelector); - }); -} - /** * Embed all the links in all messages/replies on the page. */ export function embedAll() { - if (document.querySelector('#content article[data-mid]')) { - embedLinksToArticles(); - } else { - embedLinksToPost(); - } + let beforeNodeSelector = '.msg-txt + *'; + let allLinksSelector = '.msg-txt a'; + Array.from(document.querySelectorAll('#content .msg-cont')).forEach(msg => { + embedLinksToX(msg, beforeNodeSelector, allLinksSelector); + }); } export const format = juickFormat; diff --git a/src/main/resources/templates/views/partial/message.html b/src/main/resources/templates/views/partial/message.html index 63ac9eb4..47dfb6c5 100644 --- a/src/main/resources/templates/views/partial/message.html +++ b/src/main/resources/templates/views/partial/message.html @@ -1,4 +1,4 @@ -<article data-mid="{{ msg.mid }}"> +<article class="msg-cont" data-mid="{{ msg.mid }}"> <header class="h"> <span> <a href="/{{ msg.user.name }}/"><span>{{ msg.user.name }}</span></a> |