NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @require https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js // @require https://raw.githubusercontent.com/jaywcjlove/hotkeys/master/dist/hotkeys.min.js // @name 快速点击下一页 // @namespace https://openuserjs.org/users/hjmmc // @version 1.2 // @description win:用鼠标侧键快速点击下一页 mac:可以用BetterAndBetter映射 鼠标侧键或鼠标手势 为 command+] (https://github.com/songhao/BetterAndBetter) 键盘:使用键盘delete键快速点击下一页/insert键返回上一个历史记录 // @copyright 2018, hjmmc (https://openuserjs.org/users/hjmmc) // @license MIT // @author hjmmc // @include *://*bilibili.com/* // @include * // @run-at document-start // @grant none // ==/UserScript== (function() { 'use strict'; var $ = jQuery.noConflict() //只有windows才有鼠标侧键 document.addEventListener('mousedown', function(event) { if (event.button == 4 && event.buttons == 16) { forward() } else if (event.button == 3 && event.buttons == 8) { back() } }) //all //适配Mac hotkeys('command+],Delete', function(event, handler) { forward() }) hotkeys('command+[', function(event, handler) { back() }) hotkeys('Insert', function(event, handler) { window.history.back() }) function forward() { //可以前进就前进一下吧 window.history.forward() //判断有无 下一页 //延时执行 setTimeout(function() { var doms = $(":contains('下一页')") if (doms && doms.length > 0) { checkNeedGotoTop() doms[doms.length - 1].click() } }, 50) } function back() { //只处理 B 站 if (/.*bilibili.com.*/.test(window.location.href)) { var doms = $(":contains('上一页')") if (doms && doms.length > 0) { checkNeedGotoTop() doms[doms.length - 1].click() } } } function checkNeedGotoTop() { if (/.*bilibili.com.*/.test(window.location.href)) { window.scrollTo(0, 0) //B站自动返回顶部 } } })();