Greasy Fork

yande.re keypress a-d-favs 快速收藏

使用键A添加收藏,键D移除收藏

目前为 2022-05-27 提交的版本。查看 最新版本

// ==UserScript==
// @name         yande.re keypress a-d-favs 快速收藏
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  使用键A添加收藏,键D移除收藏
// @author       Exisi
// @match        https://yande.re/post/show*
// @grant        none
// ==/UserScript==

(function () {
    "use strict";
    window.addEventListener('keypress', function (e) {
        if (e.code == "KeyA") {
            let to_favs = document.querySelector('#add-to-favs>a');
            if (to_favs != null) {
                to_favs.click();
            }
        } else if (e.code == "KeyD") {
            let un_favs = document.querySelector('#remove-from-favs>a');
            if (un_favs != null) {
                un_favs.click();
            }
        }
    });
})();