Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name E621 Swimmer
- // @description Navigate e621's pools with arrow keys
- // @include http*://e621.net/post/show/*
- // @grant none
- // ==/UserScript==
- /*
- * Remove these comments if you want images to
- * automatically expand on load and the window
- * to scroll to the image.
- */
- // window.location = '#image' //moves the screen to the image. kinda buggy if the banner disappears.
- // var e = new Event('click');
- // document.getElementById('highres').dispatchEvent(e); //loads the highres image
- var tags = document.getElementsByTagName('a');
- for(var i = 0; i < tags.length; ++i) {
- if(tags[i].innerText === '<< Previous') {
- var prev = tags[i].href;
- }
- else if(tags[i].innerText === "Next >>") {
- var next = tags[i].href;
- break
- }
- }
- document.addEventListener('keydown', function (e) {
- if (e.keyCode === 37 && prev != null && e.ctrlKey) {
- window.location = prev;
- }
- else if (e.keyCode === 39 && next != null && e.ctrlKey) {
- window.location = next;
- }
- }, false);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement