-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
346 lines (306 loc) · 14.5 KB
/
index.html
File metadata and controls
346 lines (306 loc) · 14.5 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
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
<!DOCTYPE html>
<html lang="zh-hant">
<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, viewport-fit=cover">
<meta name="theme-color" content="#ffffff">
<meta name="robots" content="index, follow">
<!-- SEO 標題與描述 -->
<title>Skill Icons 選擇器 - 邱敬幃 Pardn Chiu</title>
<meta name="title" content="Skill Icons 選擇器 - 邱敬幃 Pardn Chiu">
<meta name="description" content="透過 Skill Icons 所製作的選擇器,讓開發者能快速、方便地整合各類技能圖示,提升使用體驗與開發效率。">
<meta name="keywords" content="Skill Icons, 選擇器, 技能圖示, 前端工具, 快速整合, 開發效率, 開發者工具, 邱敬幃">
<meta name="author" content="邱敬幃 Pardn Chiu">
<link rel="author" href="https://pardn.io/">
<link rel="canonical" href="https://pardnchiu.github.io/skill-icons-picker/">
<!-- Favicon -->
<link rel="icon" href="./static/image/logo.png" type="image/x-icon">
<!-- Open Graph -->
<meta property="og:title" content="Skill Icons 選擇器 - 邱敬幃 Pardn Chiu">
<meta property="og:description" content="透過 Skill Icons 所製作的選擇器,讓開發者能快速、方便地整合各類技能圖示,提升使用體驗與開發效率。">
<!-- <meta property="og:image" content="./image/cover.jpg"> -->
<meta property="og:url" content="https://pardnchiu.github.io/skill-icons-picker/">
<meta property="og:site_name" content="QuickUI">
<meta property="og:type" content="website">
<meta property="og:locale" content="zh_TW">
<!-- Twitter -->
<meta name="twitter:card" content="summary_large_image">
<meta property="twitter:title" content="Skill Icons 選擇器 - 邱敬幃 Pardn Chiu">
<meta property="twitter:description" content="透過 Skill Icons 所製作的選擇器,讓開發者能快速、方便地整合各類技能圖示,提升使用體驗與開發效率。">
<!-- <meta property="twitter:image" content="./image/cover.jpg"> -->
<meta property="twitter:url" content="https://pardnchiu.github.io/skill-icons-picker/">
<!-- Google Verification -->
<meta name="google-site-verification" content="YQQ2f6AchR8dcb55Az2BYd_mw4TrP0J1RApD-v2v65Y">
<!-- Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-L5VYEZPVXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-L5VYEZPVXX');
</script>
<!-- Preload and Preconnect -->
<!-- link -->
<link rel="preconnect" href="https://cdn.jsdelivr.net">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="preload" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.2/css/all.min.css" as="style">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.2/css/all.min.css">
<link rel="preload" href="https://cdn.jsdelivr.net/npm/@pardnchiu/quickui@0.6.5/dist/QuickUI.js" as="script">
<script src="https://cdn.jsdelivr.net/npm/@pardnchiu/quickui@0.6.5/dist/QuickUI.js" copyright="Pardn Ltd"></script>
<link rel="preload" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0" as="style">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,1,0" />
<!-- Local Resources -->
<link rel="stylesheet" href="./static/css/index.css">
<!-- JSON-LD Schema -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebPage",
"name": "Skill Icons 選擇器 - 邱敬幃 Pardn Chiu",
"description": "透過 Skill Icons 所製作的選擇器,讓開發者能快速、方便地整合各類技能圖示,提升使用體驗與開發效率。",
"url": "https://pardnchiu.github.io/skill-icons-picker/",
"creator": {
"@type": "Person",
"name": "邱敬幃 Pardn Chiu",
"url": "https://pardn.io/"
},
"image": "./static/image/website.jpg",
"mainEntity": [
{
"@type": "WebPageElement",
"name": "關於我 - 邱敬幃",
"url": "https://pardn.io/"
},
]
}
</script>
</head>
<body id="body" :animation="fade-in">
<temp-svg src="./static/image/logo.svg" alt=""></temp-svg>
<h1 :html="i18n.title"></h1>
<a href="https://github.com/pardnchiu/skill-icons-picker/blob/main/LICENSE" target="_blank">
<span class="material-symbols-outlined">
balance
</span>
MIT License
</a>
<!-- -->
<h2>{{ i18n.picked }}</h2>
<section class="result">
<p>
<span>
<span class="material-symbols-outlined">
drag_pan
</span>
{{ i18n.drag }}
</span>
<span>
<span class="material-symbols-outlined">
touch_double
</span>
{{ i18n.tap }}
</span>
</p>
<section id="picker-result" class="result" :data-hint="i18n.empty" data-result="">
</section>
<section>
<button @click="open">
<span class="material-symbols-outlined">
open_in_new
</span>
{{ i18n.open }}
</button>
<button @click="copy">
<span class="material-symbols-outlined">
content_copy
</span>
{{ i18n.copy }}
</button>
</section>
</section>
<!-- -->
<h2>{{ i18n.all }}</h2>
<section id="picker-icon" class="icons">
<div :for="e in icons" :title="e" :data-selected="0" @click="selected">
<img :src="https://skillicons.dev/icons?i={{e}}">
<span class="material-symbols-outlined">
check_circle
</span>
</div>
</section>
<!-- -->
<footer>
<a href="https://github.com/pardnchiu/skill-icons-picker" target="_blank">
<i class="fa-brands fa-github"></i>
</a>
<a href="https://pardn.io/" target="_blank">
<i class="fa-solid fa-globe"></i>
</a>
</footer>
<!-- -->
<a :href="./index.html?lang={{ change }}" class="lang">
<i class="fa-solid fa-globe"></i>
<span>{{ change }}</span>
</a>
</body>
<script>
document.addEventListener("DOMContentLoaded", async _ => {
let icons = [], copyTimer;
await fetch("https://skillicon-list.pardn.workers.dev/")
.then(response => response.json())
.then(data => {
icons = data;
})
.catch(error => {
console.error(error);
});
const url = new URL(location.href);
const currentLanguage = navigator.language || navigator.userLanguage;
let lang = url.searchParams.get("lang");
let isZh = /^zh/i.test(currentLanguage);
if (lang != null) {
isZh = /^zh/i.test(lang);
};
lang = (isZh ? "zh" : "en");
let clickTimer = null;
let clickCount = 0;
function removeFromResult(event) {
const _this = event.target;
const title = _this.title.trim();
const picker = document.getElementById("picker-icon");
const selected = picker.querySelector("div[title='" + title + "']");
if (clickCount === 1) {
clickTimer = setTimeout(() => {
clickCount = 0;
}, 500);
}
else if (clickCount === 2 && selected != null) {
clearTimeout(clickTimer);
selected.dataset.selected = 0;
_this.remove();
clickCount = 0;
};
page.event.change();
}
page = new QUI({
id: "body",
i18n: {
zh: "./static/i18n/zh.json",
en: "./static/i18n/en.json",
},
i18nLang: isZh ? "zh" : "en",
data: {
lang: isZh ? "zh" : "en",
change: isZh ? "en" : "zh",
icons: icons
},
event: {
doubleClick: e => {
clickCount++;
removeFromResult(e);
},
doubleTab: e => {
removeFromResult(e);
},
selected: e => {
const _this = e.target;
const title = _this.title.trim();
const picker = document.getElementById("picker-result");
const selected = picker.querySelector("img[title='" + title + "']");
_this.dataset.selected = +_this.dataset.selected ? 0 : 1;
if (!+_this.dataset.selected && selected != null) {
selected.remove();
}
else if (+_this.dataset.selected) {
const img = document.createElement("img");
img.title = title;
img.src = "https://skillicons.dev/icons?i=" + title;
img.draggable = true;
img.ondragstart = page.event.dragStart;
img.ondragend = page.event.dragEnd;
img.ondragover = page.event.dragOver;
img.ondragleave = page.event.dragLeave;
img.ondrop = page.event.drop;
img.onclick = page.event.doubleClick;
img.ontouchstart = page.event.doubleTab;
picker.appendChild(img)
};
page.event.change();
},
dragStart: e => {
dragTarget = e.target;
setTimeout(() => {
dragTarget.style.opacity = "0.5";
}, 0);
},
dragEnd: e => {
setTimeout(() => {
dragTarget.style.opacity = "1";
dragTarget = null;
}, 0);
},
dragOver: e => {
e.preventDefault();
if (e.target === dragTarget) {
return;
}
e.target.style.color = "red";
},
dragLeave: e => {
e.target.style.color = "#000";
},
drop: e => {
e.preventDefault();
if (dragTarget !== e.target) {
const allItems = [...dragTarget.parentElement.children];
const droppedIndex = allItems.indexOf(e.target);
const draggedIndex = allItems.indexOf(dragTarget);
e.target.style.color = "#000";
if (draggedIndex > droppedIndex) {
console.log(dragTarget, e.target)
dragTarget.parentElement.insertBefore(dragTarget, e.target);
}
else {
dragTarget.parentElement.insertBefore(dragTarget, e.target.nextElementSibling);
};
page.event.change();
}
},
change: _ => {
const picker = document.getElementById("picker-result");
picker.dataset.result = [...picker.children].map(e => e.title).join(",");
},
open: e => {
const picker = document.getElementById("picker-result");
window.open("https://skillicons.dev/icons?i=" + picker.dataset.result)
},
copy: e => {
const picker = document.getElementById("picker-result");
const _this = e.target;
clearTimeout(copyTimer);
try {
navigator.clipboard.writeText("https://skillicons.dev/icons?i=" + picker.dataset.result);
_this.innerHTML = _this.innerHTML.replace(/拷貝連結/, "已拷貝").replace(/Copy link/, "Copied");
copyTimer = setTimeout(() => {
_this.innerHTML = _this.innerHTML.replace(/已拷貝/, "拷貝連結").replace(/Copied/, "Copy link");
}, 500);
}
catch (err) {
alert(err);
};
}
},
when: {
rendered: _ => {
document.body.addEventListener("scroll", e => {
let dom = document.getElementById("picker-result").parentElement
dom.dataset.topest = document.body.scrollTop >= dom.offsetTop ? 1 : 0
})
}
}
});
});
</script>
</html>