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 4:00

>>16
There should be an <a> tag between <span> and <img>, which would explain why the expression returned no images.

In any case, instead of using the above script, give this one a try.

// ==UserScript==
// @include http://danbooru.donmai.us/post*;
// @name Danbooru Expander
// @author Anonymous
// @version 2009-03-15
// @description Enjoy your load times. (absurdres...)
// ==/UserScript==

(function () {
// Find registered posts (JavaScript haxx)
var regexp = /Post.register\(\{(.+?)\}\)/g;
var imageUrls = Object();
var match = regexp.exec(document.body.innerHTML);
while (match) {
    eval("var arr = {" + match[1] + "};");
    imageUrls[arr["preview_url"]] = arr["file_url"];
    match = regexp.exec(document.body.innerHTML);
}

var images = document.evaluate("//span[@class='thumb']/a/img",
    document, null, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null);

var img = images.iterateNext();
while (img) {
    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")]);
    img = images.iterateNext();
}   
})();


Oh, and remove the semicolon after @include ... in case Shiichan adds one again. I'M NOT FALLING FOR IT A SECOND TIME!

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