From 81c83847bb774a8f46c0db21a63719f9c0545f4d Mon Sep 17 00:00:00 2001 From: sve1r Date: Sun, 4 Apr 2021 21:26:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9F=A5=E4=B9=8E=20=E5=8E=BB=E5=B9=BF?= =?UTF-8?q?=E5=91=8A=E9=87=8D=E5=86=99=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Scripts/AdBlock/Zhihu/Answer.js | 10 ++++++++++ Scripts/AdBlock/Zhihu/Feed.js | 9 +++++++++ Scripts/AdBlock/Zhihu/Link.js | 9 +++++++++ Scripts/AdBlock/Zhihu/People.js | 5 +++++ Scripts/AdBlock/Zhihu/Recommend.js | 9 +++++++++ 5 files changed, 42 insertions(+) create mode 100644 Scripts/AdBlock/Zhihu/Answer.js create mode 100644 Scripts/AdBlock/Zhihu/Feed.js create mode 100644 Scripts/AdBlock/Zhihu/Link.js create mode 100644 Scripts/AdBlock/Zhihu/People.js create mode 100644 Scripts/AdBlock/Zhihu/Recommend.js diff --git a/Scripts/AdBlock/Zhihu/Answer.js b/Scripts/AdBlock/Zhihu/Answer.js new file mode 100644 index 0000000..2f225e1 --- /dev/null +++ b/Scripts/AdBlock/Zhihu/Answer.js @@ -0,0 +1,10 @@ +let body = $response.body +body = JSON.parse(body) +delete body['ad_info'] +body['data'].forEach((element, index) => { + if (element['author']['name'] === "盐选推荐" || element['author']['name'] === "盐选科普") { + body['data'].splice(index, 1) + } +}) +body = JSON.stringify(body) +$done({body}) \ No newline at end of file diff --git a/Scripts/AdBlock/Zhihu/Feed.js b/Scripts/AdBlock/Zhihu/Feed.js new file mode 100644 index 0000000..54fa794 --- /dev/null +++ b/Scripts/AdBlock/Zhihu/Feed.js @@ -0,0 +1,9 @@ +let body = $response.body +body = JSON.parse(body) +body['data'].forEach((element, index) => { + if (element.hasOwnProperty('ad')) { + body['data'].splice(index, 1) + } +}) +body = JSON.stringify(body) +$done({body}) \ No newline at end of file diff --git a/Scripts/AdBlock/Zhihu/Link.js b/Scripts/AdBlock/Zhihu/Link.js new file mode 100644 index 0000000..b71cca0 --- /dev/null +++ b/Scripts/AdBlock/Zhihu/Link.js @@ -0,0 +1,9 @@ +//通知中心链接跳转到默认浏览器 +let url = $request.url +let regex = /link.zhihu.com\/\?target=(.*?)&source/ +let target = regex.exec(url) +let tmpurl = target[1] + +let realurl = decodeURIComponent(tmpurl) +$notification.post('', '', realurl) +$done({}) \ No newline at end of file diff --git a/Scripts/AdBlock/Zhihu/People.js b/Scripts/AdBlock/Zhihu/People.js new file mode 100644 index 0000000..fa6eaa0 --- /dev/null +++ b/Scripts/AdBlock/Zhihu/People.js @@ -0,0 +1,5 @@ +let body = $response.body +body = JSON.parse(body) +delete body['mcn_user_info'] +body = JSON.stringify(body) +$done({body}) \ No newline at end of file diff --git a/Scripts/AdBlock/Zhihu/Recommend.js b/Scripts/AdBlock/Zhihu/Recommend.js new file mode 100644 index 0000000..0f64bc0 --- /dev/null +++ b/Scripts/AdBlock/Zhihu/Recommend.js @@ -0,0 +1,9 @@ +let body = $response.body +body = JSON.parse(body) +body['data'].forEach((element, index) => { + if (element['card_type'] === 'slot_event_card' || element.hasOwnProperty('ad')) { + body['data'].splice(index, 1) + } +}) +body = JSON.stringify(body) +$done({body}) \ No newline at end of file