Nem olyan nehéz azt megoldani:
// ==UserScript==
// @name HUP-node
// @include http://hup.hu/node/*
// @include http://hup.hu/cikkek/*
// @include http://hup.hu/szavazasok/*
// @include http://hup.hu/treyblog/*
// @include http://hup.hu/ad/*
// @include http://hup.hu/promo/*
// ==/UserScript==
kiemelt_minta = '<div class="content" style="background-color: #BBBBFF;" >$1<div class="link">';
troll_minta = '<div class="content" style="background-color: #FF9999;" >$1<div class="link">';
torles_minta = '<div class="content" style="background-color: #E77471;">(t\u00F6r\u00F6lve)</div><div class="link">';
// ******
c = document.body.innerHTML.split( /(<!-- (?:start|end) main content -->)/m );
reg_user = new RegExp( '<div id="block-user-1" [\\s\\S]*?<h2>([^<]+)</h2>', 'm' );
user = reg_user.exec( c[4] );
reg_lista = new RegExp( '\\s*,\\s*' );
kiemelt = GM_getValue( 'kiemelt', user[1]+", trey" ).split(reg_lista);
troll = GM_getValue( 'troll', "" ).split(reg_lista);
torles = GM_getValue( 'torles', "" ).split(reg_lista);
function cmp(a,b){ a=a.toLowerCase(); b=b.toLowerCase(); return (a<b)?-1:(a>b)?1:0; }
function menuElem( name, myFunction ) {
GM_registerMenuCommand( name, function(){
myFunction?myFunction(): GM_setValue(name, prompt(name,GM_getValue(name)));
if ( confirm('A valtoztatasok ervenyesitesehez ujra kell tolteni az oldalt!\nRenden?') )
window.location.reload();
});
}
menuElem( 'kiemelt' );
menuElem( 'troll' );
menuElem( 'torles' );
menuElem( 'mind', function(){
mind = prompt('mind',
GM_getValue('kiemelt') + ' :: ' +
GM_getValue('troll') + ' :: ' +
GM_getValue('torles')
);
mind = mind.split(new RegExp('\\s*::\\s*'));
GM_setValue('kiemelt', mind[0]);
GM_setValue('troll', mind[1]);
GM_setValue('torles', mind[2]);
});
reg_uid = new RegExp( '<div id="block-user-1" [\\s\\S]*?<a href="/user/([^"]+)"', 'm' );
reg_szerzo = new RegExp( '<a href="/user/\\d+"[^>]+>([^<]+)</a>' );
reg_szoveg = new RegExp( '<div class="content">([\\s\\S]*?)<div class="link">', 'm' );
reg_uj = new RegExp( '<div class="comment comment-new">[\\s\\S]*<a id="new"></a>', 'm' );
uid = reg_uid.exec( c[4] );
c[2] = c[2].replace( '>permalink</a></li>', '>permalink</a></li>'+
'<li><a href="/tracker/'+uid[1]+'">(\u25C4)</a>\u0026nbsp;<a href="/tracker">(\u25C4\u25C4)</a></li>', 'g' );
b = c[2].split( /(<a id="comment-\d+"><\/a>)/im );
s = c[0].replace('>HupWiki</a></li>', '>HupWiki</a></li><li class="menu-1-6-101">'+
'<a href="#new" title="els\u0151 \u00FAj" class="menu-1-6-101">els\u0151 \u00FAj</a></li>'+
'<li><a href="/tracker/'+uid[1]+'">(\u25C4)</a></li>'+
'<li><a href="/tracker">(\u25C4\u25C4)</a></li>' )+c[1]+b[0];
for( uj=0, i=2; i<b.length; i+=2 ){ if( b[i].search( reg_uj )>=0 ){ uj++; } }
for( id=0, i=2; i<b.length; i+=2 ){
if( b[i].search( reg_uj )>=0 ){
b[i] = b[i].replace( reg_uj, '<div class="comment comment-new">\n <a id="new'+((id>0)?id:'')+'"></a>' );
b[i] = b[i].replace( '<span class="new">\u00FAj\u0026nbsp;</span>', '<span class="new">\u00FAj\u0026nbsp;'+
' <a href="#new'+ (id+1) +'">(\u25BC'+(uj-id-1)+')</a>'+
' <a href="#new'+ (id>1?id-1:'') +'">(\u25B2'+( id )+')</a>'+
'\u0026nbsp;</span>' );
id++;
}
var szerzo = (b[i].split( reg_szerzo ))[1];
var minta = kiemelt .indexOf(szerzo)>=0 ? kiemelt_minta:
troll .indexOf(szerzo)>=0 ? troll_minta:
torles .indexOf(szerzo)>=0 ? torles_minta:
null;
s += b[i-1] +(minta? b[i].replace( reg_szoveg, minta ): b[i]);
}
document.body.innerHTML = s+c[3]+c[4];
if( document.location.hash == "#new" ){ document.location.hash = "#new"; }
//