Greasy Fork

Greasy Fork is available in English.

[Frg] Accesskey Navigation for Kobatochan.com

Ctrl + Arrow Key navigation.

当前为 2022-11-12 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        [Frg] Accesskey Navigation for Kobatochan.com
// @namespace	https://github.com/Frigvid/scripts-and-userstyles
// @author      Frigvid
// @description Ctrl + Arrow Key navigation.
// @version     2.6.12
// @icon		https://raw.githubusercontent.com/Frigvid/scripts-and-userstyles/master/resources/favicons/kobatochan.png
// @supportURL  https://github.com/Frigvid/scripts-and-userstyles/issues
// @match       *://*.kobatochan.com/*
// @require     https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// ==/UserScript==

/* globals $ */

var prvCh = function(prv){
    var prvId = $('div').find('a').filter(':contains("<< Previous Chapter")');
    if ($(prvId).attr("href") == "null") {} else {window.open($(prvId).attr("href"),"_self")}
};

var nxtCh = function(nxt){
    var nxtId = $('div').find('a').filter(':contains("Next Chapter >>")');
    if ($(nxtId).attr("href") == "null") {} else {window.open($(nxtId).attr("href"),"_self")}
};

var prvPg = function(prv){
    var prvPgId = $('div').find('a').filter(':contains("« Previous Page")');
    if ($(prvPgId).attr("href") == "null") {} else {window.open($(prvPgId).attr("href"),"_self")}
};

var nxtPg = function(nxt){
    var nxtPgId = $('div').find('a').filter(':contains("Next Page »")');
    if ($(nxtPgId).attr("href") == "null") {} else {window.open($(nxtPgId).attr("href"),"_self")}
};

document.addEventListener('keydown', function(e){
	if (e.ctrlKey)
	{
		switch (e.keyCode)
		{
			case 37: prvCh(-1); break;
			case 39: nxtCh(1); break;
		}
	}

	if (e.shiftKey)
	{
		switch (e.keyCode)
		{
			case 37: prvPg(-1); break;
			case 39: nxtPg(1); break;
		}
	}
}, false);