KKKK动漫左右按键翻页

使用键盘左右键翻页

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name KKKK动漫左右按键翻页
// @namespace leonhcg
// @version      0.1.4
// @description  使用键盘左右键翻页
// @match *://*.ikkdm.com/*
// @match *://*.kukudm.com/*
// @match *://*.kkkkdm.com/*
// @match *://*.kukukkk.com/*
// @match *://*.ikukudm.com/*
// @match *://*.ikuku.*/*
// @require      https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js
// @grant none
// ==/UserScript==

$(function () {
    var txt1 = $("tbody").text();
    var re_1 = /共([0-9]{1,3})页 \| 当前第([0-9]{1,3})页/;
    var r_tmp = txt1.match(re_1);
    var v1_tmp = parseInt(r_tmp[1]);
    var v2_tmp = parseInt(r_tmp[2]);
    $(document).keydown(function (event) {
        var n = 0;
        //判断当event.keyCode 为37时(即左方面键),执行函数to_left();
        //判断当event.keyCode 为39时(即右方面键),执行函数to_right();
        if (event.keyCode === 37 && v2_tmp > 1) {
            //console.log('按下了左方向键');
            n = v2_tmp - 1;
            window.location.href = '' + n + '.htm';
        } else if (event.keyCode === 39 && v1_tmp > v2_tmp) {
            //console.log('按下了右方向键');
            n = v2_tmp + 1;
            window.location.href = '' + n + '.htm';
        }
    });
})();