资料分析重布局,粉笔公考

资料分析重布局

目前為 2022-11-18 提交的版本,檢視 最新版本

// ==UserScript==
// @name         资料分析重布局,粉笔公考
// @namespace    http://tampermonkey.net/
// @version      0.5
// @description  资料分析重布局
// @author       zoohoao
// @license      zoohoao
// @include      http*://*fenbi.com/*
// @include      http*://www.fenbi.com/spa/tiku/exam/practice/xingce/xingce/*
// @include      https://www.fenbi.com/spa/tiku/exam/practice/xingce/xingce/*
// @match       http*://*fenbi.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=gf.qytechs.cn
// @grant        none
// ==/UserScript==

(function() {
    window.onload = function(){

        var box,ques,nums=[];
        var t=0;
        setTimeout(function(){
            var flag = styleModify()
            var url = window.location.href;
            var temp = url.search("solution")
            if(flag && temp==-1){
                sigin(nums)
                document.getElementsByClassName("exam-content")[0].style.marginRight="200px";
                document.getElementsByClassName("border-gray-light3 bg-color-gray-light2")[0]
                ques = document.getElementsByTagName("fb-ng-question-material");
                for(var l=0;l<ques.length;l++){
                    ques[l].style.display="none"
                }
                var box= createNode(t)
                box.innerHTML = ques[t].innerHTML
                imgsrc()
                changeBtn(box,ques)
            }
            if(temp){
            var ad = document.getElementsByClassName("production-rec-nav ng-star-inserted")
            ad[0].style.display='none'
            }


        }, 1000);

        function changeBtn(box,ques){
            var a = document.getElementsByClassName("btn")
            for(var w = 0;w<a.length;w++){
                a[w].onclick=function(){

                    t=t+1;
                    if(t>=ques.length){
                        t=0;
                    }
                    box.innerHTML = ques[t].innerHTML
                    imgsrc()
                    nums[t].scrollIntoView()
                    console.log(t)
                    changeBtn(box,ques)
                };
            }
        }
    }
    function sigin(nums){
        var matri = document.getElementsByClassName("material-content theme-material-content theme-material-content-border font-color-gray-mid bg-color-gray-bold")
        for(var i=0;i<matri.length;i++){
            var index;
            index = matri[i].parentNode
            while(true){
                index.tagName
                if(index.tagName=="DIV" && index.className=="fb-question"){
                    index= index.firstElementChild
                    nums.push(index)

                    index.style.marginTop="50px"
                    index.style.background = "#B6E2A1"
                    console.log(index)
                    break
                }
                index = index.parentNode
            }

        }
    }
    function imgsrc(){
        var imgs = document.getElementById("box").getElementsByTagName("img");
        for(var q = 0;q<imgs.length;q++){
            var datasrc =imgs[q].getAttribute("data-src")
            imgs[q].setAttribute("src",datasrc);
        }}

    function styleModify(){
         var a =document.getElementsByClassName("question-content font-color-gray-mid bg-color-gray-bold theme-options-content")
            for(var i=0;i<a.length;i++){a[i].style.paddingTop="40px"}
            var title= document.getElementsByClassName("font-color-gray-mid")[1].innerHTML
            document.getElementById("fenbi-web-header").style.display="none"
            var flag=title.search("资料分析")
            return flag
    }
    function createBtn() {
        var btnpar = document.getElementsByClassName("material-nav bg-color-gray-light")
        for(var i = 0;i<btnpar.length;i++){
            var newItem=document.createElement("button")
            var textnode=document.createTextNode("切换")
            newItem.appendChild(textnode)
            btnpar[i].insertBefore(newItem,btnpar[i].childNodes[0]);
            newItem.setAttribute("class", "btn");
            newItem.style.width="90px";
            newItem.style.height="30px";
            newItem.style.position="absolute"
            newItem.style.marginLeft="706px"
        }
    }
    function createNode() {
        var para=document.createElement("div");
        var node=document.createTextNode("");
        para.appendChild(node);
        var element=document.getElementById("app-practice");
        element.appendChild(para);
        var box = element.lastChild
        box.style.width="900px";
        box.style.height="1058px";
        box.style.position="fixed"
        box.style.marginTop="82px"
        box.style.marginLeft="160px"
         box.style.overflow="auto"
        box.setAttribute('id', 'box')
        createBtn()

        return box;
    }
})();

QingJ © 2025

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