Guest User

Untitled

a guest
Jan 3rd, 2013
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  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('.msg_body');
  26.  
  27. msg_body.find('p').show('slow');
  28. msg_body.find('.sign_more').show('slow');
  29. msg_body.find('.sign').show('slow');
  30. msg_body.find('.reply').show('slow');
  31.  
  32. thi.find('.userpic').show('slow');
  33.  
  34. thi.find('.hideshow').text(uppoint);
  35.  
  36. }
  37.  
  38. window.hideComment = function(id)
  39. {
  40. thi = $('#'+id);
  41.  
  42. msg_body = thi.find('.msg_body');
  43.  
  44. msg_body.find('p').slideUp();
  45. msg_body.find('.sign_more').slideUp();
  46. msg_body.find('.sign').show();
  47. msg_body.find('.reply').slideUp();
  48.  
  49. thi.find('.userpic').slideUp();
  50.  
  51. thi.find('.hideshow').text(downpoint);
  52. }
  53.  
  54. window.showHideComment = function(id)
  55. {
  56.  
  57. thi = $('#'+id);
  58.  
  59. if (thi.find('.hideshow').text() == downpoint)
  60. {
  61. window.showComment(id);
  62. }
  63. else
  64. {
  65. window.hideComment(id);
  66. }
  67. }
  68.  
  69.  
  70.  
  71. $('article[itemprop|="comment"]').each(function(index) {
  72.  
  73. // msg_author Имя автора сообщения
  74. // msg_userpic Аватарка
  75. // msg_stars Число звёзд автора сообщения
  76. // msg_time Время сообщения
  77. // msg_replyto_name Имя пользователя, которому отвечает автор (или null)
  78. // msg_replyto_time Время предыдущего сообщения в ветке
  79.  
  80. msg_time = null;
  81.  
  82. mid = $(this).attr('id');
  83.  
  84. msg_userpic = $(this).find('.userpic');
  85.  
  86. title = $(this).find('.title');
  87. msg_body = $(this).find('.msg_body');
  88.  
  89. msg_datetime = title.find('time').attr('datetime');
  90. msg_replyto_time = new Date(msg_datetime);
  91. if (!isFinite(msg_replyto_time)) msg_replyto_time = null;
  92.  
  93. msg_datetime = msg_body.find('time').attr('datetime');
  94. msg_time = new Date(msg_datetime);
  95. if (!isFinite(msg_time)) msg_time = null;
  96.  
  97. // Сворачивание сообщений
  98. title.append('<div class="hideshow" style="float: right; cursor: pointer;" onClick="window.showHideComment(\''+mid+'\');">'+uppoint+'</div>');
  99.  
  100. // Парсинг данных
  101. msg_author = msg_body.find('a[itemprop|="creator"]').text();
  102. msg_stars = msg_body.find('img[alt|="*"]').size();
  103. msg_replyto_name = title.html().match('от (.*) <time ');
  104. if (msg_replyto_name !== null) msg_replyto_name = msg_replyto_name[1];
  105.  
  106.  
  107. // Правила
  108. if (msg_author == 'Kindly_Cat' && msg_replyto_name == 'Sadler') window.hideComment(mid);
  109. if (msg_author == 'Kindly_Cat') msg_body.find('.reply').slideUp();
  110.  
  111. });
  112.  
  113. }, false);
  114.  
  115. }
Advertisement
Add Comment
Please, Sign In to add comment