Skip to content

Commit 3e8cdb5

Browse files
committed
优化 [新标签页打开链接] 功能(适配全页面)
1 parent 9619f1a commit 3e8cdb5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

V2ex-Enhanced.user.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,12 +326,12 @@
326326
for (const target of mutation.addedNodes) {
327327
if (target.nodeType != 1) return
328328
if (target.tagName === 'A') {
329-
if (target.href.slice(0,4) != 'http' || target.href.indexOf('#;') > -1 || target.onclick) {
329+
if (target.onclick || target.href.slice(0,4) != 'http' || target.href.indexOf('#;') > -1 || target.href.indexOf('night/toggle') > -1 || target.href.indexOf('/favorite') > -1) {
330330
target.target = '_self'
331331
}
332332
} else {
333333
document.querySelectorAll('a').forEach(function (_this) {
334-
if (_this.href.slice(0,4) != 'http' || _this.href.indexOf('#;') > -1 || _this.onclick) {
334+
if (_this.onclick || _this.href.slice(0,4) != 'http' || _this.href.indexOf('#;') > -1 || _this.href.indexOf('night/toggle') > -1 || _this.href.indexOf('/favorite') > -1) {
335335
_this.target = '_self'
336336
}
337337
});

0 commit comments

Comments
 (0)