-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjumpDirect.user.js
30 lines (29 loc) · 1.09 KB
/
jumpDirect.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// ==UserScript==
// @name 链接直接跳转
// @namespace com.life5211.jumpDirect
// @version 0.1
// @description try to take over the world!
// @author life5211
// @match https://*.zhihu.com/*
// @match https://*.jianshu.com/*
// @match https://weibo.com/*
// @match https://*.weibo.com/*
// @grant none
// ==/UserScript==
(function () {
'use strict';
setTimeout(() => Array.from(document.getElementsByTagName('a')).forEach(aTag => {
if (aTag && aTag.href) {
if (aTag.href.startsWith('https://link.zhihu.com/?target=')) {
//https://link.zhihu.com/?target=www.v2ex.com
aTag.href = decodeURIComponent(aTag.href.replace('https://link.zhihu.com/?target=', ''));
}
if (aTag.href.startsWith('https://link.jianshu.com/?t=')) {
aTag.href = decodeURIComponent(aTag.href.replace('https://link.jianshu.com/?t=', ''));
}
if (aTag.href.startsWith('https://weibo.cn/sinaurl?u=')) {
aTag.href = decodeURIComponent(aTag.href.replace('https://weibo.cn/sinaurl?u=', ''));
}
}
}), 500);
})();