Created
May 18, 2018 07:46
-
-
Save autoxbc/28e177ab11c17867dc4c5488b10cf4b7 to your computer and use it in GitHub Desktop.
keepFocused
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name keepFocused | |
// @version 0.1 | |
// @match *://*/* | |
// @run-at document-start | |
// ==/UserScript== | |
const blackList = /v2ex|jandan/ig ; | |
const keepFocused = target => { | |
if( target.nodeType %8 !== 1 ) | |
return; | |
const word = target.textContent.match(blackList); | |
if(word) | |
alert(`你是不是又走神了,在看 「 ${ [ ...new Set(word) ] } 」 ?`); | |
}; | |
new MutationObserver( mutations => { | |
mutations.forEach( mutation => { | |
[...mutation.addedNodes].forEach(keepFocused); | |
}); | |
}).observe( document , { childList:true , subtree:true } ); | |
addEventListener('DOMContentLoaded', e => keepFocused(e.target) ); |
再报告一个问题
文章下面社交网络分享部分,正常情况下鼠标移到微信图标上面会显示tooltip,里面有二维码,使用这个脚本后会把二维码的图片也替换成配图并撑破tooltip
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@autoxbc
你好,关于 https://www.v2ex.com/t/495101 里的脚本,今天遇到一个例外,影响了阅读:https://jandan.net/2018/10/25/most-frightened.html
不好意思,我没V2EX账号,就在这里反馈一下
Edit: 又一个例外:http://jandan.net/2018/10/27/arsia-mons.html