Created
April 7, 2020 22:50
-
-
Save Dramacydal/ff83b191e1d087081c468ae7858a5c40 to your computer and use it in GitHub Desktop.
thiswaifudoesnotexist
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 waifu | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://www.thiswaifudoesnotexist.net/ | |
// @grant none | |
// @run-at document-end | |
// @require http://code.jquery.com/jquery-3.4.1.min.js | |
// ==/UserScript== | |
(function() { | |
$('button').closest('p').prepend('<button id="previous" value="Previous">PREVIOUS</button>'); | |
let prev = $('button#previous'); | |
console.log(prev); | |
var currId = null; | |
var lastIds = []; | |
function refresh_content_custom(customId) { | |
currId = customId; | |
id = customId; | |
new_waifu(id); | |
inject_snippet(id); | |
} | |
prev.click(function(e){ | |
console.log(lastIds); | |
if (lastIds.length <= 0) { | |
return; | |
} | |
let lastId = lastIds.splice(-1)[0]; | |
if (interval) { | |
clearInterval(interval); | |
refresh_content_custom(lastId); | |
interval = setInterval(refresh_content, refreshDelay); | |
} else { | |
refresh_content_custom(lastId); | |
} | |
}); | |
let refreshButton = $($('button')[1]); | |
currId = id; | |
refreshButton.click(function(e) { | |
if (currId !== null) { | |
lastIds.push(currId); | |
} | |
//console.log(id) | |
currId = id; | |
}); | |
/* | |
if (interval) { | |
clearInterval(interval); | |
refresh_content(); | |
interval = setInterval(refresh_content, refreshDelay); | |
} else { | |
refresh_content(); | |
} | |
id = Math.floor(Math.random() * totalImages); | |
new_waifu(id); | |
inject_snippet(id); | |
*/ | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment