consolidation
This commit is contained in:
@@ -70,14 +70,12 @@ const { title, description = 'CC24-Guide - A comprehensive directory of digital
|
||||
}
|
||||
});
|
||||
|
||||
// Make theme utils available globally
|
||||
(window as any).themeUtils = {
|
||||
initTheme,
|
||||
toggleTheme,
|
||||
getStoredTheme
|
||||
};
|
||||
|
||||
// Tool helper functions (consolidated from toolHelpers.ts)
|
||||
function createToolSlug(toolName) {
|
||||
if (!toolName || typeof toolName !== 'string') {
|
||||
console.warn('[toolHelpers] Invalid toolName provided to createToolSlug:', toolName);
|
||||
@@ -107,6 +105,12 @@ const { title, description = 'CC24-Guide - A comprehensive directory of digital
|
||||
tool.projectUrl.trim() !== "";
|
||||
}
|
||||
|
||||
// FIXED: Use type assertions to avoid TypeScript errors
|
||||
// Make functions available globally for existing code compatibility
|
||||
(window as any).createToolSlug = createToolSlug;
|
||||
(window as any).findToolByIdentifier = findToolByIdentifier;
|
||||
(window as any).isToolHosted = isToolHosted;
|
||||
|
||||
// Client-side auth functions (consolidated from client-auth.js)
|
||||
async function checkClientAuth() {
|
||||
try {
|
||||
@@ -157,6 +161,7 @@ const { title, description = 'CC24-Guide - A comprehensive directory of digital
|
||||
document.addEventListener('click', async (e) => {
|
||||
if (!e.target) return;
|
||||
|
||||
// FIXED: Properly cast EventTarget to Element for closest() method
|
||||
const button = (e.target as Element).closest(selector);
|
||||
if (!button) return;
|
||||
|
||||
@@ -171,10 +176,7 @@ const { title, description = 'CC24-Guide - A comprehensive directory of digital
|
||||
});
|
||||
}
|
||||
|
||||
// Make functions available globally
|
||||
(window as any).createToolSlug = createToolSlug;
|
||||
(window as any).findToolByIdentifier = findToolByIdentifier;
|
||||
(window as any).isToolHosted = isToolHosted;
|
||||
// Make auth functions available globally
|
||||
(window as any).checkClientAuth = checkClientAuth;
|
||||
(window as any).requireClientAuth = requireClientAuth;
|
||||
(window as any).showIfAuthenticated = showIfAuthenticated;
|
||||
@@ -184,7 +186,6 @@ const { title, description = 'CC24-Guide - A comprehensive directory of digital
|
||||
initTheme();
|
||||
setupAuthButtons('[data-contribute-button]');
|
||||
|
||||
// Initialize AI button visibility (moved from ToolFilters.astro to avoid race condition)
|
||||
const initAIButton = async () => {
|
||||
await showIfAuthenticated('#ai-view-toggle');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user