Open
feat: 霓虹主题变种 #3
feat: 霓虹主题变种 #3
Open
2401_89428291Add on Oct 22
Total: 1 files changed+260-0
Aindex.html+260-0
@@ -0,0 +1,260 @@
1+<!DOCTYPE html>
2+<html lang="zh-CN">
3+<head>
4+<meta charset="UTF-8">
5+<meta name="viewport" content="width=375, initial-scale=1.0">
6+<title>码道小助手</title>
7+<style>
8+ * { margin: 0; padding: 0; box-sizing: border-box; }
9+ body {
10+ width: 375px;
11+ height: 720px;
12+ font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
13+ background: #ededed;
14+ display: flex;
15+ flex-direction: column;
16+ overflow: hidden;
17+ }
18+ .header {
19+ height: 48px;
20+ background: linear-gradient(90deg, #0d0221, #1a0b2e);
21+ border-bottom: 1px solid #f72585;
22+ border-radius: 0 0 14px 14px;
23+ box-shadow: 0 0 12px rgba(247,37,133,0.45);
24+ display: flex;
25+ align-items: center;
26+ justify-content: center;
27+ font-size: 17px;
28+ font-weight: 600;
29+ color: #00f5d4;
30+ text-shadow: 0 0 8px rgba(0,245,212,0.7);
31+ position: relative;
32+ }
33+ .header .back {
34+ position: absolute;
35+ left: 12px;
36+ font-size: 22px;
37+ color: #00f5d4;
38+ line-height: 1;
39+ }
40+ .chat {
41+ flex: 1;
42+ padding: 12px 10px;
43+ display: flex;
44+ flex-direction: column;
45+ gap: 16px;
46+ overflow-y: auto;
47+ }
48+ .msg {
49+ display: flex;
50+ align-items: flex-start;
51+ }
52+ .msg.me { justify-content: flex-end; }
53+ .avatar {
54+ width: 36px;
55+ height: 36px;
56+ border-radius: 4px;
57+ flex-shrink: 0;
58+ }
59+ .avatar.other { background: #7cbcf0; }
60+ .avatar.me { background: linear-gradient(135deg, #00f5d4, #f72585); }
61+ .bubble {
62+ max-width: 220px;
63+ padding: 9px 12px;
64+ border-radius: 8px;
65+ font-size: 15px;
66+ line-height: 1.4;
67+ word-break: break-word;
68+ position: relative;
69+ box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
70+ }
71+ .msg.other .bubble {
72+ background: #fff;
73+ color: #000;
74+ margin-left: 8px;
75+ }
76+ .msg.other .bubble::before {
77+ content: "";
78+ position: absolute;
79+ left: -6px;
80+ top: 12px;
81+ border: 6px solid transparent;
82+ border-right-color: #fff;
83+ border-left: 0;
84+ }
85+ .msg.me .bubble {
86+ background: linear-gradient(135deg, #00f5d4, #7b2ff8, #f72585);
87+ color: #fff;
88+ margin-right: 8px;
89+ }
90+ .msg.me .bubble::before {
91+ content: "";
92+ position: absolute;
93+ right: -6px;
94+ top: 12px;
95+ border: 6px solid transparent;
96+ border-left-color: #f72585;
97+ border-right: 0;
98+ }
99+ .input-bar {
100+ height: 52px;
101+ background: #f7f7f7;
102+ border-top: 1px solid #d6d6d6;
103+ display: flex;
104+ align-items: center;
105+ padding: 0 10px;
106+ gap: 8px;
107+ }
108+ .input-bar .icon {
109+ width: 28px;
110+ height: 28px;
111+ display: flex;
112+ align-items: center;
113+ justify-content: center;
114+ font-size: 22px;
115+ color: #333;
116+ }
117+ .input-bar input {
118+ flex: 1;
119+ height: 36px;
120+ border: 1px solid #ddd;
121+ border-radius: 4px;
122+ padding: 0 8px;
123+ font-size: 15px;
124+ outline: none;
125+ background: #fff;
126+ }
127+ .msg {
128+ opacity: 0;
129+ transform: translateY(10px);
130+ animation: pop 0.28s ease forwards;
131+ }
132+ @keyframes pop {
133+ to { opacity: 1; transform: translateY(0); }
134+ }
135+ .typing {
136+ display: flex;
137+ align-items: flex-start;
138+ gap: 8px;
139+ }
140+ .typing .avatar { background: #7cbcf0; }
141+ .typing .dots {
142+ background: #fff;
143+ border-radius: 8px;
144+ padding: 9px 12px;
145+ font-size: 14px;
146+ color: #00f5d4;
147+ display: flex;
148+ align-items: center;
149+ box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
150+ }
151+ .typing .ellipsis::after {
152+ content: "";
153+ animation: dots 1.4s steps(1, end) infinite;
154+ }
155+ @keyframes dots {
156+ 0% { content: ""; }
157+ 25% { content: "."; }
158+ 50% { content: ".."; }
159+ 75% { content: "..."; }
160+ 100% { content: ""; }
161+ }
162+ .time-divider {
163+ align-self: center;
164+ background: #dadada;
165+ color: #fff;
166+ font-size: 12px;
167+ padding: 3px 12px;
168+ border-radius: 12px;
169+ margin: 6px 0;
170+ opacity: 0;
171+ animation: pop 0.28s ease forwards;
172+ }
173+</style>
174+</head>
175+<body>
176+ <div class="header">
177+ <span class="back">‹</span>
178+ 码道小助手
179+ </div>
180+ <div class="chat" id="chat"></div>
181+ <div class="input-bar">
182+ <div class="icon">+</div>
183+ <input type="text" placeholder="说点什么...">
184+ <div class="icon">😊</div>
185+ </div>
186+ <script>
187+ const script = [
188+ { who: "other", text: "在吗?" },
189+ { who: "me", text: "在的,怎么啦?" },
190+ { who: "other", text: "我想用 AI 做一个无限动画,听说可以用 git 边做边回退?" },
191+ { who: "me", text: "对,思路很简单" },
192+ { who: "me", text: "满意就 commit,不满意就 checkout / reset 回退再改" },
193+ { who: "other", text: "懂了,那我先去试试" },
194+ { who: "me", text: "👍 有不懂的随时问" }
195+ ];
196+ const chat = document.getElementById("chat");
197+ const wait = ms => new Promise(r => setTimeout(r, ms));
198+ 
199+ function scrollBottom() {
200+ chat.scrollTop = chat.scrollHeight;
201+ }
202+ 
203+ function addMsg(who, text) {
204+ const div = document.createElement("div");
205+ div.className = "msg " + who;
206+ const avatar = `<div class="avatar ${who}"></div>`;
207+ const bubble = `<div class="bubble">${text}</div>`;
208+ div.innerHTML = who === "me" ? bubble + avatar : avatar + bubble;
209+ chat.appendChild(div);
210+ scrollBottom();
211+ }
212+ 
213+ function showTyping() {
214+ const div = document.createElement("div");
215+ div.className = "typing";
216+ div.id = "typing";
217+ div.innerHTML = `<div class="avatar"></div><div class="dots">对方正在输入<span class="ellipsis"></span></div>`;
218+ chat.appendChild(div);
219+ scrollBottom();
220+ }
221+ 
222+ function hideTyping() {
223+ const t = document.getElementById("typing");
224+ if (t) t.remove();
225+ }
226+ 
227+ function addTime() {
228+ const now = new Date();
229+ const hh = String(now.getHours()).padStart(2, "0");
230+ const mm = String(now.getMinutes()).padStart(2, "0");
231+ const div = document.createElement("div");
232+ div.className = "time-divider";
233+ div.textContent = hh + ":" + mm;
234+ chat.appendChild(div);
235+ scrollBottom();
236+ }
237+ 
238+ async function play() {
239+ while (true) {
240+ chat.innerHTML = "";
241+ addTime();
242+ await wait(400);
243+ for (const m of script) {
244+ if (m.who === "other") {
245+ showTyping();
246+ await wait(1100);
247+ hideTyping();
248+ } else {
249+ await wait(500);
250+ }
251+ addMsg(m.who, m.text);
252+ await wait(700);
253+ }
254+ await wait(2200);
255+ }
256+ }
257+ play();
258+ </script>
259+</body>
260+</html>