swarmsim cheatsheet left menu

swarmsim cheatsheet left menu! god!

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

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

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

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