avatar
Untitled

Guest 349 19th Jul, 2024

MARKUP 2.51 KB
                                           
                         // ==UserScript==
// @name         Zmiana zestawów i EQ
// @version      1.0
// @author       Barkozo
// @match        *.margonem.pl/
// @grant        none
// ==/UserScript==

function run(Engine){
    if (Engine && Engine.allInit){
        const style = document.createElement('style');
        style.textContent = `
            #buildsContainer {
                position: absolute;
                z-index: 9998;
                padding: 1px;
                top: 0;
                right: 100%;
                font-family: Arial, sans-serif;
            }
            .build {
                min-width: 64px;
                height: 32px;
                line-height: 32px;
                margin: 3px;
                border: 1px solid #cf0a2c;
                display: block;
                text-align: center;
                cursor: pointer;
                background: black;
                color: white;
            }
            .build.active{
                color: lime;
                border: 1px solid lime;
            }
        `;
        document.head.appendChild(style);

        var buildsContainer = document.createElement('div');
        buildsContainer.id = "buildsContainer";
        document.querySelector(".main-column.right-column").appendChild(buildsContainer);

        const bCommons = Engine.buildsManager.getBuildsCommons();

        for (let i = 1; i <= bCommons.getAll$builds().length; i++) {
            var build = document.createElement('div');
            build.className = "build";
            var buildId = bCommons.getBuilById(i);
            document.getElementById("buildsContainer").appendChild(build).innerHTML = buildId.getData().name;
            const currentBuild = Engine.buildsManager.getBuildsWindow().getCurrentId()
            if(i == currentBuild){
                var buildList = document.getElementsByClassName('build');
                buildList[i-1].classList.add('active')
            }

            build.onclick = function(){
                Engine.buildsManager.getBuildsRequests().setCurrentBuildId(i)
                for (let j = 0; j < buildList.length; j++) {
                    buildList[j].classList.remove('active')
                }
                buildList[i-1].classList.add('active')
            }

        }

    }else setTimeout(function() { run(window.Engine) }, 100)
}
run(window.Engine)
                      
                                       
To share this paste please copy this url and send to your friends
RAW Paste Data
Recent Pastes
Ta strona używa plików cookie w celu usprawnienia i ułatwienia dostępu do serwisu oraz prowadzenia danych statystycznych. Dalsze korzystanie z tej witryny oznacza akceptację tego stanu rzeczy.
Wykorzystywanie plików Cookie
Jak wyłączyć cookies?
ROZUMIEM