-
-
Save antimatter15/a828411054fe1de22be9 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 Future | |
// @namespace http://antimatter15.com | |
// @description lets the future represent the next page | |
// @include http://* | |
// @include https://* | |
//==/UserScript== | |
var linkel = {}, links = [].slice.call(document.getElementsByTagName("a"),0) | |
.filter(function(e){return /^[0-9]+$/.test(e.innerText.replace(/\s /g,''))}) | |
.map(function(e){var num=parseInt(e.innerText);linkel[num]=e;return num}); | |
function next_page(){ | |
var last = 0; | |
for(var i = 0; i < links.length; i++){ | |
//likely layout: ascending 1,4,5,6,8,9,10,126 | |
//measure change: 0,3,1,1,2,1,1 ,136 | |
//get first =2: <,>,<,<,*,<,< ,> | |
if(links[i] - last == 2){ | |
//current page: links[i] -1 | |
//next page: links[i] | |
//next page link: linkel[links[i]].href | |
//alert(links[i] - 1); | |
window.location = linkel[links[i]].href; | |
break; //bah beh | |
} | |
last = links[i]; | |
} | |
} | |
if(links.length > 0){ | |
history.pushState('_xPageNav', 'Next Page'); | |
history.go(-1); | |
window.onpopstate = function(e){ | |
if(e.state == '_xPageNav') | |
next_page(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment