From 6ff3ceb4268a9285bfc6cc987b01132bfd85de83 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 2 Feb 2020 11:07:04 +0300 Subject: Fix embeds --- src/main/assets/embed.js | 26 +++++----------------- .../resources/templates/views/partial/message.html | 2 +- 2 files changed, 6 insertions(+), 22 deletions(-) (limited to 'src') 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 @@ -
+
{{ msg.user.name }} -- cgit v1.2.3