Last active
July 29, 2023 03:55
-
-
Save Klaster1/d4d75d9e890e9db9509fd075cbc0aab4 to your computer and use it in GitHub Desktop.
Hacker News paint likes
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 HackerNews paint likes | |
// @description Like comments and submissions by pressing Shift while mouse curosor is over or by hovering while Shift is down | |
// @version 1.1 | |
// @grant none | |
// @match https://news.ycombinator.com/* | |
// @icon https://news.ycombinator.com/favicon.ico | |
// @downloadURL https://gist.github.com/Klaster1/d4d75d9e890e9db9509fd075cbc0aab4/raw/hacker-news-paint-likes.user.js | |
// @updateURL https://gist.github.com/Klaster1/d4d75d9e890e9db9509fd075cbc0aab4/raw/hacker-news-paint-likes.user.js | |
// ==/UserScript== | |
/** @type {HTMLElement|undefined} */ | |
let lastHoveredComment | |
document.addEventListener('mouseover', e => { | |
lastHoveredComment = e.target.closest('.athing') | |
if (e.shiftKey) lastHoveredComment?.querySelector('[id*=up]')?.click() | |
}) | |
document.addEventListener('keydown', e => { | |
if (e.key === 'Shift') { | |
lastHoveredComment?.querySelector('[id*=up]')?.click() | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment