Skip to content
This repository has been archived by the owner on Sep 10, 2023. It is now read-only.

Commit

Permalink
feat: 支持爱发电. close #598
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Oct 3, 2022
1 parent 1c864f9 commit 35d0b1b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -71,6 +71,7 @@
- [x] 开源中国
- [x] 印象笔记
- [x] 标志情报局
- [x] 爱发电

<details><summary>更多</summary>

Expand Down
7 changes: 7 additions & 0 deletions index.ts
Expand Up @@ -30,6 +30,7 @@ import { ZhihuProvider } from "@/sites/www.zhihu.com";
import { BaiduXueshuProvider } from "@/sites/xueshu.baidu.com";
import { ZhihuZhuanlanProvider } from "@/sites/zhuanlan.zhihu.com";
import { LogonewsProvider } from "@/sites/www.logonews.cn";
import { AfDianNetProvider } from "@/sites/afadian.net";
import http from "gm-http";

const app = new App();
Expand Down Expand Up @@ -219,5 +220,11 @@ app
test: /www\.logonews\.cn/,
provider: LogonewsProvider,
},
{
// 测试地址: https://afdian.net/a/xiaofanEric
name: "爱发电",
test: /afdian\.net/,
provider: AfDianNetProvider,
},
])
.bootstrap();
9 changes: 9 additions & 0 deletions src/sites/afadian.net.ts
@@ -0,0 +1,9 @@
import { IProvider } from "@/provider";
import { antiRedirect } from "@/utils";

export class AfDianNetProvider implements IProvider {
public test = /afdian\.net\/link\?target=(.*)/;
public resolve(aElement: HTMLAnchorElement) {
antiRedirect(aElement, new URL(aElement.href).searchParams.get("target"));
}
}
1 change: 1 addition & 0 deletions webpack.config.ts
Expand Up @@ -83,6 +83,7 @@ const webpackConfig: webpack.Configuration = {
// @match *://*.oschina.net/*
// @match *://app.yinxiang.com/*
// @match *://www.logonews.cn/*
// @match *://afdian.net/*
// @connect www.baidu.com
// @connect *
// @compatible chrome 完美运行
Expand Down

0 comments on commit 35d0b1b

Please sign in to comment.