Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /home/nandedex/public_html/wp-content/plugins/live-news/admin/assets/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : /home/nandedex/public_html/wp-content/plugins/live-news/admin/assets/js/media-uploader.js
jQuery(document).ready(function($) {

    //will be used to store the wp.media object
    var file_frame;

    //.button_add_media click event handler
    $('.button_add_media').live('click', function( event ){

        //prevent the default behavior of this event
        event.preventDefault();

        //save this in a variable
        da_media_button = $(this);

        if($(this).attr('data-set-remove') == "set"){

            //reopen the media frame if already exists
            if ( file_frame ) {
                file_frame.open();
                return;
            }

            //extend the wp.media object
            file_frame = wp.media.frames.file_frame = wp.media({
                title: $( this ).data( 'Insert image' ),
                button: {
                  text: $( this ).data( 'Insert image' ),
                },
                multiple: false//false -> allows single file | true -> allows multiple files
            });

            //run a callback when an image is selected
            file_frame.on( 'select', function() {

              //get the attachment from the uploader
              attachment = file_frame.state().get('selection').first().toJSON();

              //change the da_media_button label
              da_media_button.text(da_media_button.attr('data-remove'));
              
              //change the da_media_button current status
              da_media_button.attr('data-set-remove', 'remove');

              //assign the attachment.url ( or attachment.id ) to the DOM element ( an input text ) that comes just before the "Add Media" button
              da_media_button.prev().val(attachment.url);

              //assign the attachment.url to the src of the image two times before the "Add Media" button
              da_media_button.prev().prev().attr("src",attachment.url);
              
              //show the image
              da_media_button.prev().prev().show();

            });

            //open the modal window
            file_frame.open();
            
        }else{
            
            //change the da_media_button label
            da_media_button.html(da_media_button.attr('data-set'))
            
            //change the da_media_button current status
            da_media_button.attr('data-set-remove', 'set');
            
            //hide the game image
            da_media_button.prev().prev().hide();
            
            //set empty to the hidden field
            da_media_button.prev().val("");
            
        }

    });

});

F1le Man4ger