403Webshell
Server IP : 162.0.217.223  /  Your IP : 216.73.216.153
Web Server : LiteSpeed
System : Linux premium269.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : mypckeys ( 1539)
PHP Version : 8.1.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/mypckeys/yeslicense.org/wp-content/plugins/beep-notifier/public/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/mypckeys/yeslicense.org/wp-content/plugins/beep-notifier/public/js/beep-notifier-public.js
(function ($) {
    'use strict';

    jQuery(document).ready(function ($) {
        let salesData = [];
        let currentIndex = 0;
        let selectedTheme = beep_ajax.theme || '1';
        let mobile_class = beep_ajax.mobile_class || '1';
        let showAnimation = beep_ajax.show_animation || 'fade_in';
        let hideAnimation = beep_ajax.hide_animation || 'fade_out';
        let loopNotifications = parseInt(beep_ajax.loop) === 1;
        let openNewTab = parseInt(beep_ajax.open_new_tab) === 1;

        // Fetch user-defined delay settings
        let firstDelay = parseInt(beep_ajax.first_delay) * 1000 || 3000; // Convert to milliseconds
        let displayTime = parseInt(beep_ajax.display_time) * 1000 || 4000;
        let betweenDelay = parseInt(beep_ajax.between_delay) * 1000 || 2000;

        function fetchSalesData() {
            $.ajax({
                url: beep_ajax.ajax_url,
                type: 'POST',
                data: { action: 'beep_get_recent_sales' },
                success: function (response) {
                    if (response.success && response.data.length > 0) {
                        salesData = response.data;
                        currentIndex = 0;
                        setTimeout(ShowNextBeepNotification, firstDelay);
                    }
                },
                error: function () {
                    console.log('Error fetching sales data.');
                }
            });
        }

        function ShowNextBeepNotification() {
            if (salesData.length === 0) return;

            if (currentIndex >= salesData.length) {
                if (loopNotifications) {
                    currentIndex = 0; // Restart loop
                } else {
                    return; // Stop notifications
                }
            }

            let sale = salesData[currentIndex];

            // Update notification content
            $('#bc-notification .bc-text-content').html(
                `<a href="${sale.link}" class="bc-link" ${openNewTab ? 'target="_blank"' : ''}>
                    <span class="bc-user-name">${sale.name || 'Someone'}</span> <span class="bc-static-text">just purchased</span> <br>
                    <strong class="bc-product-name">${sale.product}</strong>!<span class="bc-order-time">${sale.time}</span>
                </a>`
            );
            $('#bc-notification .bc-image').attr('src', sale.image || 'https://example.com/default.jpg');

            // Remove old animations and apply new ones
            $('#bc-notification')
                .removeClass()
                .addClass(`bc-notification ${mobile_class} bc-notification-theme-${selectedTheme} animated ${showAnimation}`)
                .show();

            setTimeout(function () {
                $('#bc-notification')
                    .removeClass(showAnimation)
                    .addClass(hideAnimation);

                setTimeout(function () {
                    $('#bc-notification').hide();
                    currentIndex++;
                    setTimeout(ShowNextBeepNotification, betweenDelay);
                }, 1000); // Adjust delay to match animation duration
            }, displayTime);


            if (selectedTheme === '5') {
                $('.bc-buy-now').attr({
                    'href': sale.link,
                    'target': openNewTab ? '_blank' : '_self'
                });
            }

        }

        

        // Allow manual close
        $('#bc-close').click(function () {
            $('#bc-notification').hide();
        });

        fetchSalesData();
    });
})(jQuery);

Youez - 2016 - github.com/yon3zu
LinuXploit