Фильтрует комментарии по имени комментатора. Под новостью добавляет список участников. При клике по нику, срабатывает фильтр. Скрип работает при условии, что комментариев не более 5 страниц.
当前为
// ==UserScript==
// @name Скрипт для удобства чтения комментариев на сайте oper.ru.
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Фильтрует комментарии по имени комментатора. Под новостью добавляет список участников. При клике по нику, срабатывает фильтр. Скрип работает при условии, что комментариев не более 5 страниц.
// @author rty65tt
// @match *://oper.ru/*read.php*
// @include *://*oper.ru/*/view.php*
// @grant none
// ==/UserScript==
// Может где-то не сработать. Самый посещаемый сайт рунета, верстка ад! Это по нашему.
// Для сохранения глаз, рекомендую темно-серую тему https://userstyles.org/styles/138045/oper-ru-bw-dark-grey-990px
(function() {
'use strict';
//window.stop();
// Your code here...
var p = $("a[name='100']").next().next().next().find("a");
var ip = $('a[name="comments"]');
$(ip).before('<div class="usfscrpt" style="text-align:center; color:#555;background-color:#171717;padding:5px;border:1px solid #212121;"></div><br>');
$('.usfscrpt').text('script : [LOAD]');
if(p.length > 5) {
$('.usfscrpt').text('script: [Много страниц]');
return;
}
var page = '';
$.each(p, function( i, a ) {
page = page + '<a name="page-' + i + '"></a>';
});
$('table.comment:last').after(page);
var deferreds = [];
$.each(p, function( i, a ) {
var l = $(a).attr('href');
deferreds.push(
$.get( l, function( data ) {
var d = $(data).find("table.comment, table.comment + *").prev();
var lp = "page-" + i;
$('a[name=' + lp +']').after(d);
$("a[href='" + l + "']").attr('href', "#" + lp).attr('class', 'usrscriptpage');
})
);
});
$.when.apply($, deferreds).done(function(){
$('.comment').find("a").attr('href', function( i,vl ) {
return vl.replace(/(.*)\&page=\d+(#\d+)$/, '$1$2');
}).attr('class', 'showcom');
var usrs = {};
$('.comment>tbody>tr>td>a>font>b').each(function() {
var n = $(this).text();
var color = $(this).parent().attr('color');
$(this).closest('.comment').attr('name', n);
if (usrs[n]) {
usrs[n].c = usrs[n].c + 1;
} else {
usrs[n] = {};
usrs[n].c = 1;
}
usrs[n].s = color;
});
var asd = '';
for(var u in usrs) {
asd = asd + '<a href="#1" name="' + u + '" class="ufilter" style="color:' + usrs[u].s + ' !important;">' + u + '[' + usrs[u].c + ']' + '</a>, ';
}
$('.usfscrpt').html(asd + ' <a href="#comments" class="ufilteroff" style="color:#f33 !important;">[Выкл.фильтр]</a><br>');
$('.ufilter').click(function() {
$('.comment').hide();
$('.comment[name="'+ $(this).attr('name') +'"]').show();
});
$('.ufilteroff').click(function() {
$('.comment').show();
});
$('.showcom').click(function() {
var t = $(this).text().replace(/#(\d+)$/, '$1');
$('a[name="' + t + '"]').next().show(400);
});
$('.usrscriptpage').click(function() {
$('.comment').show();
});
});
})();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址