>>5
I wrote this in about ten minutes because I was bored. You might or might not find it usable, but I don't really care either way. This is
SPARTA after all.
// ==UserScript==
// @include http://*.imagefap.com/gallery*;
// @name Imagefap Expander
// @author Anonymous
// @version 2009-03-14
// @description Enjoy your load times.
// ==/UserScript==
(function () {
// Don't change this, too lazy to actually code paging.
// Do it yourself if you actually need it.
const IMAGES_PER_PAGE = 0;
// Make sure the current location is gallery.php?...&view=2
var match = window.location.pathname.match(/\/gallery\/(\d+)/);
if (match) {
window.location.replace("http://" + window.location.hostname +
"/gallery.php?gid=" + match[1] + "&view=2");
}
match = window.location.search.match(/view=[^2]/)
if (match) {
window.location.replace(
window.location.href.replace(/view=[^2]/, "view=2"));
}
function constructImagePage(images, pageIndex) {
var fragment = document.createDocumentFragment();
var firstImgIdx = IMAGES_PER_PAGE > 0 ? pageIndex * IMAGES_PER_PAGE : 0;
var lastImgIdx = IMAGES_PER_PAGE > 0 ?
Math.min((pageIndex * IMAGES_PER_PAGE) + IMAGES_PER_PAGE,
images.snapshotLength) : images.snapshotLength;
// Add images
for (var i = firstImgIdx; i < lastImgIdx; ++i) {
var img = document.createElement("img");
var oldImg = images.snapshotItem(i);
img.setAttribute("src", oldImg.src.replace("/thumb/", "/full/"));
fragment.appendChild(img);
fragment.appendChild(document.createElement("br"));
}
return fragment;
}
// Find all images
var images = document.evaluate("//a[starts-with(@href, '/image.php')]/img",
document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
// Replace body will just the images
while (document.body.hasChildNodes())
document.body.removeChild(document.body.firstChild);
document.body.appendChild(constructImagePage(images, 0));
})();