Created
October 20, 2011 00:58
-
-
Save gdakram/1300136 to your computer and use it in GitHub Desktop.
sports-in-motion-hack.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){ | |
var images = document.getElementsByTagName("img"); | |
var id_regex = new RegExp(/^thumb-img\d+/i); | |
var image_source_regex = new RegExp(/(.+?)t(.\w{3})$/); | |
var image_sources = []; | |
for (var i = 0; i < images.length; i++) { | |
if (id_regex.test(images[i].id) && image_source_regex.test(images[i].src)) { | |
image_source = RegExp.$1 + RegExp.$2; | |
image_sources.push(image_source); | |
} | |
}; | |
document.body.innerHTML = ""; | |
for (var i = 0; i < image_sources.length; i++) { | |
var p = document.createElement("p"); | |
p.style.display = "block"; | |
p.style.margin = "10px"; | |
var a = document.createElement("a"); | |
var img = document.createElement("img"); | |
img.src = image_sources[i]; | |
a.href = image_sources[i]; | |
a.innerHTML = "Image " + (i + 1) + "<br/>"; | |
a.appendChild(img); | |
a.target = "_blank"; | |
p.appendChild(a); | |
document.body.appendChild(p); | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment