@@ -12,7 +12,7 @@ if (redBtnElement) {
1212
1313var catalogState = {
1414 mode : "blue" ,
15- nav : "categories" ,
15+ nav : "categories" ,
1616 cat : null ,
1717 sub : null
1818} ;
@@ -23,14 +23,13 @@ if (isRedPath || isRedBtn) {
2323}
2424
2525// Stats Counter Animation
26- document . addEventListener ( "DOMContentLoaded" , function ( ) {
26+ document . addEventListener ( "DOMContentLoaded" , function ( ) {
2727 var statsContainer = document . getElementById ( 'statsContainer' ) ;
2828 var blueCountEl = document . getElementById ( 'blueCount' ) ;
2929 var redCountEl = document . getElementById ( 'redCount' ) ;
3030
3131 if ( ! statsContainer || ! blueCountEl || ! redCountEl ) return ;
3232
33- // Calculate totals
3433 var totalBlue = 0 ;
3534 var totalRed = 0 ;
3635
@@ -51,7 +50,7 @@ document.addEventListener("DOMContentLoaded", function() {
5150 for ( var cat in db . red ) {
5251 var categoryObj = db . red [ cat ] ;
5352 for ( var sub in categoryObj ) {
54- if ( sub !== 'meta' && categoryObj [ sub ] . tools ) {
53+ if ( sub !== 'meta' && categoryObj [ sub ] . tools ) {
5554 totalRed += categoryObj [ sub ] . tools . length ;
5655 }
5756 }
@@ -60,8 +59,8 @@ document.addEventListener("DOMContentLoaded", function() {
6059 }
6160
6261 // Animation observer
63- var observer = new IntersectionObserver ( function ( entries ) {
64- entries . forEach ( function ( entry ) {
62+ var observer = new IntersectionObserver ( function ( entries ) {
63+ entries . forEach ( function ( entry ) {
6564 if ( entry . isIntersecting ) {
6665 statsContainer . classList . add ( 'visible' ) ;
6766 animateValue ( blueCountEl , 0 , totalBlue , 1500 ) ;
@@ -75,7 +74,7 @@ document.addEventListener("DOMContentLoaded", function() {
7574
7675 function animateValue ( obj , start , end , duration ) {
7776 var startTimestamp = null ;
78- var step = function ( timestamp ) {
77+ var step = function ( timestamp ) {
7978 if ( ! startTimestamp ) startTimestamp = timestamp ;
8079 var progress = Math . min ( ( timestamp - startTimestamp ) / duration , 1 ) ;
8180 obj . innerHTML = Math . floor ( progress * ( end - start ) + start ) ;
@@ -87,7 +86,7 @@ document.addEventListener("DOMContentLoaded", function() {
8786 }
8887} ) ;
8988
90- // DONT REMOVE TS : formats keys
89+ // DONT REMOVE THIS : formats keys
9190function formatName ( str ) {
9291 var words = str . split ( "-" ) ;
9392 var finalString = "" ;
@@ -124,7 +123,7 @@ function renderCatalog() {
124123 if ( catalogState . sub != null ) {
125124 breadcrumb += ` <span class="breadcrumb-separator">></span> <span class="breadcrumb-current">${ formatName ( catalogState . sub ) } </span>` ;
126125 }
127-
126+
128127 // legend: only when viewing tools
129128 var legend = '' ;
130129 if ( catalogState . nav === 'tools' ) {
@@ -136,7 +135,7 @@ function renderCatalog() {
136135 <span class="tool-indicator download">(D)</span> Download
137136 </div>` ;
138137 }
139-
138+
140139 // show breadcrumbs if not at root
141140 if ( catalogState . nav !== "categories" ) {
142141 filterDiv . innerHTML = `<div class="breadcrumb-nav">${ breadcrumb } </div>${ legend } ` ;
@@ -153,7 +152,7 @@ function renderCatalog() {
153152 if ( catData . meta && catData . meta . desc ) {
154153 desc = catData . meta . desc ;
155154 }
156-
155+
157156 gridHtml += `
158157 <div class="category-card" onclick="catalogState.cat='${ cat } '; catalogState.nav='subcategories'; renderCatalog()">
159158 <div class="category-cover"><div class="logo-placeholder"></div></div>
@@ -165,7 +164,7 @@ function renderCatalog() {
165164 }
166165 gridHtml += '</div>' ;
167166
168- }
167+ }
169168 else if ( catalogState . nav === "subcategories" ) {
170169
171170 gridHtml = '<div class="subcategory-grid">' ;
@@ -192,25 +191,25 @@ function renderCatalog() {
192191 <div class="subcategory-card" onclick="catalogState.sub='${ sub } '; catalogState.nav='tools'; renderCatalog()">
193192 <div class="subcategory-name">${ formatName ( sub ) } </div>
194193 <div class="subcategory-count">${ toolCount } tools</div>` ;
195-
194+
196195 if ( subDesc !== '' ) {
197196 subHtml += `<div class="subcategory-description">${ subDesc } </div>` ;
198197 }
199-
198+
200199 subHtml += `</div>` ;
201200 gridHtml += subHtml ;
202201 }
203-
202+
204203 if ( hasSubs == false ) {
205204 gridHtml = "<div class='selection-prompt'>No subcategories found.</div>" ;
206205 }
207206 gridHtml += '</div>' ;
208207
209- }
208+ }
210209 else if ( catalogState . nav === "tools" ) {
211210
212211 gridHtml = '<div class="tool-category-grid">' ;
213-
212+
214213 var subData = { } ;
215214 if ( currentDb [ catalogState . cat ] && currentDb [ catalogState . cat ] [ catalogState . sub ] ) {
216215 subData = currentDb [ catalogState . cat ] [ catalogState . sub ] ;
@@ -224,21 +223,21 @@ function renderCatalog() {
224223 } else {
225224 tools = [ ] ;
226225 }
227-
226+
228227 if ( tools . length === 0 ) {
229228 gridHtml = gridHtml + "<div style='color:white; padding:20px;'>No tools found in this subcategory.</div>" ;
230229 }
231230
232231 for ( const t of tools ) {
233- // fetch favicons
232+ // fetch favicons (care: can break with cosrm )
234233 let domain = 'google.com' ;
235234 try {
236235 if ( t . url ) {
237236 const urlObj = new URL ( t . url ) ;
238237 domain = urlObj . hostname ;
239238 }
240- }
241- catch ( e ) {
239+ }
240+ catch ( e ) {
242241 console . error ( "Invalid URL for tool:" , t . name , t . url ) ;
243242 throw e ;
244243 }
@@ -257,7 +256,7 @@ function renderCatalog() {
257256 indicators += "<span class='tool-indicator download' title='Download only'>(D)</span>" ;
258257 }
259258 }
260-
259+
261260 let tName = t . name ;
262261 if ( indicators ) {
263262 tName = tName + ' ' + indicators ;
@@ -288,12 +287,12 @@ function renderCatalog() {
288287 gridDiv . innerHTML = '<div class="tools-scroll-container">' + gridHtml + '</div>' ;
289288}
290289
291- document . addEventListener ( "DOMContentLoaded" , function ( ) {
290+ document . addEventListener ( "DOMContentLoaded" , function ( ) {
292291 var hasCatalog = document . querySelector ( ".catalog-preview" ) ;
293292 if ( ! hasCatalog ) {
294293 hasCatalog = document . querySelector ( ".catalog-fullscreen" ) ;
295294 }
296-
295+
297296 if ( hasCatalog ) {
298297 renderCatalog ( ) ;
299298 }
0 commit comments