forked from leftypol/leftypol
show-backlinks.js: add support for op post
This commit is contained in:
parent
9430b1b78e
commit
87a30b8aab
1 changed files with 11 additions and 6 deletions
|
@ -26,12 +26,17 @@ $(document).ready(function() {
|
|||
}
|
||||
|
||||
let post = $('#reply_' + id);
|
||||
if(post.length == 0)
|
||||
return;
|
||||
if (post.length == 0) {
|
||||
post = $('#op_' + id);
|
||||
if (post.length == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let mentioned = post.find('.head div.mentioned');
|
||||
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) {
|
||||
|
@ -48,13 +53,13 @@ $(document).ready(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);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue