forked from doio/Surge-Script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsurge bilibili tab.js
87 lines (74 loc) · 1.92 KB
/
surge bilibili tab.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
var body = $response.body;
body=JSON.parse(body);
function should_filter_top(element) {
// 屏蔽游戏推广
if ("uri" in element) {
if (element['uri'].includes("game")) {
return [true, "游戏相关"];
}
}
if ("name" in element) {
if (element['name'].includes("游戏")) {
return [true, "游戏相关"];
}
}
if ("tab_id" in element) {
if (element['tab_id'].includes("游戏")) {
return [true, "游戏相关"];
}
}
return [false,""];
}
function should_filter_bottom(element) {
// 屏蔽发布按钮
if ("name" in element) {
if (element['name'].includes("发布")) {
return [true, "发布"];
}
}
if ("tab_id" in element) {
if (element['tab_id'].includes("发布")) {
return [true, "发布"];
}
}
// 屏蔽会员购
if ("name" in element) {
if (element['name'].includes("会员购")) {
return [true, "会员购"];
}
}
if ("tab_id" in element) {
if (element['tab_id'].includes("会员购")) {
return [true, "会员购"];
}
}
return [false,""];
}
console.log("======对顶栏进行屏蔽======")
var new_array = [];
body["data"]["top"].forEach((element, index) => {
info = should_filter_top(element)
should_be_filterd = info[0]
filter_reason = info[1]
console.log(`${index} ${should_be_filterd} ${filter_reason}`);
if (! should_be_filterd) {
new_array.push(element)
}
});
body["data"]["top"] = new_array;
console.log("======对顶栏进行屏蔽结束======")
console.log("======对底栏进行屏蔽======")
var new_array = [];
body["data"]["bottom"].forEach((element, index) => {
info = should_filter_bottom(element)
should_be_filterd = info[0]
filter_reason = info[1]
console.log(`${index} ${should_be_filterd} ${filter_reason}`);
if (! should_be_filterd) {
new_array.push(element)
}
});
body["data"]["bottom"] = new_array;
console.log("======对底栏进行屏蔽结束======")
body=JSON.stringify(body)
$done({body})