Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name lorignore
- // @namespace http://linux.org.ru
- // @description
- // @author Sadler
- // @require http://code.jquery.com/jquery-1.8.1.min.js
- if (window.location.hostname.indexOf('linux.org.ru') != -1) {
- window.addEventListener('load', function (e) {
- //window.opera.addEventListener('AfterScript', function (e) {
- //init_jquery();
- $ = window.$;
- var uppoint = '△';//'△';
- var downpoint = '▽';//'▽';
- window.showComment = function(id)
- {
- thi = $('#'+id);
- msg_body = thi.find('div[itemprop|="commentText"]');
- msg_body.find('p').show('slow');
- msg_body.find('.sign_more').show('slow');
- msg_body.find('.sign').show('slow');
- msg_body.find('.reply').show('slow');
- thi.find('.userpic').show('slow');
- thi.find('.hideshow').text(uppoint);
- }
- window.hideComment = function(id)
- {
- thi = $('#'+id);
- msg_body = thi.find('div[itemprop|="commentText"]');
- msg_body.find('p').slideUp();
- msg_body.find('.sign_more').slideUp();
- msg_body.find('.sign').show();
- msg_body.find('.reply').slideUp();
- thi.find('.userpic').slideUp();
- thi.find('.hideshow').text(downpoint);
- }
- window.showHideComment = function(id)
- {
- thi = $('#'+id);
- if (thi.find('.hideshow').text() == downpoint)
- {
- window.showComment(id);
- }
- else
- {
- window.hideComment(id);
- }
- }
- $('article[itemprop|="comment"]').each(function(index) {
- // msg_author Имя автора сообщения
- // msg_userpic Аватарка
- // msg_stars Число звёзд автора сообщения
- // msg_time Время сообщения
- // msg_replyto_name Имя пользователя, которому отвечает автор (или null)
- // msg_replyto_time Время предыдущего сообщения в ветке
- msg_time = null;
- mid = $(this).attr('id');
- msg_userpic = $(this).find('.userpic');
- title = $(this).find('.title');
- msg_body = $(this).find('div[itemprop|="commentText"]');
- msg_datetime = title.find('time').attr('datetime');
- msg_replyto_time = new Date(msg_datetime);
- if (!isFinite(msg_replyto_time)) msg_replyto_time = null;
- msg_datetime = msg_body.find('time').attr('datetime');
- msg_time = new Date(msg_datetime);
- if (!isFinite(msg_time)) msg_time = null;
- // Сворачивание сообщений
- title.append('<div class="hideshow" style="float: right; cursor: pointer;" onClick="window.showHideComment(\''+mid+'\');">'+uppoint+'</div>');
- // Парсинг данных
- msg_author = msg_body.find('a[rel|="author"]').text();
- msg_stars = msg_body.find('img[alt|="*"]').size();
- msg_replyto_name = title.html().match('от (.*) <time ');
- if (msg_replyto_name !== null) msg_replyto_name = msg_replyto_name[1];
- // Правила
- if (msg_author == 'Kindly_Cat' && msg_replyto_name == 'Sadler') window.hideComment(mid);
- });
- }, false);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement