Thread Navigating by Arrow keys

Use ← or → and Ctrl to navigate to previous, next, first or last page

Fra og med 28.05.2017. Se den nyeste version.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Thread Navigating by Arrow keys
// @namespace   https://greasyfork.org/scripts/6849-thread-navigating-by-arrow-keys
// @description Use ← or → and Ctrl to navigate to previous, next, first or last page
// @author      theheroofvn
// @include     /^.*(thread|forum|diendan).*$/
// @include     http://www.vn-zoom.com/*
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
// @noframes
// @grant       GM_addStyle
// @version     6.2
// ==/UserScript==

$(document).ready(function(){function a(a){return $('script[src*="'+a+'"]').length>0}$(window).focus();var t,e,r,n,i;if(0===function(a){if(0===a.length)return 0;for(var o=0;o<a.length;o++)if(location.hostname==a[o].host)return t=a[o].prev,e=a[o].next,r=a[o].first,n=a[o].last,i=a[o].up,1;return 0}([{host:"www.webtretho.com",prev:"a.arrowPrePage",next:"a.arrowNextPage",first:"a.arrowFstPage",last:"a.arrowLstPage"},{host:"forum.bkav.com.vn",prev:"a.js-pagenav-prev-button",next:"a.js-pagenav-next-button",first:"a[data-page='1']",last:"a.js-pagenav-button:nth-last-child(2)",up:"#breadcrumbs a.crumb-link"}]))switch(function(){var t="";return a("vbulletin")?t="vbb":a("xenforo")?t="xenforo":a("general.js")?t="mybb":a("forum_fn.js")&&(t="phpbb"),t}()){case"vbb":t='a[rel="prev"]',e='a[rel="next"]',r='a[rel="start"]',n='a[title^="Last"], a[title*="uối"]',i="span.navbar a, li.navbit a";break;case"xenforo":t=".PageNav a.text:first-child",e=".PageNav a.text:last-child",n=".PageNav nav > a:nth-last-child(2)",r='a[rel="start"]',i="a.crumb";break;case"mybb":t="a.pagination_previous",e="a.pagination_next",r="a.pagination_first",n="a.pagination_last",i=".navigation > a";break;case"phpbb":t=".display-options a.left-box.left",e=".display-options a.right-box.right",r=".pagination > span > a:first-child",n=".pagination > span > a:last-child",i=".navlinks > .icon-home a";break;default:return}var o={prev:function(){return $(t)},next:function(){return $(e)},first:function(){if($(r).length>0)return $(r);var a=$(t).first();return a?(a.attr("href",function(a,t){return t.replace(/page=\d+/,"page=1")}),a):$()},last:function(){if($(n).length>0)return $(n);var a=$(e).first();return a?(a.attr("href",function(a,t){return t.replace(/page=\d+/,"page=9999")}),a):$()},up:function(){return $(i).length>0?$(i).last():$('[itemtype="http://data-vocabulary.org/Breadcrumb"] a').last()}},s=!0;$(document).keydown(function(a){if(s){s=!1;var t=a.keyCode,e=null;if(a.ctrlKey)s=!0,39==t?e="last":37==t?e="first":8==t&&(e="up");else if(39==t)e="next";else{if(37!=t)return;e="prev"}if(e&&"INPUT"!=a.target.tagName&&"TEXTAREA"!=a.target.tagName){var r=o[e]();r.length&&(window.location=r.attr("href"))}}}).keyup(function(a){s=!0})});