// ImageCASH direct images
// version 1.1.2
// created: 23 Sep 2005
// revised: 29 Nov 2005
// Copyright (c) 2005, RadioK
// ==UserScript==
// @name ImageCASH direct images
// @namespace http://radiok.info/greasemonkey
// @description Bypass the individual pages for images hosted by ImageCASH
// @include http://*
// ==/UserScript==
// COMMENTS:
// There are a couple of ways to do this, I went with going through the links
// one by one, then going through the images one by one, then we take the
// filename from the link and the server from the preview image to replace the
// link with a direct link to the file. My method might seem haphazard but I
// think it will work for quite a while.
//
// I also noticed that the filename is the same for the preview image as it is
// for the actual image, you could just take all the preview images, reform
// their source and have the gallery load all the full images instead of
// thumbnails. That seems like a crummy idea in my mind since you most likely
// want to see what you are getting into before you download up to 30 images
// This could be an interesting development in a different format, allowing you
// to see the preview images, then press ýreload full imagesý to load the real
// images all at once, then you could save the page and you would have all the
// full images in one swoop. This is a neat idea, but I do not know how to do
// it right now, and do not really want to, yet.
//
// All in all, imagecash has an interesting little system, thatýs rather easy
// to exploit right now. I do not imagine that will last forever though, so
// take your pickings while you can.
// COMMENTS REDUX:
// Still learning JavaScript/DOM, found a simpler solution. Still going
// through the links one by one looking for links to images, but I am now
// taking the links child to determine the preview image's host address. Much
// simpler, much more effective.
// EXAMPLES:
// gallery http://www.imagecash.net/gallery.php?gid=5527&public=yes
// link http://www.imagecash.net/image.php?file=916133468
// preview http://img2.imagecash.net/preview/916133468.jpg
// REGEX:
// gid=[^\&|$]*
// notes: "gid" can be any query string you need
// source: http://www.imagecash.net/gallery.php?gid=5527&public=yes
// return: gid=5527
//
// image\.php
// notes: "image\.php" can be any file name you need
// source: http://www.imagecash.net/image.php?file=916133468
// return: image.php
//
// .+//[^/]+
// source: http://img2.imagecash.net/preview/916133468.jpg
// return: http://img2.imagecash.net
(function() {
var ImageCASH = {
changeGalleryLinks: function() {
//if (document.location.href.search("gid=[^\&|$]*") == -1) return;
var objAnchors = document.getElementsByTagName('a');
//GM_log(objAnchors.length);
for (var intAnchorsPos = 0; intAnchorsPos < objAnchors.length; intAnchorsPos++) {
if (objAnchors[intAnchorsPos].href.search("image\.php") != -1 && objAnchors[intAnchorsPos].href.search("file=[^\&|$]*") != -1 && objAnchors[intAnchorsPos].childNodes.length > 0) {
//GM_log(objAnchors[intAnchorsPos].href);
var strAnchorQueryFile = new String(objAnchors[intAnchorsPos].href.match("file=[^\&|$]*"));
if (strAnchorQueryFile) {
var objAnchorQueryFile = strAnchorQueryFile.split("=");
objAnchors[intAnchorsPos].href = objAnchors[intAnchorsPos].firstChild.src.match(".+//[^/]+") + "/files666/" + objAnchorQueryFile[1] + ".jpg";
}
}
}
}
}
ImageCASH.changeGalleryLinks();
})();