现在新版Chrome主页会在点击时出现黑色边框,是因为 :focus 属性,原理就是把它移除。
// ==UserScript==
// @name 移除焦点轮廓线
// @namespace http://tampermonkey.net/
// @version 1.0
// @description 全局移除所有元素获得焦点时的轮廓线
// @author Forever_Rain
// @match https://www.luogu.com.cn/*
// @grant GM_addStyle
// @run-at document-start
// @all-frames true
// ==/UserScript==
(function() {
'use strict';
GM_addStyle(`
*:focus, *:focus-visible {
outline: none !important;
}
`);
})();