您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Automatically formats barcodes and simulates Enter key behavior on TAB in GMINVENT input fields.
// ==UserScript== // @name GMINVENT Barcode Formatter v2 // @namespace https://gf.qytechs.cn/users/your-username // @version 1.1 // @description Automatically formats barcodes and simulates Enter key behavior on TAB in GMINVENT input fields. // @match https://bgmdolly.gminvent.fr/* // @grant none // @run-at document-idle // ==/UserScript== (function () { 'use strict'; function simulateCarriageReturn(inputField) { inputField.value += '\r'; inputField.dispatchEvent(new Event('input', { bubbles: true })); inputField.dispatchEvent(new Event('change', { bubbles: true })); inputField.blur(); const isDorian = inputField.classList.contains('doriainput'); setTimeout(() => { if (isDorian) { ['keydown', 'keypress', 'keyup'].forEach(type => { inputField.dispatchEvent(new KeyboardEvent(type, { key: 'Enter', code: 'Enter', keyCode: 13, which: 13, bubbles: true, cancelable: true })); }); } else { inputField.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', code: 'Enter', keyCode: 13, which: 13, bubbles: true })); } }, 300); } document.addEventListener('keydown', function (event) { if (event.key !== 'Tab') return; const inputFields = document.querySelectorAll("input[id$='input']"); const inputField = Array.from(inputFields).find(field => field === event.target); if (!inputField) return; event.preventDefault(); event.stopImmediatePropagation(); const original = inputField.value.trim(); let formatted = null; const match = original.match(/^(la|re|ch|cm)(\d+)$/i); if (match) { const [_, prefix, digits] = match; formatted = "SEMLG" + prefix + digits.padStart(10 - prefix.length, '0'); } else if (original.startsWith("A ")) { formatted = "cmdb0a000" + original.slice(2); } if (formatted !== null) { inputField.value = formatted; inputField.dispatchEvent(new Event('input', { bubbles: true })); inputField.dispatchEvent(new Event('change', { bubbles: true })); } simulateCarriageReturn(inputField); }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址