Show/Hide ACed problems

Show or hide accepted problem in the luogu training session

اعتبارا من 18-04-2024. شاهد أحدث إصدار.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         Show/Hide ACed problems
// @namespace    http://tampermonkey.net/
// @version      v1.0.0
// @description  Show or hide accepted problem in the luogu training session
// @author       limesarine
// @match        https://luogu.com/training/*
// @match        https://luogu.com.cn/training/*
// @match        https://*.luogu.com/training/*
// @match        https://*.luogu.com.cn/training/*
// @license      © 2024 Limesarine. All rights reserved.
// @icon         https://www.google.com/s2/favicons?sz=64&domain=luogu.com.cn
// @grant        none
// ==/UserScript==

function displayAC(display)
{
    let x=document.getElementsByClassName('border table')[0];
    if(x){}
    else{return;}
    x=x.childNodes[2].childNodes;
    for(let i=1;i<x.length;i++)
    {
        if(x[i].childNodes[2].childNodes[0].childNodes[0].classList[2]=='fa-check')
        {
            x[i].style.display=display;
        }
    }
}

(function() {
    'use strict';

    const observer=new MutationObserver(function(mutationsList,observer){
        if(document.getElementsByClassName('bottom-inner')[0].childNodes[0].innerText=="多选")
        {
            let e=document.createElement('a');
            e.setAttribute("href","javascript:void 0");
            e.setAttribute("colorscheme","default");
            e.setAttribute("class","color-default");
            e.onclick=function(){
                if(e.innerHTML=="隐藏已AC题目")
                {
                    e.innerHTML="显示已AC题目";
                    displayAC("none");
                }
                else
                {
                    e.innerHTML="隐藏已AC题目";
                    displayAC("");
                }
            }
            e.innerHTML="隐藏已AC题目";
            document.getElementsByClassName('bottom-inner')[0].childNodes[0].appendChild(e);
        }
    });
    observer.observe(document,{childList:true,subtree:true});
})();