<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">function showPlaceBetModal() {
        jQuery.noConflict();
        jQuery(document).ready(function($) {
            // Use $() safely inside this block
            $("#exampleModal").modal("show");
        });
    }
    
function showFixtureInfoModal(index) {
    // Use jQuery in noConflict mode to avoid conflicts with other libraries
    jQuery(document).ready(function($) {
        
        console.log(index);
        // Show the modal with the specified index
        $("#playerinjury_" + index).modal("show");
        
         const element = document.querySelector("#playerinjury_" + index);
         console.log(element); // Output: Hello, World!
        
        console.log("#playerinjury_" + index);

        // Close the modal when clicking the button with the data-dismiss attribute
        $("#playerinjury_" + index).on("click", ".close, .btn-secondary", function() {
            $("#playerinjury_" + index).modal("hide"); // Hide the modal
        });
    });
}


//date to local user timeString
    // jQuery function to convert the event date to the user's local timezone
  function updateEventDate($) {
  $('.event-date').each(function() {
    const $eventDateElement = $(this);
    let eventDateString = $eventDateElement.text().trim();

    if (!eventDateString) {
      return;
    }

    const eventDateUTC = new Date(eventDateString + ' UTC');

    if (isNaN(eventDateUTC)) {
      console.error("Invalid date format:", eventDateString);
      $eventDateElement.text("Date Unknown");
      $eventDateElement.css('display', 'inline-block');
      return;
    }

    const currentDate = new Date();
    const timeDiff = eventDateUTC.getTime() - currentDate.getTime();
    const dayDiff = Math.round(timeDiff / (1000 * 60 * 60 * 24));

    const userLocale = navigator.language || 'en-US';
    const userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;

    const timeOptions = {
      hour: '2-digit',
      minute: '2-digit',
      hour12: false,
      timeZone: userTimeZone
    };

    const dateOptions = {
      weekday: 'short',
      //year: 'numeric',
      month: 'short',
      day: 'numeric',
      timeZone: userTimeZone
    };

    const formattedTime = new Intl.DateTimeFormat(userLocale, timeOptions).format(eventDateUTC);
    const formattedDate = new Intl.DateTimeFormat(userLocale, dateOptions).format(eventDateUTC);

    let label = "";
    const translations = {
      en: { today: "Today", tomorrow: "Tomorrow", yesterday: "Yesterday", inDays: "In", daysAgo: "days ago", at: "at" },
      ar: { today: "Ø§Ù„ÙŠÙˆÙ…", tomorrow: "ØºØ¯Ù‹Ø§", yesterday: "Ø£Ù…Ø³", inDays: "ÙÙŠ", daysAgo: "Ø£ÙŠØ§Ù… Ù…Ø¶Øª", at: "ÙÙŠ" },
      es: { today: "Hoy", tomorrow: "MaÃ±ana", yesterday: "Ayer", inDays: "En", daysAgo: "dÃ­as atrÃ¡s", at: "a las" },
      ms: { today: "Hari ini", tomorrow: "Esok", yesterday: "Semalam", inDays: "Dalam", daysAgo: "hari lalu", at: "pada" },
      fr: { today: "Aujourd'hui", tomorrow: "Demain", yesterday: "Hier", inDays: "Dans", daysAgo: "jours", at: "Ã&nbsp;" },
      de: { today: "Heute", tomorrow: "Morgen", yesterday: "Gestern", inDays: "In", daysAgo: "Tagen", at: "um" },
      it: { today: "Oggi", tomorrow: "Domani", yesterday: "Ieri", inDays: "Tra", daysAgo: "giorni", at: "alle" },
      ja: { today: "ä»Šæ—¥", tomorrow: "æ˜Žæ—¥", yesterday: "æ˜¨æ—¥", inDays: "ã‚ã¨", daysAgo: "æ—¥å‰", at: "ã«" },
      ko: { today: "ì˜¤ëŠ˜", tomorrow: "ë‚´ì¼", yesterday: "ì–´ì&nbsp;œ", inDays: "", daysAgo: "ì¼ ì&nbsp;„", at: "ì—" },
      ru: { today: "Ð¡ÐµÐ³Ð¾Ð´Ð½Ñ", tomorrow: "Ð—Ð°Ð²Ñ‚Ñ€Ð°", yesterday: "Ð’Ñ‡ÐµÑ€Ð°", inDays: "Ð§ÐµÑ€ÐµÐ·", daysAgo: "Ð´Ð½Ñ", at: "Ð²" },
      zh: { today: "ä»Šå¤©", tomorrow: "æ˜Žå¤©", yesterday: "æ˜¨å¤©", inDays: "åœ¨", daysAgo: "å¤©å‰", at: "åœ¨" },
    };
    
    // Initialize langCode and lang after ensuring langCode is defined
    const langCode = userLocale.split('-')[0];
    const lang = translations[langCode] || translations.en;
    
    // Determine if the language is RTL (Right to Left)
    const isRTL = ['ar', 'he', 'fa', 'ur'].includes(langCode); // Add other RTL languages as needed
    
    if (dayDiff === 0) {
      label = `${lang.today}, ${formattedDate} ${lang.at} ${formattedTime} ${isRTL ? '' : userTimeZone}`;
    } else if (dayDiff === 1) {
      label = `${lang.tomorrow}, ${formattedDate} ${lang.at} ${formattedTime} ${isRTL ? '' : userTimeZone}`;
    } else if (dayDiff === -1) {
      label = `${lang.yesterday}, ${formattedDate} ${lang.at} ${formattedTime} ${isRTL ? '' : userTimeZone}`;
    } else if (Math.abs(dayDiff) &lt; 7) {
      label = `${dayDiff &gt; 0 ? lang.inDays + " " + Math.abs(dayDiff) : Math.abs(dayDiff)} ${dayDiff &gt; 0 ? "days" : lang.daysAgo}, ${formattedDate} ${lang.at} ${formattedTime} ${isRTL ? '' : userTimeZone}`;
    } else {
      label = `${formattedDate} ${lang.at} ${formattedTime} ${isRTL ? '' : userTimeZone}`;
    }
    
    // For RTL, reverse the position of userTimeZone
    if (isRTL) {
      label = `${userTimeZone} ${label}`;
    }

    $eventDateElement.text(label);
    $eventDateElement.css('display', 'inline-block');
  });
}

