Advertisement
Guest User

LOR soft-ignore

a guest
Nov 4th, 2012
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2.  // @name lorignore
  3.  // @namespace http://linux.org.ru
  4.  // @description
  5.  // @author Sadler
  6.  // @require http://code.jquery.com/jquery-1.8.1.min.js
  7.  
  8. if (window.location.hostname.indexOf('linux.org.ru') != -1) {
  9.  
  10.  
  11. window.addEventListener('load', function (e) {
  12. //window.opera.addEventListener('AfterScript', function (e) {
  13.  
  14. //init_jquery();
  15.  
  16. $ = window.$;
  17.  
  18. var uppoint = '△';//'△';
  19. var downpoint = '▽';//'▽';
  20.  
  21. window.showComment = function(id)
  22. {
  23.     thi = $('#'+id);
  24.  
  25.     msg_body = thi.find('div[itemprop|="commentText"]');
  26.     msg_body.find('p').show('slow');
  27.     msg_body.find('.sign_more').show('slow');
  28.     msg_body.find('.sign').show('slow');
  29.     msg_body.find('.reply').show('slow');
  30.  
  31.     thi.find('.userpic').show('slow');
  32.  
  33.     thi.find('.hideshow').text(uppoint);
  34.  
  35. }
  36.  
  37. window.hideComment = function(id)
  38. {
  39.     thi = $('#'+id);
  40.     msg_body = thi.find('div[itemprop|="commentText"]');
  41.     msg_body.find('p').slideUp();
  42.     msg_body.find('.sign_more').slideUp();
  43.     msg_body.find('.sign').show();
  44.     msg_body.find('.reply').slideUp();
  45.    
  46.     thi.find('.userpic').slideUp();
  47.  
  48.     thi.find('.hideshow').text(downpoint);
  49. }
  50.  
  51. window.showHideComment = function(id)
  52. {
  53.  
  54.     thi = $('#'+id);
  55.  
  56.     if (thi.find('.hideshow').text() == downpoint)
  57.     {
  58.         window.showComment(id);
  59.     }
  60.     else
  61.     {
  62.         window.hideComment(id);
  63.     }
  64. }
  65.  
  66.  
  67.  
  68. $('article[itemprop|="comment"]').each(function(index) {   
  69.  
  70.     // msg_author       Имя автора сообщения
  71.     // msg_userpic      Аватарка
  72.     // msg_stars        Число звёзд автора сообщения
  73.     // msg_time     Время сообщения
  74.     // msg_replyto_name Имя пользователя, которому отвечает автор (или null)
  75.     // msg_replyto_time Время предыдущего сообщения в ветке
  76.  
  77.     msg_time = null;
  78.  
  79.     mid = $(this).attr('id');
  80.  
  81.     msg_userpic = $(this).find('.userpic');
  82.    
  83.     title = $(this).find('.title');
  84.     msg_body = $(this).find('div[itemprop|="commentText"]');
  85.    
  86.     msg_datetime = title.find('time').attr('datetime');
  87.     msg_replyto_time = new Date(msg_datetime);
  88.     if (!isFinite(msg_replyto_time)) msg_replyto_time = null;
  89.  
  90.     msg_datetime = msg_body.find('time').attr('datetime');
  91.     msg_time = new Date(msg_datetime);
  92.     if (!isFinite(msg_time)) msg_time = null;
  93.  
  94.     // Сворачивание сообщений
  95.     title.append('<div class="hideshow" style="float: right; cursor: pointer;" onClick="window.showHideComment(\''+mid+'\');">'+uppoint+'</div>');
  96.  
  97.     // Парсинг данных
  98.     msg_author = msg_body.find('a[rel|="author"]').text();
  99.     msg_stars = msg_body.find('img[alt|="*"]').size();
  100.     msg_replyto_name = title.html().match('от (.*) <time ');
  101.     if (msg_replyto_name !== null) msg_replyto_name = msg_replyto_name[1];
  102.  
  103.  
  104.     // Правила
  105.     if (msg_author == 'Kindly_Cat' && msg_replyto_name == 'Sadler') window.hideComment(mid);
  106.    
  107. });
  108.  
  109. }, false);
  110.  
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement