HEX
Server: nginx/1.27.1
System: Linux in-4 5.15.0-131-generic #141-Ubuntu SMP Fri Jan 10 21:18:28 UTC 2025 x86_64
User: ilikadirect (1186)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source
Upload Files
File: /storage/v6964/testingff/public_html/fdfctr/wp-content/plugins/iks-menu/assets/js/image-picker.js
'use strict';

jQuery(document).ready(function ($j) {
    initImagePicker();
});

function initImagePicker() {
    var attrs = ImagePickerLocalization;
    if (attrs.length <= 1) {
        console.error('Not found localization in Image Picker');
        return;
    }

    var $ = jQuery;
    var pickerSelector = attrs['pickerSelector'];

    // Uploading files
    var file_frame;

    // For each picker on page
    $(pickerSelector).each(function () {
        var $picker = $(this);
        var $input = $picker.find('input');
        var $image = $picker.find('img');
        var $uploadButton = $picker.find(attrs['uploadButtonSelector']);
        var $removeButton = $picker.find(attrs['removeButtonSelector']);

        // Process remove button visibility
        if (!parseInt($input.val())) {
            $removeButton.length > 0 && $removeButton.hide();
        }

        // On click Upload button
        $uploadButton.on('click', function (event) {
            event.preventDefault();

            // Create the media frame, if it not exists
            if (!file_frame) {
                file_frame = wp.media.frames.downloadable_file = wp.media({
                    title: attrs['mediaTitle'],
                    button: {
                        text: attrs['mediaButtonTitle']
                    },
                    multiple: false
                });
            }

            // When an image is selected, run a callback.
            file_frame.off('select').on('select', function () {
                var attachment = file_frame.state().get('selection').first().toJSON();
                var attachment_thumbnail = attachment.sizes.thumbnail || attachment.sizes.full;

                $input.val(attachment.id);
                $image.attr('src', attachment_thumbnail.url);
                $removeButton.show();
            });

            // Finally, open the modal.
            file_frame.open();
        });

        // On click Remove button
        $removeButton.on('click', function () {
            $image.attr('src', attrs['placeholderURL']);
            $input.val('');
            $(this).hide();
            return false;
        });
    });
}