// ==UserScript==
// @name HotKey Next Page(L改)
// @namespace https://greasyfork.org/zh-TW/users/4839
// @author hzhbest,leadra
// @version 1.0.4
// @description 按方向鍵[左.右]或shift+[A.D]翻頁
// @match *://*/*
// @exclude https://anime1.me/*
// @exclude https://twitter.com/*
// @exclude https://ani.gamer.com.tw/*
// @exclude https://*.youtube.com/*
// @exclude https://*.facebook.com/*
// @exclude https://*.manhuagui.com/*
// @exclude https://copymanga.*/*
// @exclude https://mangacopy.*/*
// @exclude https://mangacopy.*/*
// @exclude https://www.dm5.com/*
// @exclude https://*.google.com/*
// @exclude https://*.imasdk.googleapis.com/*
// @exclude https://*.googlesyndication.com/*
// @license MIT
// @icon data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAoHCBYWFRgWFhUYGRgZGBoaHBwcGBwcHhocIRoaJB4aGh4eIS4lHB4rIRwcJjgnKy8xNTU1GiQ7QDs0Py40NTEBDAwMBgYGEAYGEDEdFh0xMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMf/AABEIAOEA4QMBIgACEQEDEQH/xAAcAAEAAgIDAQAAAAAAAAAAAAAAAQcEBgIFCAP/xABJEAABAQUFBQUGAgkCAwkBAAABAgADESFBBBIxMlEGImFxgQVCocHwBxNikbHhUnIUY4KSorLC0fEW0lNUkxUjJDNDRIOjsxf/xAAUAQEAAAAAAAAAAAAAAAAAAAAA/8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQACEQMRAD8At0C5MziwCG9rTmwCGaelWgCEzloPpJgmHepp4MIvb2EGQr3dPswiM0yFaeDAO9hKHn/hhN6WEGGeWWtGGckyNaMCMd2urAYbutebOAza/dojQ5tfpNgkG7LGLALuM4sEs0zSrEiGaelWABDe182Q71NPBoAhM5aDHlJphXu6fZgER3tPJh3sJQZCMxJNac5MM8staMAm9ISgyMd3x5MM5Jka0ZwGbX6zYEYbvjzYDdljFoj3Tm1+k2lMpKmaVYAFzjFgEN7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KVYJ5ulGCebClGCAITOX1CTTCoy6fZg0OWnk0cBl9RmwSRGaZCtGGeWWtOTSZZcKtBll615ebBLGMYIIu5Zx9UZCAvDE05shc4x6MhDe1pzYFL1dGAXt4yIZDv8Ah4YshHewhTlNgDexlD1VgN6RkAzPwh1x/wAMjelhDqwTGO7TVoJhujA15sjHd8eXBkYbutefBggm7ITj6o0ndwnH1RkbssY9GiFzjHowSRDeGJ82UvV0YRDexjTmyHf8PDFgAR3jiGDexlD1VkI72EKcmQv8IdWADekZAMBju015MjelhDqyMd3x5cGATDdprzaCbshMFpjDd8efBkbssY9GAd3CcfVGEXd4TJaIXOMejTCG9jGnNgUvV0YBHeOIpyZDv+HhiwCO9hCnJgAXs0oeqsSb0lSh6qyF7hDqyN6WEOrAjHdOGvJpjDdpq0Rju6V5cGRhu+PPgwQTdkJgtJ3cs49foyN2WMWjJxj0hD/LBMWNLGCC0sYwGMYwGMYwGMYwGFjGAxjGAxjGAxjGA0MYwSWMYwGMYwGMYwGMYwQWljGD5sYxg//Z
// ==/UserScript==
// original author : scottxp@126.com (https://userscripts-mirror.org/scripts/show/87895)
// mod by hzhbest : add hilite and float buttons
const Strs = {
next: [
"下一页",
"下页",
"下一页 »",
"下一页 >",
"下一节",
"下一章",
"下一篇",
"后一章",
"后一篇",
"后页>",
"»",
"next",
"next page",
"old",
"older",
"earlier",
"下頁",
"下一頁",
"后一页",
"后一頁",
"翻下页",
"翻下頁",
"后页",
"后頁",
"下翻",
"下一个",
"下一张",
"下一幅",
],
last: [
"上一页",
"上页",
"« 上一页",
"< 上一页",
"上一节",
"上一章",
"上一篇",
"前一章",
"前一篇",
"<前页",
"«",
"previous",
"prev",
"previous page",
"new",
"newer",
"later",
"上頁",
"上一頁",
"前一页",
"前一頁",
"翻上页",
"翻上頁",
"前页",
"前頁",
"上翻",
"上一个",
"上一张",
"上一幅",
]
}
const GeneralXpaths = [
["//a[(text()='", "')]"],
["//a[@class='", "']"],
["//input[@type='button' and @value='", "']"],
];
//编辑下面的数组来自定义规则
const SpecialXpaths = [
{
urls: ["http://www.google.com"], //匹配的url
last: "//a[@id='pnprev']", //上一页节点的xpath
next: "//a[@id='pnnext']", //下一页节点的xpath
},
{
urls: ["bilibili.com"],
last: '//li[@class="be-pager-prev"]',
next: '//li[@class="be-pager-next"]',
},
{
urls: ["taobao.com"],
last: '//button[contains(@aria-label,"上一页")]',
next: '//button[contains(@aria-label,"下一页")]',
},
];
const LastKEY = [
37, // 左方向键
65 // 字母键A
];
const NextKEY = [
39, // 右方向键
68 // 字母键D
];
const LastKEY2 = [
37, // 左方向键
];
const NextKEY2 = [
39, // 右方向键
];
const css = `.__hkbtn {outline: 3px solid #bb1a6a; font-size: larger;}
.__hkbse {position: fixed; z-index: 1000; right: 1em; bottom: 1em; background: #fff2;}
.__hkbse>div:first-of-type {display: none;}
.__hkbse:hover>div:first-of-type {display: inline-block;}
.__hkfbtn {width: 3em; height: 1em; display: inline-block; border: 2px solid #8a8a8a8a;
cursor: pointer; text-align: center; font-size: 1em; line-height: 1em; opacity: 0.3;}
.__hkfbtn.disabled {opacity: 0.3;}
.__hkfbtn:hover {opacity: 1; background: #fbcf84dd;}
`;
addCSS(css, 'hknp_css');
var lnode = getNode('last');
var rnode = getNode('next');
if (!!lnode || !!rnode) {
var bnode = creaElemIn('div', document.body);
bnode.className = '__hkbse';
var lbutton = creaElemIn('div', bnode);
var rbutton = creaElemIn('div', bnode);
lbutton.className = rbutton.className = '__hkfbtn disabled';
lbutton.innerHTML = "<";
rbutton.innerHTML = ">";
if (!!lnode && lnode.offsetHeight !== 0) {
lnode.classList.add('__hkbtn') ;
lbutton.classList.remove('disabled');
if (lnode.textContent.length > 0) lbutton.innerHTML = lnode.textContent.substring(0,3);
lbutton.title = lnode.textContent + ((!!lnode.href)? '\n' + lnode.href : '');
lbutton.addEventListener('click', ()=>{click(lnode);}, false);
}
if (!!rnode && rnode.offsetHeight !== 0) {
rnode.classList.add('__hkbtn') ;
rbutton.classList.remove('disabled');
if (rnode.textContent.length > 0) rbutton.innerHTML = rnode.textContent.substring(0,3);
rbutton.title = rnode.textContent + ((!!rnode.href)? '\n' + rnode.href : '');
rbutton.addEventListener('click', ()=>{click(rnode);}, false);
}
}
function creaElemIn(tagname, destin) {
let theElem = destin.appendChild(document.createElement(tagname));
return theElem;
}
function addCSS(css, cssid) {
let stylenode = creaElemIn('style',document.getElementsByTagName('head')[0]);
stylenode.textContent = css;
stylenode.type = 'text/css';
stylenode.id = cssid || '';
}
function checkKey(e) {
//快速鍵:shift+AD
if (e.shiftKey ){ //|| e.ctrlKey || e.altKey || e.metaKey return;
if (checkTextArea(e.target)) return;
//console.log("hknp_keydown:",e.keyCode);
if (LastKEY.includes(e.keyCode) && !!lnode) {
click(lnode);
}
if (NextKEY.includes(e.keyCode) && !!rnode) {
click(rnode);
}
}
//快速鍵:方向鍵左右
if (e.ctrlKey || e.shiftKey || e.altKey || e.metaKey) return;
if (checkTextArea(e.target)) return;
if (LastKEY2.includes(e.keyCode) && !!lnode) {
click(lnode);
}
if (NextKEY2.includes(e.keyCode) && !!rnode) {
click(rnode);
}
}
function checkTextArea(node) {
var name = node.localName.toLowerCase();
if (name == "textarea" || name == "input" || name == "select") {
return true;
}
if (name == "div" && (node.id.toLowerCase().indexOf("textarea") != -1 || node.contentEditable !== false)) {
return true;
}
return false;
}
function click(node) {
if (node.onclick) node.onclick();
if (node.click) node.click();
if (node.href) location.href = node.href;
}
function xpath(query) {
return unsafeWindow.document.evaluate(
query,
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null
);
}
function getNode(lnstr) {
var node = getNodeByGeneralXpath(lnstr);
if (!node) node = getNodeBySpecialXpath(lnstr);
return node;
}
function getNodeByGeneralXpath(lnstr) { // lnstr 只支持输入 【last】 或者 【next】
var strs;
strs = Strs[lnstr];
var x = GeneralXpaths;
for (var i in x) {
for (var j in strs) {
var query = x[i][0] + strs[j] + x[i][1];
var nodes = xpath(query);
if (nodes.snapshotLength > 0) return nodes.snapshotItem(0);
}
}
return null;
}
function getNodeBySpecialXpath(lnstr) { // lnstr 只支持输入 【last】 或者 【next】
var s = SpecialXpaths;
for (var i in s) {
if (checkXpathUrl(s[i].urls)) {
return xpath(s[i][lnstr]).snapshotItem(0);
}
}
return null;
}
function checkXpathUrl(urls) {
for (var i in urls) if (location.href.indexOf(urls[i]) >= 0) return true;
return false;
}
if (top.location != self.location) return;
unsafeWindow.document.addEventListener("keydown", checkKey, false);