autoAnswer_Nav

题目快速导航

目前为 2022-06-10 提交的版本。查看 最新版本

// ==UserScript==
// @name         autoAnswer_Nav
// @namespace    http://tampermonkey.net/
// @version      0.3.2
// @description  题目快速导航
// @author       lsmhq
// @match        https://www.wizard101.com/quiz/trivia/game/*
// @match        https://www.wizard101.com/game/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=https://www.wizard101.com
// @require      https://gf.qytechs.cn/scripts/446229-nav-list/code/nav_list.js?version=1059140
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    let questAddress = window.questAddress
    let basePath = 'https://www.wizard101.com/quiz/trivia/game/'
    let index = 0
    let index_done = 0
    let style = `
        display:flex;
        flex-direction: column;
        width:270px;
        padding:20px 0;
        position:fixed;
        text-align:center;
        bottom:0;
        right:0;
        background:rgb(57 57 57 / 85%);
        z-index:1000;
        border-radius:10px;
        color:white;
    `
    let done_style = `
        display:flex;
        flex-direction: column;
        width:100%;
        text-align:center;
        z-index:1000;
        color:white;
    `
    let btn_style = `
        width:100%;
        position:relative;
        height:24px;
        line-height:24px;
        text-align:left;
        cursor:pointer;
        padding-left:15px;
    `
    // 节点元素
    let container, h22, h2, noDo, h2_noDo, done, h2_done
    // 记录值
    if(sessionStorage.getItem('tested_quiz_val') == null){
        sessionStorage.setItem('tested_quiz_val',JSON.stringify([]))
    }
    function createBtnGroup(){
        // 创建容器
        createContainer()
        // 创建List
        createList()
        container.append(noDo)
        container.append(done)
        document.body.append(container)
    }

    setTimeout(function(){
        let quiz = document.getElementsByClassName('quizQuestion')
        if(quiz.length === 0){
            createBtnGroup()
        }
    },1000)

    function createContainer(){
        // 总容器
        container = document.createElement('div')
        container.style = style
        container.classList.add('fadeIn')
        // 大标题
        h22 = document.createElement('h1')
        h22.innerText = 'Quiz List'
        h22.style.color = 'white'
        h22.style.fontSize = '20px'
        container.append(h22)
        // 小标题
        h2 = document.createElement('h2')
        h2.innerText = 'Click to the test Page!'
        h2.style.color = 'white'
        container.append(h2)
        // 未完成
        noDo = document.createElement('div')
        noDo.style = done_style
        h2_noDo = document.createElement('h2')
        h2_noDo.innerText = '😨Not Finished'
        h2_noDo.style.color = 'white'
        noDo.append(h2_noDo)
        //已完成
        done = document.createElement('div')
        noDo.style = done_style
        h2_done = document.createElement('h2')
        h2_done.innerText = '😛Finished'
        h2_done.style.color = 'white'
        done.append(h2_done)
    }
    // 创建List
    function createList(){
        let quizs = JSON.parse(sessionStorage.getItem('tested_quiz_val'))
        //未完成list
        questAddress.forEach((element,idx) => {
            if(!quizs.includes(element)){
                let btn = document.createElement('div')
                btn.style = btn_style
                btn.innerText = `${++index}、${element}`
                btn.onclick = ()=>{
                    // 记录值
                    window.location.href = basePath + element
                    quizs.push(element)
                    sessionStorage.setItem('tested_quiz_val',JSON.stringify(quizs))
                }
                noDo.append(btn)
            }
        });
        // 已完成list
        quizs.forEach((element,idx) => {
            let btn = document.createElement('div')
            btn.style = btn_style
            btn.innerText = `${++index_done}、${element}`
            done.append(btn)
        })
    }
})();

QingJ © 2025

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