-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmihoyo_emoticon.html
159 lines (141 loc) · 3.76 KB
/
mihoyo_emoticon.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
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>表情包</title>
<script>
var _hmt = _hmt || [];
(function () {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?90b728e271c36bba7dbaf721120d177d";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
</head>
<body>
<div id="select"></div>
<div id="imgs"></div>
<style>
.mask::-webkit-scrollbar {
width: 0;
}
::-webkit-scrollbar-track-piece {
background-color: #f8f8f8;
}
::-webkit-scrollbar {
/* 隐藏竖向滚动条 */
width: 0px;
/* 滚动条高度 */
height: 1rem;
}
::-webkit-scrollbar-thumb {
background-color: #dddddd;
background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
background-color: #bbb;
}
body {
margin: 0;
}
:root {
--width: 20vw;
}
#select {
width: 100%;
/* 去除行间空白 */
font-size: 0;
overflow-x: scroll;
/* 显示横向滚动条 */
overflow-y: hidden;
/* 不换行 */
white-space: nowrap;
}
#imgs>img,
#select>img {
/* 去除行间空白 */
font-size: 0;
width: var(--width);
height: var(--width);
transition: 0.3s;
}
@media screen and (min-width: 720px) {
:root {
--width: 10vw;
}
}
@media screen and (min-width: 1440px) {
:root {
--width: 6.666vw;
}
}
@media screen and (min-width: 2160px) {
:root {
--width: 5vw;
}
}
@media screen and (min-width: 2880px) {
:root {
--width: 4vw;
}
}
</style>
<script>
var select = document.getElementById("select");
var imgs = document.getElementById("imgs");
var id = null;
var show_draft = false;
function load_set(id) {
imgs.innerHTML = "";
emoticon_set = emoticon_set_list.find(function (emoticon_set) {
return emoticon_set.id == id;
});
if (emoticon_set) {
document.title = emoticon_set.name;
var dom = "";
emoticon_set.list.forEach(function (emoticon) {
if (
(show_draft || emoticon.status == "published") &&
emoticon.icon
) {
dom += `<img loading="lazy" title="${emoticon.name}" src="${emoticon.icon}">`;
} else {
console.log("not published emoticon", emoticon);
}
});
imgs.innerHTML = dom;
}
}
function img_view(img) {
load_set(img.id);
}
fetch("https://bbs-api-static.mihoyo.com/misc/api/emoticon_set")
.then(function (response) {
return response.json();
})
.then(function (data) {
var list = data.data.list;
var dom = "";
list.forEach(function (emoticon_set) {
if (
(show_draft || emoticon_set.status == "published") &&
emoticon_set.icon
) {
if (id == null) {
id = emoticon_set.id;
}
dom += `<img loading="lazy" onclick="img_view(this)" id="${emoticon_set.id}" title="${emoticon_set.name}" src="${emoticon_set.icon}">`;
} else {
console.log("not published emoticon_set", emoticon_set);
}
});
select.innerHTML = dom;
window.emoticon_set_list = list;
load_set(id);
});
</script>
</body>
</html>