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

Commit

Permalink
feat: 支持去除pocket重定向, close #47
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Jan 17, 2019
1 parent 4d73b83 commit a259e6c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions index.ts
Expand Up @@ -22,6 +22,7 @@ import { QQMailProvider } from "./src/sites/qq.mail";
import { MozillaProvider } from "./src/sites/mozilla";
import { JianShuProvider } from "./src/sites/jianshu";
import { DouBanProvider } from "./src/sites/douban";
import { PocketProvider } from "./src/sites/pocket";

const app = new App();
const isDebug: boolean = process.env.NODE_ENV !== "production";
Expand Down Expand Up @@ -148,6 +149,13 @@ app
return /www\.douban\.com\/doulist\/\d+/.test(location.href)
},
provider: DouBanProvider
},
{
// 测试地址: https://getpocket.com/a/recommended/
// 需要登陆
name: 'Pocket',
test: /getpocket\.com/,
provider: PocketProvider
}
])
.bootstrap();
9 changes: 9 additions & 0 deletions src/sites/pocket.ts
@@ -0,0 +1,9 @@
import { IProvider } from "../provider";
import { matchLinkFromUrl, antiRedirect } from "../utils";

export class PocketProvider implements IProvider {
public test = /getpocket\.com\/redirect\?url=(.*)/;
public resolve(aElement: HTMLAnchorElement) {
antiRedirect(aElement, matchLinkFromUrl(aElement, this.test));
}
}
1 change: 1 addition & 0 deletions webpack.config.ts
Expand Up @@ -70,6 +70,7 @@ const webpackConfig: webpack.Configuration = {
// @include *addons.mozilla.org*
// @include *www.jianshu.com*
// @include *www.douban.com*
// @include *getpocket.com*
// @connect *
// @compatible chrome 完美运行
// @compatible firefox 完美运行
Expand Down

0 comments on commit a259e6c

Please sign in to comment.