您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Validate CodeMatirx MR input field content with regex pattern ^(fix|feat|docs|doc|refactor|test|style|ci|chore|revert)(\(.*\))?!?: .+
// ==UserScript== // @name CodeMatirx MR Title Input Validation // @license MIT // @namespace https://git.woa.com/ // @version 1.0 // @description Validate CodeMatirx MR input field content with regex pattern ^(fix|feat|docs|doc|refactor|test|style|ci|chore|revert)(\(.*\))?!?: .+ // @author kerwinpeng // @match https://git.woa.com/CodeMatrix/CodeMatrix/merge_requests/new?* // @match http://git.woa.com/CodeMatrix/CodeMatrix/merge_requests/new?* // @grant none // ==/UserScript== (function() { 'use strict'; setTimeout(function() { const pattern = /^(fix|feat|docs|doc|refactor|test|style|ci|chore|revert)(\(.*\))?!?: .+/; const inputField = document.querySelector('.tg-input__input'); if(!pattern.test(inputField.value)) { inputField.value='feat(qta): '+inputField.value } inputField.addEventListener('input', (event) => { const inputValue = event.target.value.trim(); //console.log(inputValue) const isValid = pattern.test(inputValue); if (!isValid) { inputField.setCustomValidity('MR标题不符合正则 pattern:'+pattern); inputField.reportValidity(); inputField.value='feat(qta): '+inputField.value } else { inputField.setCustomValidity('符合标准'); } }); }, 3000); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址