NowCodeMinSheng

牛客 a b c d选择选项 enter提交并且下一题 空格显示老师的参考答案

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         NowCodeMinSheng
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  牛客  a b c d选择选项 enter提交并且下一题 空格显示老师的参考答案
// @author       You
// @match        https://www.nowcoder.com/minsheng/study/index/2/197
// @icon         https://www.google.com/s2/favicons?sz=64&domain=nowcoder.com
// @grant        none
// @license MIT

// @match    https://www.nowcoder.com/*
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
const answer = document.querySelectorAll(".menu")[0].children[1]
const submit_btn = document.querySelectorAll(".subject-action")[0].children[0]
window.addEventListener("keyup", () => {
    const options = document.querySelectorAll(".js-options")[0]
    if (event.keyCode == 32)
        answer.click()
    // a
    if (event.keyCode == 65)
        options.children[0].click()
    // b
    if (event.keyCode == 66)
        options.children[1].click()
    // c
    if (event.keyCode == 67)
        options.children[2].click()
    // d
    if (event.keyCode == 68)
        options.children[3].click()

    // enter
    if (event.keyCode == 13) {
        submit_btn.click()
        setTimeout(() => {
            const next_btn = document.querySelectorAll(".design-answer-box")[0].children[0]
            next_btn.click()
        }, 500)
    }
    // "符号
    if (event.keyCode == 222) {
        const next_btn = document.querySelectorAll(".design-answer-box")[0].children[0]
        console.log("next", next_btn)
        next_btn.click()
    }
})


})();