@@ -33,11 +33,10 @@ function updateWebsiteFilterOptions(scripts, websiteFilter) {
3333 }
3434 }
3535
36- // Clear all options
3736 while ( websiteFilter . firstChild ) {
3837 websiteFilter . removeChild ( websiteFilter . firstChild ) ;
3938 }
40- // Add "All Websites" option
39+
4140 const allOption = document . createElement ( "option" ) ;
4241 allOption . value = "" ;
4342 allOption . textContent = "All Websites" ;
@@ -68,7 +67,6 @@ function updateScriptsList(scripts, elements) {
6867 return ;
6968 }
7069
71- // show scripts
7270 if ( elements . scriptsTable ) elements . scriptsTable . style . display = "table" ;
7371 if ( elements . emptyState ) elements . emptyState . style . display = "none" ;
7472
@@ -145,56 +143,6 @@ function createStatusToggleCell(script) {
145143 return statusCell ;
146144}
147145
148- function createFaviconCell ( script ) {
149- const faviconCell = document . createElement ( "td" ) ;
150- const faviconContainer = document . createElement ( "div" ) ;
151- faviconContainer . className = "favicon-container" ;
152-
153- // mutli favs
154- const uniqueHosts = new Set ( ) ;
155-
156- // get fav for each
157- if ( script . targetUrls && script . targetUrls . length > 0 ) {
158- script . targetUrls . forEach ( ( url ) => {
159- try {
160- let hostname ;
161- if ( url . includes ( "://" ) ) {
162- hostname = new URL ( url ) . hostname ;
163- } else {
164- hostname = url . split ( "/" ) [ 0 ] ;
165- }
166-
167- if ( ! uniqueHosts . has ( hostname ) ) {
168- uniqueHosts . add ( hostname ) ;
169-
170- if ( faviconContainer . children . length < 3 ) {
171- const faviconWrapper = createFaviconWrapper ( hostname ) ;
172- faviconContainer . appendChild ( faviconWrapper ) ;
173- }
174- }
175- } catch ( error ) {
176- // skip invalid (e.g. "about:blank") URLs
177- }
178- } ) ;
179- }
180- if ( uniqueHosts . size > 3 ) {
181- const extraHosts = Array . from ( uniqueHosts ) . slice ( 3 ) ;
182- const counterElement = createFaviconCounter ( extraHosts ) ;
183- faviconContainer . appendChild ( counterElement ) ;
184- }
185-
186- // FALLBACK!
187- if ( faviconContainer . children . length === 0 ) {
188- const fallback = document . createElement ( "div" ) ;
189- fallback . className = "favicon-fallback" ;
190- fallback . textContent = ( script . name [ 0 ] || "?" ) . toUpperCase ( ) ;
191- faviconContainer . appendChild ( fallback ) ;
192- }
193-
194- faviconCell . appendChild ( faviconContainer ) ;
195- return faviconCell ;
196- }
197-
198146function createIconCell ( script ) {
199147 const iconCell = document . createElement ( "td" ) ;
200148 const container = document . createElement ( "div" ) ;
@@ -218,68 +166,6 @@ function createIconCell(script) {
218166 return iconCell ;
219167}
220168
221- function createFaviconWrapper ( hostname ) {
222- const faviconWrapper = document . createElement ( "div" ) ;
223- faviconWrapper . className = "favicon-wrapper" ;
224- faviconWrapper . title = hostname ;
225-
226- const faviconImg = document . createElement ( "img" ) ;
227- const faviconUrl = `https://s2.googleusercontent.com/s2/favicons?domain=${ hostname } ` ;
228-
229- console . log ( `Fetching favicon for ${ hostname } :` , faviconUrl ) ;
230-
231- faviconImg . src = faviconUrl ;
232- faviconImg . alt = "" ;
233- faviconImg . className = "favicon" ;
234- faviconImg . onerror = function ( ) {
235- console . warn ( `Failed to load favicon for ${ hostname } ` ) ;
236- const fallbackText = hostname . replace ( / \* \. / g, "" ) . charAt ( 0 ) . toUpperCase ( ) ;
237- const fallbackDiv = document . createElement ( "div" ) ;
238- fallbackDiv . className = "favicon-fallback" ;
239- fallbackDiv . textContent = fallbackText ;
240- this . parentElement . innerHTML = "" ; // Clear previous content
241- this . parentElement . appendChild ( fallbackDiv ) ;
242- } ;
243-
244- faviconWrapper . appendChild ( faviconImg ) ;
245- return faviconWrapper ;
246- }
247-
248- function createFaviconCounter ( extraHosts ) {
249- const counter = document . createElement ( "div" ) ;
250- counter . className = "favicon-counter" ;
251- counter . textContent = `+${ extraHosts . length } ` ;
252- const dropdown = document . createElement ( "div" ) ;
253- dropdown . className = "favicon-dropdown" ;
254-
255- const urlList = document . createElement ( "ul" ) ;
256- urlList . className = "favicon-url-list" ;
257-
258- extraHosts . forEach ( ( hostname ) => {
259- const listItem = document . createElement ( "li" ) ;
260- listItem . className = "favicon-url-item" ;
261- const favicon = document . createElement ( "img" ) ;
262- favicon . src = `https://${ hostname } /favicon.ico` ;
263- favicon . alt = "" ;
264- favicon . onerror = ( ) => {
265- const fallbackDiv = document . createElement ( "div" ) ;
266- fallbackDiv . className = "favicon-fallback" ;
267- fallbackDiv . textContent = ( hostname [ 0 ] || "?" ) . toUpperCase ( ) ;
268- favicon . replaceWith ( fallbackDiv ) ;
269- } ;
270-
271- const domain = document . createElement ( "span" ) ;
272- domain . textContent = hostname ;
273-
274- listItem . append ( favicon , domain ) ;
275- urlList . appendChild ( listItem ) ;
276- } ) ;
277-
278- dropdown . appendChild ( urlList ) ;
279- counter . appendChild ( dropdown ) ;
280- return counter ;
281- }
282-
283169function createActionsCell ( script ) {
284170 const actionsCell = document . createElement ( "td" ) ;
285171 actionsCell . className = "script-actions" ;
@@ -408,20 +294,16 @@ function escapeHtml(unsafe) {
408294 . replace ( / & / g, "&" )
409295 . replace ( / < / g, "<" )
410296 . replace ( / > / g, ">" )
411- . replace ( / \ "/ g, """ )
297+ . replace ( / " / g, """ )
412298 . replace ( / ' / g, "'" ) ;
413299}
414300
415- // ----------------------------------------------
416- // About Tab helpers
417- // ----------------------------------------------
418301function setupAboutNav ( aboutContainer ) {
419302 if ( ! aboutContainer ) return ;
420303
421304 const navButtons = aboutContainer . querySelectorAll ( ".about-nav" ) ;
422305 const sections = aboutContainer . querySelectorAll ( ".about-section" ) ;
423306
424- // ensure exporting section exists
425307 const contentEl = aboutContainer . querySelector ( ".about-content" ) ;
426308 if ( contentEl && ! contentEl . querySelector ( "#exporting" ) ) {
427309 contentEl . insertAdjacentHTML (
@@ -447,7 +329,6 @@ function setupAboutNav(aboutContainer) {
447329 } ) ;
448330}
449331
450- // Expose helpers for other modules
451332window . updateWebsiteFilterOptions = updateWebsiteFilterOptions ;
452333window . updateScriptsList = updateScriptsList ;
453334window . showNotification = showNotification ;
0 commit comments