-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
211 lines (209 loc) · 6.8 KB
/
index.html
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link
rel="stylesheet"
href="https://unpkg.com/[email protected]/dist/css/bootstrap.min.css" />
<style>
tr,
td {
text-align: center;
vertical-align: middle;
}
small {
color: #666;
}
</style>
<title>프로세카 이벤트 목록</title>
</head>
<body>
<div id="app">
<nav class="navbar bg-light">
<div class="container-fluid">
<a href="" class="navbar-brand">프로세카 이벤트 목록</a>
</div>
</nav>
<div class="container">
<table class="table">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">제목</th>
<th scope="col">종류</th>
<th scope="col">기간(일본)</th>
<th scope="col">기간(한국)</th>
<th scope="col">격차</th>
</tr>
</thead>
<tbody>
<tr v-for="event in events" :key="event.id">
<td>{{event.id}}</td>
<td>
<span v-if="event.title">{{event.title}}<br /></span>
<small>{{event.originalTitle}}</small>
</td>
<td>
{{event.type || event.originalType}}
<small v-if="event.type && event.type !== event.originalType"
><br />({{event.originalType}})</small
>
</td>
<td>
{{event.originalDate}}
<br />
({{event.originalPeriod}}일간)
</td>
<td>
<template v-if="event.date">
{{event.date}}
<br />
({{event.period}}일간)
</template>
<span class="text-muted" v-else>
{{event.expectedDate}}?
<br />
({{event.expectedPeriod}}일간?)
</span>
</td>
<td>
<template v-if="event.diff">{{event.diff}}일</template>
<span class="text-muted" v-else>
{{event.expectedDiff}}일?
</span>
</td>
</tr>
</tbody>
</table>
<p>
이벤트 데이터는
<a href="https://sekai.best" target="_blank">Sekai Viewer</a>의 Github
저장소 (<a
href="https://github.com/Sekai-World/sekai-master-db-diff"
target="_blank"
>일본 서버 데이터</a
>,
<a
href="https://github.com/Sekai-World/sekai-master-db-kr-diff"
target="_blank"
>한국 서버 데이터</a
>)에서 가져오고 있습니다. 실제와 다를 수 있습니다.
</p>
<p>
<a
href="https://github.com/robin-maki/pjsekai-event-diff"
target="_blank"
>Github 저장소</a
>
</p>
</div>
</div>
<script src="https://unpkg.com/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://unpkg.com/vue@3"></script>
<script src="https://unpkg.com/[email protected]"></script>
<script>
const EVENT_CYCLE_KR = 7;
function eventType2Text(type) {
switch (type) {
case "marathon":
return "일반";
case "cheerful_carnival":
return "치어풀";
case "world_bloom":
return "월드링크";
}
return type;
}
function zerofill(num, length = 2) {
let str = num.toString();
while (str.length < length) {
str = `0${str}`;
}
return str;
}
function timestamp2DateText(timestamp) {
const date = new Date(timestamp);
return `${date.getFullYear()}-${zerofill(
date.getMonth() + 1
)}-${zerofill(date.getDate())}`;
}
function getPeriod(start, end) {
let startDate = new Date(start);
let endDate = new Date(end);
startDate.setHours(0, 0, 0, 0);
endDate.setHours(0, 0, 0, 0);
return Math.floor((endDate - startDate) / (1000 * 60 * 60 * 24));
}
const app = {
data() {
return {
eventsDataJP: [],
eventsDataKR: [],
};
},
computed: {
events() {
let lastEventStartAt = 0;
let lastDiff = 0;
if (!this.eventsDataJP.length) {
return [];
}
return this.eventsDataJP.map((eventDataOrigin) => {
let event = {
id: eventDataOrigin.id,
originalTitle: eventDataOrigin.name,
originalType: eventType2Text(eventDataOrigin.eventType),
originalDate: timestamp2DateText(eventDataOrigin.startAt),
originalPeriod:
getPeriod(
eventDataOrigin.startAt,
eventDataOrigin.aggregateAt
) + 1,
};
const eventData = this.eventsDataKR.find((eventData) => {
return eventData.id === eventDataOrigin.id;
});
if (eventData) {
event.title = eventData.name;
event.type = eventType2Text(eventData.eventType);
event.date = timestamp2DateText(eventData.startAt);
event.period =
getPeriod(eventData.startAt, eventData.aggregateAt) + 1;
event.diff = getPeriod(
eventDataOrigin.startAt,
eventData.startAt
);
if (lastEventStartAt < eventData.startAt) {
lastEventStartAt = eventData.startAt;
lastDiff = event.diff;
}
} else {
event.expectedPeriod =
getPeriod(
eventDataOrigin.startAt,
eventDataOrigin.aggregateAt
) + 1;
event.expectedDiff = lastDiff;
event.expectedDate = timestamp2DateText(
eventDataOrigin.startAt + 1000 * 60 * 60 * 24 * lastDiff
);
}
return event;
});
},
},
created() {
axios.get("sekai-master-db-diff/events.json").then((res) => {
this.eventsDataJP = res.data;
});
axios.get("sekai-master-db-kr-diff/events.json").then((res) => {
this.eventsDataKR = res.data;
});
},
};
Vue.createApp(app).mount("#app");
</script>
</body>
</html>