61
61
cursor : pointer;
62
62
transition : background-color 0.2s ease;
63
63
text-decoration : none;
64
- color : inherit;
64
+ color : # 333333 ;
65
+ }
66
+ [data-theme = "dark" ] tags span , [data-theme = "dark" ] tags a .tag-link {
67
+ background-color : # 2a2a30 ;
68
+ color : # ffffff ;
69
+ border : 1px solid rgba (111 , 161 , 255 , 0.3 );
65
70
}
66
71
tags span : hover , tags a .tag-link : hover {
67
72
background-color : # e0e0e0 ;
68
73
}
74
+ [data-theme = "dark" ] tags span : hover , [data-theme = "dark" ] tags a .tag-link : hover {
75
+ background-color : # 3a3a40 ;
76
+ }
69
77
tags span .active , tags a .tag-link .active {
70
78
background-color : # 007bff ;
71
79
color : white;
72
80
}
81
+ [data-theme = "dark" ] tags span .active , [data-theme = "dark" ] tags a .tag-link .active {
82
+ background-color : # 4d8dff ;
83
+ color : white;
84
+ }
73
85
/* Style for filter notification */
74
86
.filter-note {
75
87
margin : 1rem 0 ;
152
164
< script defer src ="https://cdn.jsdelivr.net/npm/marked/marked.min.js "> </ script >
153
165
< script defer src ="
https://cdn.jsdelivr.net/npm/[email protected] "
> </ script >
154
166
< script defer src ="/assets/js/main.js "> </ script >
167
+ < script defer src ="/assets/js/platform-utils.js "> </ script >
155
168
< script defer src ="/assets/js/command-data.js "> </ script >
156
169
< script >
157
170
document . documentElement . classList . remove ( 'no-js' ) ;
195
208
< script >
196
209
// Check if we're on localhost
197
210
if ( window . location . hostname === 'localhost' || window . location . hostname === '127.0.0.1' ) {
198
- // Load only specific Font Awesome icons for local development
199
- var icons = [ 'github' , 'search' , 'arrow-up-right-from-square' , 'bluesky' , 'youtube' , 'arrow-up' ] ;
200
- var link = document . createElement ( 'link' ) ;
201
- link . rel = 'stylesheet' ;
202
- link . href = 'https://use.fontawesome.com/releases/v6.7.2/css/solid.css' ;
203
- link . crossOrigin = 'anonymous' ;
204
- document . head . appendChild ( link ) ;
205
-
206
- var link2 = document . createElement ( 'link' ) ;
207
- link2 . rel = 'stylesheet' ;
208
- link2 . href = 'https://use.fontawesome.com/releases/v6.7.2/css/brands.css' ;
209
- link2 . crossOrigin = 'anonymous' ;
210
- document . head . appendChild ( link2 ) ;
211
+ // Load Font Awesome stylesheets with improved error handling and version extraction
212
+ function loadStylesheet ( href ) {
213
+ const link = document . createElement ( 'link' ) ;
214
+ link . rel = 'stylesheet' ;
215
+ link . href = href ;
216
+ link . crossOrigin = 'anonymous' ;
217
+ link . onerror = ( ) => console . error ( `Failed to load stylesheet: ${ href } ` ) ;
218
+ document . head . appendChild ( link ) ;
219
+ return link ;
220
+ }
221
+
222
+ const FA_VERSION = '6.7.2' ; // Extract version to a constant for easier updates
211
223
212
- var link3 = document . createElement ( 'link' ) ;
213
- link3 . rel = 'stylesheet' ;
214
- link3 . href = 'https://use.fontawesome.com/releases/v6.7.2/css/fontawesome.css' ;
215
- link3 . crossOrigin = 'anonymous' ;
216
- document . head . appendChild ( link3 ) ;
224
+ loadStylesheet ( `https://use.fontawesome.com/releases/v${ FA_VERSION } /css/solid.css` ) ;
225
+ loadStylesheet ( `https://use.fontawesome.com/releases/v${ FA_VERSION } /css/brands.css` ) ;
226
+ loadStylesheet ( `https://use.fontawesome.com/releases/v${ FA_VERSION } /css/fontawesome.css` ) ;
217
227
} else {
218
228
// Use Kit for production with defer
219
229
var script = document . createElement ( 'script' ) ;
@@ -516,7 +526,12 @@ <h3>Contents</h3>
516
526
const updateMatchingTags = ( tagText , shouldHighlight ) => {
517
527
document . querySelectorAll ( 'tags span' ) . forEach ( tag => {
518
528
if ( tag . textContent === tagText ) {
519
- tag . classList . toggle ( 'active' , shouldHighlight ) ;
529
+ // First remove any active class
530
+ tag . classList . remove ( 'active' ) ;
531
+ // Then add it back if needed
532
+ if ( shouldHighlight ) {
533
+ tag . classList . add ( 'active' ) ;
534
+ }
520
535
}
521
536
} ) ;
522
537
} ;
@@ -529,7 +544,8 @@ <h3>Contents</h3>
529
544
// If clicking the active tag, deactivate it
530
545
if ( activeTag === tagText ) {
531
546
activeTag = null ;
532
- updateMatchingTags ( tagText , false ) ;
547
+ // Remove active class from all tags
548
+ allTags . forEach ( t => t . classList . remove ( 'active' ) ) ;
533
549
paperContainers . forEach ( container => {
534
550
container . classList . remove ( 'hidden' ) ;
535
551
} ) ;
@@ -539,7 +555,9 @@ <h3>Contents</h3>
539
555
540
556
// Update active tag
541
557
activeTag = tagText ;
558
+ // Remove active class from all tags
542
559
allTags . forEach ( t => t . classList . remove ( 'active' ) ) ;
560
+ // Add active class to matching tags
543
561
updateMatchingTags ( tagText , true ) ;
544
562
545
563
// Update URL
0 commit comments