Skip to content

Instantly share code, notes, and snippets.

@RadarCZ
Last active August 27, 2018 14:53
Show Gist options
  • Save RadarCZ/59630a86e6e15c15c95476bc276bbf86 to your computer and use it in GitHub Desktop.
Save RadarCZ/59630a86e6e15c15c95476bc276bbf86 to your computer and use it in GitHub Desktop.
// ==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