您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Append ".html" to the end of the input with name="slug" if it's not already there
// ==UserScript== // @name halo文章别名自动加html // @namespace http://tampermonkey.net/ // @version 0.2 // @license MIT // @description Append ".html" to the end of the input with name="slug" if it's not already there // @author Nicek&文心一言 // @match *://请将我替换成你的域名,例如www.n2zip.cn/console/posts/* // @grant none // ==/UserScript== (function() { 'use strict'; function checkAndAppendHtml() { // 获取所有name="slug"的输入框 const slugInputs = document.querySelectorAll('input[name="slug"]'); // 遍历所有输入框 slugInputs.forEach(function(input) { // 检查输入框的值是否以.html结尾 if (!input.value.endsWith('.html')) { // 如果不是,就在末尾添加.html input.value += '.html'; } }); } // 初始检查 checkAndAppendHtml(); // 每隔1秒检查一次(可以根据需要调整时间间隔) setInterval(checkAndAppendHtml, 1000); })();