知乎 不感兴趣

给知乎加一个 不感兴趣 的快捷键X。目前只对收起的回答生效(展开/收起 快捷键O)

// ==UserScript==
// @name         知乎 不感兴趣
// @namespace    github.com/klt14
// @license      GPL
// @version      0.1
// @description  给知乎加一个 不感兴趣 的快捷键X。目前只对收起的回答生效(展开/收起 快捷键O)
// @author       [email protected]
// @match        https://www.zhihu.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    // currently only works when the answer is folded.
    function ignore() {
        //document.activeElement.firstChild.firstChild.firstChild.firstChild.childNodes[7].childNodes[2].childNodes[5].firstChild.click();
        let moreButton = document.activeElement.firstChild.firstChild.firstChild.firstChild.childNodes[7].lastChild.childNodes[5].firstChild;
        moreButton.click();
        // setTimeout so that focus is moved to "举报" button
        setTimeout(function(){
            console.log(document.activeElement);
            document.activeElement.parentNode.lastChild.previousSibling.click();
        }, 100);

    }
    document.onkeydown = function (event) {
        //console.log(event.keyCode);
        //console.log(document.activeElement);
        if (event.keyCode == 88) {
            ignore();
        }
    };
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址