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

feat: 支持 cn.bing.com #463

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { YoutubeProvider } from "@/sites/www.youtube.com";
import { ZhihuProvider } from "@/sites/www.zhihu.com";
import { BaiduXueshuProvider } from "@/sites/xueshu.baidu.com";
import { ZhihuZhuanlanProvider } from "@/sites/zhuanlan.zhihu.com";
import { CnBingProvider } from "@/sites/cn.bing.com";
import http from "gm-http";

const app = new App();
Expand Down Expand Up @@ -211,5 +212,11 @@ app
test: /app\.yinxiang\.com/,
provider: YinXiangProvider,
},
{
// 测试地址: https://cn.bing.com/search?q=GitHub
name: "必应中国",
test: /cn\.bing\.com/,
provider: CnBingProvider,
},
])
.bootstrap();
17 changes: 17 additions & 0 deletions src/sites/cn.bing.com.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { IProvider } from "@/provider";

export class CnBingProvider implements IProvider {
public test = true;
private container: HTMLElement;
public resolve(aElement: HTMLAnchorElement) {
this.container = document.querySelector("#b_results")
if (this.container && this.container.contains(aElement)) {
aElement.removeAttribute('onclick')
// Replace with a clone to remove all event listeners
aElement.parentElement.replaceChild(
aElement.cloneNode(true),
aElement,
);
}
}
}
1 change: 1 addition & 0 deletions webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const webpackConfig: webpack.Configuration = {
// @include *blog.csdn.net*
// @include *.oschina.net*
// @include *app.yinxiang.com*
// @include *cn.bing.com*
// @connect www.baidu.com
// @connect *
// @compatible chrome 完美运行
Expand Down