make the icon appear after everything is loaded in discord and the script:

// ==UserScript==
// @name         Discord Server Search
// @namespace    Made by @hakav
// @version      2.1
// @description  Search and navigate to a Discord server by name
// @match        https://discord.com/*
// @grant        none
// @icon         https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSrWjmWEq2JeU0yKb2ArlyAAJA4QQLkhbuihw&s
// @license      Copyright @hakav
// ==/UserScript==
 
(function() {
    'use strict';
 
    // Create the search icon
    const searchIcon = document.createElement('div');
    searchIcon.innerHTML = '🔍';
    searchIcon.style.position = 'fixed';
    searchIcon.style.bottom = '20px';
    searchIcon.style.right = '20px';
    searchIcon.style.backgroundColor = 'rgba(255, 255, 255, 0.3)';
    searchIcon.style.color = 'black';
    searchIcon.style.border = '2px solid rgba(0, 0, 0, 0.3)';
    searchIcon.style.borderRadius = '50%';
    searchIcon.style.padding = '10px';
    searchIcon.style.cursor = 'pointer';
    searchIcon.style.zIndex = '1000';
    searchIcon.style.boxShadow = '0 0 10px rgba(0, 0, 0, 0.2)';
    searchIcon.style.transition = 'background-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease'; // Add scaling transition
    document.body.appendChild(searchIcon);
 
    // Add hover effect with scaling to give depth
    searchIcon.onmouseenter = function() {
        searchIcon.style.backgroundColor = 'rgba(255, 255, 255, 0.8)';
        searchIcon.style.boxShadow = '0 0 15px rgba(0, 0, 0, 0.5)';
        searchIcon.style.transform = 'scale(1.1)'; // Slightly scale up
    };
 
    searchIcon.onmouseleave = function() {
        searchIcon.style.backgroundColor = 'rgba(255, 255, 255, 0.3)';
        searchIcon.style.boxShadow = '0 0 10px rgba(0, 0, 0, 0.2)';
        searchIcon.style.transform = 'scale(1)'; // Return to normal size
    };
 
    // Create the "Designed by @hakav" label
    const designerLabel = document.createElement('div');
    designerLabel.innerHTML = 'Designed by @hakav';
    designerLabel.style.position = 'fixed';
    designerLabel.style.bottom = '60px';
    designerLabel.style.right = '20px';
    designerLabel.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
    designerLabel.style.color = 'white';
    designerLabel.style.padding = '5px 10px';
    designerLabel.style.borderRadius = '5px';
    designerLabel.style.fontFamily = 'Arial, sans-serif';
    designerLabel.style.fontSize = '12px';
    designerLabel.style.zIndex = '1001';
    designerLabel.style.opacity = '0'; // Initially hidden
    designerLabel.style.transition = 'opacity 0.5s ease';
    designerLabel.style.boxShadow = '0 0 10px rgba(0, 0, 0, 0.5)';
    document.body.appendChild(designerLabel);
 
    // Show the designer label on click
    const showDesignerLabel = () => {
        designerLabel.style.opacity = '1';
        setTimeout(() => {
            designerLabel.style.opacity = '0';
        }, 3000);
    };
 
    // Create the search input popup with smooth slide-in effect
    const searchPopup = document.createElement('div');
    searchPopup.style.position = 'fixed';
    searchPopup.style.bottom = '80px';
    searchPopup.style.right = '-250px'; // Slide in from outside the screen
    searchPopup.style.backgroundColor = 'white';
    searchPopup.style.padding = '15px';
    searchPopup.style.borderRadius = '5px';
    searchPopup.style.boxShadow = '0 0 10px rgba(0, 0, 0, 0.5)';
    searchPopup.style.display = 'none';
    searchPopup.style.zIndex = '1001';
    searchPopup.style.opacity = '0';
    searchPopup.style.transition = 'opacity 0.3s ease, transform 0.3s ease, right 0.5s ease'; // Smooth slide-in effect
 
    const searchInput = document.createElement('input');
    searchInput.placeholder = 'Enter server name...';
    searchInput.style.width = '200px';
    searchInput.style.border = '2px solid #ccc';
    searchInput.style.padding = '5px';
    searchInput.style.transition = 'border-color 0.3s ease'; // Add border change on focus
    searchPopup.appendChild(searchInput);
 
    // Language selection dropdown
    const languageSelector = document.createElement('select');
    languageSelector.style.marginLeft = '10px';
    const languages = {
        'English (US)': 'en-US',
        'English (UK)': 'en-GB',
        'French': 'fr-FR',
        'German': 'de-DE',
        'Spanish': 'es-ES',
        'Chinese (Mandarin)': 'zh-CN',
        'Japanese': 'ja-JP',
    };
 
    Object.keys(languages).forEach(lang => {
        const option = document.createElement('option');
        option.value = languages[lang];
        option.textContent = lang;
        languageSelector.appendChild(option);
    });
 
    searchPopup.appendChild(languageSelector);
 
    // Highlight the input on focus
    searchInput.onfocus = function() {
        searchInput.style.borderColor = '#4A90E2'; // Change border to blue on focus
    };
 
    searchInput.onblur = function() {
        searchInput.style.borderColor = '#ccc'; // Revert border color on blur
    };
 
    const searchButton = document.createElement('button');
    searchButton.innerText = 'Search';
    searchButton.style.marginLeft = '10px';
    searchButton.style.padding = '5px 10px';
    searchButton.style.backgroundColor = '#4A90E2'; // Add some cool color
    searchButton.style.color = 'white';
    searchButton.style.border = 'none';
    searchButton.style.borderRadius = '3px';
    searchButton.style.cursor = 'pointer';
    searchButton.style.transition = 'transform 0.2s ease, background-color 0.3s ease'; // Add button hover effect
 
    const voiceButton = document.createElement('button');
    voiceButton.innerText = '🎤';
    voiceButton.style.marginLeft = '10px';
    searchPopup.appendChild(voiceButton);
 
    searchPopup.appendChild(searchButton);
    document.body.appendChild(searchPopup);
 
    const suggestionBox = document.createElement('div');
    suggestionBox.style.position = 'absolute';
    suggestionBox.style.top = '40px';
    suggestionBox.style.left = '0';
    suggestionBox.style.backgroundColor = 'white';
    suggestionBox.style.border = '1px solid #ccc';
    suggestionBox.style.width = '200px';
    suggestionBox.style.zIndex = '1002';
    suggestionBox.style.display = 'none';
    searchPopup.appendChild(suggestionBox);
 
    // Load last searched server from local storage
    const lastServer = localStorage.getItem('lastServer');
    if (lastServer) {
        searchInput.value = lastServer;
    }
 
    // Search function
    const searchServer = () => {
        const serverName = searchInput.value.trim();
        if (serverName) {
            localStorage.setItem('lastServer', serverName); // Save last searched server
            const servers = Array.from(document.querySelectorAll('[data-list-id="guildsnav"] [aria-label]'));
            const matchedServer = servers.find(server =>
                server.getAttribute('aria-label').toLowerCase().includes(serverName.toLowerCase())
            );
 
            if (matchedServer) {
                showNotification('Navigating to server...', true);
                matchedServer.click(); // Click the server to open it
            } else {
                showNotification('Server not found!', false);
            }
        }
    };
 
    const showNotification = (message, isSuccess = true) => {
        const notification = document.createElement('div');
        notification.innerText = message;
        notification.style.position = 'fixed';
        notification.style.bottom = '100px';
        notification.style.right = '20px';
        notification.style.backgroundColor = isSuccess ? '#4CAF50' : '#f44336'; // Green for success, red for error
        notification.style.color = 'white';
        notification.style.padding = '10px';
        notification.style.borderRadius = '5px';
        notification.style.zIndex = '1002';
        notification.style.opacity = '0';
        notification.style.transition = 'opacity 0.5s ease';
        document.body.appendChild(notification);
 
        setTimeout(() => {
            notification.style.opacity = '1'; // Fade in
            setTimeout(() => {
                notification.style.opacity = '0'; // Fade out
                setTimeout(() => {
                    document.body.removeChild(notification); // Remove element after fading
                }, 500);
            }, 2000); // Show for 2 seconds
        }, 10);
    };
 
    // Suggest matching servers while typing
    searchInput.addEventListener('input', () => {
        const query = searchInput.value.trim().toLowerCase();
        suggestionBox.innerHTML = ''; // Clear previous suggestions
 
        if (query) {
            const matchedServers = Array.from(document.querySelectorAll('[data-list-id="guildsnav"] [aria-label]'))
                .filter(server => server.getAttribute('aria-label').toLowerCase().includes(query));
 
            matchedServers.forEach(server => {
                const suggestionItem = document.createElement('div');
                suggestionItem.textContent = server.getAttribute('aria-label');
                suggestionItem.style.padding = '5px';
                suggestionItem.style.cursor = 'pointer';
                suggestionItem.onclick = () => {
                    searchInput.value = server.getAttribute('aria-label');
                    suggestionBox.style.display = 'none';
                    server.click(); // Navigate to server when clicked
                };
                suggestionItem.onmouseenter = () => suggestionItem.style.backgroundColor = '#f0f0f0';
                suggestionItem.onmouseleave = () => suggestionItem.style.backgroundColor = 'white';
                suggestionBox.appendChild(suggestionItem);
            });
            suggestionBox.style.display = 'block';
        } else {
            suggestionBox.style.display = 'none';
        }
    });
 
    searchButton.onclick = searchServer;
 
    searchInput.addEventListener('keydown', function (e) {
        if (e.key === 'Enter') {
            searchServer(); // Call search function when Enter key is pressed
        }
    });
 
    // Voice search functionality with language selection
    const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
    if (SpeechRecognition) {
        const recognition = new SpeechRecognition();
        recognition.interimResults = false; // Only final results
        recognition.maxAlternatives = 1;
 
        // Handle recognition results
        recognition.onresult = (event) => {
            const transcript = event.results[0][0].transcript;
            searchInput.value = transcript; // Fill the input field with the recognized text
            searchServer(); // Automatically search after recognition
        };
 
        // Handle errors
        recognition.onerror = (event) => {
            console.error('Speech recognition error detected: ' + event.error);
            showNotification('Voice recognition error: ' + event.error, false); // Display an error notification
        };
 
        // Start recognition on button click
        voiceButton.onclick = () => {
            recognition.lang = languageSelector.value; // Set the selected language
            recognition.start(); // Start listening for speech input
            showNotification('Listening for voice input...', true); // Notify the user that voice input is active
        };
    } else {
        // If SpeechRecognition is not supported, show a notification and hide the voice button
        console.warn('Speech recognition is not supported in this browser.');
        voiceButton.style.display = 'none'; // Hide the voice button if not supported
        showNotification('Voice search is not supported in this browser', false);
    }
 
    // Show popup with sliding and fading animation
    const showPopup = () => {
        searchPopup.style.display = 'block';
        setTimeout(() => {
            searchPopup.style.opacity = '1';
            searchPopup.style.right = '20px'; // Slide it into view
        }, 10);
    };
 
    // Hide popup with sliding out animation
    const hidePopup = () => {
        searchPopup.style.opacity = '0';
        searchPopup.style.right = '-250px'; // Slide it back out
        setTimeout(() => {
            searchPopup.style.display = 'none';
        }, 300);
    };
 
    // Single onclick event to handle both animations and popup toggling
    searchIcon.onclick = function() {
        searchIcon.style.transform = 'scale(0.9)'; // Shrink slightly on click
        setTimeout(() => {
            searchIcon.style.transform = 'scale(1.1)'; // Bounce back
            setTimeout(() => {
                searchIcon.style.transform = 'scale(1)'; // Return to normal size
            }, 100);
 
            if (searchPopup.style.display === 'none' || searchPopup.style.opacity === '0') {
                showPopup();
                showDesignerLabel(); // Show "Designed by @hakav" label when the icon is clicked
                searchInput.focus();
            } else {
                hidePopup();
            }
        }, 100);
    };
 
    // Hide popup when clicking outside with animation
    window.onclick = function(event) {
        if (!searchIcon.contains(event.target) && !searchPopup.contains(event.target)) {
            hidePopup();
        }
    };
 
    // Toggle search popup with hotkey (Ctrl + S)
    document.addEventListener('keydown', function (e) {
        if (e.ctrlKey && e.key === 's') {
            e.preventDefault(); // Prevent the default browser save dialog
            if (searchPopup.style.display === 'none' || searchPopup.style.opacity === '0') {
                showPopup();
                searchInput.focus();
            } else {
                hidePopup();
            }
        }
    });
 
    // Dark mode support
    const isDarkMode = document.body.classList.contains('theme-dark');
    if (isDarkMode) {
        searchIcon.style.backgroundColor = 'rgba(50, 50, 50, 0.3)';
        designerLabel.style.backgroundColor = 'rgba(50, 50, 50, 0.8)';
        searchPopup.style.backgroundColor = '#2c2f33';
        searchInput.style.borderColor = '#555';
        searchButton.style.backgroundColor = '#7289da'; // Discord's primary color
    }
 
})();