/**
 * Common JavaScript functions for Mementor TTS admin pages
 *
 * Handles page-specific body classes and other common functionality
 * that was previously included as inline scripts.
 */
jQuery(document).ready(function($) {
    // Get the current page from URL
    const urlParams = new URLSearchParams(window.location.search);
    const currentPage = urlParams.get('page');
    
    // Add page-specific body classes based on current page
    if (currentPage) {
        // Extract the page name from the full page slug
        const pageName = currentPage.replace('text-to-speech-tts-', '');
        
        // Add a body class specific to the current page
        $('body').addClass(pageName + '-page-active');
        
        // For backward compatibility, also add these specific classes
        if (pageName === 'statistics') {
            $('body').addClass('statistics-page-active');
        } else if (pageName === 'shortcodes') {
            $('body').addClass('shortcodes-page-active');
        } else if (pageName === 'advanced') {
            $('body').addClass('advanced-page-active');
        } else if (pageName === 'settings') {
            $('body').addClass('mementor-tts-settings-page');
        }
    }
    
    // Set global API key status for backward compatibility
    // This variable is used in the navigation component
    window.mementorTTSApiKeyConnected = true; // Always true to prevent locking
}); 