Wizard101_Quiz_Nav

Wizard101_quick_test

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

// ==UserScript==
// @name         Wizard101_Quiz_Nav
// @namespace    http://tampermonkey.net/
// @version      0.4.0
// @description  Wizard101_quick_test
// @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:280px;
        padding:20px 0;
        position:fixed;
        text-align:center;
        bottom:1%;
        right:1%;
        background:rgb(57 57 57 / 85%);
        z-index:1000;
        border-radius:10px;
        color:white;
        user-select:none;
        overflow:hidden;
    `
    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:center;
        cursor:pointer;
    `
    // 节点元素
    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)
        h2_noDo.innerText = `😨Not Finished(${document.getElementsByClassName('btn_no').length})`
        h2_done.innerText = `😛Finished(${document.getElementsByClassName('btn_yes').length})`
    }

    setTimeout(function(){
        let quiz = document.getElementsByClassName('quizQuestion')
        let quizs = JSON.parse(sessionStorage.getItem('tested_quiz_val'))
        let btn_sub = document.getElementsByClassName('kiaccountsbuttongreen')
        // 只有在CLAIM YOUR REWARD时才出现
        if(quiz.length === 0 && btn_sub.length > 0 && btn_sub[0].innerText === 'CLAIM YOUR REWARD'){
            checkFinished(quizs)
            createBtnGroup()
        }
        
        if(btn_sub.length > 0 && btn_sub[0].innerText === 'CLAIM YOUR REWARD' ){
            if(quizs.length >= 10){
                sessionStorage.setItem('tested_quiz_val',JSON.stringify([]))
            }
            if(window.openIframeSecure)// 弹出验证
                window.openIframeSecure('/auth/popup/LoginWithCaptcha/game?fpSessionAttribute=QUIZ_SESSION');
            if(window.submitForm)submitForm()// 提交弹窗
            // 直接跳转
            questAddress.forEach(element=>{
                if(!quizs.includes(element)){
                    window.location.href = basePath + element
                }
            })
        }
    },500)
    function checkFinished(quizs){
        let item = window.location.href.split('/')
        if(questAddress.includes(item[item.length - 1]) && !quizs.includes(item[item.length - 1])){
            quizs.push(item[item.length - 1])
        }
        sessionStorage.setItem('tested_quiz_val',JSON.stringify(quizs))
    }
    function createContainer(){
        // 总容器
        container = document.createElement('div')
        container.style = style
        container.classList.add('fadeIn')
        // 大标题
        h22 = document.createElement('h1')
        h22.innerText = 'Quiz List'
        h22.style = `
            height: 30px;
            line-height: 20px;
            font-size:22px;
            color:white;
            font-weight: normal;
        `
        container.append(h22)
        // 小标题
        h2 = document.createElement('h2')
        h2.innerText = 'Click to the test Page!'
        h2.style = `
            height: 40px;
            color: white !important;
        `
        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: #00ceff !important;
        `
        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: #00ff6c !important;
        `
        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.style.color = 'rgb(92,230,251)'
                btn.innerText = `${++index}、${element}`
                btn.style.transition = 'all ease 0.3s'
                btn.classList.add('btn_no')
                btn.onclick = ()=>{
                    // 记录值
                    window.location.href = basePath + element
                }
                btn.onmouseenter = ()=>{
                    btn.style.transform = 'scale(1.2)'
                    btn.style.backgroundColor = 'black'
                }
                btn.onmouseleave = ()=>{
                    btn.style.transform = 'scale(1)'
                    btn.style.backgroundColor = ''
                }
                noDo.append(btn)
            }
        });
        // 已完成list
        quizs.forEach((element,idx) => {
            let btn = document.createElement('div')
            btn.style = btn_style
            btn.style.color = '#ffe200'
            btn.style.cursor = ''
            btn.style.textDecoration = 'line-through'
            btn.innerText = `${++index_done}、${element}`
            btn.classList.add('btn_yes')
            done.append(btn)
        })
    }
})();

QingJ © 2025

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