/waffleimages.user.js Secret
Last active
July 10, 2020 16:05
-
-
Save Gavitron/4fc14eea57d66d5e3863 to your computer and use it in GitHub Desktop.
This file contains 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
// ==UserScript== | |
// @name WaffleImage Grabber | |
// @namespace http://www.imcrapproductions.com | |
// @description sup | |
// @include *forums.somethingawful.com/* | |
// @include *archives.somethingawful.com/* | |
// @version 1.0 | |
// @grant none | |
// ==/UserScript== | |
// Generated by LiveScript 1.3.1 | |
var getNewLink, deadImages, i$, len$, deadImage, deadImagePath; | |
getNewLink = function(url){ | |
var parser, segments, imagePath, imageFiletype; | |
parser = document.createElement('a'); | |
parser.href = url; | |
segments = parser.pathname.replace(/^\//, '').split('/'); | |
imagePath = segments[0]; | |
//alert(imagePath); | |
imageFileType = segments[segments.length-1].split(".")[1]; | |
//alert(imageFileType); | |
//alert('http://randomwaffle.gbs.fm/images/' + imagePath.substring(0, 2) + '/' + imagePath + '.' + imageFileType); | |
//alert(url + ' ' + imagePath + ' ' + imageFileType); | |
return 'http://randomwaffle.gbs.fm/images/' + imagePath.substring(0, 2) + '/' + imagePath + '.' + imageFileType; | |
}; | |
deadImages = $("img[src*='waffleimages']"); | |
//alert('found '+deadImages.length+' images'); | |
for (i$ = 0, len$ = deadImages.length; i$ < len$; ++i$) { | |
deadImage = deadImages[i$]; | |
deadImagePath = deadImage.src; | |
var newLink = getNewLink(deadImagePath); | |
deadImage.src = newLink; | |
//console.log(i + ' : ' + deadImagePath + ' : ' + newLink); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment