HEX
Server:Apache
System:Linux localhost 5.10.0-14-amd64 #1 SMP Debian 5.10.113-1 (2022-04-29) x86_64
User:enlugo-es (10006)
PHP:7.4.33
Disabled:opcache_get_status
Upload Files
File: /var/www/vhosts/enlugo.es/httpdocs/wp-content/plugins/simple-image-sizes/assets/js/src/featured.js
// Functions for the regenerating of images
var rahe;
if (!rahe) {
    rahe = {};
} else if (typeof rahe !== "object") {
    throw new Error('rahe already exists and not an object');
}

if (!rahe.sis) {
    rahe.sis = {};
} else if (typeof rahe.sis !== "object") {
    throw new Error('rahe.sis already exists and not an object');
}

rahe.sis.featured = {
    messageZone: '',
    parent: '',
    element: '',
    init: function () {
        this.element = jQuery('#sis_featured_regenerate');
        this.parent = this.element.closest('.inside');
        this.nonce = this.element.attr('data-nonce');
        this.id = jQuery('#post_ID').val();

        this.parent.on(
            'click', '#sis_featured_regenerate', function (e) {
                e.preventDefault();
                rahe.sis.featured.regenItem();
            }
        );
    },
    setMessage: function (msg) {
        // Display the message
        this.parent.find('.sis_message').html("<p>" + msg + "</p>").show();
    },
    regenItem: function () {
        var self = this;

        jQuery.ajax(
            {
                url: ajaxurl,
                type: "POST",
                dataType: 'json',
                cache: false,
                data: {
                    action: 'sis_rebuild_featured',
                    id: this.id,
                    nonce: this.nonce
                },
                beforeSend: function () {
                    self.parent.find('.spinner').addClass('is-active');
                    self.parent.find('#sis_featured_regenerate').attr('disabled', 'disabled');
                },
                success: function (r) {
                    var message = '';
                    // Check if error or a message in response
                    if (!r.time || r.error || typeof r !== 'object') {
                        message = typeof r !== 'object' ? message = sis.phpError : r.error;
                    } else {
                        message = sis.soloRegenerated.replace('%s', r.time);
                    }
                    self.setMessage(message);

                    self.parent.find('.spinner').removeClass('is-active');
                    self.parent.find('#sis_featured_regenerate').removeAttr('disabled');
                }
            }
        );
    }
};

jQuery(
    function () {
        rahe.sis.featured.init();
    }
);