Changes

Jump to: navigation, search

CpcsceneSpy

2,091 bytes added, 13:36, 29 April 2008
New page: = Aim = Here is a little &lt;a href="Greasmonkey"&gt; http://www.greasespot.net/ &lt;/a&gt; script in order to spy cpcscene trolliner who change there pseudonyme all the time. <br> = TO...
= Aim =

Here is a little &lt;a href="Greasmonkey"&gt; http://www.greasespot.net/ &lt;/a&gt; script in order to spy cpcscene trolliner who change there pseudonyme all the time.

<br>

= TODO =

* better visual
* store and restore data every time in order to keep pseudo not in the actual content

<br>

= code =
<pre>// ==UserScript==
// @name cpcscenespy
// @namespace http://krusty.benediction.eu
// @description Un script vite fait/mal fait permettant d'espionner les troll-liner indelicats
// @include http://www.cpcscene.com/
// ==/UserScript==



/**
* Histoire de gagner du temps au dev mais pas a l'execution ....
* Recuperation de DOJO
*/
var script = document.createElement('script');
script.src="http://o.aolcdn.com/dojo/1.1.0/dojo/dojo.xd.js";
script.type="text/javascript";
document.getElementsByTagName('head')[0].appendChild(script);

var link = document.createElement('link');
link.rel = "stylesheet";
link.type= "text/css";
link.href="http://o.aolcdn.com/dojo/1.1.0/dijit/themes/tundra/tundra.css";
document.getElementsByTagName('head')[0].appendChild(link);


String.prototype.trim = function(){
return this.replace(/(?:^\s+|\s+$)/g, "")&nbsp;;
}


//Wait until everything is loaded before trying to do anything
window.addEventListener(
'load',
function(event) {


var dojo = unsafeWindow["dojo"];
var list = dojo.fromJson(GM_getValue('cpcscene_troller', '{}'))&nbsp;;
list = {}; //TODO debug



dojo.query('table tr &gt; td &gt; span.blob').forEach(
function( troller ){
var ip = troller.id.trim()&nbsp;;
var pseudo = troller.textContent.trim()&nbsp;;

if ( list[ip]&nbsp;!= undefined ){
if ( list[ip].indexOf(pseudo) == -1) list[ip].push( pseudo)&nbsp;;
}else{
list[ip] = new Array( pseudo )&nbsp;;
}
});


GM_setValue('cpcscene_troller', dojo.toJson(list))&nbsp;;

// a priori dojo met le resultat en cache ...
dojo.query('table tr &gt; td &gt; span.blob').forEach(
function( troller ) {
troller.alt = " "&nbsp;;

list[troller.id].forEach(
function(pseudo){
troller.alt += pseudo + " "&nbsp;;
});


troller.textContent = troller.alt&nbsp;;
});

},
'false'
);


</pre>
18
edits