Server IP : 104.21.93.192 / Your IP : 216.73.216.73 Web Server : LiteSpeed System : Linux premium900.web-hosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 User : redwjova ( 1790) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/redwjova/fyntric.com/wp-content/plugins/smartmag-core/lib/js/admin/ |
Upload File : |
/** * Methods that deal with meta box and other options. */ (function($) { "use strict"; function handleUpload() { var element = $(this), text_box = element.parent().find('.element-upload'), insert_label = element.data('insert-label'), mediaType = element.data('media-type'), file_frame = null; if (file_frame) { return file_frame.open(); } file_frame = wp.media({ title: element.data('title'), button: {text: insert_label}, multiple: false }); file_frame.on('select', function() { var attachment = file_frame.state().get('selection').first().toJSON(); // Set it in hidden input. text_box.val( mediaType == 'id' ? attachment.id : attachment.url ); // Remove existing img and add the new one. element.parent().find('.image-upload').find('img').remove(); element.parent().find('.image-upload').prepend('<img src="' + attachment.url + '" />').fadeIn(); element.parent().find('.after-upload').addClass('visible'); }); file_frame.open(); return; } function removeUpload() { $(this).parent().parent().find('.element-upload').val(''); $(this).parent().find('img').remove(); $(this).parent().find('.after-upload').removeClass('visible'); return false; } const init = () => { // Setup colors. if ($.fn.wpColorPicker) { $('.bunyad-color-picker').wpColorPicker(); } // Setup upload handler. $(document).on('click', '.bunyad-meta .upload-btn, .bunyad-option .upload-btn', handleUpload); $(document).on('click', '.bunyad-meta .remove-image, .bunyad-option .remove-image', removeUpload); }; init(); })(jQuery);