I'm writing a greasemonkey script and want to call the start function only once after the page loads - it's for facebook. First I started with following code:
function start(){
alert("hello");
}
start();
The start() function was executed more then once. So I changed the code to following:
jQuery.noConflict();
window.stoop = 0;
jQuery(document).ready(function(){
if(window.stoop == 0){
start();
}
window.stoop = 55;
//or window.stoop++;
});
function start(){
alert("hello");
}
The problem is that the window.stoop value won't change.
I tried with
var stoop = 0;
stoop++;
and
var obj = {};
obj.stoop = 0;
obj.stoop++;
too, but these ways didn't work neither.
What am I doing wrong? I'm in Europe right now -it's night, so I will answer your questions later.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…