Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Greasemonkey

Name: Anonymous 2009-03-14 0:01

Hey /prog/

What do I have to change about this greasemonkey script so that when I go to an imagefap page, the thing acutally finishes loading:
http://userscripts.org/scripts/show/15603

I tried removing the timeout at the bottom but then it'll just stop working.

Help me experts.

Name: Anonymous 2009-03-15 7:44

>>18
I see. Probably due to setting the result type to XPathResult.UNORDERED_NODE_ITERATOR_TYPE, which is invalidated after a modification to the DOM tree. I originally tested the script with Opera (don't have Firefox), so I thought it was fine.

You might have more luck with a loop like this:
var images = document.evaluate("//span[@class='thumb']/a/img",
    document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);

for (var i = 0; i < images.snapshotLength; ++i) {
    var img = images.snapshotItem(i);
    img.removeAttribute("width");
    img.removeAttribute("height");
    img.parentNode.parentNode.style.height = "auto";
    img.parentNode.parentNode.style.width = "auto";
    img.setAttribute("src", imageUrls[img.getAttribute("src")]);
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List