-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
196 lines (164 loc) · 8.63 KB
/
index.html
File metadata and controls
196 lines (164 loc) · 8.63 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
<!doctype html>
<html lang="zh-Hant">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="author" content="ecjojo toolbox" />
<meta name="description" content="Emoji, symbols, cute fonts toolkit by ecjojo." />
<meta property="og:type" content="website" />
<meta property="og:title" content="ecjojo toolbox" />
<meta property="og:description" content="Emoji book, symbol book, cute font generator." />
<title>ecjojo clipboard - emoji | 顏文字 | 符號</title>
<!-- App CSS -->
<link rel="stylesheet" href="styles.css">
<link rel="icon"
href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ctext y='.9em' font-size='90'%3E%F0%9F%A7%B0%3C/text%3E%3C/svg%3E" />
</head>
<body>
<main class="page-wrap" role="main">
<section class="card-shell" aria-label="toolbox">
<!-- Toolbar / Tabs (only: ᴇᴍᴏᴊɪ / ꜱʏᴍʙᴏʟ / ꜰᴏɴᴛ) -->
<div class="toolbar" role="tablist" aria-label="工具切換">
<button type="button" class="toggle-button" role="tab" aria-selected="true"
aria-pressed="true">ᴇᴍᴏᴊɪ</button>
<button type="button" class="toggle-button" role="tab"
aria-selected="false" aria-pressed="false">ᴋᴀᴏᴍᴏᴊɪ</button>
<button type="button" class="toggle-button" role="tab" aria-selected="false"
aria-pressed="false">ꜱʏᴍʙᴏʟ</button>
<button type="button" class="toggle-button" role="tab" aria-selected="false"
aria-pressed="false">ꜰᴏɴᴛ</button>
</div>
<!-- Panels -->
<div class="content-container">
<!-- Emoji Book -->
<section class="toggle-content active" role="tabpanel" aria-label="emoji book">
<hr />
<h5 class="section-title">ᴇᴍᴏᴊɪ ʙᴏᴏᴋ⁵</h5>
<div id="recent-emojis" aria-live="polite"></div>
<div id="emoji-book"></div>
</section>
<section class="toggle-content" role="tabpanel" aria-label="kaomoji book">
<hr />
<h5 class="section-title">ᴋᴀᴏᴍᴏᴊɪ ʙᴏᴏᴋ</h5>
<div id="recent-kaomojis" aria-live="polite"></div>
<div id="kaomoji-book"></div>
</section>
<!-- Symbol Book -->
<section class="toggle-content" role="tabpanel" aria-label="symbol book">
<hr />
<h5 class="section-title">ꜱʏᴍʙᴏʟ ʙᴏᴏᴋ</h5>
<div id="recent-symbols" aria-live="polite"></div>
<div id="symbol-book"></div>
</section>
<!-- Cute Font Generator -->
<section class="toggle-content" role="tabpanel" aria-label="cute font generator">
<hr />
<h5 class="section-title">ᴄᴜᴛᴇ ꜰᴏɴᴛ ɢᴇɴᴇʀᴀᴛᴏʀ</h5>
<!-- 輸入框 -->
<textarea class="form-control dark-textarea fancytext" rows="3"
placeholder="Type or paste text here..." autocomplete="off" autocapitalize="off"
spellcheck="false" aria-label="Input text to convert into cute font"></textarea>
<!-- 預覽與複製 -->
<div id="result" class="mt-3">
<div class="input-group mb-3">
<input type="text" class="form-control dark-input text-9" id="copy_8" value="ᴘʀᴇᴠɪᴇᴡ ᴛᴇxᴛ"
readonly aria-live="polite">
<div class="input-group-append">
<button type="button" class="input-group-text copybutton" data-clipboard-action="copy"
data-clipboard-target="#copy_8" aria-label="Copy converted text">
Copy
</button>
</div>
</div>
</div>
</section>
</div>
<hr />
<!-- Socials -->
<div class="container text-center">
<nav class="socials" aria-label="social links">
<a href="https://twitter.com/ecjojoDEV" aria-label="Twitter" data-hover="twitter"><i
class="fa fa-twitter fa-lg" aria-hidden="true"></i><span class="sr-only">Twitter</span></a>
<a href="https://www.youtube.com/@ecjojoDEV" aria-label="YouTube" data-hover="youtube"><i
class="fa fa-youtube-play fa-lg" aria-hidden="true"></i><span
class="sr-only">YouTube</span></a>
<a href="https://github.com/ecjojo" aria-label="GitHub" data-hover="github"><i
class="fa fa-github fa-lg" aria-hidden="true"></i><span class="sr-only">GitHub</span></a>
<a href="https://discord.gg/2uFuM9UjEJ" aria-label="Discord" data-hover="discord"><i
class="fa fa-comments fa-lg" aria-hidden="true"></i><span class="sr-only">Discord</span></a>
<a href="https://www.linkedin.com/in/ecjojo/" aria-label="LinkedIn" data-hover="linkedin"><i
class="fa fa-linkedin fa-lg" aria-hidden="true"></i><span
class="sr-only">LinkedIn</span></a>
</nav>
</div>
<footer>© 2024 <a href="https://ecjojo.github.io/">ecjojo studio</a></footer>
</section>
</main>
<!-- Local scripts (kept only needed ones) -->
<script defer src="js/clipboard.js"></script>
<script defer src="js/fonts.js"></script>
<script defer src="js/preview.js"></script>
<script defer src="js/copybutton.js"></script>
<script defer src="js/tooldisplay.js"></script>
<!-- Progressive enhancement for tabs -->
<script type="module">
document.addEventListener('DOMContentLoaded', () => {
const buttons = Array.from(document.querySelectorAll('.toggle-button'));
const panels = Array.from(document.querySelectorAll('.toggle-content'));
const loaders = {
"emoji book": () => import('./js/emojibook.js'),
"symbol book": () => import('./js/symbolbook.js'),
"cute font generator": () => Promise.resolve(), // 已載入
"kaomoji book": () => import('./js/kaomojibook.js'), // ← 加這行
};
const loaded = new Set();
function activate(idx) {
// 先對「將要被隱藏」的 Emoji 面板做 unmount(把 DOM 縮小)
const currentActive = panels.findIndex(p => p.classList.contains('active'));
if (currentActive !== -1) {
const currentLabel = panels[currentActive].getAttribute('aria-label');
if (currentLabel === 'emoji book' && window.emojiBook?.unmount) {
window.emojiBook.unmount();
}
}
// 切換 aria / 類
buttons.forEach((btn, i) => {
const active = i === idx;
btn.setAttribute('aria-selected', active);
btn.setAttribute('aria-pressed', active);
});
panels.forEach((p, i) => p.classList.toggle('active', i === idx));
// Lazy import
const label = panels[idx].getAttribute('aria-label');
if (!loaded.has(label)) {
loaders[label]?.().catch(console.error).finally(() => {
loaded.add(label);
// 首次載入完如果是 emoji 面板,馬上掛載
if (label === 'emoji book' && window.emojiBook?.mount) {
window.emojiBook.mount();
}
});
} else {
// 已載入過 → 如果是 emoji 面板,切回時馬上掛載
if (label === 'emoji book' && window.emojiBook?.mount) {
window.emojiBook.mount();
}
}
}
buttons.forEach((btn, i) => btn.addEventListener('click', () => activate(i)));
document.querySelector('.toolbar').addEventListener('keydown', (e) => {
const current = document.activeElement;
const idx = buttons.indexOf(current);
if (idx < 0) return;
if (e.key === 'ArrowRight') buttons[(idx + 1) % buttons.length].focus();
if (e.key === 'ArrowLeft') buttons[(idx - 1 + buttons.length) % buttons.length].focus();
if (e.key === 'Home') buttons[0].focus();
if (e.key === 'End') buttons[buttons.length - 1].focus();
if (e.key === 'Enter' || e.key === ' ') activate(idx);
});
// 預設第一個面板活化(會觸發對應 lazy )
activate(0);
});
</script>
</body>
</html>