Shortcut to collapse HackerNews Threads

Hello, here is a tampermonkey script to make the "H" button collapse threads.

// ==UserScript==
// @name         New Userscript
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://news.ycombinator.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=ycombinator.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    document.addEventListener('keydown', (e) => {
       if (e.key == "h" || e.key == "H") {
           document.querySelector('.athing.comtr:not(.noshow):not(.coll) .togg.clicky').click()
           document.querySelector('.athing.comtr:not(.noshow):not(.coll) .togg.clicky').scrollIntoView()
       }
    });
})();