I have a webpage that I want to mess with using Greasemonkey. There are flash headers at the top (With changing images).
I already have all those images and have reproduced the file structure so I can redirect the image requests.
This is how the flash object works:
It loads, and then whenever it goes to the next image in the slideshow it sends a GET request to retrieve the image. I want to redirect that request to my image so that the slideshow is now showing my images.
-
The site is the Haslett Public School’s page. I want to change the images to ponies.
I don’t want to edit the flash object, just redirect the requests.
Example: Redirect:
http://www.haslett.k12.mi.us/images/album/11139/hs/album_3964_1327077935.png
To:
http://anotherdomain.net/images/album/11139/hs/album_3964_1327077935.png
Or, most likely scenario, I’ll use an image sharing site and I’ll redirect to:
http://imagesite.com/image/album_3964_1327077935.png
The 11139 directory is sometimes different, so is the HS directory, but the file names won’t actually change from old file to new file.
The file names are all different, so I think I can just redirect the specific album requests (11139, 11140, 11141, etc). to one directory.
Here’s what I have: I got it from some example code, but a have a feeling that it just edits any and tags, or maybe tags. Mine needs to actually redirect the GET requests.
// ==UserScript==
// @name Sudofox image redirect
// @namespace imagehost redirect
// @description Replace requests for images with
// @include http://www.haslett.k12.mi.us/*
// @include https://haslett.k12.mi.us/*
// @include https://www.haslett.k12.mi.us/*
// @include http://haslett.k12.mi.us/*
// ==/UserScript==
var a = document.getElementsByTagName('a');
for (i=0;i<a.length;i++) {
p = /\/images\/album\/([A-Za-z0-9]+)/;
res = p.exec(a[i]);
if (res!=null) {
a[i].href = 'http://site.com/image/' + res[1] + '.png';
}
}
It’s Flash, not Javascript. You can’t mess with that from the outside. Without access to the server to actually redirect the requests, your chances are slim to none.