From 1c98c1ce765426e14b802202cf2ff90e600384c1 Mon Sep 17 00:00:00 2001 From: Zankaria Date: Sun, 29 Dec 2024 00:53:05 +0100 Subject: [PATCH] show-backlinks.js: add support for op post --- js/show-backlinks.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/js/show-backlinks.js b/js/show-backlinks.js index a71737d8..05c0f3f8 100644 --- a/js/show-backlinks.js +++ b/js/show-backlinks.js @@ -25,7 +25,7 @@ onReady(function() { } let post = $('#reply_' + id); - if (post.length == 0){ + if (post.length == 0) { post = $('#op_' + id); if (post.length == 0) { return; @@ -34,7 +34,8 @@ onReady(function() { let mentioned = post.find('.head div.mentioned'); if (mentioned.length === 0) { - mentioned = $('
').prependTo(post.find('.head')); + // The op has two "head"s divs, use the second. + mentioned = $('
').prependTo(post.find('.head').last()); } if (mentioned.find('a.mentioned-' + reply_id).length != 0) { @@ -51,13 +52,13 @@ onReady(function() { }); }; - $('div.post.reply').each(showBackLinks); + $('div.post').each(showBackLinks); $(document).on('new_post', function(e, post) { - if ($(post).hasClass('reply')) { + if ($(post).hasClass('reply') || $(post).hasClass('op')) { showBackLinks.call(post); } else { - $(post).find('div.post.reply').each(showBackLinks); + $(post).find('div.post').each(showBackLinks); } }); });