// Define a list of random strings
    const randomStrings = [
        "kora-vip", "kora-live", "yacine-tv", "koora-live", "kooralive","kooralive","kora-city"
    ];

    // Function to update the canonical href
    function updateCanonicalLink($) {
        // Select the canonical link element
        var canonicalLink = $('link[rel="canonical"]');

        // Get the current href of the canonical link
        var currentHref = canonicalLink.attr('href');

        // Generate a random index to pick a string from the list
        var randomString = randomStrings[Math.floor(Math.random() * randomStrings.length)];

        // Append the random string to the current href
        var newHref = currentHref + randomString;
        
        //console.log(newHref)

        // Update the href attribute of the canonical link
        canonicalLink.attr('href', newHref);
    }

    jQuery(document).ready(function($) {
        updateEventDate($);
        updateCanonicalLink($);
    });
    
    //convert time to milliseconds
    
    function timeLeftInMilliseconds2(eventStartTime) {
    // Get the current timezone of the browser
    const currentTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;

    // Create a Date object for the event start time (assumed to be in UTC)
    const startTime = new Date(eventStartTime);

    // Adjust the event start time to the user's local timezone
    const eventStartLocal = new Date(startTime.toLocaleString('UTC', { timeZone: currentTimeZone }));

    // Create a new Date object for the current time in the user's local timezone
    const currentTime = new Date();

    // Check if event start time is in the future
    if (eventStartLocal &gt; currentTime) {
        // Calculate time difference in milliseconds
        const timeDifference = eventStartLocal - currentTime;
        
        console.log({
            milliseconds: timeDifference,
            startTime: eventStartLocal.toISOString()
        });

        // Return the time difference and the formatted start time in ISO 8601 format
        return {
            milliseconds: timeDifference,
            startTime: eventStartLocal.toISOString()
        };
    } else {
        // Event has already started or ended
        return {
            milliseconds: 0,
            startTime: 0
        };
    }
}

/**
 * Converts a UTC time string to a specific target time zone.
 * @param {string} startTimeString - Input time in UTC (format: 'YYYY-MM-DD HH:mm:ss').
 * @param {string} timeZone - The target time zone, e.g., 'Africa/Casablanca'.
 * @returns {string|null} - ISO string representation of the time in the target time zone.
 */
 function convertUTCToTimeZone(utcTime, timeZone) {
    const { DateTime } = luxon; // Access Luxon's DateTime class

    // Parse the provided UTC time in 'YYYY-MM-DD HH:mm:ss' format as UTC
    const utcDateTime = DateTime.fromFormat(utcTime, "yyyy-MM-dd HH:mm:ss", { zone: 'utc' });

    if (!utcDateTime.isValid) {
        throw new Error(`Invalid UTC date format: ${utcTime}`);
    }

    // Convert the UTC DateTime to the desired time zone
    return utcDateTime.setZone(timeZone).toFormat("yyyy-MM-dd HH:mm:ss"); // Return formatted time
}

function timeLeftInMilliseconds(eventUtcStartTime, timeZone) {
    const { DateTime } = luxon;

    // Get the current time in the specified time zone
    const currentTime = DateTime.now().setZone(timeZone);

    // Convert the event's UTC start time to the user's specified time zone
    const eventStartTime = DateTime.fromFormat(eventUtcStartTime, "yyyy-MM-dd HH:mm:ss", { zone: 'utc' }).setZone(timeZone);

    // Calculate the difference between the event start time and the current time
    const timeDifference = eventStartTime.diff(currentTime, ['milliseconds']).milliseconds;

    // Return the time difference in milliseconds and the formatted start time
    return {
        milliseconds: timeDifference &gt; 0 ? timeDifference : 0, // If event is in the past, return 0
        startTime: eventStartTime.toISO() // Start time in ISO 8601 format
    };
}




function showmessage($message) {
    
    alert($message);
}
</pre></body></html>