gacha_records.html 6.73 KB
Newer Older
蓝云Reyes's avatar
蓝云Reyes committed
1
<!doctype html>
2
3
<html>
    <head>
蓝云Reyes's avatar
蓝云Reyes committed
4
5
6
7
8
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400&display=swap">
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css">
        <style>
蓝云Reyes's avatar
蓝云Reyes committed
9
10
11
            body {
                background-color: #f0f0f0;
            }
蓝云Reyes's avatar
蓝云Reyes committed
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
            p {
                font-weight:300;
            }
            a,a:hover {
                text-decoration:none !important;
                color:#626976;
            }
            .content {
                padding:3rem 0;
            }
            .container {
                color:#626976;
                position: relative;
            }

            h2 {
                font-size:20px;
            }
            .custom-table {
                min-width:900px;
            }
            .custom-table thead tr,.custom-table thead th {
                padding-bottom:30px;
                color:#000;
            }
            .custom-table tbody th,.custom-table tbody td {
                color:#777;
                font-weight:400;
                padding-bottom:20px;
                padding-top:20px;
                font-weight:300;
                border:none;
            }
蓝云Reyes's avatar
蓝云Reyes committed
45
            .yellow {
蓝云Reyes's avatar
蓝云Reyes committed
46
                color: rgb(255, 162, 0);
蓝云Reyes's avatar
蓝云Reyes committed
47
48
49
50
51
52
53
            }
            .blue {
                color: rgb(75, 107, 251);
            }
            .purple {
                color: rgb(242, 40, 242);
            }
蓝云Reyes's avatar
蓝云Reyes committed
54
55
        </style>
        <title>Gacha Records</title>
56
57
58
        <!-- This file could be generated automatically using `java -jar grasscutter.jar -gachamap` -->
        <!-- You can also modify the file manually to customize it -->
        <!-- Otherwise you may onle see number IDs in the gacha record -->
59
        <script type="text/javascript" src="/gacha/mappings"></script>
60
        <script>
61
62
63
            record = {{REPLACE_RECORD}};
            maxPage = {{REPLACE_MAXPAGE}};

64
            mappings['default'] = mappings['en-us']; // make en-us as default/fallback option
65
66
        </script>
    </head>
蓝云Reyes's avatar
蓝云Reyes committed
67
    <body>
68
        <div class="content">
蓝云Reyes's avatar
蓝云Reyes committed
69
70
71
72
            <div class="container">
                <h2 class="mb-5">Gacha Records</h2>
                <table id="container" class="table table-striped custom-table">
                    <thead>
73
                        <tr>
蓝云Reyes's avatar
蓝云Reyes committed
74
75
                            <th scope="col">Date</th>
                            <th scope="col">Item</th>
76
                        </tr>
蓝云Reyes's avatar
蓝云Reyes committed
77
78
                    </thead>
                    <tbody>
79
80
                    </tbody>
                </table>
蓝云Reyes's avatar
蓝云Reyes committed
81
                <div class="navbar">
蓝云Reyes's avatar
蓝云Reyes committed
82
                    <a href="" id="prev">&lt;&lt;&lt;</a>
蓝云Reyes's avatar
蓝云Reyes committed
83
                    <span id="curpage">1</span>
蓝云Reyes's avatar
蓝云Reyes committed
84
                    <a href="" id="next">&gt;&gt;&gt;</a>
蓝云Reyes's avatar
蓝云Reyes committed
85
                </div>
86
87
            </div>
        </div>
蓝云Reyes's avatar
蓝云Reyes committed
88
89
90
91
92
93
        <footer>
            <div class="copyright">
                <div class="container">
                    <div class="row">
                        <div class="col-md-6">
                            <span>
Melledy's avatar
Melledy committed
94
                                Template by BecodReyes. All rights reserved.
蓝云Reyes's avatar
蓝云Reyes committed
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
                            </span>
                        </div>
                        <div class="col-md-6">
                            <ul style="float:right">
                                <li class="list-inline-item">
                                    <a href="https://github.com/Grasscutters/Grasscutter">Github</a>
                                </li>
                                <li class="list-inline-item">·</li>
                                <li class="list-inline-item">
                                    <a href="https://github.com/Grasscutters/Grasscutter/blob/stable/LICENSE">License</a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </footer>
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135

        <script>
            var lang = new window.URLSearchParams(window.location.search).get("lang");
            function itemMapper(itemID) {
                if (mappings[lang] != null && mappings[lang][itemID] != null) {
                    var entry = mappings[lang][itemID];
                    if (entry){
                        return "<span class='" + entry[1] + "'>" + entry[0] + "</span>";
                    }
                } else {
                    if (mappings['default'][itemID] != null) {
                        var entry = mappings['default'][itemID];
                        if (entry){
                            return "<span class='" + entry[1] + "'>" + entry[0] + "</span>";
                        }
                    }
                }
                return "<span class='blue'>" + itemID + "</span>";
            }
            (function (){
                var container = document.getElementById("container");
                record.forEach(element => {
                    var e = document.createElement("tr");
                    
136
                    e.innerHTML= "<td>" + (new Date(element.time).toLocaleString(lang)) + "</td><td>" + itemMapper(element.item) + "</td>";
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
                    container.appendChild(e);
                });
                // setup pagenation buttons
                var page = parseInt(new window.URLSearchParams(window.location.search).get("p"));
                if (!page){
                    page = 0;
                }
                document.getElementById("curpage").innerText = page + 1;
                var href = new URL(window.location);
                href.searchParams.set("p", page - 1);
                document.getElementById("prev").href = href.toString();
                href.searchParams.set("p", page + 1);
                document.getElementById("next").href = href.toString();

                if (page <= 0) {
                    document.getElementById("prev").style.display = "none";
                }
                if (page >= maxPage - 1) {
                    document.getElementById("next").style.display = "none";
                }

                // setup gacha type info
                var gachaType = new window.URLSearchParams(window.location.search).get("gachaType");
                var gachaString;
                if (mappings[lang] != null && mappings[lang][gachaType] != null) {
                    gachaString = mappings[lang][gachaType];
                }else{
                    gachaString = mappings['default'][gachaType];
                    if (gachaString == null) {
                        gachaString = gachaType;
                    }
                }
                document.getElementById("gacha-type").innerText = gachaString;
        })();
        </script>

    </body>
蓝云Reyes's avatar
蓝云Reyes committed
174
</html>