diff --git a/boards/static/js/refpopup.js b/boards/static/js/refpopup.js --- a/boards/static/js/refpopup.js +++ b/boards/static/js/refpopup.js @@ -55,6 +55,8 @@ function showPostPreview(e) { cln.innerHTML = 'Загрузка...'; + var found = false; + //если пост найден в дереве. if($('div[id='+pNum+']').length > 0) { var postdata = $('div[id='+pNum+']').html(); @@ -64,6 +66,8 @@ function showPostPreview(e) { //make preview mkPreview(cln, postdata); + + found = true; } //ajax api // else { @@ -86,8 +90,10 @@ function showPostPreview(e) { $del(doc.getElementById(cln.id)); - //add preview - $('body').append(cln); + if (found) { + //add preview + $('body').append(cln); + } } function delPostPreview(e) { @@ -98,101 +104,8 @@ function delPostPreview(e) { else while(el.nextSibling) $del(el.nextSibling); } - - - - - function addPreview() { $('.post').find('a').each(function() { showPostPreview($(this)); }); } - -function showPreview(node) { - node.each(function() { - //reflink? - if($(this).text().indexOf('>>') == 0) { - //add mouseover event - $(this).on('mouseover', function(e) { - var ref = $(this); - - var doc = document; - //ref id - var pNum = ref.text().match(/\d+/); - - //position - var x = e.clientX + (doc.documentElement.scrollLeft || doc.body.scrollLeft) + 2; - var y = e.clientY + (doc.documentElement.scrollTop || doc.body.scrollTop); - - //create preview block - var cln = $('