-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
1254 lines (1089 loc) · 58.8 KB
/
index.html
File metadata and controls
1254 lines (1089 loc) · 58.8 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>Sentry.Anywhere</title>
<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">
<link rel="icon" type="image/x-icon" href="/images/favicon.ico">
<style>
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&family=Oswald:wght@200..700&display=swap');
</style>
<style>
body{
overflow-y: hidden;
/*font-family: "Noto Sans", sans-serif;
font-variation-settings: "wdth" 100;
*/
font-family: "Oswald", sans-serif;
font-optical-sizing: auto;
font-weight: 300;
font-style: normal;
}
.tree-node {
transition: all 0.2s ease;
}
.tree-node.dragging {
opacity: 0.6;
background-color: #f3f4f6;
}
.tree-node.drag-over {
background-color: #e5e7eb;
}
.tree-children {
margin-left: 1.5rem;
border-left: 1px dashed #d1d5db;
}
.node-content {
cursor: pointer;
user-select: none;
}
.resize-handle {
width: 5px;
background: transparent;
cursor: col-resize;
transition: background 0.2s;
}
.resize-handle:hover, .resize-handle.active {
background: #3b82f6;
}
.sidebar {
min-width: 200px;
max-width: 80%;
}
.modal {
transition: opacity 0.25s ease;
}
.node-actions {
opacity: 0;
transition: opacity 0.2s;
}
.tree-node:hover .node-actions {
opacity: 1;
}
.file-item {
transition: all 0.2s;
}
.file-item:hover {
background-color: #f3f4f6;
}
</style>
<style>
.noShow{
display: none !important;
}
.dailyTool{
display: flex;
flex-direction: row;
}
.dailyTool :hover{
cursor: pointer;
}
.dailyToolAction {
opacity: 0;
transition: opacity 0.2s;
}
.dailyTool:hover .dailyToolAction {
opacity: 1;
}
</style>
<style>
.bookmarkItem{
display: flex;
flex-direction: row;
justify-content:flex-start;
align-items: center;
gap: 10px;
/*width:100% ;*/
}
.bookmarkItem :hover{
cursor: pointer;
color: #3b82f6;
}
.bookmarkAction {
opacity: 0;
transition: opacity 0.2s;
}
.bookmarkItem:hover .bookmarkAction {
opacity: 1;
}
.btnOutpost:hover{
cursor: pointer;
}
</style>
<style>
/* 紧凑书签网格样式 */
.bookmarks-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
gap: 15px;
}
.bookmark-card {
background: white;
border-radius: var(--border-radius);
box-shadow: var(--shadow);
overflow: hidden;
transition: var(--transition);
padding: 12px;
display: flex;
flex-direction: column;
height: 150px;
transform: translateY(0px);
}
.bookmark-card:hover {
transform: translateY(-3px);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.bookmark-header {
display: flex;
align-items: flex-start;
margin-bottom: 8px;
width:100% ;
}
.bookmark-favicon {
width: 32px;
height: 32px;
border-radius: 6px;
background: var(--primary-light);
display: flex;
align-items: center;
justify-content: center;
color:black;
font-weight: bold;
margin-right: 10px;
flex-shrink: 0;
font-size: 14px;
}
.bookmark-info {
flex: 1;
min-width: 0;
}
.bookmark-title {
font-weight: 600;
margin-bottom: 4px;
line-height: 1.3;
font-size: 14px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 10em;
/*
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
*/
}
.bookmark-url {
font-size: 10px;
color: var(--gray);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 15em;
}
.bookmark-actions {
display: flex;
gap: 5px;
margin-left: 5px;
align-items:center
}
.bookmark-actions button {
background: none;
border: none;
color: var(--gray);
cursor: pointer;
padding: 4px;
border-radius: 3px;
transition: var(--transition);
font-size: 12px;
}
.bookmark-actions button:hover {
background: var(--gray-light);
color: var(--dark);
}
.bookmark-description {
font-size: 12px;
color: var(--gray);
line-height: 1.4;
margin-bottom: 8px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
flex: 1;
}
.bookmark-footer {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 11px;
color: var(--gray);
width:100%;
}
.bookmark-tags span {
background: var(--gray-light);
padding: 2px 6px;
border-radius: 10px;
margin-right: 4px;
}
</style>
</head>
<body class="bg-gray-100 h-screen flex flex-col">
<!-- 顶部工具栏 -->
<header class="bg-white shadow-sm py-2 px-6 flex items-center justify-between">
<div class="flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" class="btnOutpost" id="idBTNHome" width="24" height="24" viewBox="0 0 1024 1025"><path fill="#000000" d="M1004.5 556.5Q985 576 957.5 576T911 557l-15-15v419q0 26-18.5 45t-45.5 19H192q-27 0-45.5-19T128 961V542l-15 15q-19 19-46.5 19t-47-19.5t-19.5-47T19 463L463 19Q479 3 501.5.5T543 10q8 0 18 9l444 444q19 19 19 46.5t-19.5 47zM768 414L512 158L256 414v483h512V414z"/></svg> </div>
<div class="flex space-x-4">
<svg xmlns="http://www.w3.org/2000/svg" class="btnOutpost" id="idBTNDisplayCalendar" width="24" height="24" viewBox="0 0 26 26"><path fill="#000000" d="M7 0c-.551 0-1 .449-1 1v3c0 .551.449 1 1 1c.551 0 1-.449 1-1V1c0-.551-.449-1-1-1zm12 0c-.551 0-1 .449-1 1v3c0 .551.449 1 1 1c.551 0 1-.449 1-1V1c0-.551-.449-1-1-1zM3 2C1.344 2 0 3.344 0 5v18c0 1.656 1.344 3 3 3h20c1.656 0 3-1.344 3-3V5c0-1.656-1.344-3-3-3h-2v2a2 2 0 0 1-4 0V2H9v2a2 2 0 0 1-4 0V2H3zM2 9h22v14c0 .551-.449 1-1 1H3c-.551 0-1-.449-1-1V9zm7 3v2.313h4.813l-3.782 7.656H13.5l3.469-8.438V12H9z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" class="btnOutpost" id="idBTNDisplayTodos" width="24" height="24" viewBox="0 0 26 26"><path fill="#000000" d="M7.875 0a1 1 0 0 0-.656.375L3.812 4.656l-2.25-1.5A1.014 1.014 0 1 0 .438 4.844l3 2a1 1 0 0 0 1.344-.219l4-5A1 1 0 0 0 7.875 0zM12 3v2h14V3H12zM7.875 9a1 1 0 0 0-.656.375l-3.407 4.281l-2.25-1.5a1.014 1.014 0 1 0-1.125 1.688l3 2a1 1 0 0 0 1.344-.219l4-5A1 1 0 0 0 7.875 9zM12 12v2h14v-2H12zm-4.125 6a1 1 0 0 0-.656.375l-3.407 4.281l-2.25-1.5a1.014 1.014 0 1 0-1.125 1.688l3 2a1 1 0 0 0 1.344-.219l4-5A1 1 0 0 0 7.875 18zM12 21v2h14v-2H12z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" class="btnOutpost" id="idBTNDisplayDailyTools" width="24" height="24" viewBox="0 0 24 24"><path fill="#000000" d="M18.29 5.706a1.405 1.405 0 0 0-1.987 0L4.716 17.296l1.324-2.65l-2.65-2.649l3.312-3.311l2.65 2.65l1.986-1.988l-3.642-3.642a1.405 1.405 0 0 0-1.987 0L.411 11.004a1.404 1.404 0 0 0 0 1.987l4.305 4.304l.993.993a1.405 1.405 0 0 0 1.987 0L19.285 6.7l-.993-.994Zm-.332 3.647l2.65 2.65l-4.306 4.305a1.404 1.404 0 1 0 1.986 1.986l5.299-5.298a1.404 1.404 0 0 0 0-1.987l-4.305-4.304z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" class="btnOutpost" id="idBTNFreshData" width="24" height="24" viewBox="0 0 14 14"><path fill="#000000" fill-rule="evenodd" d="M.127 1.85c0-.111.055-.283.294-.506c.241-.225.623-.456 1.148-.663C2.614.27 4.1 0 5.775 0c1.673 0 3.16.269 4.205.681c.525.207.907.438 1.148.663c.24.223.294.395.294.506c0 .111-.055.283-.294.506c-.24.225-.623.456-1.148.663c-1.045.412-2.532.68-4.205.68c-1.674 0-3.161-.268-4.206-.68C1.044 2.812.662 2.58.42 2.356C.18 2.133.126 1.961.126 1.85ZM11.55 3.61a5.75 5.75 0 0 1-1.11.57c-1.225.484-2.874.769-4.664.769c-1.79 0-3.44-.285-4.665-.769A5.747 5.747 0 0 1 0 3.611v2.585c.04.093.118.207.266.342c.248.226.643.458 1.183.666c1.076.414 2.605.683 4.326.683c.451 0 .89-.018 1.31-.053a1.87 1.87 0 0 1 .984-.156c.056-.208.152-.41.294-.598a1.91 1.91 0 0 1 .962-.655c.543-.17 1.117-.126 1.413-.09c.215.026.425.067.628.122a.89.89 0 0 0 .183-.262V3.611ZM1 8.371c1.181.454 2.75.733 4.461.764a1.875 1.875 0 0 0 .356 2.48c.04.214.096.424.166.628l-.208.002C2.585 12.245 0 11.135 0 9.77V7.888c.298.182.636.343 1 .482Zm12.403 2.377l.058.008a.625.625 0 0 1 .29 1.117l-.84.636a.625.625 0 0 1-.876-.122l-.635-.84a.625.625 0 0 1 .585-.997l.16.023a1.955 1.955 0 0 0-2.187-1.757a.625.625 0 0 1-.697-.543V8.27c-.03-.252.05-.42.192-.53a.622.622 0 0 1 .352-.165a3.19 3.19 0 0 1 .782 0a3.205 3.205 0 0 1 2.816 3.172ZM7.484 9.043a.625.625 0 0 1 .876.121l.635.841a.625.625 0 0 1-.584.996l-.161-.022a1.955 1.955 0 0 0 2.187 1.757a.625.625 0 1 1 .153 1.24a3.207 3.207 0 0 1-3.599-3.172l-.057-.008a.625.625 0 0 1-.29-1.118z" clip-rule="evenodd"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" class="btnOutpost" id="idBTNSaveChange" width="24" height="24" viewBox="0 0 24 24"><path fill="#000000" d="M12 4a5 5 0 0 0-5 5v2H6c-.78 0-1.805.302-2.62.964C2.598 12.6 2 13.572 2 15c0 1.414.615 2.388 1.42 3.032c.836.67 1.866.968 2.58.968c.973 0 2.239-.015 3.263-.521c.485-.24.9-.585 1.203-1.097c.306-.517.534-1.27.534-2.382v-1.086l-1.5 1.5L8.086 14L12 10.086L15.914 14L14.5 15.414l-1.5-1.5V15c0 1.387-.286 2.51-.812 3.4a4.783 4.783 0 0 1-2.04 1.872C8.674 21 6.979 21 6.056 21H6c-1.168 0-2.638-.452-3.83-1.407C.943 18.613 0 17.086 0 15c0-2.072.903-3.6 2.12-4.589A6.447 6.447 0 0 1 5 9.093V9a7 7 0 0 1 14 0v.093a6.447 6.447 0 0 1 2.88 1.318C23.099 11.401 24 12.928 24 15c0 2.076-.907 3.614-2.205 4.607C20.529 20.575 18.93 21 17.5 21h-4v-2h4c1.07 0 2.221-.325 3.08-.982C21.407 17.386 22 16.424 22 15c0-1.428-.598-2.4-1.38-3.036C19.804 11.302 18.78 11 18 11h-1V9a5 5 0 0 0-5-5Z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" class="btnOutpost" id="idBTNPortfolioMan" width="24" height="24" viewBox="0 0 24 24"><path fill="#000000" d="M8 13.65V7q0-.425.288-.713T9 6h1q.425 0 .713.288T11 7v6.65l-.125-.125q-.575-.55-1.375-.55t-1.375.55L8 13.65Zm5 1.5V3q0-.425.288-.713T14 2h1q.425 0 .713.288T16 3v9.15l-3 3ZM3 18.6V11q0-.425.288-.713T4 10h1q.425 0 .713.288T6 11v4.6l-3 3Zm2.4 2.45q-.65 0-.913-.613T4.7 19.35l4.1-4.1q.275-.275.663-.3t.687.25L13 17.65l5.6-5.6H18q-.425 0-.713-.288T17 11.05q0-.425.288-.713T18 10.05h3q.425 0 .713.288t.287.712v3q0 .425-.288.713T21 15.05q-.425 0-.713-.288T20 14.05v-.6l-6.25 6.25q-.275.275-.663.3t-.687-.25L9.55 17.3L6.1 20.75q-.125.125-.312.213t-.388.087Z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" class="btnOutpost" id="idBTNSetting" width="24" height="24" viewBox="0 0 48 48"><path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M41.5 10h-6m-8-4v8m0-4h-22m8 14h-8m16-4v8m22-4h-22m20 14h-6m-8-4v8m0-4h-22"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" class="btnOutpost" id="idBTNSignIn" width="24" height="24" viewBox="0 0 24 24"><path fill="#000000" d="M8 15h8v-.55q0-1.125-1.1-1.788T12 12q-1.8 0-2.9.663T8 14.45V15Zm4-4q.825 0 1.413-.588T14 9q0-.825-.588-1.413T12 7q-.825 0-1.413.588T10 9q0 .825.588 1.413T12 11ZM8 21v-2H4q-.825 0-1.413-.588T2 17V5q0-.825.588-1.413T4 3h16q.825 0 1.413.588T22 5v12q0 .825-.588 1.413T20 19h-4v2H8Zm-4-4h16V5H4v12Zm0 0V5v12Z"/></svg> </div>
</header>
<div class="flex flex-1 overflow-hidden">
<!-- 左侧导航栏 -->
<aside class="sidebar bg-white shadow-md px-2 py-2 overflow-y-auto relative" id="sidebar">
<div style="height:100%;overflow-y: hidden; display: flex;flex-direction: column;">
<h3 class="text-md font-medium text-gray-600 flex items-center justify-between" style="height:30px;">
<input type="text" placeholder="搜索目录..." class="w-full px-2 border rounded-lg focus:outline-none focus:ring-blue-500">
<svg xmlns="http://www.w3.org/2000/svg" id="idBTNSearchCategory" width="20" height="20" viewBox="0 0 26 26"><path fill="#000000" d="M10 .188A9.812 9.812 0 0 0 .187 10A9.812 9.812 0 0 0 10 19.813c2.29 0 4.393-.811 6.063-2.125l.875.875a1.845 1.845 0 0 0 .343 2.156l4.594 4.625c.713.714 1.88.714 2.594 0l.875-.875a1.84 1.84 0 0 0 0-2.594l-4.625-4.594a1.824 1.824 0 0 0-2.157-.312l-.875-.875A9.812 9.812 0 0 0 10 .188zM10 2a8 8 0 1 1 0 16a8 8 0 0 1 0-16zM4.937 7.469a5.446 5.446 0 0 0-.812 2.875a5.46 5.46 0 0 0 5.469 5.469a5.516 5.516 0 0 0 3.156-1a7.166 7.166 0 0 1-.75.03a7.045 7.045 0 0 1-7.063-7.062c0-.104-.005-.208 0-.312z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" id="add-node-btn" width="20" height="20" viewBox="0 0 24 24"><mask id="lineMdFolderPlus0"><g fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path stroke-dasharray="64" stroke-dashoffset="64" d="M12 7h8c0.55 0 1 0.45 1 1v10c0 0.55 -0.45 1 -1 1h-16c-0.55 0 -1 -0.45 -1 -1v-11Z"><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.6s" values="64;0"/></path><path d="M12 7h-9v0c0 0 0.45 0 1 0h6z" opacity="0"><animate fill="freeze" attributeName="d" begin="0.6s" dur="0.2s" values="M12 7h-9v0c0 0 0.45 0 1 0h6z;M12 7h-9v-1c0 -0.55 0.45 -1 1 -1h6z"/><set fill="freeze" attributeName="opacity" begin="0.6s" to="1"/></path><path fill="#000" fill-opacity="0" stroke="none" d="M19 13c3.31 0 6 2.69 6 6c0 3.31 -2.69 6 -6 6c-3.31 0 -6 -2.69 -6 -6c0 -3.31 2.69 -6 6 -6Z"><set fill="freeze" attributeName="fill-opacity" begin="0.8s" to="1"/></path><path stroke-dasharray="8" stroke-dashoffset="8" d="M16 19h6"><animate fill="freeze" attributeName="stroke-dashoffset" begin="0.8s" dur="0.2s" values="8;0"/></path><path stroke-dasharray="8" stroke-dashoffset="8" d="M19 16v6"><animate fill="freeze" attributeName="stroke-dashoffset" begin="1s" dur="0.2s" values="8;0"/></path></g></mask><rect width="24" height="24" fill="currentColor" mask="url(#lineMdFolderPlus0)"/></svg>
</h3>
<div id="directory-tree" class="mt-2" style="overflow-y: auto; flex-grow: 1;"><!-- 目录树将通过JS动态生成 --></div>
</div>
<!-- 调整宽度的拖拽手柄 -->
<div class="resize-handle absolute top-0 right-0 h-full" id="resize-handle"></div>
</aside>
<!-- 右侧内容展示区 -->
<main class="flex-1 bg-gray-50 p-6 overflow-y-auto" id="main-content">
<div class="mx-auto">
<div class="rounded-xl shadow-sm p-6" style="background-color: #f5f7fb;">
<div class="flex items-center mb-6">
<h2 class="text-2xl font-bold text-gray-800" id="idCurrentFolderTitle">daily Toolbox</h2>
<span class="ml-2 text-sm text-gray-500" id="items-count">5</span>
<div class="canvasDailyToolbar">
<svg xmlns="http://www.w3.org/2000/svg" id="idBTNPlusBookmark" width="24" height="24" viewBox="0 0 32 32"><path fill="#000000" d="M24 16v10.752l-7.096-3.59l-.904-.457l-.9.456L8 26.748V4h10V2H8a2 2 0 0 0-2 2v26l10-5.054L26 30V16Z"/><path fill="#000000" d="M26 6V2h-2v4h-4v2h4v4h2V8h4V6h-4z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" id="idBTNPlusDailyTool" class="canvasToolbarBTN" width="18" height="18" viewBox="0 0 16 16" fill="#000000"><g fill="#000000"><path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM2 2a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1H2z"/><path d="M2.5 4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5V4zM8 8a.5.5 0 0 1 .5.5V10H10a.5.5 0 0 1 0 1H8.5v1.5a.5.5 0 0 1-1 0V11H6a.5.5 0 0 1 0-1h1.5V8.5A.5.5 0 0 1 8 8z"/></g></svg>
</div>
</div>
<!-- 文件列表区域 -->
<div id="idFolderContents" class="bookmarks-grid grid-view"></div>
</div>
</div>
</main>
</div>
<!-- 添加节点的模态框 -->
<div class="modal fixed inset-0 bg-gray-600 bg-opacity-50 flex items-center justify-center hidden" id="add-node-modal">
<div class="bg-white rounded-lg shadow-xl w-full max-w-md p-6">
<h3 class="text-xl font-semibold text-gray-800 mb-4">添加新节点</h3>
<div class="mb-4">
<label class="block text-gray-700 text-sm font-bold mb-2" for="node-name">
节点名称
</label>
<input type="text" id="node-name" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
</div>
<div class="flex justify-end space-x-3">
<button class="bg-gray-300 hover:bg-gray-400 text-gray-800 py-2 px-4 rounded" id="cancel-add">
取消
</button>
<button class="bg-blue-500 hover:bg-blue-600 text-white py-2 px-4 rounded" id="confirm-add">
确认添加
</button>
</div>
</div>
</div>
<!-- 添加节点的模态框 -->
<div class="modal fixed inset-0 bg-gray-600 bg-opacity-50 flex items-center justify-center hidden" id="add-DailyTool-modal">
<div class="bg-white rounded-lg shadow-xl w-full max-w-md p-6">
<h3 class="text-xl font-semibold text-gray-800 mb-4">添加新节点</h3>
<div class="mb-4">
<label class="block text-gray-700 text-sm font-bold mb-2" for="node-name">
节点名称
</label>
<input type="text" id="node-name" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
</div>
<div class="flex justify-end space-x-3">
<button class="bg-gray-300 hover:bg-gray-400 text-gray-800 py-2 px-4 rounded" id="cancel-add">
取消
</button>
<button class="bg-blue-500 hover:bg-blue-600 text-white py-2 px-4 rounded" id="confirm-add">
确认添加
</button>
</div>
</div>
</div>
<!-- 删除确认模态框 -->
<div class="modal fixed inset-0 bg-gray-600 bg-opacity-50 flex items-center justify-center hidden" id="delete-node-modal">
<div class="bg-white rounded-lg shadow-xl w-full max-w-md p-6">
<h3 class="text-xl font-semibold text-gray-800 mb-4">确认删除</h3>
<p class="text-gray-600 mb-6" id="delete-confirm-msg">确定要删除这个节点吗?此操作不可撤销。</p>
<div class="flex justify-end space-x-3">
<button class="bg-gray-300 hover:bg-gray-400 text-gray-800 py-2 px-4 rounded" id="cancel-delete">
取消
</button>
<button class="bg-red-500 hover:bg-red-600 text-white py-2 px-4 rounded" id="confirm-delete">
确认删除
</button>
</div>
</div>
</div>
<script src="https://unpkg.com/@popperjs/core@2"></script>
<script src="https://unpkg.com/tippy.js@6"></script>
<script src="https://cdn.jsdelivr.net/npm/dayjs@1/dayjs.min.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.10.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.10.1/firebase-database.js"></script>
<script src="./Lab/DataAPI.js"></script>
<script src="./js/list.min.js"></script>
<script src="./js/modalFactoryV2.js"></script>
<script>
function formatDateYYYYMMDD(date) {
let cDate = new Date(date) ;
const year = cDate.getFullYear();
const month = String(cDate.getMonth() + 1).padStart(2, '0');
const day = String(cDate.getDate()).padStart(2, '0');
return `${year}${month}${day}`;
}
// 颜色方案
const colorSchemes = {
vibrant: [
"#FF6B6B", "#4ECDC4", "#FFD166", "#06D6A0",
"#118AB2", "#EF476F", "#7209B7", "#3A86FF"
],
pastel: [
"#FFADAD", "#9BF6FF", "#CAFFBF", "#FDFFB6",
"#A0C4FF", "#BDB2FF", "#FFC6FF", "#FFFFFC"
],
monochromatic: [
"#4361EE", "#4895EF", "#4CC9F0", "#3F37C9",
"#3A0CA3", "#480CA8", "#560BAD", "#7209B7"
]
};
// 生成随机颜色
function getRandomColor(scheme) {
if (scheme === "random") {
// 生成完全随机颜色
const letters = '0123456789ABCDEF';
let color = '#';
for (let i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
} else {
// 从预定义方案中选择颜色
const colors = colorSchemes[scheme];
return colors[Math.floor(Math.random() * colors.length)];
}
}
// 从URL提取域名并生成图标文本
function getIconText(url, mode) {
try {
const domain = new URL(url).hostname.replace('www.', '');
const parts = domain.split('.');
const mainDomain = parts[0];
switch(mode) {
case "first-letter":
return mainDomain.charAt(0).toUpperCase();
case "first-two":
return mainDomain.substring(0, 2).toUpperCase();
case "domain":
// 取域名前两个字母或整个短域名
return mainDomain.length <= 3 ?
mainDomain.toUpperCase() :
mainDomain.substring(0, 2).toUpperCase();
default:
return mainDomain.charAt(0).toUpperCase();
}
} catch (e) {
return "?";
}
}
</script>
<script>
// 当前选中的节点
let selectedNode = null;
let nodeToDelete = null;
// 目录树渲染功能
function renderTree(data, parentElement, level = 0) {
data.forEach(item => {
const hasChildren = item.children && item.children.length > 0;
const nodeElement = document.createElement('div');
nodeElement.className = 'tree-node';
nodeElement.dataset.id = item.id;
nodeElement.draggable = true;
// 所有节点都显示为文件夹图标
nodeElement.innerHTML = `
<div class="node-content px-2 rounded-lg flex items-center hover:bg-gray-100 group">
<span class="toggle-icon mr-2 text-gray-500 ${hasChildren ? '' : 'invisible'}">
<i class="fas fa-caret-right"></i>
</span>
<i class="fas fa-folder text-yellow-500 mr-2"></i>
<span class="text-gray-700 flex-grow" style="font-size:18px;">${item.name}</span>
<div class="node-actions flex">
<i class="fas fa-times text-red-400 hover:text-red-600 ml-2 delete-node" title="删除节点"></i>
</div>
</div>
${hasChildren ? `<div class="tree-children ${level > 0 ? 'pl-4' : ''}"></div>` : ''}
`;
parentElement.appendChild(nodeElement);
// 添加展开/折叠功能
const toggleIcon = nodeElement.querySelector('.toggle-icon');
const childrenContainer = nodeElement.querySelector('.tree-children');
if (hasChildren && childrenContainer) {
let expanded = false;
toggleIcon.addEventListener('click', (e) => {
e.stopPropagation();
expanded = !expanded;
if (expanded) {
childrenContainer.style.display = 'block';
toggleIcon.innerHTML = '<i class="fas fa-caret-down"></i>';
renderTree(item.children, childrenContainer, level + 1);
} else {
childrenContainer.style.display = 'none';
toggleIcon.innerHTML = '<i class="fas fa-caret-right"></i>';
childrenContainer.innerHTML = '';
}
});
}
// 添加点击事件
const nodeContent = nodeElement.querySelector('.node-content');
nodeContent.addEventListener('click', () => {
document.querySelectorAll('.node-content').forEach(el => {
el.classList.remove('bg-blue-100', 'font-semibold');
});
nodeContent.classList.add('bg-blue-100', 'font-semibold');
// 更新当前选中的节点
selectedNode = item;
// 显示文件夹内容
displayFolderContents(item);
let tagCurrentFolder = document.querySelector(".selectedFolder") ;
if(tagCurrentFolder == nodeElement) return ;
if(tagCurrentFolder!=null)tagCurrentFolder.classList.remove("selectedFolder") ;
nodeElement.classList.add('selectedFolder') ;
});
// 添加删除节点事件
const deleteBtn = nodeElement.querySelector('.delete-node');
deleteBtn.addEventListener('click', (e) => {
e.stopPropagation();
nodeToDelete = item;
showDeleteModal();
});
// 添加拖拽事件
nodeElement.addEventListener('dragstart', handleDragStart);
nodeElement.addEventListener('dragover', handleDragOver);
nodeElement.addEventListener('dragenter', handleDragEnter);
nodeElement.addEventListener('dragleave', handleDragLeave);
nodeElement.addEventListener('drop', handleDrop);
nodeElement.addEventListener('dragend', handleDragEnd);
});
}
// 显示文件夹内容
function displayFoldersInFolder(folder) {
const folderContents = document.getElementById('idFolderContents');
const currentFolder = document.getElementById('idCurrentFolderTitle');
// 更新标题
currentFolder.textContent = folder.name;
// 清空内容区域
folderContents.innerHTML = '';
// 检查文件夹是否为空
if (!folder.children || folder.children.length === 0) {
folderContents.innerHTML = `
<div class="text-center py-12">
<i class="fas fa-folder-open text-5xl text-gray-300 mb-4"></i>
<p class="text-gray-500 text-lg">此文件夹为空</p>
</div>
`;
document.getElementById('items-count').textContent = '(0 个项目)';
return;
}
// 显示项目数量
const itemsCount = folder.children.length;
document.getElementById('items-count').textContent = `(${itemsCount} 个项目)`;
// 创建文件列表容器
const fileList = document.createElement('div');
fileList.className = 'bg-gray-50 rounded-lg p-4';
// 添加标题
const title = document.createElement('h3');
title.className = 'text-lg font-semibold text-gray-700 mb-4';
title.textContent = '内容';
fileList.appendChild(title);
// 添加文件和文件夹项目
folder.children.forEach(item => {
const isFolder = item.type === 'folder';
const itemElement = document.createElement('div');
itemElement.className = 'file-item flex items-center py-3 px-4 border-b border-gray-200 last:border-b-0';
itemElement.innerHTML = `
<i class="fas ${isFolder ? 'fa-folder text-yellow-500' : 'fa-file text-blue-400'} mr-3"></i>
<span class="text-gray-700 flex-grow">${item.name}</span>
<span class="text-xs text-gray-500">${isFolder ? '文件夹' : '文件'}</span>
`;
// 添加点击事件(如果是文件夹)
if (isFolder) {
itemElement.style.cursor = 'pointer';
itemElement.addEventListener('click', () => {
// 在目录树中找到并高亮对应的节点
highlightTreeNode(item.id);
// 显示文件夹内容
displayFolderContents(item);
});
}
fileList.appendChild(itemElement);
});
folderContents.appendChild(fileList);
}
const callbackPlusBookmark = (formData)=>{
let jsonBookmark = {
id:crypto.randomUUID(),
type:"Gateway.Bookmark",
title:formData.title,
url:formData.url,
userID:'alexszhang'
} ;
plusBookmark2Folder(jsonBookmark,selectedNode) ;
//_renderDailyTool(jsonTool,tagToolsContainer) ;
//displayFolderContents(selectedNode) ;
let tagCanvas = document.querySelector("#idFolderContents");
renderBookmark(jsonBookmark,tagCanvas) ;
} ;
function displayFolderContents(folder) {
const folderContents = document.getElementById('idFolderContents');
const currentFolder = document.getElementById('idCurrentFolderTitle');
let tagBTNPlusBookmark = document.getElementById("idBTNPlusBookmark") ;
tagBTNPlusBookmark.classList.remove('noShow') ;
let tagBTNPlusDailyTool = document.getElementById("idBTNPlusDailyTool") ;
tagBTNPlusDailyTool.classList.add('noShow') ;
//let tagBookmarks = document.
console.log(folder) ;
// 更新标题
currentFolder.textContent = folder.name;
// 清空内容区域
folderContents.innerHTML = `
<!---
<div id="idBookmarkList"></div>
-->
`;
let bookmarksInFolder = fetchFolderBookmarks(folder) ;
console.log(bookmarksInFolder) ;
bookmarksInFolder.forEach(bookmark=>{
renderBookmark(bookmark,folderContents) ;
}) ;
document.querySelector("#idBTNPlusBookmark").addEventListener('click',(event)=>{
const bookmarkSchema = [
{ "name": "title", "type": "string", "placeholder": "书签标题" },
{ "name": "url", "type": "string", "placeholder": "https://..." }
];
const bookmarkCallbacks = {
onConfirm: callbackPlusBookmark,
onCancel: () => {
console.log("用户取消了操作。");
}
};
createFormModal('新建书签', bookmarkSchema, bookmarkCallbacks);
}) ;
}
function renderBookmark(bookmark,tagContainer){
const color = getRandomColor("vibrant");
const iconText = getIconText(bookmark.url, "first-two");
let tagBookmark = document.createElement('div') ;
tagBookmark.classList.add("bookmarkItem")
tagBookmark.dataset.dataID = bookmark.id ;
tagContainer.appendChild(tagBookmark) ;
let stringBookmarks = '' ;
if(bookmark.hasOwnProperty("tags")){
for(let i=0;i<bookmark.tags.length;i++){
stringBookmarks = stringBookmarks + `<span>${bookmark.tags[i]}</span>`
}
}else{
stringBookmarks = `<span>没有标签</span>` ;
}
tagBookmark.innerHTML = `
<div class="bookmark-header">
<div class="bookmark-favicon" style="background-color: ${color};">${iconText}</div>
<div class="bookmark-info">
<div class="bookmark-title">${bookmark.title}</div>
<div class="bookmark-url">${bookmark.url.replace(/^https?:\/\//, '')}</div>
</div>
<div class="bookmark-actions">
<button><i class="fas fa-star"></i></button>
<button><i class="fas fa-ellipsis-v"></i></button>
<svg xmlns="http://www.w3.org/2000/svg" class="bmActionRemove" width="14" height="14" viewBox="0 0 16 16"><path fill="#000000" d="M6.5 1h3a.5.5 0 0 1 .5.5v1H6v-1a.5.5 0 0 1 .5-.5ZM11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3A1.5 1.5 0 0 0 5 1.5v1H2.506a.58.58 0 0 0-.01 0H1.5a.5.5 0 0 0 0 1h.538l.853 10.66A2 2 0 0 0 4.885 16h6.23a2 2 0 0 0 1.994-1.84l.853-10.66h.538a.5.5 0 0 0 0-1h-.995a.59.59 0 0 0-.01 0H11Zm1.958 1l-.846 10.58a1 1 0 0 1-.997.92h-6.23a1 1 0 0 1-.997-.92L3.042 3.5h9.916Zm-7.487 1a.5.5 0 0 1 .528.47l.5 8.5a.5.5 0 0 1-.998.06L5 5.03a.5.5 0 0 1 .47-.53Zm5.058 0a.5.5 0 0 1 .47.53l-.5 8.5a.5.5 0 1 1-.998-.06l.5-8.5a.5.5 0 0 1 .528-.47ZM8 4.5a.5.5 0 0 1 .5.5v8.5a.5.5 0 0 1-1 0V5a.5.5 0 0 1 .5-.5Z"/></svg>
</div>
</div>
<div class="bookmark-description">${bookmark.hasOwnProperty("memo")?bookmark.memo:"memo"}</div>
<div class="bookmark-footer">
<div class="bookmark-date">${bookmark.hasOwnProperty("date")?formatDateYYYYMMDD(bookmark.date):"date TBD"}</div>
<div class="bookmark-tags">
${stringBookmarks}
</div>
</div>
`;
tagBookmark.classList.add('bookmark-card') ;
tagContainer.appendChild(tagBookmark) ;
tagBookmark.querySelector('.bmActionRemove').addEventListener('click',async (event)=>{
event.stopPropagation() ;
event.preventDefault() ;
await removeBookmark(tagBookmark.dataset.dataID) ;
tagBookmark.remove() ;
}) ;
tagBookmark.addEventListener('click',(event)=>{
window.open(bookmark.url,"_blank") ;
}) ;
}
// 高亮目录树中的节点
function highlightTreeNode(nodeId) {
// 清除所有高亮
document.querySelectorAll('.node-content').forEach(el => {
el.classList.remove('bg-blue-100', 'font-semibold');
});
// 找到对应节点并高亮
const nodeElement = document.querySelector(`.tree-node[data-id="${nodeId}"]`);
if (nodeElement) {
const nodeContent = nodeElement.querySelector('.node-content');
nodeContent.classList.add('bg-blue-100', 'font-semibold');
// 确保节点可见(展开父节点)
let parent = nodeElement.parentElement;
while (parent && parent.classList.contains('tree-children')) {
const parentNode = parent.previousElementSibling;
if (parentNode) {
const toggleIcon = parentNode.querySelector('.toggle-icon');
if (toggleIcon && !toggleIcon.classList.contains('invisible')) {
const childrenContainer = parentNode.nextElementSibling;
if (childrenContainer.style.display === 'none') {
toggleIcon.click();
}
}
}
parent = parent.parentElement;
}
// 滚动到节点位置
nodeElement.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
}
}
// 显示添加节点模态框
function showAddModal() {
/*
if (!selectedNode) {
alert('请先选择一个节点作为父节点');
return;
}
*/
document.getElementById('add-node-modal').classList.remove('hidden');
document.getElementById('node-name').value = '';
document.getElementById('node-name').focus();
}
// 隐藏添加节点模态框
function hideAddModal() {
document.getElementById('add-node-modal').classList.add('hidden');
}
// 显示删除确认模态框
function showDeleteModal() {
if (!nodeToDelete) return;
const hasChildren = nodeToDelete.children && nodeToDelete.children.length > 0;
if (hasChildren) {
document.getElementById('delete-confirm-msg').textContent =
'该节点包含子节点,无法删除。请先删除所有子节点。';
document.getElementById('confirm-delete').disabled = true;
document.getElementById('confirm-delete').classList.add('opacity-50');
} else {
document.getElementById('delete-confirm-msg').textContent =
'确定要删除这个节点吗?此操作不可撤销。';
document.getElementById('confirm-delete').disabled = false;
document.getElementById('confirm-delete').classList.remove('opacity-50');
}
document.getElementById('delete-node-modal').classList.remove('hidden');
}
// 隐藏删除确认模态框
function hideDeleteModal() {
document.getElementById('delete-node-modal').classList.add('hidden');
nodeToDelete = null;
}
// 添加新节点
function addNewNode() {
const nodeName = document.getElementById('node-name').value.trim();
if (!nodeName) {
alert('请输入节点名称');
return;
}
let jsonFolder={
id:crypto.randomUUID(),
name:nodeName,
type:'folder',
children: []
} ;
if (!selectedNode) {
plusFolderatRoot(jsonFolder);
}else{
// 生成唯一ID
plusFolder2Folder(jsonFolder,selectedNode) ;
}
// 重新渲染目录树
const treeContainer = document.getElementById('directory-tree');
treeContainer.innerHTML = '';
renderTree(gFolderTree, treeContainer);
// 隐藏模态框
hideAddModal();
// 更新内容显示
displayFolderContents(selectedNode);
}
// 删除节点
function deleteNode() {
if (!nodeToDelete) return;
// 检查是否有子节点
const hasChildren = nodeToDelete.children && nodeToDelete.children.length > 0;
if (hasChildren) {
alert('无法删除包含子节点的节点');
hideDeleteModal();
return;
}
removeFolderFromForest(nodeToDelete.id);
// 重新渲染目录树
const treeContainer = document.getElementById('directory-tree');
treeContainer.innerHTML = '';
renderTree(gFolderTree, treeContainer);
// 隐藏模态框
hideDeleteModal();
// 清除当前选中节点
selectedNode = null;
// 重置内容显示
document.getElementById('idCurrentFolderTitle').textContent = '内容展示区域';
document.getElementById('items-count').textContent = '';
document.getElementById('idFolderContents').innerHTML = "" ;
}
// 拖拽相关变量
let draggedItem = null;
// 拖拽事件处理函数
function handleDragStart(e) {
draggedItem = this;
e.dataTransfer.effectAllowed = 'move';
e.dataTransfer.setData('text/plain', this.dataset.id);
this.classList.add('dragging');
}
function handleDragOver(e) {
e.preventDefault();
e.dataTransfer.dropEffect = 'move';
return false;
}
function handleDragEnter(e) {
this.classList.add('drag-over');
}
function handleDragLeave(e) {
this.classList.remove('drag-over');
}
function handleDrop(e) {
e.preventDefault();
this.classList.remove('drag-over');
if (draggedItem !== this) {
// 检查是否是兄弟节点(简单实现,实际应用中需要更复杂的验证)
const parent = this.parentElement;
if (parent === draggedItem.parentElement) {
// 获取所有兄弟节点
const siblings = Array.from(parent.children);
const thisIndex = siblings.indexOf(this);
const draggedIndex = siblings.indexOf(draggedItem);
if (draggedIndex < thisIndex) {
parent.insertBefore(draggedItem, this.nextSibling);
} else {
parent.insertBefore(draggedItem, this);
}
}
}
return false;
}
function handleDragEnd(e) {
this.classList.remove('dragging');
document.querySelectorAll('.tree-node').forEach(node => {
node.classList.remove('drag-over');
});
}
// 调整侧边栏宽度功能
function initResizeHandler() {
const resizeHandle = document.getElementById('resize-handle');
const sidebar = document.getElementById('sidebar');
const mainContent = document.getElementById('main-content');
let isResizing = false;
resizeHandle.addEventListener('mousedown', (e) => {
isResizing = true;
resizeHandle.classList.add('active');
document.body.style.cursor = 'col-resize';
document.body.style.userSelect = 'none';
e.preventDefault();
});
document.addEventListener('mousemove', (e) => {
if (!isResizing) return;
const containerRect = sidebar.parentElement.getBoundingClientRect();
const widthPercentage = ((e.clientX - containerRect.left) / containerRect.width) * 100;
// 设置最小和最大宽度限制
const newWidth = Math.max(20, Math.min(80, widthPercentage));
sidebar.style.width = `${newWidth}%`;
mainContent.style.width = `${100 - newWidth}%`;
});
document.addEventListener('mouseup', () => {
if (isResizing) {
isResizing = false;
resizeHandle.classList.remove('active');
document.body.style.cursor = '';
document.body.style.userSelect = '';
}
});
}
// 初始化应用
document.addEventListener('DOMContentLoaded', async () => {
const treeContainer = document.getElementById('directory-tree');
await asyncLoadAppData() ;
// 渲染目录树
renderTree(gFolderTree, treeContainer);
// 初始化调整宽度功能
initResizeHandler();
// 添加搜索功能
const searchInput = document.querySelector('input[type="text"]');
searchInput.addEventListener('input', (e) => {
const searchTerm = e.target.value.toLowerCase();
document.querySelectorAll('.node-content').forEach(node => {
const nodeText = node.textContent.toLowerCase();
const treeNode = node.closest('.tree-node');
if (nodeText.includes(searchTerm)) {
treeNode.style.display = 'block';
// 展开父节点
let parent = treeNode.parentElement;
while (parent && parent.classList.contains('tree-children')) {
const parentNode = parent.previousElementSibling;
if (parentNode) {
const toggleIcon = parentNode.querySelector('.toggle-icon');
if (toggleIcon && !toggleIcon.classList.contains('invisible')) {
const childrenContainer = parentNode.nextElementSibling;
if (childrenContainer.style.display === 'none') {
toggleIcon.click();
}
}
}
parent = parent.parentElement;
}
} else {