Highlight references to the current post

This commit is contained in:
topkek 2014-11-05 22:41:35 +00:00
parent 1a259a3cd4
commit 2a2108a698

View File

@ -74,7 +74,7 @@ onready(function(){
.css('z-index', '100') .css('z-index', '100')
.css('left', '0') .css('left', '0')
.addClass('reply').addClass('post') .addClass('reply').addClass('post')
.insertAfter(link.parent()) .appendTo(link.parents('div.post'))
// shrink expanded images // shrink expanded images
newPost.find('div.file a[data-expanded="true"]').each(function() { newPost.find('div.file a[data-expanded="true"]').each(function() {
@ -82,6 +82,19 @@ onready(function(){
$(this).find('img.post-image').attr('src', thumb); $(this).find('img.post-image').attr('src', thumb);
}); });
// Highlight references to the current post
if (link.hasClass('mentioned-'+id)) {
var postLinks = newPost.find('div.body a:not([rel="nofollow"])');
if (postLinks.length > 1) {
var originalPost = link.parents('div.post').attr('id').replace("reply_", "");
postLinks.each(function() {
if ($(this).text() == ">>"+originalPost) {
$(this).addClass('dashed-underline');
}
});
}
}
var previewWidth = newPost.outerWidth(true); var previewWidth = newPost.outerWidth(true);
var widthDiff = previewWidth - newPost.width(); var widthDiff = previewWidth - newPost.width();
var linkLeft = link.offset().left; var linkLeft = link.offset().left;