-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
2273 lines (1956 loc) · 91.9 KB
/
Copy pathindex.html
File metadata and controls
2273 lines (1956 loc) · 91.9 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
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>EzGit - 我的 GitHub 精选仓库</title>
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg viewBox='0 0 64 64' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='64' height='64' rx='12' fill='%23151713'/%3E%3Cg transform='translate(12 12) scale(1.6667)' fill='%23fcfaf5'%3E%3Cpath d='M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z'/%3E%3C/g%3E%3C/svg%3E">
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
:root {
--paper: #f7f2e8;
--paper-soft: #fcfaf5;
--ink: #151713;
--muted: #62685f;
--line: rgba(21, 23, 19, 0.14);
--emerald: #047a55;
--emerald-strong: #035f43;
--amber: #bd6b1b;
--clay: #8f4d35;
--mist: #dfe7df;
--shadow: 0 22px 70px rgba(43, 36, 24, 0.14);
--radius: 8px;
--max: 1160px;
}
* {
box-sizing: border-box;
scrollbar-width: none;
-ms-overflow-style: none;
}
*::-webkit-scrollbar { display: none; }
html, body {
height: 100%;
overflow: hidden;
}
body {
display: flex;
flex-direction: column;
color: var(--ink);
background:
linear-gradient(90deg, rgba(21, 23, 19, 0.045) 1px, transparent 1px),
linear-gradient(180deg, rgba(21, 23, 19, 0.035) 1px, transparent 1px),
var(--paper);
background-size: 42px 42px;
font-family:
ui-sans-serif,
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
"PingFang SC",
"Hiragino Sans GB",
"Microsoft YaHei",
sans-serif;
}
button,
input,
select,
textarea {
font: inherit;
}
header,
.stats-section,
.categories-section,
footer {
flex-shrink: 0;
}
.site-header {
border-bottom: 1px solid var(--line);
background: rgba(247, 242, 232, 0.88);
backdrop-filter: blur(18px);
}
.shell {
width: min(var(--max), calc(100% - 48px));
margin: 0 auto;
}
.brand-mark {
width: 38px;
height: 38px;
border: 1px solid var(--ink);
border-radius: var(--radius);
background: var(--ink);
color: var(--paper-soft);
display: inline-flex;
align-items: center;
justify-content: center;
}
.search-control {
border: 1px solid var(--line);
border-radius: var(--radius);
background: rgba(252, 250, 245, 0.72);
color: var(--ink);
transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.search-control:focus-within {
border-color: rgba(4, 122, 85, 0.46);
background: var(--paper-soft);
box-shadow: 0 0 0 3px rgba(4, 122, 85, 0.09);
}
.icon-button,
.text-button,
.view-btn,
.filter-btn,
.repo-action,
.load-more-action {
border: 1px solid var(--line);
border-radius: var(--radius);
background: rgba(252, 250, 245, 0.7);
color: var(--ink);
font-weight: 800;
transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease;
}
.icon-button:hover,
.text-button:hover,
.view-btn:hover,
.filter-btn:hover,
.repo-action:hover,
.load-more-action:hover {
transform: translateY(-1px);
border-color: rgba(4, 122, 85, 0.36);
background: var(--paper-soft);
}
.primary-action {
border-color: var(--ink);
background: var(--ink);
color: var(--paper-soft);
}
.primary-action:hover {
background: var(--emerald-strong);
color: var(--paper-soft);
}
.index-panel {
border-bottom: 1px solid var(--line);
background: rgba(252, 250, 245, 0.64);
}
.index-stat {
border-right: 1px solid var(--line);
min-width: 132px;
}
.index-stat:last-child {
border-right: 0;
}
.index-label,
.card-meta,
.label-mono {
color: var(--muted);
font-family: "SF Mono", Menlo, Consolas, monospace;
font-size: 11px;
font-weight: 800;
letter-spacing: 0;
text-transform: uppercase;
}
.workspace-copy {
color: #343a33;
font-weight: 700;
}
.main-content {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
min-height: auto;
}
.categories-section {
border-bottom: 1px solid var(--line);
background: rgba(247, 242, 232, 0.72);
}
.filter-btn {
min-height: 38px;
padding: 0 14px;
font-size: 13px;
}
.filter-btn.is-active {
border-color: var(--ink);
background: var(--ink);
color: var(--paper-soft);
}
.view-btn.is-active,
#filter-starred.is-active {
border-color: var(--emerald);
background: rgba(4, 122, 85, 0.1);
color: var(--emerald-strong);
}
#repo-list {
flex: 1;
overflow-y: auto;
padding: 0 0 24px;
align-content: flex-start;
}
.repo-card {
border: 1px solid var(--line);
border-radius: var(--radius);
background: rgba(255, 253, 248, 0.78);
cursor: grab;
min-width: 0;
transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}
.repo-card:hover {
transform: translateY(-2px);
border-color: rgba(4, 122, 85, 0.42);
background: #fffdf8;
box-shadow: var(--shadow);
}
.repo-card.dragging {
opacity: 0.55;
cursor: grabbing;
transform: scale(1.01);
}
.repo-card.drag-over {
border: 1px dashed var(--emerald);
background: rgba(4, 122, 85, 0.08);
}
.repo-avatar {
border: 1px solid var(--line);
border-radius: var(--radius);
background: var(--paper-soft);
}
.category-chip {
border: 1px solid var(--line);
border-radius: 999px;
background: rgba(252, 250, 245, 0.72);
color: var(--muted);
font-size: 11px;
font-weight: 900;
}
.repo-title-link {
color: var(--ink);
font-weight: 900;
}
.repo-title-link:hover {
color: var(--emerald);
}
.footer-bar {
border-top: 1px solid var(--line);
background: rgba(21, 23, 19, 0.96);
color: rgba(252, 250, 245, 0.74);
}
#load-more-btn {
padding: 10px;
text-align: center;
flex-shrink: 0;
}
.user-menu {
border: 1px solid var(--line);
border-radius: var(--radius);
background: #fffdf8;
box-shadow: var(--shadow);
transition: all 0.2s;
transform-origin: top right;
}
.user-menu.hidden { opacity: 0; transform: scale(0.95); pointer-events: none; }
.user-menu:not(.hidden) { opacity: 1; transform: scale(1); pointer-events: auto; }
.modal-backdrop {
background: rgba(21, 23, 19, 0.48);
backdrop-filter: blur(3px);
}
.modal-panel {
border: 1px solid var(--line);
border-radius: var(--radius);
background:
linear-gradient(90deg, rgba(21, 23, 19, 0.035) 1px, transparent 1px),
linear-gradient(180deg, rgba(21, 23, 19, 0.03) 1px, transparent 1px),
#fffdf8;
background-size: 42px 42px;
box-shadow: var(--shadow);
}
.modal-header,
.modal-footer {
border-color: var(--line);
}
.field-label {
color: var(--ink);
font-size: 13px;
font-weight: 900;
}
.required-mark {
color: var(--clay);
}
.form-input {
width: 100%;
border: 1px solid var(--line);
border-radius: var(--radius);
background: rgba(252, 250, 245, 0.78);
color: var(--ink);
font-size: 14px;
transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.form-input::placeholder {
color: rgba(98, 104, 95, 0.62);
}
.form-input:focus {
outline: none;
border-color: rgba(4, 122, 85, 0.52);
background: var(--paper-soft);
box-shadow: 0 0 0 3px rgba(4, 122, 85, 0.1);
}
.secondary-action,
.danger-action {
border: 1px solid var(--line);
border-radius: var(--radius);
background: rgba(252, 250, 245, 0.78);
color: var(--ink);
font-weight: 900;
transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}
.secondary-action:hover {
transform: translateY(-1px);
border-color: rgba(4, 122, 85, 0.36);
background: var(--paper-soft);
}
.danger-action {
border-color: rgba(143, 77, 53, 0.34);
background: rgba(143, 77, 53, 0.08);
color: var(--clay);
}
.danger-action:hover {
background: rgba(143, 77, 53, 0.14);
}
.note-panel {
border: 1px solid var(--line);
border-radius: var(--radius);
background: rgba(4, 122, 85, 0.07);
color: var(--emerald-strong);
}
.checkbox-control {
width: 16px;
height: 16px;
accent-color: var(--emerald);
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
@media (max-width: 760px) {
.shell {
width: min(100% - 28px, var(--max));
}
.site-actions {
width: 100%;
flex-wrap: wrap;
}
.search-control {
width: 100%;
order: 2;
}
.index-stat {
min-width: 50%;
border-bottom: 1px solid var(--line);
}
.index-stat:nth-child(2n) {
border-right: 0;
}
.repo-card {
align-items: flex-start;
flex-wrap: wrap;
}
.repo-controls {
width: 100%;
justify-content: flex-start;
padding-left: 52px;
flex-wrap: wrap;
}
.repo-controls .card-meta {
margin-right: 8px;
}
}
</style>
</head>
<body>
<!-- Header -->
<header class="site-header sticky top-0 z-50">
<div class="shell py-4">
<div class="flex items-center justify-between gap-5 flex-wrap">
<div class="flex items-center gap-3">
<div class="brand-mark">
<svg viewBox="0 0 24 24" fill="currentColor" class="w-5 h-5">
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/>
</svg>
</div>
<div>
<h1 class="text-xl font-black leading-tight">EzGit</h1>
<p class="label-mono mt-0.5">GitHub repo index</p>
</div>
</div>
<div class="site-actions flex items-center gap-2">
<div class="search-control relative">
<input type="text" id="search-input" placeholder="搜索仓库..."
class="pl-10 pr-4 py-2 bg-transparent text-sm focus:outline-none w-60">
<i class="fas fa-search absolute left-3 top-1/2 -translate-y-1/2 text-sm" style="color: var(--muted);"></i>
</div>
<!-- 导入导出 -->
<button id="export-btn" class="icon-button w-9 h-9 flex items-center justify-center" title="导出数据">
<i class="fas fa-download"></i>
</button>
<label class="icon-button w-9 h-9 flex items-center justify-center cursor-pointer" title="导入数据">
<i class="fas fa-upload"></i>
<input type="file" id="import-file" accept=".json" class="hidden">
</label>
<button id="add-btn" class="text-button primary-action px-4 py-2 flex items-center gap-2 text-sm">
<i class="fas fa-plus"></i>
<span>添加</span>
</button>
<!-- GitHub 登录按钮 / 用户头像 -->
<div id="auth-container" class="relative ml-2">
<!-- 未登录状态 -->
<button id="login-btn" class="hidden text-button primary-action px-3 py-2 flex items-center gap-2 text-sm">
<i class="fab fa-github"></i>
<span>登录</span>
</button>
<!-- 已登录状态 -->
<div id="user-menu-container" class="hidden">
<button id="user-avatar-btn" class="icon-button w-9 h-9 overflow-hidden flex items-center justify-center">
<img id="user-avatar" src="" alt="avatar" class="w-full h-full object-cover hidden">
<i id="user-avatar-fallback" class="fas fa-user" style="color: var(--muted);"></i>
</button>
<!-- 下拉菜单 -->
<div id="user-menu" class="user-menu hidden absolute right-0 mt-2 w-60 py-2 z-50">
<div class="px-4 py-2 border-b" style="border-color: var(--line);">
<p id="user-name" class="font-black truncate"></p>
<p id="user-login" class="text-sm truncate" style="color: var(--muted);"></p>
</div>
<div class="px-4 py-2 border-b" style="border-color: var(--line);">
<div class="flex items-center gap-2 text-sm">
<div id="sync-status-dot" class="w-2 h-2 rounded-full bg-gray-300"></div>
<span id="sync-status-text" style="color: var(--muted);">未同步</span>
</div>
<p id="sync-time" class="label-mono mt-1"></p>
</div>
<button id="manual-sync-btn" class="w-full px-4 py-2 text-left text-sm hover:bg-black/5 flex items-center gap-2">
<i class="fas fa-sync-alt" style="color: var(--muted);"></i>
<span>立即同步</span>
</button>
<button id="logout-btn" class="w-full px-4 py-2 text-left text-sm text-red-700 hover:bg-red-50 flex items-center gap-2">
<i class="fas fa-sign-out-alt text-red-500"></i>
<span>退出登录</span>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</header>
<!-- Main Content -->
<div class="main-content flex-1">
<!-- Stats Hero -->
<section class="stats-section index-panel">
<div class="shell">
<div class="flex flex-wrap items-stretch">
<div class="index-stat py-4 pr-6">
<p class="index-label">Repos</p>
<p id="total-count" class="text-3xl font-black leading-tight">0</p>
</div>
<div class="index-stat py-4 px-6">
<p class="index-label">Categories</p>
<p id="category-count" class="text-3xl font-black leading-tight">0</p>
</div>
<div class="index-stat py-4 px-6">
<p class="index-label">Starred</p>
<p id="starred-count" class="text-3xl font-black leading-tight">0</p>
</div>
<div class="py-4 pl-6 flex-1 min-w-56">
<p class="index-label">Workspace</p>
<div class="flex items-center justify-between gap-4">
<p class="workspace-copy text-sm mt-1">管理、筛选、同步值得长期保留的 GitHub 仓库。</p>
<div id="cloud-sync-status" class="hidden items-center gap-2 px-3 py-1.5 border text-sm font-bold" style="border-color: var(--line); border-radius: var(--radius); background: rgba(4,122,85,0.08); color: var(--emerald-strong);">
<i class="fas fa-cloud"></i>
<span>Gist synced</span>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Categories -->
<section class="categories-section">
<div class="shell py-5">
<div class="flex flex-wrap items-center justify-between gap-4">
<div class="flex flex-wrap gap-2" id="category-filters">
<button data-category="all" class="filter-btn is-active">
<i class="fas fa-layer-group mr-1"></i> 全部
</button>
<button data-category="tools" class="filter-btn">
<i class="fas fa-wrench mr-1"></i> 效率工具
</button>
<button data-category="learning" class="filter-btn">
<i class="fas fa-graduation-cap mr-1"></i> 学习资源
</button>
<button data-category="inspiration" class="filter-btn">
<i class="fas fa-lightbulb mr-1"></i> 参考灵感
</button>
<button data-category="infrastructure" class="filter-btn">
<i class="fas fa-cubes mr-1"></i> 基础建设
</button>
</div>
<!-- View Toggle & Starred Filter -->
<div class="flex items-center gap-2">
<button id="filter-starred" class="text-button px-3 py-2 text-sm flex items-center gap-1" title="只看精选">
<i class="far fa-star"></i> 精选 <span id="starred-count-badge" class="label-mono"></span>
</button>
<div class="flex items-center gap-1">
<button id="view-grid" class="view-btn px-3 py-2 text-sm" title="网格视图">
<i class="fas fa-th-large"></i>
</button>
<button id="view-list" class="view-btn is-active px-3 py-2 text-sm" title="列表视图">
<i class="fas fa-list"></i>
</button>
</div>
</div>
</div>
</div>
</section>
<!-- Repo List -->
<section class="flex-1 overflow-hidden flex flex-col shell pt-5">
<div id="repo-list" class="flex-1 overflow-y-auto">
<!-- 动态内容 -->
</div>
</section>
<!-- 空状态(在 repo-list 外部,初始隐藏) -->
<div id="empty-state" class="hidden text-center py-16 flex-1">
<div class="w-20 h-20 flex items-center justify-center mx-auto mb-4" style="border: 1px solid var(--line); border-radius: var(--radius); background: rgba(252,250,245,0.72);">
<i class="fas fa-inbox text-4xl" style="color: var(--muted);"></i>
</div>
<h3 class="text-lg font-black mb-2">还没有收藏的仓库</h3>
<p style="color: var(--muted);">添加你发现的有价值的 GitHub 项目</p>
</div>
<!-- 加载更多按钮(在 repo-list 外部) -->
<div id="load-more-btn" class="hidden py-4 text-center flex-shrink-0 shell">
<button onclick="loadMore()" class="load-more-action px-6 py-2 text-sm">
<i class="fas fa-chevron-down mr-1"></i> 加载更多
</button>
</div>
</div>
<!-- Footer -->
<footer class="footer-bar mt-auto">
<div class="shell py-5">
<!-- Top Section -->
<div class="flex items-center justify-between gap-6 flex-wrap">
<div class="flex items-center gap-3">
<div class="brand-mark" style="background: var(--paper-soft); color: var(--ink);">
<svg viewBox="0 0 24 24" fill="currentColor" class="w-5 h-5">
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/>
</svg>
</div>
<div>
<h3 class="font-black text-lg text-white">EzGit</h3>
<p class="text-sm">管理和发现有价值的 GitHub 仓库</p>
</div>
</div>
<div class="flex items-center gap-6 text-sm font-bold">
<a href="https://github.com/keepwonder/ezgit" target="_blank" class="hover:text-white transition">GitHub</a>
<a href="https://github.com/keepwonder/ezgit/issues" target="_blank" class="hover:text-white transition">反馈问题</a>
<a href="https://keepwonder.top" target="_blank" class="hover:text-white transition">更多项目</a>
</div>
</div>
</div>
</footer>
<!-- Add Modal -->
<div id="add-modal" class="modal-backdrop hidden fixed inset-0 z-50 flex items-center justify-center p-4">
<div class="modal-panel w-full max-w-md max-h-[85vh] overflow-y-auto">
<div class="modal-header px-5 py-4 border-b flex items-center justify-between">
<div>
<p class="label-mono">Repository</p>
<h3 class="text-lg font-black">添加仓库</h3>
</div>
<button id="close-modal" class="icon-button w-8 h-8 flex items-center justify-center" title="关闭">
<i class="fas fa-times"></i>
</button>
</div>
<div class="px-5 py-4">
<div class="mb-3">
<label class="field-label block mb-1.5">GitHub URL <span class="required-mark">*</span></label>
<div class="flex gap-2">
<input type="text" id="repo-url" placeholder="https://github.com/user/repo"
class="form-input flex-1 px-3 py-2"
onblur="window.fetchRepoInfo&&window.fetchRepoInfo()">
<button id="fetch-btn" class="secondary-action px-3 py-2 text-sm" title="获取仓库信息">
<i class="fas fa-search"></i>
</button>
</div>
</div>
<div id="repo-preview" class="note-panel hidden mb-3 p-3">
<div class="flex items-center gap-3">
<img id="preview-avatar" src="" class="repo-avatar w-9 h-9">
<div class="flex-1 min-w-0">
<p id="preview-name" class="font-black text-sm truncate"></p>
<p id="preview-desc" class="text-xs truncate" style="color: var(--muted);"></p>
</div>
</div>
<div class="card-meta flex items-center gap-3 mt-2">
<span><i class="fas fa-star mr-1" style="color: var(--amber);"></i><span id="preview-stars"></span></span>
<span><i class="fas fa-code mr-1"></i><span id="preview-lang"></span></span>
</div>
</div>
<div class="mb-3">
<label class="field-label block mb-1.5">分类 <span class="required-mark">*</span></label>
<select id="repo-category" class="form-input px-3 py-2">
<option value="">选择分类...</option>
<option value="tools">🔧 效率工具</option>
<option value="learning">📚 学习资源</option>
<option value="inspiration">💡 参考灵感</option>
<option value="infrastructure">📦 基础建设</option>
</select>
<div id="custom-category-input" class="hidden mt-2">
<div class="flex gap-2">
<input type="text" id="new-category-name" placeholder="分类名称" class="form-input flex-1 px-3 py-2">
<button id="save-category-btn" class="text-button primary-action px-3 py-2 text-sm">添加</button>
<button id="cancel-category-btn" class="secondary-action px-3 py-2 text-sm">取消</button>
</div>
</div>
</div>
<div class="mb-3">
<label class="field-label block mb-1.5">一句话评价</label>
<input type="text" id="repo-title" placeholder="为什么推荐这个仓库?"
class="form-input px-3 py-2">
</div>
<div class="mb-4">
<label class="field-label block mb-1.5">详细笔记</label>
<textarea id="repo-notes" placeholder="更多想法..." rows="3"
class="form-input px-3 py-2 resize-none"></textarea>
</div>
<div class="flex items-center gap-2 mb-4">
<input type="checkbox" id="repo-starred" class="checkbox-control">
<label for="repo-starred" class="text-sm font-bold" style="color: var(--muted);">标记为精选</label>
</div>
<div class="flex gap-3">
<button id="cancel-btn" class="secondary-action flex-1 py-2">取消</button>
<button id="save-btn" class="text-button primary-action flex-1 py-2">添加</button>
</div>
</div>
</div>
</div>
<!-- Custom Confirm Dialog -->
<div id="confirm-modal" class="modal-backdrop hidden fixed inset-0 z-50 flex items-center justify-center p-4">
<div class="modal-panel w-full max-w-sm p-6">
<p class="label-mono">Confirm</p>
<h3 class="text-lg font-black mb-2">确认操作</h3>
<p id="confirm-message" class="text-sm mb-6" style="color: var(--muted);"></p>
<div class="flex gap-3">
<button id="confirm-cancel" class="secondary-action flex-1 py-2">取消</button>
<button id="confirm-ok" class="danger-action flex-1 py-2">确定</button>
</div>
</div>
</div>
<!-- Token Input Modal -->
<div id="token-modal" class="modal-backdrop hidden fixed inset-0 z-50 flex items-center justify-center p-4">
<div class="modal-panel w-full max-w-md overflow-hidden">
<div class="modal-header px-6 py-4 border-b">
<p class="label-mono">GitHub Sync</p>
<h3 class="text-lg font-black">GitHub 登录</h3>
<p class="text-sm mt-1" style="color: var(--muted);">输入 Personal Access Token 以同步数据</p>
</div>
<div class="px-6 py-4">
<div class="note-panel p-3 mb-4">
<p class="text-sm font-black mb-2">获取 Token 步骤:</p>
<ol class="text-sm space-y-1 list-decimal list-inside">
<li>访问 <a href="https://github.com/settings/tokens" target="_blank" class="underline hover:text-blue-900">github.com/settings/tokens</a></li>
<li>点击 Generate new token (classic)</li>
<li>勾选 <strong>gist</strong> 权限</li>
<li>生成并复制 Token</li>
</ol>
</div>
<label class="field-label block mb-2">GitHub Token</label>
<input type="password" id="token-input" placeholder="ghp_xxxxxxxxxxxx"
class="form-input px-4 py-2.5"
autocomplete="off">
<p class="label-mono mt-2 normal-case" style="text-transform: none;">Token 仅存储在浏览器本地,不会上传到任何服务器</p>
</div>
<div class="modal-footer px-6 py-4 border-t flex gap-3">
<button id="token-cancel" class="secondary-action flex-1 py-2.5 text-sm">取消</button>
<button id="token-confirm" class="text-button primary-action flex-1 py-2.5 text-sm">登录</button>
</div>
</div>
</div>
<!-- Toast -->
<div id="toast" class="hidden fixed top-6 left-1/2 -translate-x-1/2 z-50 transition-all duration-300 transform -translate-y-2 opacity-0">
<div class="bg-white shadow-xl flex items-center gap-3 min-w-[320px] rounded-lg border border-gray-200 px-4 py-3">
<div id="toast-icon" class="w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0">
<i class="fas fa-info text-sm"></i>
</div>
<div class="flex-1">
<p id="toast-message" class="text-sm font-medium text-gray-800"></p>
</div>
<button onclick="hideToast()" class="text-gray-400 hover:text-gray-600 transition">
<i class="fas fa-times"></i>
</button>
</div>
</div>
<script>
// ===== GitHub OAuth & Gist Sync Configuration =====
const GITHUB_CLIENT_ID = 'YOUR_CLIENT_ID'; // 请替换为您的 GitHub OAuth App Client ID
const REDIRECT_URI = window.location.origin + window.location.pathname;
const GIST_FILENAME = 'ezgit-data.json';
const GIST_DESCRIPTION = 'EzGit - 我的 GitHub 精选仓库数据';
// GitHub OAuth 代理服务(用于交换 code 获取 token)
// 推荐使用 https://github.com/prose/gatekeeper 或类似服务部署
// 示例: const OAUTH_PROXY_URL = 'https://your-gatekeeper.herokuapp.com/authenticate';
const OAUTH_PROXY_URL = '';
// 认证状态
let currentUser = null;
let githubToken = localStorage.getItem('github_token');
let gistId = localStorage.getItem('ezgit_gist_id');
let isSyncing = false;
// 示例数据
const sampleRepos = [
{
id: '1',
url: 'https://github.com/dongbeixiaohuo/writing-agent',
owner: 'dongbeixiaohuo',
name: 'writing-agent',
description: '🚀 基于 Claude Code 的去AI味写作系统',
language: 'Markdown',
stars: '2.1k',
category: 'ai',
title: 'AI写作工作流,反AI味设计值得借鉴',
notes: 'Skills + Subagents 架构很棒',
starred: true,
addedAt: '2026-03-02'
}
];
let repos = JSON.parse(localStorage.getItem('ezgit-repos') || JSON.stringify(sampleRepos));
let currentCategory = 'all';
let currentView = localStorage.getItem('ezgit-view') || 'list';
let editingRepoId = null;
// 懒加载配置
const GRID_ITEMS_PER_BATCH = 16; // 网格视图:16个(4行x4列)
const LIST_ITEMS_PER_BATCH = 20; // 列表视图:20个
let visibleItems = GRID_ITEMS_PER_BATCH; // 当前已加载数量
let isLoading = false; // 是否正在加载
let showOnlyStarred = false;
// 获取当前视图的加载数量
function getItemsPerBatch() {
return currentView === 'grid' ? GRID_ITEMS_PER_BATCH : LIST_ITEMS_PER_BATCH;
}
// 加载自定义分类
let customCategories = JSON.parse(localStorage.getItem('ezgit-categories') || '{}');
const defaultCategoryNames = {
tools: '效率工具',
learning: '学习资源',
inspiration: '参考灵感',
infrastructure: '基础建设'
};
// 合并默认和自定义分类
let categoryNames = { ...defaultCategoryNames, ...customCategories };
// 筛选后的仓库列表
let filteredRepos = [];
// DOM 元素
const repoList = document.getElementById('repo-list');
const emptyState = document.getElementById('empty-state');
const addModal = document.getElementById('add-modal');
const toast = document.getElementById('toast');
// ===== GitHub OAuth Functions =====
// 检查是否已登录
function checkAuthStatus() {
if (githubToken) {
// 验证 token 是否有效
fetchGitHubUser().then(user => {
if (user) {
currentUser = user;
showLoggedInUI();
syncFromGist();
} else {
// Token 无效,清除登录状态
logout();
}
});
} else {
showLoggedOutUI();
}
}
// 显示已登录 UI
function showLoggedInUI() {
document.getElementById('login-btn').classList.add('hidden');
document.getElementById('user-menu-container').classList.remove('hidden');
document.getElementById('cloud-sync-status').classList.remove('hidden');
// 设置用户头像和名称
const avatarImg = document.getElementById('user-avatar');
const avatarFallback = document.getElementById('user-avatar-fallback');
if (currentUser && currentUser.avatar_url) {
avatarImg.src = currentUser.avatar_url;
avatarImg.classList.remove('hidden');
avatarFallback.classList.add('hidden');
} else {
avatarImg.classList.add('hidden');
avatarFallback.classList.remove('hidden');
}
document.getElementById('user-name').textContent = currentUser?.name || currentUser?.login || 'GitHub User';
document.getElementById('user-login').textContent = '@' + (currentUser?.login || 'unknown');
updateSyncStatus('synced');
}
// 显示未登录 UI
function showLoggedOutUI() {
document.getElementById('login-btn').classList.remove('hidden');
document.getElementById('user-menu-container').classList.add('hidden');
document.getElementById('cloud-sync-status').classList.add('hidden');
currentUser = null;
}
// GitHub 登录
function login() {
// 如果没有配置 Client ID,使用手动输入 Token 的方式
if (GITHUB_CLIENT_ID === 'YOUR_CLIENT_ID' || !GITHUB_CLIENT_ID) {
showTokenModal();
return;
}
const state = generateRandomState();
localStorage.setItem('github_oauth_state', state);
const authUrl = `https://github.com/login/oauth/authorize?client_id=${GITHUB_CLIENT_ID}&redirect_uri=${encodeURIComponent(REDIRECT_URI)}&scope=gist&state=${state}`;
window.location.href = authUrl;
}
// 显示 Token 输入模态框
function showTokenModal() {
const modal = document.getElementById('token-modal');
const input = document.getElementById('token-input');
const confirmBtn = document.getElementById('token-confirm');
const cancelBtn = document.getElementById('token-cancel');
modal.classList.remove('hidden');
input.value = '';
input.focus();
// 确认登录
const handleConfirm = async () => {
const token = input.value.trim();
if (!token) {
showToast('请输入 Token', 'warning');
return;
}
hideTokenModal();
await validateAndLogin(token);
};
// 取消
const handleCancel = () => {
hideTokenModal();
};
// 绑定事件
confirmBtn.onclick = handleConfirm;
cancelBtn.onclick = handleCancel;
// 回车确认
input.onkeydown = (e) => {
if (e.key === 'Enter') {
handleConfirm();
}
};
// 点击遮罩关闭
modal.onclick = (e) => {
if (e.target === modal) {
handleCancel();
}
};
}
// 隐藏 Token 模态框
function hideTokenModal() {
const modal = document.getElementById('token-modal');
modal.classList.add('hidden');
}
// 验证 Token 并登录
async function validateAndLogin(token) {
try {
showToast('正在验证...', 'info');
const response = await fetch('https://api.github.com/user', {
headers: {
'Authorization': `token ${token}`,
'Accept': 'application/vnd.github.v3+json'
}
});
if (response.ok) {
const user = await response.json();
githubToken = token;
currentUser = user;
localStorage.setItem('github_token', token);
showLoggedInUI();
showToast('登录成功!', 'success');
// 从 Gist 加载数据
await syncFromGist();
} else {
showToast('Token 无效,请检查', 'error');
}