您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
解决禅道备注中粘贴图片重复的问题
// ==UserScript== // @name 禅道粘贴图片去重 // @namespace http://tampermonkey.net/ // @version 1.0 // @description 解决禅道备注中粘贴图片重复的问题 // @author You // @match *://*/zentao/* // @icon https://www.zentao.net/favicon.ico // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; window.addEventListener("load", function() { createCommentBoxListen() }) // 监听编辑框插入 function listenImgInsert() { var elementToObserve = this.querySelector(".article-content"); var observer = new MutationObserver(() => { removeImg.apply(this) }); elementToObserve && observer.observe(elementToObserve, { subtree: true, childList: true }); } // 删除多余图片 function removeImg() { this.querySelectorAll(".article-content img").forEach(function(img) { if (img.hasAttribute("data-ke-src") && img.getAttribute("src").indexOf("base64") > -1) { img.remove() } }) } // 批量监听评论框操作 function createCommentBoxListen() { document.querySelectorAll("iframe").forEach(iframe => { var doc = iframe.contentWindow.document listenImgInsert.apply(doc) }) } })();