From 4b2a8bdf128eea8ab644cceb6af2b0aba446d619 Mon Sep 17 00:00:00 2001
From: xiu2 <54703944+XIU2@users.noreply.github.com>
Date: Sun, 29 Aug 2021 21:21:00 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E6=8E=92=E9=99=A4?=
=?UTF-8?q?=E9=9D=9E=E9=93=BE=E6=8E=A5=E7=9A=84=20=20=E6=A0=87=E7=AD=BE?=
=?UTF-8?q?=EF=BC=88=E8=BF=99=E7=B1=BB=20=20=E6=A0=87=E7=AD=BE=E4=B8=80?=
=?UTF-8?q?=E8=88=AC=E6=98=AF=E7=94=A8=E6=9D=A5=E6=89=A7=E8=A1=8C=20JS=20?=
=?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=9A=84=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
TargetBlank.user.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/TargetBlank.user.js b/TargetBlank.user.js
index ead2921..d3db7c3 100644
--- a/TargetBlank.user.js
+++ b/TargetBlank.user.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 新标签页打开链接
-// @version 1.0.1
+// @version 1.0.2
// @author X.I.U
// @description 将网页中所有链接改为新标签页打开~
// @match *://*/*
@@ -28,7 +28,9 @@
// 修改为新标签页打开
function targetBlank() {
Array.from(document.links).forEach(function (_this) {
- _this.target = '_blank'
+ if (_this.href && _this.href.slice(0,4) === 'http') {
+ _this.target = '_blank'
+ }
})
}
})();
\ No newline at end of file