Webtoons navigator

Function for navigating chapters in webtoon reader using left and right arrow button and hearting the chapter using the 'h' (for Heart) button.

질문, 리뷰하거나, 이 스크립트를 신고하세요.
// ==UserScript==
// @name         Webtoons navigator
// @icon         https://upload.wikimedia.org/wikipedia/commons/thumb/0/09/Naver_Line_Webtoon_logo.png/128px-Naver_Line_Webtoon_logo.png
// @version      0.2
// @description  Function for navigating chapters in webtoon reader using left and right arrow button and hearting the chapter using the 'h' (for Heart) button.
// @author       Mr. M
// @match        https://www.webtoons.com/en/*/*/*/*
// @grant        none
// @namespace    https://greasyfork.org/users/553660
// ==/UserScript==

(function() {
    'use strict';

    document.onkeydown = checkKey;

    function checkKey(e) {

        e = e || window.event;

        if (e.keyCode == '37') {
            var x = document.getElementsByClassName("_prevEpisode");
            window.location = x[0].getAttribute("href");
        }
        else if (e.keyCode == '39') {
            var y = document.getElementsByClassName("_nextEpisode");
            window.location = y[0].getAttribute("href");
        }
        else if (e.keyCode == '72') {
            document.getElementById("likeItButton").click();
        }

}
})();