I am trying to write a cross-browser userscript that hides IMDb's rating and replaces it with a link that allows the user to rate the show/film later on.
In Opera, this approach already works, but Firefox and Chrome both stumble upon an undefined function and/or variable. here's my code so far:
function hideimdbratings() {
    if (document.getElementsByClassName("star-box")[0]) {
        reenabled = document.getElementsByClassName("star-box")[0].innerHTML;
        document.getElementsByClassName("star-box")[0].innerHTML = '<a href="#" id="showvote" onclick="reenableit();">Rate!</a>';
    }
}
function reenableit() {
    document.getElementsByClassName("star-box")[0].innerHTML = reenabled;
}
window.addEventListener('load', hideimdbratings, false);
The first part works fine, hideimdbratings() is executed and hides the rating.
But, upon clicking the "Rate!"-link, Firefox and Chrome both say that reenableit() is not defined.
Trying this:
onclick="document.getElementsByClassName(\"star-box\")[0].innerHTML = reenabled;"
Results in them saying reenabled is not defined.
I tried putting the code directly into the event listener:
window.addEventListener("load", function(e) {
// ...
}, false);
and this way of defining the functions (with unsafeWindow for Firefox):
var window.reenableit = function() { }
But, whatever I do, both reenableit() and reenabled remain undefined. From what I understand, neither the function nor the variable are global in browsers other than Opera, but I can't seem to find a solution just yet.
What am I missing/doing wrong?
 
     
     
    