mirror of
https://github.com/XIU2/UserScript.git
synced 2026-09-22 15:06:57 +00:00
优化 [新标签页打开链接] 功能(适配全页面)
This commit is contained in:
@@ -326,12 +326,12 @@
|
||||
for (const target of mutation.addedNodes) {
|
||||
if (target.nodeType != 1) return
|
||||
if (target.tagName === 'A') {
|
||||
if (target.href.slice(0,4) != 'http' || target.href.indexOf('#;') > -1 || target.onclick) {
|
||||
if (target.onclick || target.href.slice(0,4) != 'http' || target.href.indexOf('#;') > -1 || target.href.indexOf('night/toggle') > -1 || target.href.indexOf('/favorite') > -1) {
|
||||
target.target = '_self'
|
||||
}
|
||||
} else {
|
||||
document.querySelectorAll('a').forEach(function (_this) {
|
||||
if (_this.href.slice(0,4) != 'http' || _this.href.indexOf('#;') > -1 || _this.onclick) {
|
||||
if (_this.onclick || _this.href.slice(0,4) != 'http' || _this.href.indexOf('#;') > -1 || _this.href.indexOf('night/toggle') > -1 || _this.href.indexOf('/favorite') > -1) {
|
||||
_this.target = '_self'
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user