百度教育自动展开答案

自动点击“百度教育-不挂科”/“百度教育-百度题库”题目详情页的查看答案

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         百度教育自动展开答案
// @namespace    net.myitian.js.easylearn.autoShowAnswer
// @version      1
// @description  自动点击“百度教育-不挂科”/“百度教育-百度题库”题目详情页的查看答案
// @author       Myitian
// @license      Unlicensed
// @match        https://easylearn.baidu.com/edu-page/tiangong/bgkdetail?*
// @match        https://easylearn.baidu.com/edu-page/tiangong/questiondetail?*
// @run-at       document-body
// @grant        none
// ==/UserScript==

function sleep(time) {
  return new Promise((resolve) => setTimeout(resolve, time));
}
async function main() {
  let show = null;
  while (!show) {
    await sleep(10);
    show = document.querySelector(".answer-hide, .shiti-answer .mask .toogle-btn");
  }
  show.click();
  show = null;
  while (!show) {
    await sleep(10);
    show = document.querySelector(".question-recomm .dan-btn, .exercise-new-dialog .exercise-btn-4");
  }
  show.click();
}
main();