Guest User

2ch-style

a guest
Jan 24th, 2013
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $('div.title > a').each(function(idx,elem){
  2.     $(elem).mouseover(function(){
  3.         if($('.2ch_popup').length > 0 && $('.2ch_popup').attr('rel') == $(this).attr('href'))
  4.             return false;        
  5.         $.ajax({type: "GET", url: $(this).attr('href')})
  6.         .done(function(msg){
  7.             msg = $(msg);
  8.             msg = msg.find('a').filter(function(){return ($(this).text() === "Ссылка" && $(this).attr('href') == $(elem).attr('href')); }).parents('article').find('.msg_body.message-w-userpic');
  9.             popup = $('<div class="2ch_popup">' + msg.html() + '</div>');
  10.             $('body').remove('.2ch_popup');
  11.             $('body').append(popup);
  12.             $('.2ch_popup').css('z-index', '9999')
  13.                             .css('position', 'absolute')
  14.                             .css('top', $(elem).offset().top+'px')
  15.                             .css('left', ($(elem).offset().left+$(elem).width()+20)+'px')
  16.                             .css('background-color','#101010')
  17.                             .css('width', '600px')
  18.                             .css('border-radius', '5px')
  19.                             .css('padding', '5px')
  20.                             .attr('rel', $(elem).attr('href'));
  21.         })
  22.     })
  23.     .mouseout(function(){setTimeout(function(){$('.2ch_popup').remove();}, 2000); })
  24. });
Advertisement
Add Comment
Please, Sign In to add comment