Skip to content

Commit fee179c

Browse files
feat(redirect): 适配pixiv
1 parent e3d4744 commit fee179c

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

src/scripts-header/redirect.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module.exports = isProd =>
22
`// ==UserScript==
33
// @name redirect 外链跳转
4-
// @version 1.12.0
5-
// @description 自动跳转(重定向)到目标链接,免去点击步骤。适配了简书、知乎、微博、QQ邮箱、QQPC、印象笔记、贴吧、CSDN、YouTube、微信、微信开放社区、开发者知识库、豆瓣、个人图书馆
4+
// @version 1.13.0
5+
// @description 自动跳转(重定向)到目标链接,免去点击步骤。适配了简书、知乎、微博、QQ邮箱、QQPC、印象笔记、贴吧、CSDN、YouTube、微信、微信开放社区、开发者知识库、豆瓣、个人图书馆、Pixiv
66
// @author sakura-flutter
77
// @namespace https://github.com/sakura-flutter/tampermonkey-scripts
88
// @license GPL-3.0
@@ -24,5 +24,6 @@ module.exports = isProd =>
2424
// @match *://www.itdaan.com/link/*
2525
// @match *://www.douban.com/link2/*
2626
// @match *://www.360doc.com/content/*
27+
// @match *://www.pixiv.net/jump.php*
2728
// ==/UserScript==
2829
`

src/scripts/redirect/sites/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { weixinDevelopers } from './developers-weixin-qq-com'
1212
import { itdaan } from './www-itdaan-com'
1313
import { douban } from './www-douban-com'
1414
import { doc360 } from './www-360doc-com'
15+
import { pixiv } from './www-pixiv-net'
1516

1617
const sites = [
1718
{
@@ -92,6 +93,11 @@ const sites = [
9293
readyState: 'interactive',
9394
use: doc360,
9495
},
96+
{
97+
name: 'Pixiv',
98+
test: /^www\.pixiv\.net\/jump.php$/,
99+
use: pixiv,
100+
},
95101
]
96102

97103
export default sites
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { parse } from '@/utils/querystring'
2+
3+
export const pixiv = () => {
4+
let link
5+
// 链接居然是直接拼在url上的
6+
// https://www.pixiv.net/jump.php?https%3A%2F%2Fwww.huawei.com%2Fcn%2Fcorporate-information
7+
for (const [key, value] of Object.entries(parse())) {
8+
try { link ||= new URL(key).href } catch {}
9+
try { link ||= new URL(value).href } catch {}
10+
}
11+
12+
return {
13+
link,
14+
}
15+
}

0 commit comments

Comments
 (0)