aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2020-02-02 11:07:04 +0300
committerGravatar Vitaly Takmazov2020-02-02 11:07:04 +0300
commit6ff3ceb4268a9285bfc6cc987b01132bfd85de83 (patch)
tree35ef2e80585445e464c56aff99f6a8520359eb43
parent3db482e11fc3cd7b299909d847e39f7f9ed88064 (diff)
Fix embeds
-rw-r--r--src/main/assets/embed.js26
-rw-r--r--src/main/resources/templates/views/partial/message.html2
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>