-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathcustomize.js
65 lines (57 loc) · 1.35 KB
/
customize.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
const version = '1020v3';
const urlMap = {
'xiaohongshu.com/api/sns/v2/system_service/splash_config': 'removeXHSLaunch', //小红书开屏
}
let $ = new nobyda();
//删除小红书广告
function removeXHSLaunch(data) {
try {
// console.log(data);
data.data.ads_groups = [];
} catch (error) {
console.log(error);
}
}
function getModifyMethod(url) {
for(const [path, method] of Object.entries(urlMap)) {
if(url.indexOf(path) > -1) {
return method;
}
}
return null;
}
function nobyda() {
const isQuanX = typeof $task != "undefined";
const isSurge = typeof $httpClient != "undefined";
const isRequest = typeof $request != "undefined";
const notify = (title, subtitle='', message='') => {
if (isQuanX) $notify(title, subtitle, message)
if (isSurge) $notification.post(title, subtitle, message);
}
// const read = (key) => {
// if (isQuanX) return $prefs.valueForKey(key);
// if (isSurge) return $persistentStore.read(key);
// }
const done = (value = {}) => {
if (isQuanX) return $done(value);
if (isSurge) isRequest ? $done(value) : $done();
}
return {
isRequest,
isSurge,
isQuanX,
notify,
// read,
done
}
}
var body = $response.body;
var url = $request.url;
let method = getModifyMethod(url);
if(method) {
var func = eval(method);
let data = JSON.parse(body);
new func(data);
body = JSON.stringify(data);
}
$.done(body);