MCPcopy Create free account
hub / github.com/XIU2/UserScript / targetDiscuz

Function targetDiscuz

TargetBlank.user.js:40–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38
39 // 针对 Discuz! 论坛的帖子
40 function targetDiscuz() {
41 if (document.querySelector('meta[name="author"][content*="Discuz!"], meta[name="generator"][content*="Discuz!"]') || document.querySelector('body[id="nv_forum"][class^="pg_"][onkeydown*="27"]') || document.querySelector('body[id="nv_search"][onkeydown*="27"]') || (document.querySelector('a[href*="www.discuz.net"]') && document.querySelector('a[href*="www.discuz.net"]').textContent.indexOf('Discuz!') > -1) || (document.getElementById('ft') && document.getElementById('ft').textContent.indexOf('Discuz!') > -1)) {
42 let atarget = document.getElementById('atarget');
43 if (atarget && atarget.className.indexOf('atarget_1') === -1) { // 强制勾选 [新窗]
44 atarget.click();
45 }
46 }
47 }
48
49
50 // 针对动态加载内容中的 a 标签

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected