-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.html
More file actions
177 lines (159 loc) · 4.85 KB
/
code.html
File metadata and controls
177 lines (159 loc) · 4.85 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>《崩坏:星穹铁道》兑换码 - PaiGramTeam</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="js/bootstrap.bundle.min.js"></script>
<!-- custom styles -->
<style>
body {
background-color: #222;
color: #222;
}
h1 {
color: #eee;
margin-top: 50px;
text-align: center;
}
.table-title {
text-align: center;
font-size: 24px;
font-weight: bold;
margin-bottom: 20px;
}
.navbar {
background-color: #333;
position: fixed;
bottom: 0;
width: 100%;
}
.navbar-brand {
color: #eee;
}
.tab-content {
margin-top: 20px;
}
.table {
margin-top: 20px;
}
.table-title {
color: #eee;
}
</style>
</head>
<body>
<header>
<h1>《崩坏:星穹铁道》兑换码</h1>
</header>
<div style="height: 30px;"></div>
<main class="container">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link active" data-bs-toggle="tab" href="#tab1">国服(官服)</a>
</li>
<li class="nav-item">
<a class="nav-link" data-bs-toggle="tab" href="#tab2">国际服</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab1">
<div class="row">
<div class="col-12 col-md-8 offset-md-2">
<h2 class="table-title">未到期</h2>
<table class="table table-dark table-striped">
<thead>
<tr>
<th>兑换码</th>
<th>奖励</th>
</tr>
</thead>
<tbody id="main-true">
</tbody>
</table>
<h2 class="table-title">已到期</h2>
<table class="table table-dark table-striped">
<thead>
<tr>
<th>兑换码</th>
<th>奖励</th>
</tr>
</thead>
<tbody id="main-false">
</tbody>
</table>
</div>
</div>
</div>
<div class="tab-pane" id="tab2">
<div class="row">
<div class="col-12 col-md-8 offset-md-2">
<h2 class="table-title">未到期</h2>
<table class="table table-dark table-striped">
<thead>
<tr>
<th>兑换码</th>
<th>奖励</th>
</tr>
</thead>
<tbody id="over-true">
</tbody>
</table>
<h2 class="table-title">已到期</h2>
<table class="table table-dark table-striped">
<thead>
<tr>
<th>兑换码</th>
<th>奖励</th>
</tr>
</thead>
<tbody id="over-false">
</tbody>
</table>
</div>
</div>
</div>
</div>
</main>
<div style="height: 100px;"></div>
<footer>
<nav class="navbar">
<div class="container-fluid">
<a class="navbar-brand" href="#">PaiGramTeam</a>
</div>
</nav>
</footer>
<script>
function addRow(tableId, data) {
if (data.expire) {
tableId += "-false";
} else {
tableId += "-true";
}
let table = document.getElementById(tableId);
let new_tr = document.createElement("tr");
let code = document.createElement("td");
code.innerHTML = data.code;
let reward = document.createElement("td");
data.reward.forEach(function (item) {
let p = document.createElement("p");
p.innerHTML = item;
reward.appendChild(p);
});
new_tr.appendChild(code);
new_tr.appendChild(reward);
table.appendChild(new_tr);
}
fetch('code.json')
.then(response => response.json())
.then(data => {
for (let key in data) {
for (let value in data[key]) {
addRow(key, data[key][value]);
}
}
})
.catch(error => console.error(error));
</script>
</body>
</html>