Bing Homepage Quiz

Automatically answers Bing Homepage Quiz

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Bing Homepage Quiz
// @name:zh-CN   必应首页测试
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Automatically answers Bing Homepage Quiz
// @description:zh-CN  自动回答必应首页的测试题
// @author       PRO
// @match        https://cn.bing.com/*
// @icon         http://bing.com/favicon.ico
// @grant        none
// @license      gpl-3.0
// ==/UserScript==

(function() {
    'use strict';
    function selectAnswer() {
        let quiz = document.getElementById("wkCanvas");
        if (!quiz) return;
        let next = quiz.querySelector("input[id^=nextQuestionbtn]");
        if (next && next.checkVisibility()) next.click();
        let answers = quiz.querySelectorAll("div[id^=QuestionPane] a.wk_choicesInstLink div.b_hPanel div.wk_choiceMaxWidth");
        for (let answer of answers) {
            if (answer.querySelector("div.wk_hideCompulsary")) {
                answer.click();
                break;
            }
        }
    }
    window.setTimeout(selectAnswer, Math.random() * 1000 + 1000);
})();