koishi-plugin-tmp-bot 1.8.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -39,10 +39,22 @@ const serverAlias = {
|
|
|
39
39
|
* 路况程度转中文
|
|
40
40
|
*/
|
|
41
41
|
const severityToZh = {
|
|
42
|
-
'Fluid':
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
'Fluid': {
|
|
43
|
+
text: '畅通',
|
|
44
|
+
color: '#00d26a'
|
|
45
|
+
},
|
|
46
|
+
'Moderate': {
|
|
47
|
+
text: '正常',
|
|
48
|
+
color: '#ff6723'
|
|
49
|
+
},
|
|
50
|
+
'Congested': {
|
|
51
|
+
text: '缓慢',
|
|
52
|
+
color: '#f8312f'
|
|
53
|
+
},
|
|
54
|
+
'Heavy': {
|
|
55
|
+
text: '拥堵',
|
|
56
|
+
color: '#8d67c5'
|
|
57
|
+
}
|
|
46
58
|
}
|
|
47
59
|
|
|
48
60
|
/**
|
|
@@ -88,7 +100,7 @@ module.exports = async (ctx, cfg, serverName) => {
|
|
|
88
100
|
country: await baiduTranslate(ctx, cfg, traffic.country),
|
|
89
101
|
province: await baiduTranslate(ctx, cfg, traffic.name.substring(0, traffic.name.lastIndexOf('(') - 1)),
|
|
90
102
|
playerCount: traffic.players,
|
|
91
|
-
severity: severityToZh[traffic.newSeverity] ||
|
|
103
|
+
severity: severityToZh[traffic.newSeverity] || { text: '未知', color: '#ffffff' }
|
|
92
104
|
})
|
|
93
105
|
}
|
|
94
106
|
|
|
@@ -45,6 +45,10 @@
|
|
|
45
45
|
border-right: 1px solid rgba(255, 255, 255, 0.3);
|
|
46
46
|
box-sizing: border-box;
|
|
47
47
|
padding: 0 10px;
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: row;
|
|
50
|
+
align-items: center;
|
|
51
|
+
justify-content: center;
|
|
48
52
|
}
|
|
49
53
|
.traffic-item:nth-child(-n+3) {
|
|
50
54
|
margin-top: 0;
|
|
@@ -54,7 +58,10 @@
|
|
|
54
58
|
}
|
|
55
59
|
.traffic-item .region-info {
|
|
56
60
|
display: inline-block;
|
|
57
|
-
width:
|
|
61
|
+
width: 72%;
|
|
62
|
+
white-space: nowrap;
|
|
63
|
+
overflow: hidden;
|
|
64
|
+
text-overflow: ellipsis;
|
|
58
65
|
}
|
|
59
66
|
.traffic-item .player-count {
|
|
60
67
|
display: inline-block;
|
|
@@ -63,7 +70,7 @@
|
|
|
63
70
|
}
|
|
64
71
|
.traffic-item .traffic-status {
|
|
65
72
|
display: inline-block;
|
|
66
|
-
width:
|
|
73
|
+
width: 12%;
|
|
67
74
|
text-align: right;
|
|
68
75
|
}
|
|
69
76
|
</style>
|
|
@@ -187,7 +194,7 @@
|
|
|
187
194
|
for (const traffic of data.trafficList) {
|
|
188
195
|
document.getElementsByClassName('traffic-box')[0].insertAdjacentHTML('beforeend', `
|
|
189
196
|
<div class="traffic-item">
|
|
190
|
-
<span class="region-info"><strong>${traffic.country}</strong> ${traffic.province}</span><span class="player-count">${traffic.playerCount}人</span><span class="traffic-status">${traffic.severity}</span>
|
|
197
|
+
<span class="region-info"><strong>${traffic.country}</strong> ${traffic.province}</span><span class="player-count">${traffic.playerCount}人</span><span class="traffic-status" style="color: ${traffic.severity.color}">${traffic.severity.text}</span>
|
|
191
198
|
</div>
|
|
192
199
|
`);
|
|
193
200
|
}
|
package/package.json
CHANGED