swarmsim cheatsheet left menu

swarmsim cheatsheet left menu! god!

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.

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.

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

// ==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
    }
})();