您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Helps with WooCommerce
当前为
// ==UserScript== // @name init Lab Shop helper // @namespace https://gitlab.com/user890104 // @version 2025-10-04 // @description Helps with WooCommerce // @author Vencislav Atanasov // @license MIT // @match https://shop.initlab.org/wp-admin/admin.php?page=wc-orders&action=new // @icon https://www.google.com/s2/favicons?sz=64&domain=initlab.org // @grant none // ==/UserScript== (function() { 'use strict'; function openSelectAndWaitForSingleItem() { const $select = jQuery(':input.wc-product-search[name="item_id"].enhanced').last(); const selectApi = $select.data('select2'); selectApi.on('results:all', e => { if (e.data.results.length === 1) { const result = e.data.results[0]; selectApi.trigger('select', { data: result, }); requestAnimationFrame(openSelectAndWaitForSingleItem); } }); $select.selectWoo('open'); } const numItems = document.querySelector('#order_line_items').childElementCount; if (numItems === 0) { document.querySelector('.add-order-item').click(); openSelectAndWaitForSingleItem(); } })();