GreaseMonkey script for resizing the stones in Firefox Einstein forum

2 replies. Last post: 2007-04-09

Reply to this topic Return to forum

GreaseMonkey script for resizing the stones in Firefox
  • FatPhil at 2007-04-09

    Save this as .user.js and install as a GreaseMonkey script. It's my first ever greasemonkey script and has some page resizing problems (it doesn't), so I would welcome contributions from others.

    (and I'm hoping that '<' symbols etc. don't get mangled…)

    --- 8// ==UserScript==// @name          EinStein Resize// @namespace @description   Resize stones to be smaller in EinStein games.// @include*// ==/UserScript==// Change this to 45 or 60 or 120 or whatevervar newsize=60;// Do the workvar allImages = document.getElementsByTagName('TD');for (var i = 0; i     var imParent=allImages[i];    var isDie=0;    var wa, ha;    if(imParent.nodeName == 'TD')    {        for( var x = 0; x         {            if( imParent.attributes[x].nodeName.toLowerCase() == 'width' &&                imParent.attributes[x].value == '90')            {                wa=x;                isDie|=1;       }            if( imParent.attributes[x].nodeName.toLowerCase() == 'height' &&                imParent.attributes[x].value == '90')            {                ha=x;                isDie|=2;      }        }        if(isDie==3)        {            imParent.attributes[wa].value=newsize;            imParent.attributes[ha].value=newsize;            var kinder=imParent.childNodes;            for(var i=0; ibr>            {                if(kinder[i].nodeName == 'IMG')                {                    kinder[i].setAttribute('width', newsize);                    kinder[i].setAttribute('height', newsize);                }                if(kinder[i].nodeName == 'A')                {                    kinder[i].childNodes[0].setAttribute('width', newsize);                    kinder[i].childNodes[0].setAttribute('height', newsize);                }            }        }    }}
  • FatPhil at 2007-04-09

    Yup, the third for loop got mangled:

    for(var i=0; i < kinder.length; ++i)

    Oh man - ignore the variable names, the script changed a lot in behaviour while I was hacking away.

Return to forum

Reply to this topic