Our local expert DanRollins created the following bookmarkable javascript to automatically split all points to all unique authors in an EE-Thread. I see it uses some ActiveXObject-thingie, that certainly won't cut it with Firefox.. Also, finding the window isn't going to work, as FireFox uses tabs (usually, at least I do)... One idea might be to put it into a FireFox Extension, via the Context-Menu or something like that, but I'm a javascript-n00b, don't trust me.
** Can anyone create a FireFox'able-Version? **
Instructions (from wertyk):
Put the code in a file with a .js extension, and place it in your bookmarks. Then you
just have to click split points and then click the bookmark. the script will calculate how
many points each person gets and will write that in the first post by each person, then
it will tell you how many points did not distribute evenly and are left over for you to assign.
Code (from DanRollins + small mods by wertyk):
//////////////////////////
//////////
//////////
//////////
//////////
////
var oShellApp= new ActiveXObject("Shell.Appli
cation");
var aoWins= oShellApp.Windows();
for( var j=0; j<aoWins.Count; j++) { // find the right IE window
owinIe= aoWins.Item(j);
var sURL=new String( owinIe.LocationURL );
var nOffset= sURL.indexOf("splitPoints.
jsp" );
if ( nOffset >= 0 ) {
var sBody= owinIe.document.body.inner
HTML;
var nOffset= sBody.indexOf("Points must total " );
var nPoinx= parseInt( sBody.substr(nOffset+17, 4) );
SplitEmUp( owinIe.document,nPoinx );
break;
}
}
function SplitEmUp( oDoc, nPoinx ) {
var aLizards= new Array();
var aEdBoxIDs= new Array();
var nCnt= 0;
for (j=0; j<oDoc.anchors.length; j++) {
var s= oDoc.anchors[j].parentNode
.outerHTML
;
// WScript.Echo( s );
var n= s.indexOf('name=points_')
if ( n != -1 ) {
var sEdboxID= s.substr(n+5, 15 );
s= s.substr( n+21 );
var nNameStart= s.indexOf(">")+1;
var nNameEnd= s.indexOf("</");
var sLzrd= s.substring(nNameStart,nNa
meEnd);
// ---- if the Lizard is already listed, then skip the poink-hungry puke
if ( aLizards.toString().indexO
f(sLzrd) == -1 ) {
aEdBoxIDs[nCnt]= sEdboxID;
aLizards[nCnt++]= sLzrd;
}
}
}
// ---- sanity check
if ( (aLizards.length==0) || (nPoinx==0) ) {
WScript.Echo( "oh, pulleeeezzze" );
return;
}
var nPoinxPerLizard= parseInt( nPoinx/ aLizards.length );
for (j=0; j<aLizards.length; j++ ) {
oDoc.all(aEdBoxIDs[j]).val
ue= nPoinxPerLizard;
}
var nAssigned= nPoinxPerLizard * aLizards.length;
if ( nAssigned != nPoinx ) {
WScript.Echo( "Leftovers! You need to assign " +(nPoinx-nAssigned)+ " poinx!!!" );
}
}
Thanks!