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==
- var tags = jQuery.find('a')
- //I do a.length/2 because I'm assuming it will be in
- //the first half of the page. I don't want to have to loop over
- //every link if it's not there
- for(var i = 0; i < tags.length/2; ++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) {
- window.location = prev;
- }
- else if (e.keyCode === 39 && next != null) {
- window.location = next;
- }
- }, false);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement