swarmsim cheatsheet left menu

swarmsim cheatsheet left menu! god!

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

You will need to install an extension such as Stylus to install this style.

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

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

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

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         swarmsim cheatsheet left menu
// @namespace    http://tampermonkey.net/
// @version      2024-12-24
// @description  swarmsim cheatsheet left menu! god!
// @author       imzhi <[email protected]>
// @match        https://static.oschina.net/trytry/swarmsim/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=oschina.net
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    document.addEventListener('keydown', function(event) {
        if (event.key === 'p') {
            event.preventDefault();
            // 如果需要的话,可以在这里实现你的逻辑
            document.querySelectorAll(`.tab-pane.active .table  > tbody > tr`)[curr_act()+1].click()
        }
    });

    function curr_act() {
        const tr_multi = document.querySelectorAll(`.tab-pane.active .table  > tbody > tr`)
        const index_act = 0
        for (const [tr_key, tr_item] of Object.entries(tr_multi)) {
            console.log('tr_multi', tr_key, tr_item, tr_item.className)
            if (tr_multi.className && tr_multi.className.includes('active')) {
                index_act = tr_key
                break
            }
        }
        return index_act
    }
})();