@@ -232,6 +232,16 @@ document.addEventListener("astro:page-load", () => {
232232 BIM : { name : "Big Ideas Math" , icon : "/assets/media/favicons/bim.ico" } ,
233233 } ;
234234
235+ const maskPresetIcon = ( iconUrl : string ) : string => {
236+ const isPreset = Object . values ( cloaker ) . some ( preset => preset . icon === iconUrl ) ;
237+ if ( ! isPreset ) return iconUrl ;
238+
239+ const match = iconUrl . match ( / \. ( [ ^ . ] + ) $ / ) ;
240+ const extension = match ? match [ 1 ] : "" ;
241+
242+ return extension ? `***.${ extension } ` : "***" ;
243+ } ;
244+
235245 if ( cloakerDropdown ) {
236246 const links = cloakerDropdown . querySelectorAll < HTMLAnchorElement > ( "a" ) ;
237247 links . forEach ( ( link ) => {
@@ -319,12 +329,14 @@ document.addEventListener("astro:page-load", () => {
319329 }
320330
321331 if ( customIcon ) {
322- customIcon . value = localStorage . getItem ( "icon" ) || "" ;
332+ const storedIcon = localStorage . getItem ( "icon" ) || "" ;
333+ customIcon . value = maskPresetIcon ( storedIcon ) ;
334+
323335 customIcon . addEventListener ( "keydown" , ( event ) => {
324336 if ( event . key !== "Enter" ) return ;
325337 event . preventDefault ( ) ;
326338 const icon = customIcon . value . trim ( ) ;
327- if ( ! icon ) return ;
339+ if ( ! icon || icon . startsWith ( "***" ) ) return ;
328340 localStorage . setItem ( "icon" , icon ) ;
329341 window . location . reload ( ) ;
330342 } ) ;
@@ -339,8 +351,13 @@ if (panicKey) {
339351 panicKey . addEventListener ( "keydown" , ( event ) => {
340352 if ( event . key !== "Enter" ) return ;
341353 event . preventDefault ( ) ;
342- const key = panicKey . value . trim ( ) ;
354+ let key = panicKey . value . trim ( ) ;
343355 if ( ! key ) return ;
356+
357+ if ( key . length >= 2 && ! key . includes ( "," ) ) {
358+ key = key . split ( "" ) . join ( "," ) ;
359+ }
360+
344361 localStorage . setItem ( "key" , key ) ;
345362 window . location . reload ( ) ;
346363 } ) ;
0 commit comments