Merge branch '57-add-backlinks-to-op' into 'config'

Resolve "Add backlinks to OP"

Closes #57

See merge request leftypol/leftypol!20
This commit is contained in:
Zankaria Auxa 2024-12-29 00:14:12 +00:00
commit 8b82318bd8

View file

@ -26,12 +26,17 @@ $(document).ready(function() {
} }
let post = $('#reply_' + id); let post = $('#reply_' + id);
if(post.length == 0) if (post.length == 0) {
return; post = $('#op_' + id);
if (post.length == 0) {
return;
}
}
let mentioned = post.find('.head div.mentioned'); let mentioned = post.find('.head div.mentioned');
if (mentioned.length === 0) { if (mentioned.length === 0) {
mentioned = $('<div class="mentioned unimportant"></div>').prependTo(post.find('.head')); // The op has two "head"s divs, use the second.
mentioned = $('<div class="mentioned unimportant"></div>').prependTo(post.find('.head').last());
} }
if (mentioned.find('a.mentioned-' + replyId).length !== 0) { if (mentioned.find('a.mentioned-' + replyId).length !== 0) {
@ -48,13 +53,13 @@ $(document).ready(function() {
}); });
}; };
$('div.post.reply').each(showBackLinks); $('div.post').each(showBackLinks);
$(document).on('new_post', function(e, post) { $(document).on('new_post', function(e, post) {
if ($(post).hasClass('reply')) { if ($(post).hasClass('reply') || $(post).hasClass('op')) {
showBackLinks.call(post); showBackLinks.call(post);
} else { } else {
$(post).find('div.post.reply').each(showBackLinks); $(post).find('div.post').each(showBackLinks);
} }
}); });
}); });