HEX
Server: Apache
System: Linux az1-ss100.a2hosting.com 4.18.0-553.16.1.lve.1.el8.x86_64 #1 SMP Mon Sep 23 20:16:18 UTC 2024 x86_64
User: crypto73 (2057)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/crypto73/www/wp-content/plugins/cryptocurrency-price-ticker-widget/assets/js/admin-script.js
jQuery(document).ready(function ($) {
    const $deleteCacheBtn = $("#ccpw_delete_cache");
    const ajaxUrl = $deleteCacheBtn.data('ajax-url');
    const nonce = $deleteCacheBtn.data('ccpw-nonce');

    $deleteCacheBtn.prop("disabled", false).on("click", function (e) {
        e.preventDefault();
        $(this).text('Purging...').prop("disabled", true);
        const requestData = {
            action: 'ccpw_delete_transient',
            nonce: nonce
        };
        $.ajax({
            type: 'POST',
            url: ajaxUrl,
            data: requestData,
            success: function (response) {
                if (response !== undefined && response.success == true) {
                    $deleteCacheBtn.text('Purged Cache').prop("disabled", true);
                }
            },
            error: function (error) {
                console.log(error);
            }
        });

    });

    //added current class in settings menu.
    const url = window.location.href;
    if (url.includes('?page=ccpw_get_started')) {
        $('[href="admin.php?page=ccpw_get_started"]').parent('li').addClass('current');
    }

    const cmcData = $('#adminmenu #toplevel_page_cool-crypto-plugins ul li a[href="admin.php?page=ccpw_get_started"]');

    cmcData.each(function () {
        if ($(this).is(':empty')) {
            $(this).hide();
        }
    });

});