您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
A userscript that removes the "+" and "-" from code diffs
当前为
// ==UserScript== // @name GitHub Remove Diff Signs // @version 1.1.6 // @description A userscript that removes the "+" and "-" from code diffs // @license MIT // @author Rob Garrison // @namespace https://github.com/Mottie // @include https://github.com/* // @run-at document-idle // @grant none // @require https://greasyforks.org/scripts/28721-mutations/code/mutations.js?version=189706 // @icon https://github.com/fluidicon.png // ==/UserScript== (() => { "use strict"; function processDiff() { if (document.querySelector(".highlight")) { let indx = 0, els = document.querySelectorAll(` .blob-code-deletion .blob-code-inner, .blob-code-addition .blob-code-inner` ), len = els.length, // target "+" and "-" at start regex = /^[+-]/, // loop with delay to allow user interaction loop = () => { let el, txt, // max number of DOM insertions per loop max = 0; while ( max < 50 && indx < len ) { if (indx >= len) { return; } el = els[indx]; txt = el.childNodes[0].textContent; el.childNodes[0].textContent = txt.replace(regex, " "); max++; indx++; } if (indx < len) { setTimeout(() => { loop(); }, 200); } }; loop(); } } // Observe GitHub dynamic content document.addEventListener("ghmo:container", init); document.addEventListener("ghmo:diff", processDiff); function init() { if (document.querySelector("#files.diff-view")) { processDiff(); } } init(); })();