multi insert nodes

5/31/2025, 8:50:16 AM

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name        multi insert nodes
// @namespace   Violentmonkey Scripts
// @match       https://www.cs.usfca.edu/~galles/visualization/RedBlack.html
// @grant       window
// @version     1.0
// @author      s4n7r0
// @description 5/31/2025, 8:50:16 AM
// @license     MIT
// @grant GM_addElement
// ==/UserScript==

function insert_multiple() {
    values = currentAlg.insertField.value.split(",").filter((x) => x.length).map((x) => x.trim())
    currentAlg.animationManager.addListener("AnimationEnded", currentAlg, insert_single)
    currentAlg.insertField.value = values.shift()
    AlgorithmSpecificControls.children[1].children[0].click()
    return;
}

function insert_single(e) {

    currentAlg.insertField.value = values.shift()
    AlgorithmSpecificControls.children[1].children[0].click()
    if (values.length <= 0) {
        currentAlg.animationManager.removeListener("AnimationEnded", currentAlg, insert_single)
        //console.log("i have quit!")
    }
    return currentAlg.enableUi(e)
}

var values = []
let element1 = GM_addElement(AlgorithmSpecificControls.children[1], "input", {id: "insert-multiple", type: "button", value: "Multi Insert"});

element1.onclick = () => insert_multiple()