Last active
May 14, 2018 05:06
-
-
Save RadarCZ/8c0f5261b2c415d33f8a4d034becde0e 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 E6Saver | |
// @namespace http://tampermonkey.net/ | |
// @version 0.3b | |
// @description try to take over the world! | |
// @author You | |
// @match https://e621.net/post/show/* | |
// @grant none | |
// ==/UserScript== | |
function addJQuery(callback) { | |
var script = document.createElement("script"); | |
script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"); | |
script.addEventListener('load', function() { | |
var script = document.createElement("script"); | |
script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();"; | |
document.body.appendChild(script); | |
}, false); | |
document.body.appendChild(script); | |
} | |
function main(){ | |
// test server host | |
var testSrv = "89.24.12.38"; | |
console.log("main called"); | |
jQ("a:contains('Download')").click(function(event){ | |
event.preventDefault(); | |
console.log(jQ(this).attr("href")); | |
var encodedImgLink = encodeURI(jQ(this).attr("href").replace("https://", "//")); | |
window.open("http://"+testSrv+":98/size?origin=e621&imgUrl="+ encodedImgLink, window); | |
}); | |
} | |
addJQuery(main); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment