Thread Navigating by Arrow keys

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

14.01.2015 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==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
// @grant       none
// @version     3.9
// ==/UserScript==
this.$ = this.jQuery = jQuery.noConflict(true);

$(document).ready(function() {
    var detect_forum, prev, next, first, last, up, up_sub = '[itemtype="http://data-vocabulary.org/Breadcrumb"] a';
    if ($('script[src*="vbulletin"]').length > 0) {
        detect_forum = "v";
        prev = 'a[rel="prev"]';
        next = 'a[rel="next"]';
        first = 'a[rel="start"]';
        last = 'a[title^="Last"], a[title*="uối"]';
        up = "span.navbar a, li.navbit a";
    } else if ($('script[src*="xenforo"]').length > 0) {
        detect_forum = "x";
        prev = ".PageNav a.text:first-child";
        next = last = ".PageNav a.text:last-child";
        first = 'a[rel="start"]';
        up = "a.crumb";
    } else return;
    var site_info = [ 
	    {
	        host: "www.webtretho.com",
	        prev: "a.arrowPrePage",
	        next: "a.arrowNextPage",
	        first: "a.arrowFstPage",
	        last: "a.arrowLstPage"
	    } 
    ];
    function custom_site(list) {
        if (list.length === 0) return;
        for (var i = 0; i < list.length; i++) {
            if (location.hostname == list[i].host) {
                prev = list[i].prev;
                next = list[i].next;
                first = list[i].first;
                last = list[i].last;
                return;
            }
        }
    }
    custom_site(site_info);
    var multi = {
        17: false,
        8: false,
        37: false,
        39: false
    }, multi1 = {
        17: false,
        8: false
    }, multi2 = {
        17: false,
        37: false
    }, multi3 = {
        17: false,
        39: false
    };
    var nav = {
        prev: $(prev)[0],
        next: $(next)[0],
        first: $(first)[0],
        last: function() {
            if (detect_forum == "v") return $(last)[0]; else if (detect_forum == "x") return $(last).prev()[0];
        },
        up: function() {
            return $(up).length > 0 ? $(up).last()[0] : $(up_sub).last()[0];
        }
    };
    $(window).keydown(function(event) {
        var key = event.keyCode, action = null, link;
        if (key in multi) multi[key] = true; else return;
        if (key in multi1) {
            if (multi[17] && multi[8]) action = "up";
        } else if (key in multi2) {
            if (!multi[17] && multi[37]) action = "prev"; else if (multi[17] && multi[37]) action = "first";
        } else if (key in multi3) {
            if (!multi[17] && multi[39]) action = "next"; else if (multi[17] && multi[39]) action = "last";
        }
        if (!action || event.target.tagName == "INPUT" || event.target.tagName == "TEXTAREA") return;
        if (typeof nav[action] === "function") link = nav[action](); else link = nav[action];
        window.location = link.href;
    }).keyup(function(event) {
        if (event.keyCode in multi) multi[event.keyCode] = false;
    });
});