-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRenameNode.js
More file actions
79 lines (73 loc) · 2.57 KB
/
RenameNode.js
File metadata and controls
79 lines (73 loc) · 2.57 KB
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
/*
// Quantumult X 节点名称和国旗替换脚本 (支持常见国家)
// 该脚本将根据节点名称中的关键词匹配替换相应的国家名称及国旗。
// 把该脚本写入重写并打开Quantumult X资源解析器
[rewrite_local]
^https?:\/\/.*\/path\/to\/nodeRename$ url script-response-body https://raw.githubusercontent.com/Fromboy/JavaScript/refs/heads/Scripts/RenameNode.js
*/
let body = $response.body;
// 创建国家和国旗的对应表
const countryFlags = {
"香港": "Hong Kong 🇭🇰",
"Hong Kong": "Hong Kong 🇭🇰",
"台湾": "Taiwan 🇹🇼",
"Taiwan": "Taiwan 🇹🇼",
"日本": "Japan 🇯🇵",
"Japan": "Japan 🇯🇵",
"美国": "United States 🇺🇸",
"USA": "United States 🇺🇸",
"United States": "United States 🇺🇸",
"新加坡": "Singapore 🇸🇬",
"Singapore": "Singapore 🇸🇬",
"韩国": "South Korea 🇰🇷",
"South Korea": "South Korea 🇰🇷",
"韩国": "South Korea 🇰🇷",
"俄罗斯": "Russia 🇷🇺",
"Russia": "Russia 🇷🇺",
"德国": "Germany 🇩🇪",
"Germany": "Germany 🇩🇪",
"英国": "United Kingdom 🇬🇧",
"UK": "United Kingdom 🇬🇧",
"United Kingdom": "United Kingdom 🇬🇧",
"法国": "France 🇫🇷",
"France": "France 🇫🇷",
"印度": "India 🇮🇳",
"India": "India 🇮🇳",
"澳大利亚": "Australia 🇦🇺",
"Australia": "Australia 🇦🇺",
"加拿大": "Canada 🇨🇦",
"Canada": "Canada 🇨🇦",
"巴西": "Brazil 🇧🇷",
"Brazil": "Brazil 🇧🇷",
"意大利": "Italy 🇮🇹",
"Italy": "Italy 🇮🇹",
"西班牙": "Spain 🇪🇸",
"Spain": "Spain 🇪🇸",
"瑞士": "Switzerland 🇨🇭",
"Switzerland": "Switzerland 🇨🇭",
"荷兰": "Netherlands 🇳🇱",
"Netherlands": "Netherlands 🇳🇱",
"瑞典": "Sweden 🇸🇪",
"Sweden": "Sweden 🇸🇪",
"挪威": "Norway 🇳🇴",
"Norway": "Norway 🇳🇴",
"芬兰": "Finland 🇫🇮",
"Finland": "Finland 🇫🇮",
"丹麦": "Denmark 🇩🇰",
"Denmark": "Denmark 🇩🇰",
"比利时": "Belgium 🇧🇪",
"Belgium": "Belgium 🇧🇪",
"南非": "South Africa 🇿🇦",
"South Africa": "South Africa 🇿🇦",
"墨西哥": "Mexico 🇲🇽",
"Mexico": "Mexico 🇲🇽",
"阿根廷": "Argentina 🇦🇷",
"Argentina": "Argentina 🇦🇷"
};
// 遍历每个国家,进行替换操作
for (const [country, replacement] of Object.entries(countryFlags)) {
const regex = new RegExp(country, 'gi');
body = body.replace(regex, replacement);
}
// 返回修改后的内容
$done({ body });