Created
April 10, 2021 10:37
-
-
Save Xatenev/aa919c93fc3e284c266648c15bba6b0f to your computer and use it in GitHub Desktop.
Lichess study enhancement user script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Lichess study enhancement | |
// @author Xatenev | |
// @match https://*.lichess.org/* | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
console.log("Lichess study userscript loaded"); | |
document.addEventListener('keydown', onKeyDown); | |
function onKeyDown(e) { | |
const activeElement = document.querySelector('.study__chapters .active'); | |
if(activeElement) { | |
if(e.keyCode === 78) { // press n | |
const next = activeElement.nextSibling; | |
if(next) { | |
next.click(); | |
} | |
} | |
if(e.keyCode === 80) { // press p | |
const previous = activeElement.previousSibling; | |
if(previous) { | |
previous.click(); | |
} | |
} | |
} | |
} | |
})(); |
Excuse me this might sound dumb but what do I do with this? Like where do I insert this ty.
@blacklegend1000 You need a browser addon that allows you to insert and run userscripts. The addons might have a different name depending on the browser you are using.
Google „Userscript Browser Javascript“ for example to find tutorials on how to use them.
This is one possible addon.
Sorry to bother you once again but I use safari on my MacBook and tampermonkey costs money as well on app store do you know a free addon or do I buy this
Sorry to bother you once again but I use safari on my MacBook and tampermonkey costs money as well on app store do you know a free addon or do I buy this
@blacklegend1000 Sorry, I don‘t know about Safari/MacBook.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Excuse me this might sound dumb but what do I do with this? Like where do I insert this ty.