Next-Prev By Arrow Key

Cái tên nói lên tất cả rồi

اعتبارا من 11-12-2014. شاهد أحدث إصدار.

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name        Next-Prev By Arrow Key
// @version     1.0
// @author      theheroofvn
// @namespace   https://greasyfork.org/scripts/6849-next-prev-by-arrow-key
// @include     *showthread.php*
// @include     */threads/*
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
// @run-at      document-start
// @grant       none
// @description Cái tên nói lên tất cả rồi
// ==/UserScript==

$(document).ready(function() {
    var detect_forum;
    var prev, next, first, last;
    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 Page"], a[title^="Trang cuối"]';
    } 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"]';
    } else return;
    $(window).keydown(function(event) {
        var key = event.keyCode || event.which;
        if ($("textarea:focus").length == 0) {
            switch (key) {
                case 37: $(prev)[0].click(); break;
                case 39: $(next)[0].click(); break;
                case 97: $(first)[0].click(); break;
                case 99: 
                    if (detect_forum == 'v') $(last)[0].click();
                    else if (detect_forum == 'x') $(last).prev()[0].click();
                    break;
                default: break;
            }
        }
    });
});