-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex3.html
More file actions
672 lines (624 loc) · 33.3 KB
/
Copy pathindex3.html
File metadata and controls
672 lines (624 loc) · 33.3 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
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
<!DOCTYPE html>
<html lang="th" data-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Git Command Reference — C:\ProjectTest</title>
<link href="https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
*{margin:0;padding:0;box-sizing:border-box;}
[data-theme="dark"]{
--bg:#080c12;--bg2:#0d1420;--bg3:#121a28;--bg4:#182030;
--glass:rgba(13,20,32,0.84);--border:rgba(255,255,255,0.07);
--border2:rgba(255,255,255,0.14);--text:#e6edf8;--text2:#8898aa;--text3:#364556;
--moon:rgba(255,255,255,0.07);--term:#060a0f;
--c1:#1d6feb;--l1:#60a5fa;--g1:rgba(29,111,235,0.12);
--c2:#16a34a;--l2:#4ade80;--g2:rgba(22,163,74,0.12);
--c3:#7c3aed;--l3:#a78bfa;--g3:rgba(124,58,237,0.12);
--c4:#ca8a04;--l4:#fbbf24;--g4:rgba(202,138,4,0.12);
--c5:#0891b2;--l5:#22d3ee;--g5:rgba(8,145,178,0.12);
}
[data-theme="light"]{
--bg:#f0f4fb;--bg2:#ffffff;--bg3:#f6f9ff;--bg4:#edf1fa;
--glass:rgba(255,255,255,0.88);--border:rgba(0,0,0,0.08);
--border2:rgba(0,0,0,0.16);--text:#0d1420;--text2:#4a5568;--text3:#aab4c0;
--moon:rgba(0,0,0,0.07);--term:#111827;
--c1:#1d4ed8;--l1:#1d6feb;--g1:rgba(29,78,216,0.09);
--c2:#15803d;--l2:#16a34a;--g2:rgba(21,128,61,0.09);
--c3:#6d28d9;--l3:#7c3aed;--g3:rgba(109,40,217,0.09);
--c4:#b45309;--l4:#ca8a04;--g4:rgba(180,83,9,0.09);
--c5:#0e7490;--l5:#0891b2;--g5:rgba(14,116,144,0.09);
--term:#111827;
}
html,body{width:100%;height:100%;overflow:hidden;font-family:'Prompt',sans-serif;}
body{background:var(--bg);color:var(--text);display:flex;flex-direction:column;transition:background .35s,color .35s;}
/* mesh */
.mesh{position:fixed;border-radius:50%;filter:blur(100px);pointer-events:none;z-index:0;opacity:.07;transition:all .5s;}
#m1{width:580px;height:580px;top:-200px;left:-200px;background:var(--c1);}
#m2{width:480px;height:480px;bottom:-160px;right:-160px;background:var(--c3);}
/* particles */
#pts{position:fixed;inset:0;pointer-events:none;z-index:0;overflow:hidden;}
.pd{position:absolute;border-radius:50%;animation:pdrift linear infinite;opacity:0;}
@keyframes pdrift{0%{transform:translateY(100vh);opacity:0;}8%{opacity:.35;}92%{opacity:.12;}100%{transform:translateY(-5vh);opacity:0;}}
.shell{position:relative;z-index:1;height:100vh;display:flex;flex-direction:column;overflow:hidden;}
/* HEADER */
header{
flex-shrink:0;display:flex;align-items:center;justify-content:space-between;
padding:11px 26px;
background:var(--glass);backdrop-filter:blur(24px);
border-bottom:1px solid var(--border);
}
.hl{display:flex;align-items:center;gap:11px;}
.gitlogo{
width:32px;height:32px;
background:linear-gradient(135deg,#f05033,#c0392b);
border-radius:8px;display:flex;align-items:center;justify-content:center;
box-shadow:0 0 16px rgba(240,80,51,.4);flex-shrink:0;
}
.gitlogo svg{width:20px;height:20px;}
.h-title{font-size:15.5px;font-weight:700;letter-spacing:-.02em;}
.h-path{font-family:'Courier New',monospace;font-size:12.5px;background:var(--bg4);border:1px solid var(--border);border-radius:7px;padding:3px 13px;color:var(--l1);letter-spacing:.02em;}
.h-sub{font-size:11.5px;color:var(--text3);font-weight:300;}
.hr{display:flex;align-items:center;gap:9px;}
.hbadge{font-size:12px;font-weight:500;background:var(--g2);color:var(--l2);border:1px solid rgba(22,163,74,.22);border-radius:20px;padding:3px 13px;}
.moonbtn{width:36px;height:36px;background:var(--moon);border:1px solid var(--border);border-radius:9px;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:all .22s;font-size:17px;user-select:none;}
.moonbtn:hover{background:var(--border2);transform:scale(1.1) rotate(-20deg);}
/* ═══════════════════════════════
GIT GRAPH SECTION
═══════════════════════════════ */
.graph-section{
flex-shrink:0;
background:var(--bg2);
border-bottom:1px solid var(--border);
padding:14px 26px 10px;
position:relative;overflow:hidden;
}
.graph-section::before{
content:'';position:absolute;inset:0;
background:repeating-linear-gradient(90deg,transparent,transparent 60px,rgba(255,255,255,.012) 60px,rgba(255,255,255,.012) 61px);
pointer-events:none;
}
[data-theme="light"] .graph-section::before{background:repeating-linear-gradient(90deg,transparent,transparent 60px,rgba(0,0,0,.025) 60px,rgba(0,0,0,.025) 61px);}
.graph-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;}
.graph-label{font-size:11px;font-weight:600;color:var(--text3);letter-spacing:.08em;text-transform:uppercase;}
.graph-legend{display:flex;align-items:center;gap:14px;}
.leg-item{display:flex;align-items:center;gap:5px;font-size:11px;color:var(--text3);}
.leg-dot{width:8px;height:8px;border-radius:50%;}
#gc{display:block;width:100%;height:96px;cursor:pointer;}
/* TABS */
.tabs{flex-shrink:0;display:flex;background:var(--bg2);border-bottom:1px solid var(--border);padding:0 26px;overflow-x:auto;}
.tabs::-webkit-scrollbar{display:none;}
.tab{display:flex;align-items:center;gap:7px;padding:10px 17px;cursor:pointer;white-space:nowrap;border-bottom:2.5px solid transparent;font-size:13px;font-weight:500;color:var(--text3);transition:all .2s;}
.tab:hover{color:var(--text2);}
.tab.on{color:var(--lc,var(--l1));border-bottom-color:var(--lc,var(--l1));}
.tab .tn{width:21px;height:21px;border-radius:50%;background:var(--bg4);display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;color:var(--text3);transition:all .2s;}
.tab.on .tn{background:var(--lc);color:#fff;}
/* CONTENT */
.content{flex:1;overflow:hidden;display:grid;grid-template-columns:1fr 1fr;gap:0;}
/* LEFT */
.lp{overflow-y:auto;padding:18px 22px;display:flex;flex-direction:column;gap:13px;border-right:1px solid var(--border);}
.sec-header{display:flex;align-items:center;gap:10px;padding:11px 15px;background:var(--gc,var(--g1));border:1px solid var(--bc2,rgba(29,111,235,.2));border-left:3px solid var(--lc,var(--l1));border-radius:10px;transition:all .3s;}
.sec-icon{font-size:17px;flex-shrink:0;}
.sec-title{font-size:15px;font-weight:700;color:var(--lc,var(--l1));}
.sec-desc{font-size:12px;color:var(--text2);font-weight:300;margin-left:auto;}
.cmd-list{display:flex;flex-direction:column;gap:6px;}
.cmd-card{display:flex;align-items:stretch;background:var(--bg3);border:1px solid var(--border);border-radius:9px;overflow:hidden;transition:border-color .18s,transform .18s;cursor:default;}
.cmd-card:hover{border-color:var(--lc,var(--l1));transform:translateX(4px);}
.cmd-acc{width:3px;flex-shrink:0;background:var(--lc,var(--l1));opacity:.45;}
.cmd-card:hover .cmd-acc{opacity:1;}
.cmd-inner{flex:1;padding:10px 14px;display:flex;align-items:center;gap:11px;}
.cmd-p{color:var(--l2);font-family:'Courier New',monospace;font-size:13.5px;font-weight:700;flex-shrink:0;}
.cmd-t{font-family:'Courier New',monospace;font-size:13.5px;color:var(--text);flex:1;}
.cmd-t .flag{color:var(--l4);}
.cmd-t .str{color:var(--l2);}
.cmd-t .url{color:var(--l5);}
.cmd-n{font-size:11.5px;color:var(--text3);font-weight:300;flex-shrink:0;text-align:right;max-width:155px;line-height:1.45;}
.cmd-card:hover .cmd-n{color:var(--text2);}
/* RIGHT TERMINAL */
.rp{display:flex;flex-direction:column;overflow:hidden;background:var(--term);}
.tbar{display:flex;align-items:center;gap:7px;padding:8px 17px;background:rgba(0,0,0,.35);border-bottom:1px solid rgba(255,255,255,.05);flex-shrink:0;}
.tdot{width:11px;height:11px;border-radius:50%;}
.tbt{font-size:11px;color:#334155;margin-left:5px;font-family:'Courier New',monospace;}
.tbr{margin-left:auto;display:flex;align-items:center;gap:8px;}
.tbd{font-size:10.5px;background:rgba(29,111,235,.12);border:1px solid rgba(29,111,235,.22);padding:2px 10px;border-radius:5px;color:#60a5fa;font-family:'Courier New',monospace;}
.tbtag{font-size:10px;padding:2px 8px;border-radius:5px;font-weight:500;transition:all .3s;}
.tbody{flex:1;overflow-y:auto;padding:16px 20px;display:flex;flex-direction:column;gap:0;}
.tl{display:flex;font-family:'Courier New',monospace;font-size:13.5px;line-height:1.88;opacity:0;animation:tlin .17s ease forwards;}
@keyframes tlin{from{opacity:0;transform:translateX(-5px);}to{opacity:1;transform:none;}}
.tblk{height:9px;}
.tsec{font-size:11px;font-weight:600;font-family:'Prompt',sans-serif;padding:3px 10px;border-radius:5px;margin:5px 0 3px;display:inline-block;opacity:0;animation:tlin .18s ease forwards;}
.t-ps{color:#22c55e;}.t-pa{color:#60a5fa;}.t-sep{color:#334155;}
.t-cm{color:#e2e8f4;}.t-fl{color:#fbbf24;}.t-st{color:#86efac;}.t-url{color:#22d3ee;}
.og{color:#4b5563;}.ogr{color:#22c55e;}.oy{color:#fbbf24;}
.ob{color:#60a5fa;}.op{color:#a78bfa;}.or{color:#f87171;}
.cur{display:inline-block;width:8px;height:14px;background:#e2e8f4;opacity:.8;animation:bl .75s step-end infinite;vertical-align:middle;margin-left:2px;border-radius:1px;}
@keyframes bl{0%,100%{opacity:.8;}50%{opacity:0;}}
/* NAV */
.fnav{flex-shrink:0;display:flex;align-items:center;justify-content:space-between;padding:9px 26px 12px;background:var(--glass);backdrop-filter:blur(24px);border-top:1px solid var(--border);}
.nb{display:flex;align-items:center;gap:7px;padding:9px 22px;border-radius:10px;font-size:13.5px;font-weight:500;font-family:'Prompt',sans-serif;cursor:pointer;transition:all .18s;border:1px solid var(--border);background:var(--bg4);color:var(--text2);}
.nb:hover:not(:disabled){border-color:var(--border2);color:var(--text);transform:translateY(-1px);}
.nb:disabled{opacity:.3;cursor:default;}
.nb.pri{background:var(--lc,var(--c1));border-color:var(--lc,var(--c1));color:#fff;}
.nb.pri:hover:not(:disabled){filter:brightness(1.1);transform:translateY(-2px);}
.fc{display:flex;flex-direction:column;align-items:center;gap:4px;}
.fds{display:flex;gap:7px;}
.fd{width:7px;height:7px;border-radius:50%;background:var(--border2);transition:all .28s;}
.fd.on{background:var(--lc);box-shadow:0 0 9px var(--lc);}
.ffr{font-size:11.5px;color:var(--text3);font-family:'Courier New',monospace;}
::-webkit-scrollbar{width:4px;}
::-webkit-scrollbar-track{background:transparent;}
::-webkit-scrollbar-thumb{background:var(--border2);border-radius:2px;}
</style>
</head>
<body>
<div id="pts"></div>
<div class="mesh" id="m1"></div>
<div class="mesh" id="m2"></div>
<div class="shell">
<!-- HEADER -->
<header>
<div class="hl">
<div class="gitlogo">
<svg viewBox="0 0 24 24" fill="white"><path d="M23.546 10.93L13.067.452a1.55 1.55 0 00-2.188 0L8.708 2.627l2.76 2.76a1.838 1.838 0 012.327 2.341l2.658 2.66a1.838 1.838 0 11-1.1 1.098L12.694 8.84v6.479a1.838 1.838 0 11-1.508-.05V8.73a1.84 1.84 0 01-.999-2.416L7.45 3.552.452 10.55a1.55 1.55 0 000 2.189l10.478 10.478a1.55 1.55 0 002.188 0l10.428-10.428a1.55 1.55 0 000-2.188"/></svg>
</div>
<span class="h-title">Git Command Reference</span>
<span class="h-path">C:\ProjectTest</span>
<span class="h-sub">Full Workflow + Cheatsheet</span>
</div>
<div class="hr">
<span class="hbadge">● Git Workflow</span>
<div class="moonbtn" id="moonbtn" onclick="toggleTheme()" title="Dark / Light (M)">🌙</div>
</div>
</header>
<!-- ═══ GIT GRAPH ═══ -->
<div class="graph-section">
<div class="graph-header">
<span class="graph-label">⬡ Git Graph Workflow — C:\ProjectTest</span>
<div class="graph-legend">
<div class="leg-item"><div class="leg-dot" style="background:#60a5fa"></div>config</div>
<div class="leg-item"><div class="leg-dot" style="background:#4ade80"></div>main</div>
<div class="leg-item"><div class="leg-dot" style="background:#a78bfa"></div>feature branch</div>
<div class="leg-item"><div class="leg-dot" style="background:#fbbf24"></div>commit</div>
<div class="leg-item"><div class="leg-dot" style="background:#22d3ee"></div>remote / push</div>
</div>
</div>
<canvas id="gc" height="96" title="คลิกที่ node เพื่อไปยัง section นั้น"></canvas>
</div>
<!-- TABS -->
<div class="tabs" id="tabs"></div>
<!-- CONTENT -->
<div class="content">
<div class="lp" id="lp"></div>
<div class="rp">
<div class="tbar">
<span class="tdot" style="background:#ff5f57"></span>
<span class="tdot" style="background:#febc2e"></span>
<span class="tdot" style="background:#28c840"></span>
<span class="tbt">Git Bash — C:\ProjectTest</span>
<div class="tbr">
<span class="tbd">C:\ProjectTest</span>
<span class="tbtag" id="tbrtag">main</span>
</div>
</div>
<div class="tbody" id="tbody"></div>
</div>
</div>
<!-- FOOTER NAV -->
<div class="fnav">
<button class="nb" id="btnprev" onclick="go(-1)" disabled>← ก่อนหน้า</button>
<div class="fc">
<div class="fds" id="fdots"></div>
<div class="ffr" id="ffrac">1 / 5</div>
</div>
<button class="nb pri" id="btnnext" onclick="go(1)">ถัดไป →</button>
</div>
</div>
<script>
/* ══════════════════════════════════════════
DATA
══════════════════════════════════════════ */
const SECS=[
{
id:'config',label:'Config',icon:'⚙️',desc:'ตั้งค่าครั้งแรก (1 ครั้งเท่านั้น)',
col:'--c1',light:'--l1',glow:'--g1',
tagBg:'rgba(29,111,235,.15)',tagTx:'#60a5fa',tagBd:'rgba(29,111,235,.25)',tagLb:'(1 time)',
branch:'main',
cmds:[
{c:'git config --global user.name',f:'',s:' "Username"',u:'',n:'ตั้งชื่อผู้ใช้ GitHub'},
{c:'git config --global user.email',f:'',s:' "Email GitHub"',u:'',n:'ตั้ง email GitHub'},
{c:'git config --global',f:' --list',s:'',u:'',n:'ตรวจสอบค่าที่ตั้งทั้งหมด'},
],
terminal:[
{sec:'⚙️ Config — ตั้งค่าครั้งแรก (1 time)',col:'rgba(29,111,235,.15)',tc:'#60a5fa'},
{cmd:true,t:'git config <span class="t-fl">--global</span> user.name <span class="t-st">"AI Pairoj"</span>'},
{cmd:true,t:'git config <span class="t-fl">--global</span> user.email <span class="t-st">"aipairoj@gmail.com"</span>'},
{cmd:true,t:'git config <span class="t-fl">--global --list</span>'},
{out:'oy',t:'user.name=AI Pairoj'},
{out:'oy',t:'user.email=aipairoj@gmail.com'},
null,
{out:'ogr',t:'✓ Config สำเร็จ — พร้อมใช้ Git แล้ว'},
]
},
{
id:'start',label:'Start Git',icon:'🚀',desc:'init → add → commit → push',
col:'--c2',light:'--l2',glow:'--g2',
tagBg:'rgba(22,163,74,.15)',tagTx:'#4ade80',tagBd:'rgba(22,163,74,.25)',tagLb:'main',
branch:'main',
cmds:[
{c:'git init',f:'',s:'',u:'',n:'เริ่มต้น repo ใหม่ใน folder ปัจจุบัน'},
{c:'git add',f:'',s:' .',u:'',n:'stage ไฟล์ทั้งหมดเข้า Staging Area'},
{c:'git commit',f:' -m',s:' "message"',u:'',n:'บันทึก snapshot พร้อม message'},
{c:'git status',f:'',s:'',u:'',n:'ดูสถานะไฟล์ปัจจุบัน'},
{c:'git log',f:'',s:'',u:'',n:'ดูประวัติ commit ทั้งหมด'},
{c:'git log',f:' --oneline',s:'',u:'',n:'ดู commit แบบย่อ 1 บรรทัด'},
{c:'git checkout',f:'',s:'',u:'',n:'เปลี่ยน branch หรือ restore ไฟล์'},
{c:'git branch',f:' -M',s:' main',u:'',n:'เปลี่ยนชื่อ branch เป็น main'},
{c:'git remote add origin',f:'',s:'',u:' https://github.com/...',n:'เชื่อม remote repository'},
{c:'git push',f:' -u',s:' origin main',u:'',n:'push ครั้งแรก + set upstream'},
],
terminal:[
{sec:'🚀 Start Git — เริ่มต้นโปรเจกต์',col:'rgba(22,163,74,.15)',tc:'#4ade80'},
{cmd:true,t:'git init'},
{out:'ogr',t:'Initialized empty Git repository in C:/ProjectTest/.git/'},
null,
{cmd:true,t:'git add <span class="t-st">.</span>'},
{cmd:true,t:'git commit <span class="t-fl">-m</span> <span class="t-st">"initial commit"</span>'},
{out:'oy',t:'[main (root-commit) a1b2c3d] initial commit'},
{out:'og',t:' 3 files changed, 42 insertions(+)'},
null,
{cmd:true,t:'git remote add origin <span class="t-url">https://github.com/aipairoj/ProjectTest.git</span>'},
{cmd:true,t:'git branch <span class="t-fl">-M</span> <span class="t-st">main</span>'},
{cmd:true,t:'git push <span class="t-fl">-u</span> origin main'},
{out:'ob',t:"Branch 'main' set up to track origin/main."},
{out:'ogr',t:'✓ Push สำเร็จ — ขึ้น GitHub แล้ว'},
]
},
{
id:'branch',label:'Branch',icon:'🌿',desc:'สร้างและจัดการ Branch',
col:'--c3',light:'--l3',glow:'--g3',
tagBg:'rgba(124,58,237,.15)',tagTx:'#a78bfa',tagBd:'rgba(124,58,237,.25)',tagLb:'feature/xxx',
branch:'feature/login',
cmds:[
{c:'git branch',f:'',s:'',u:'',n:'ดูรายการ branch ทั้งหมด'},
{c:'git branch',f:'',s:' branch_name',u:'',n:'สร้าง branch ใหม่ (ไม่ switch)'},
{c:'git checkout',f:' -b',s:' branch_name',u:'',n:'สร้าง branch ใหม่ + switch ทันที'},
{c:'git checkout',f:'',s:' branch_name',u:'',n:'switch ไป branch ที่มีอยู่'},
],
terminal:[
{sec:'🌿 Branch — สร้างและสลับ Branch',col:'rgba(124,58,237,.15)',tc:'#a78bfa'},
{cmd:true,t:'git branch'},
{out:'ogr',t:'* main'},
null,
{cmd:true,t:'git branch <span class="t-st">feature/login</span>'},
{cmd:true,t:'git branch'},
{out:'og',t:' feature/login'},
{out:'ogr',t:'* main'},
null,
{cmd:true,t:'git checkout <span class="t-fl">-b</span> <span class="t-st">feature/login</span>'},
{out:'op',t:"Switched to a new branch 'feature/login'"},
null,
{cmd:true,t:'git checkout <span class="t-st">feature/login</span>'},
{out:'op',t:"Switched to branch 'feature/login'"},
{out:'ogr',t:'✓ อยู่ใน feature/login แล้ว'},
]
},
{
id:'merge',label:'Merge',icon:'🔀',desc:'รวม Branch กลับ master',
col:'--c4',light:'--l4',glow:'--g4',
tagBg:'rgba(202,138,4,.15)',tagTx:'#fbbf24',tagBd:'rgba(202,138,4,.25)',tagLb:'merge → main',
branch:'master',
cmds:[
{c:'git checkout',f:'',s:' master',u:'',n:'กลับ master ก่อน merge'},
{c:'git merge',f:'',s:' branch_name',u:'',n:'รวม branch เข้า master'},
{c:'git branch',f:' -d',s:' branch_name',u:'',n:'ลบ branch ที่ merge แล้ว'},
],
terminal:[
{sec:'🔀 Merge — รวม Branch เข้า master',col:'rgba(202,138,4,.15)',tc:'#fbbf24'},
{cmd:true,t:'git checkout <span class="t-st">master</span>'},
{out:'og',t:"Switched to branch 'master'"},
null,
{cmd:true,t:'git merge <span class="t-st">feature/login</span>'},
{out:'ogr',t:'Updating e5f6a7b..a1b2c3d'},
{out:'ogr',t:'Fast-forward'},
{out:'og',t:' login.php | 1 + 1 file changed'},
null,
{cmd:true,t:'git branch <span class="t-fl">-d</span> <span class="t-st">feature/login</span>'},
{out:'og',t:"Deleted branch feature/login (was a1b2c3d)."},
{out:'ogr',t:'✓ Merge สำเร็จ — ทำ push ต่อได้เลย'},
]
},
{
id:'pull',label:'Pull & Push',icon:'🔄',desc:'Sync Remote — pull → commit → push',
col:'--c5',light:'--l5',glow:'--g5',
tagBg:'rgba(8,145,178,.15)',tagTx:'#22d3ee',tagBd:'rgba(8,145,178,.25)',tagLb:'sync',
branch:'main',
cmds:[
{c:'git pull',f:'',s:'',u:'',n:'ดึง code ล่าสุดจาก remote มา local'},
{c:'git commit',f:' -a -m',s:' "comment"',u:'',n:'stage ทุก tracked file + commit ในที'},
{c:'git push',f:'',s:'',u:'',n:'ส่ง commit ล่าสุดขึ้น remote'},
],
terminal:[
{sec:'🔄 Pull & Push — Sync กับ Remote',col:'rgba(8,145,178,.15)',tc:'#22d3ee'},
{cmd:true,t:'git pull'},
{out:'ob',t:'remote: Enumerating objects: 5, done.'},
{out:'ob',t:'Updating a1b2c3d..f4e5d6c Fast-forward'},
{out:'og',t:' README.md | 3 +++'},
null,
{cmd:true,t:'git commit <span class="t-fl">-a -m</span> <span class="t-st">"fix: update readme"</span>'},
{out:'oy',t:'[main f4e5d6c] fix: update readme'},
{out:'og',t:' 1 file changed, 3 insertions(+), 1 deletion(-)'},
null,
{cmd:true,t:'git push'},
{out:'ob',t:'To https://github.com/aipairoj/ProjectTest.git'},
{out:'ob',t:' a1b2c3d..f4e5d6c main -> main'},
{out:'ogr',t:'✓ Push สำเร็จ — ทีม pull ได้แล้ว'},
]
},
];
/* ══ Graph Node definitions ══
Each node: {id, label, sublabel, sec(0-4), x(%), y:'main'|'feature', col, shape}
*/
const GNODES=[
// CONFIG
{id:'cfg', lbl:'git config',sub:'ตั้งค่า',sec:0, xp:.04, row:'top', col:'#60a5fa'},
// START GIT — main row
{id:'init', lbl:'git init', sub:'สร้าง repo',sec:1, xp:.16, row:'main', col:'#4ade80'},
{id:'add', lbl:'git add', sub:'staging',sec:1, xp:.27, row:'main', col:'#4ade80'},
{id:'cmt1', lbl:'git commit',sub:'C1',sec:1, xp:.35, row:'main', col:'#fbbf24'},
// BRANCH
{id:'br', lbl:'git branch',sub:'สร้าง branch',sec:2, xp:.35, row:'feat', col:'#a78bfa'},
{id:'cmt2', lbl:'git commit',sub:'C2',sec:2, xp:.46, row:'feat', col:'#fbbf24'},
{id:'cmt3', lbl:'git commit',sub:'C3',sec:2, xp:.54, row:'feat', col:'#fbbf24'},
// MERGE
{id:'mrg', lbl:'git merge', sub:'รวม branch',sec:3, xp:.65, row:'main', col:'#fbbf24'},
// PULL & PUSH
{id:'pull', lbl:'git pull', sub:'sync',sec:4, xp:.75, row:'main', col:'#22d3ee'},
{id:'cmt4', lbl:'git commit',sub:'C4',sec:4, xp:.84, row:'main', col:'#fbbf24'},
{id:'push', lbl:'git push', sub:'→ origin',sec:4, xp:.94, row:'top', col:'#22d3ee'},
];
/* which nodes belong to each section */
const SEC_NODES={0:['cfg'],1:['init','add','cmt1'],2:['br','cmt2','cmt3'],3:['mrg'],4:['pull','cmt4','push']};
let cur=0,dark=true;
/* particles */
(()=>{
const w=document.getElementById('pts');
const cs=['#1d6feb','#7c3aed','#16a34a','#ca8a04','#0891b2'];
for(let i=0;i<22;i++){
const d=document.createElement('div');d.className='pd';
const sz=Math.random()*2+.8;
d.style.cssText=`width:${sz}px;height:${sz}px;left:${Math.random()*100}%;background:${cs[i%5]};animation-duration:${14+Math.random()*20}s;animation-delay:${Math.random()*18}s;`;
w.appendChild(d);
}
})();
function css(v){return getComputedStyle(document.documentElement).getPropertyValue(v).trim();}
function toggleTheme(){dark=!dark;document.documentElement.setAttribute('data-theme',dark?'dark':'light');document.getElementById('moonbtn').textContent=dark?'🌙':'☀️';drawGraph();}
/* ══════════════════════════════════════════
DRAW GRAPH
══════════════════════════════════════════ */
function drawGraph(){
const cv=document.getElementById('gc');
const dpr=window.devicePixelRatio||1;
const W=cv.offsetWidth, H=96;
cv.width=W*dpr; cv.height=H*dpr;
const ctx=cv.getContext('2d'); ctx.scale(dpr,dpr);
const isDark=document.documentElement.getAttribute('data-theme')==='dark';
// row Y positions
const Ytop=18, Ymain=52, Yfeat=80;
const rowY={top:Ytop,main:Ymain,feat:Yfeat};
// compute pixel x for each node
const NX={}, NY={};
GNODES.forEach(n=>{NX[n.id]=n.xp*W; NY[n.id]=rowY[n.row];});
const borderLine=isDark?'rgba(255,255,255,0.08)':'rgba(0,0,0,0.10)';
const doneClr=isDark?'rgba(255,255,255,0.25)':'rgba(0,0,0,0.18)';
function nodeState(n){
if(n.sec<cur)return'done';
if(n.sec===cur)return'active';
return'dim';
}
// Draw remote box at top
if(true){
const rx=NX['push']-55, rw=110, rh=16, ry=6;
ctx.strokeStyle=cur>=4?'#22d3ee80':'rgba(34,211,238,0.15)';
ctx.lineWidth=1; ctx.setLineDash([4,3]);
ctx.beginPath();if(ctx.roundRect)ctx.roundRect(rx,ry,rw,rh,4);else ctx.rect(rx,ry,rw,rh);
ctx.stroke();ctx.setLineDash([]);
ctx.fillStyle=cur>=4?'rgba(34,211,238,0.08)':'rgba(34,211,238,0.03)';ctx.fill();
ctx.fillStyle=cur>=4?'#22d3ee':'rgba(34,211,238,0.3)';
ctx.font=`500 9px 'Prompt',sans-serif`;ctx.textAlign='center';
ctx.fillText('origin / GitHub',NX['push'],ry+11);
}
// ── EDGES ──
function drawEdge(ax,ay,bx,by,col,dashed,w){
ctx.strokeStyle=col;ctx.lineWidth=w||1.5;
if(dashed)ctx.setLineDash([4,3]);else ctx.setLineDash([]);
ctx.beginPath();ctx.moveTo(ax,ay);ctx.lineTo(bx,by);ctx.stroke();
ctx.setLineDash([]);
}
function drawCurve(ax,ay,bx,by,col,dashed,w){
ctx.strokeStyle=col;ctx.lineWidth=w||1.5;
if(dashed)ctx.setLineDash([4,3]);else ctx.setLineDash([]);
const mx=(ax+bx)/2;
ctx.beginPath();ctx.moveTo(ax,ay);ctx.bezierCurveTo(mx,ay,mx,by,bx,by);ctx.stroke();
ctx.setLineDash([]);
}
// helper: edge color based on active state
function ec(secA,secB,col){
const maxSec=Math.max(secA,secB);
if(maxSec<cur)return col+'cc';
if(maxSec===cur)return col;
return isDark?'rgba(255,255,255,0.08)':'rgba(0,0,0,0.09)';
}
// config → init (top to main)
drawCurve(NX.cfg,NY.cfg,NX.init,NY.init,ec(0,1,'#60a5fa'));
// main line: init→add→cmt1→mrg→pull→cmt4
drawEdge(NX.init,NY.init,NX.add,NY.add,ec(1,1,'#4ade80'));
drawEdge(NX.add,NY.add,NX.cmt1,NY.cmt1,ec(1,1,'#4ade80'));
drawEdge(NX.cmt1,NY.cmt1,NX.mrg,NY.mrg,ec(1,3,'#4ade80'),false,1);// dashed placeholder
// branch off: cmt1 → br (main→feat)
drawCurve(NX.cmt1,NY.cmt1,NX.br,NY.br,ec(1,2,'#a78bfa'));
// feature line: br→cmt2→cmt3
drawEdge(NX.br,NY.br,NX.cmt2,NY.cmt2,ec(2,2,'#a78bfa'));
drawEdge(NX.cmt2,NY.cmt2,NX.cmt3,NY.cmt3,ec(2,2,'#a78bfa'));
// merge: cmt3 → mrg (feat→main)
drawCurve(NX.cmt3,NY.cmt3,NX.mrg,NY.mrg,ec(2,3,'#fbbf24'));
// post merge main
drawEdge(NX.mrg,NY.mrg,NX.pull,NY.pull,ec(3,4,'#4ade80'));
drawEdge(NX.pull,NY.pull,NX.cmt4,NY.cmt4,ec(4,4,'#22d3ee'));
drawEdge(NX.cmt4,NY.cmt4,NX.push,NY.push-8,ec(4,4,'#22d3ee')); // up to remote
// push up arrow to remote
{
const col=cur>=4?'#22d3ee':'rgba(34,211,238,0.15)';
ctx.strokeStyle=col;ctx.lineWidth=1.5;ctx.setLineDash([3,3]);
ctx.beginPath();ctx.moveTo(NX.push,NY.push-8);ctx.lineTo(NX.push,22);ctx.stroke();
ctx.setLineDash([]);
}
// ── draw main branch label ──
ctx.fillStyle=isDark?'rgba(255,255,255,.1)':'rgba(0,0,0,.1)';
ctx.font=`300 9px 'Courier New',monospace`;ctx.textAlign='left';
ctx.fillText('main',NX.init-2,Ymain-10);
ctx.fillText('feature/login',NX.br-2,Yfeat-10);
// ── NODES ──
GNODES.forEach(n=>{
const st=nodeState(n);
const x=NX[n.id], y=NY[n.id];
const active=st==='active', done=st==='done';
const r=active?8.5:done?6.5:5.5;
// glow ring for active
if(active){
ctx.beginPath();ctx.arc(x,y,r+7,0,Math.PI*2);
ctx.fillStyle=n.col+'18';ctx.fill();
ctx.beginPath();ctx.arc(x,y,r+3.5,0,Math.PI*2);
ctx.fillStyle=n.col+'20';ctx.fill();
}
// node circle
ctx.beginPath();ctx.arc(x,y,r,0,Math.PI*2);
ctx.fillStyle=active?n.col:(done?n.col+'99':(isDark?'#0d1420':'#f0f4fb'));
ctx.fill();
ctx.strokeStyle=active?n.col+'ff':(done?n.col+'bb':(isDark?'rgba(255,255,255,.14)':'rgba(0,0,0,.12)'));
ctx.lineWidth=active?2:1.5;ctx.stroke();
// label below (or above for top row)
const lblY=n.row==='top'? y-12 : (n.row==='feat'? y+16 : y+16);
ctx.fillStyle=active?n.col:(done?n.col+'cc':(isDark?'rgba(255,255,255,0.2)':'rgba(0,0,0,0.2)'));
ctx.font=`${active?600:400} ${active?10.5:10}px 'Courier New',monospace`;
ctx.textAlign='center';
ctx.fillText(n.lbl,x,lblY);
// sub label
if(active||done){
const sublY=n.row==='top'? y-22 : (n.row==='feat'? y+26 : y+26);
ctx.fillStyle=active?n.col+'cc':(done?n.col+'66':'rgba(255,255,255,.1)');
ctx.font=`300 8.5px 'Prompt',sans-serif`;ctx.textAlign='center';
ctx.fillText(n.sub,x,sublY);
}
});
// section highlight boxes
SECS.forEach((s,i)=>{
if(i!==cur)return;
const nodes=SEC_NODES[i].map(id=>GNODES.find(n=>n.id===id));
if(!nodes.length)return;
const xs=nodes.map(n=>NX[n.id]);
const ys=nodes.map(n=>NY[n.id]);
const minX=Math.min(...xs)-18,maxX=Math.max(...xs)+18;
const minY=Math.min(...ys)-14,maxY=Math.max(...ys)+14;
const lc=css(s.light);
ctx.strokeStyle=lc+'50';ctx.lineWidth=1;ctx.setLineDash([4,3]);
ctx.beginPath();if(ctx.roundRect)ctx.roundRect(minX,minY,maxX-minX,maxY-minY,8);else ctx.rect(minX,minY,maxX-minX,maxY-minY);
ctx.stroke();ctx.setLineDash([]);
ctx.fillStyle=lc+'0a';ctx.fill();
ctx.fillStyle=lc+'99';ctx.font=`500 8.5px 'Prompt',sans-serif`;ctx.textAlign='center';
ctx.fillText(s.label,( minX+maxX)/2,minY-2);
});
}
/* click on canvas → jump to section */
document.getElementById('gc').addEventListener('click',function(e){
const rect=this.getBoundingClientRect();
const mx=(e.clientX-rect.left)*(this.width/(window.devicePixelRatio*rect.width));
const my=(e.clientY-rect.top)*(this.height/(window.devicePixelRatio*rect.height));
const rowY={top:18,main:52,feat:80};
let best=-1,bestD=999;
GNODES.forEach(n=>{
const nx=n.xp*this.offsetWidth, ny=rowY[n.row];
const d=Math.sqrt((mx-nx)**2+(my-ny)**2);
if(d<bestD){bestD=d;best=n.sec;}
});
if(best>=0&&bestD<40){jump(best);}
});
/* ══════════════════════════════════════════
RENDER
══════════════════════════════════════════ */
function render(){
const s=SECS[cur];
const lc=css(s.light),gc=css(s.glow);
document.documentElement.style.setProperty('--lc',lc);
document.documentElement.style.setProperty('--gc',gc);
document.documentElement.style.setProperty('--bc2',s.tagBd);
document.getElementById('m1').style.background=css(s.col);
// tag
const tt=document.getElementById('tbrtag');
tt.textContent=s.branch;
tt.style.cssText=`background:${s.tagBg};border:1px solid ${s.tagBd};color:${s.tagTx};`;
// tabs
document.getElementById('tabs').innerHTML=SECS.map((sec,i)=>`
<div class="tab${i===cur?' on':''}" onclick="jump(${i})" style="${i===cur?'--lc:'+css(sec.light):''}">
<div class="tn" style="${i===cur?'background:'+css(sec.light)+';color:#fff;':''}">${i+1}</div>
${sec.icon} ${sec.label}
</div>`).join('');
// left
document.getElementById('lp').innerHTML=`
<div class="sec-header" style="--lc:${lc};--gc:${gc};--bc2:${s.tagBd};">
<span class="sec-icon">${s.icon}</span>
<span class="sec-title">${s.label}</span>
<span class="sec-desc">${s.desc}</span>
</div>
<div class="cmd-list">${s.cmds.map(c=>`
<div class="cmd-card">
<div class="cmd-acc"></div>
<div class="cmd-inner">
<span class="cmd-p">$</span>
<span class="cmd-t">${c.c}<span class="flag">${c.f}</span><span class="str">${c.s}</span><span class="url">${c.u}</span></span>
<span class="cmd-n">${c.n}</span>
</div>
</div>`).join('')}
</div>`;
// terminal
const tb=document.getElementById('tbody');
tb.innerHTML='';
s.terminal.forEach((l,i)=>{
if(l===null){const b=document.createElement('div');b.className='tblk';tb.appendChild(b);return;}
if(l.sec!==undefined){
const d=document.createElement('div');d.className='tsec';
d.style.cssText=`background:${l.col};color:${l.tc};animation-delay:${i*.03}s`;
d.textContent=l.sec;tb.appendChild(d);return;
}
const d=document.createElement('div');d.className='tl';d.style.animationDelay=(i*.04)+'s';
if(l.cmd){
d.innerHTML=`<span class="t-ps">$</span><span class="t-pa"> C:/ProjectTest</span><span class="t-sep"> $ </span><span class="t-cm">${l.t}</span>`;
} else {
d.innerHTML=`<span class="${l.out}">${l.t}</span>`;
}
tb.appendChild(d);
});
const cl=document.createElement('div');cl.className='tl';cl.style.animationDelay=((s.terminal.length+1)*.04)+'s';
cl.innerHTML=`<span class="t-ps">$</span><span class="t-pa"> C:/ProjectTest</span><span class="t-sep"> $ </span><span class="cur"></span>`;
tb.appendChild(cl);
setTimeout(()=>tb.scrollTop=tb.scrollHeight,80);
// nav
document.getElementById('ffrac').textContent=`${cur+1} / ${SECS.length}`;
document.getElementById('fdots').innerHTML=SECS.map((_,i)=>`<div class="fd${i===cur?' on':''}" ${i===cur?`style="background:${lc};box-shadow:0 0 9px ${lc};"`:''}></div>`).join('');
document.getElementById('btnprev').disabled=cur===0;
const bn=document.getElementById('btnnext');bn.disabled=cur===4;
bn.style.cssText=`background:${lc};border-color:${lc};color:#fff;`;
bn.textContent=cur===4?'เสร็จสิ้น ✓':'ถัดไป →';
drawGraph();
}
function go(d){cur=Math.max(0,Math.min(4,cur+d));render();}
function jump(i){cur=i;render();}
window.addEventListener('resize',drawGraph);
window.addEventListener('keydown',e=>{
if(e.key==='ArrowRight')go(1);
if(e.key==='ArrowLeft')go(-1);
if(e.key==='m'||e.key==='M')toggleTheme();
});
document.fonts.ready.then(()=>render());
</script>
</body>
</html>