forked from alpha87/QuantumultX-Profiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathITHome.js
40 lines (37 loc) · 775 Bytes
/
ITHome.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
/**
* @supported
*/
function indexAD(obj) {
// 去除 IT 之家首页滚动板块广告
let del_num = [];
for (item of obj) {
if (item["isad"]) {
del_num.unshift(obj.indexOf(item));
}
}
for (n of del_num) {
obj.splice(n, 1);
}
return obj;
}
function newslistAD(obj) {
// 去除 IT 之家新闻列表广告
let data = obj["newslist"];
let del_num = [];
for (item of data) {
if ("aid" in item) {
del_num.unshift(data.indexOf(item));
}
}
for (n of del_num) {
data.splice(n, 1);
}
obj["newslist"] = data;
return obj;
}
let obj = JSON.parse($response.body);
if (obj["newslist"] == undefined) {
$done({ body: JSON.stringify(indexAD(obj)) });
} else {
$done({ body: JSON.stringify(newslistAD(obj)) });
}