Skip to content

Instantly share code, notes, and snippets.

@leftrk
Created December 10, 2020 09:53
Show Gist options
  • Select an option

  • Save leftrk/47d9deed68ce7492199592f52bd3da8f to your computer and use it in GitHub Desktop.

Select an option

Save leftrk/47d9deed68ce7492199592f52bd3da8f to your computer and use it in GitHub Desktop.
liaoxuefeng.com 左右方向键翻页
// ==UserScript==
// @name liaoxuefeng.com 左右方向键翻页
// @description liaoxuefeng.com 教程 增加翻页功能
// @namespace Big Scripts
// @match *://www.liaoxuefeng.com/wiki/*
// @grant none
// @require https://code.jquery.com/jquery-3.5.1.min.js
// @version 0.0.1
// ==/UserScript==
// https://greasyfork.org/zh-CN/scripts/416040-liaoxuefeng-com-%E5%B7%A6%E5%8F%B3%E6%96%B9%E5%90%91%E9%94%AE%E7%BF%BB%E9%A1%B5
(function () {
$(document).keydown(function (e) {
if (e && e.keyCode == 39) {
let url = document.querySelector("#x-content > div.x-wiki-prev-next.uk-clearfix > a.uk-float-right").href
location.assign(url)
}
if (e && e.keyCode == 37) {
let url = document.querySelector("#x-content > div.x-wiki-prev-next.uk-clearfix > a:nth-child(1)").href
location.assign(url)
}
})
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment