// ==UserScript== // @name KJL后台-编辑器参数提示框优化 // @namespace Violentmonkey Scripts // @match https://www.kujiale.com/vc/modeleditor/new* // @grant none // @version 1.0 // @author hejie13250 // @description 2024/11/28 20:55:48 // ==/UserScript== // html body div#react-slot div.auto-complete-select-list (function() { 'use strict'; // Function to reorder the first two children of the target element function reorderChildren(target) { if (target && target.children.length > 1) { // Store the first child var firstChild = target.children[0]; // Store the second child var secondChild = target.children[1]; // Remove the first child target.removeChild(firstChild); // Insert the first child after the second child target.insertBefore(firstChild, secondChild.nextSibling); } } // Create a new MutationObserver instance var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { // Check if addedNodes is not empty and the first added node is a div with the class 'auto-complete-select-list' if (mutation.addedNodes.length > 0 && mutation.addedNodes[0].classList && mutation.addedNodes[0].classList.contains('auto-complete-select-list')) { // Call the reorder function with the added node reorderChildren(mutation.addedNodes[0]); } }); }); // Start the observer observer.observe(document.body, { childList: true, subtree: true }); })();