// ==UserScript== // @name TopicPageLinks // @namespace skyboy@kongregate // @author skyboy // @version 1.0.0 // @description Converts the "last" link in the forums into a link to individual pages in the topic (ie. "1 | 2 | 3 | 4" instead of "last") // @include http://www.kongregate.com/forums/* // @homepage http://userscripts.org/scripts/show/98515 // @downloadURL https://update.greasyfork.icu/scripts/17773/TopicPageLinks.user.js // @updateURL https://update.greasyfork.icu/scripts/17773/TopicPageLinks.meta.js // ==/UserScript== if (/^\/?forums\/\d+[^\/?]*[^\/][\s\S]*/.test(window.location.pathname)) { setTimeout(function() { var body = document.body; body.innerHTML = String(body.innerHTML).gsub(/last<\/a><\/small>/i, function(a){ var url = a[1], last = parseInt(a[2], 10), rtn = ""; if (last > 7) { rtn += '1 | 2 | 3 | \u2026 | '; last -= 2; rtn += ''+last+++' | '+last+++' | '+last+++''; } else if(last == 7) { rtn += '1 | 2 | 3 | 4 | 5 | 6 | 7' } else if(last>1) { var i=1; while(i!=last) { rtn += ''+i+++' | '; } rtn += ''+i+++''; } return rtn + ""; }); }, 1250); }