Last active
August 27, 2018 14:53
-
-
Save RadarCZ/59630a86e6e15c15c95476bc276bbf86 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.3a | |
// @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 = "192.168.2.11"; | |
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