Sup!
Okay... Version 1.1:
- Problem mit Sortieren von Daten (geht wohl built-in doch nicht so gut) beseitigt
- Skript läuft nur einmal (macht auch sonst keinen Sinn) pro Seite-Laden
Lesbar:
function threadinfo(node,time) {
this.node = node;
this.time = time;
}
function sortthreads(a,b) {
return (b.time - a.time);
}
function timesort(a,b) {
return (a-b);
}
function check(){
dt = document.title;
if (dt.match(/BioSort/)) {return true;}
rn=document.getElementById("root");
non = rn.childNodes.length;
real_thread_list = new Array();
realthreads = new Array();
threads = 0;
for (i=0;i<non;i++) {
document.title=dt +" - BioSorting - Phase 1/2 - ("+ Math.floor((i/non) * 100) + "%)";
if (rn.childNodes.item(i).nodeType == 1) {
a = analyse_thread_get_latest_date(rn.childNodes.item(i));
if (a) {
real_thread_list[threads] = i;
realthreads[threads++] = new threadinfo(rn.childNodes.item(i).cloneNode(1),a);
}
}
}
realthreads.sort(sortthreads);
for (i=0; i < threads; i++) {
document.title=dt +" - BioSorting - Phase 2/2 - ("+ Math.floor((i/threads) * 100) + "%)";
rn.replaceChild(realthreads[i].node,rn.childNodes.item(real_thread_list[i]));
}
document.title=dt + " - BioSorted - most active threads first"
}
function analyse_thread_get_latest_date(node) {
if (node.childNodes.item(0).nodeType == 3) return false;
var content = node.innerHTML;
var timearray = new Array();
var myregexp = /</b>, (\d{2}). (\d{2}). (\d{4}), (\d{2}):(\d{2}) /;
results = content.match(/</b>, \d{2}. \d{2}. \d{4}, \d{2}:\d{2} /g);
if (results) {
text = "";
for (a = 0; a<results.length; a++) {
myregexp.exec(results[a]);
timearray[a] = new Date(RegExp.$3,RegExp.$2,RegExp.$1,RegExp.$4,RegExp.$5,0);
text += timearray[a]+" # ";
}
} else {
return false;
}
timearray.sort(timesort);
return timearray[timearray.length-1];
}
Bookmarkbar:
javascript:function timesort(a,b) {return (a-b);}function threadinfo(node,time) {this.node = node;this.time = time;} function sortthreads(a,b) {return (b.time - a.time);} function check(){dt = document.title; if (dt.match(/BioSort/)) {return;} rn=document.getElementById("root"); non = rn.childNodes.length; real_thread_list = new Array(); realthreads = new Array(); threads = 0; for (i=0;i<non;i++) {document.title=dt +"BioSorting - Phase 1 - ("+ Math.floor((i/non) * 100) + "%)";if (rn.childNodes.item(i).nodeType == 1) {a = analyse_thread_get_latest_date(rn.childNodes.item(i)); if (a) {real_thread_list[threads] = i; realthreads[threads++] = new threadinfo(rn.childNodes.item(i).cloneNode(1),a);}}} realthreads.sort(sortthreads); for (i=0; i < threads; i++) {document.title=dt +"BioSorting - Phase 2 - ("+ Math.floor((i/threads) * 100) + "%)"; rn.replaceChild(realthreads[i].node,rn.childNodes.item(real_thread_list[i]));} document.title=dt + " - BioSorted - most active threads first"} function analyse_thread_get_latest_date(node) { if (node.childNodes.item(0).nodeType == 3) return false; var content = node.innerHTML; var timearray = new Array(); var myregexp = /</b>, (\d{2}). (\d{2}). (\d{4}), (\d{2}):(\d{2}) /; results = content.match(/</b>, \d{2}. \d{2}. \d{4}, \d{2}:\d{2} /g); if (results) {for (a = 0; a<results.length; a++) {myregexp.exec(results[a]);timearray[a] = new Date(RegExp.$3,RegExp.$2,RegExp.$1,RegExp.$4,RegExp.$5,0);}} else {return false;} timearray.sort(timesort);return timearray[timearray.length-1];} check();
Gruesse,
Bio
--
Tötet DJ Ötzi! (Nicht wirklich!)