Trying to eliminate the annoying default autoplay feature on Site-Which-Must-Not-Be-Named I made a custom JavaScript for Opera 12.17 (Presto):
setInterval(function(){
var ap = document.getElementById('autoplay-checkbox');
if ((ap) && (ap.checked === true)) ap.click();
},
500);
setInterval
is here because I do not want to deal with window.load
and similar handlers and I am not sure about the moment when the checkbox is being created and initialized.
The script worked for a very long period of time, but now, after I turned Opera cookies off for Site-Which-Must-Not-Be-Named, getElementById
returns null
according to console.log
. It simply cannot find the checkbox, although when executing
var ap = document.getElementById('autoplay-checkbox');
ap.click();
in DragonFly console, it works well. I turned cookies on, and again - JS cannot find the checkbox.
What is happening?
Update
I am completely lost in doubt: the script works on some content pages, especially when loaded by direct links, but doesn't work on other pages (with equal layout).