![]() Server : Apache/2.4.52 (Ubuntu) System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64 User : www-data ( 33) PHP Version : 8.1.2-1ubuntu2.21 Disable Function : NONE Directory : /var/www/theprintave/wp-content/plugins/haru-pricom/assets/js/ |
jQuery(document).ready(function($){ var label_ids = []; $('.label-color').each( function() { var sub_label_id = $(this).data('id'); label_ids.push(sub_label_id); }); // Select color picker for( var i = 0; i < label_ids.length; i++ ) { $('.label-color-'+ label_ids[i]).wpColorPicker({ change: function(event, ui) { $('.label-color-' + label_ids[i]).css('color', ui.color.toCSS()); } }); } var optionsframework_upload; var optionsframework_selector; function optionsframework_add_file(event, selector) { var upload = $(".uploaded-file"), frame; var $el = $(this); optionsframework_selector = selector; event.preventDefault(); // If the media frame already exists, reopen it. if ( optionsframework_upload ) { optionsframework_upload.open(); } else { // Create the media frame. optionsframework_upload = wp.media.frames.optionsframework_upload = wp.media({ // Set the title of the modal. title: "Select Image", // Customize the submit button. button: { // Set the text of the button. text: "Selected", // Tell the button not to close the modal, since we're // going to refresh the page when the image is selected. close: false } }); // When an image is selected, run a callback. optionsframework_upload.on( 'select', function() { // Grab the selected attachment. var attachment = optionsframework_upload.state().get('selection').first(); optionsframework_upload.close(); optionsframework_selector.find('.upload_image').val(attachment.attributes.url).change(); if ( attachment.attributes.type == 'image' ) { optionsframework_selector.find('.screenshot').empty().hide().prepend('<img src="' + attachment.attributes.url + '">').slideDown('fast'); } }); } // Finally, open the modal. optionsframework_upload.open(); } function optionsframework_remove_file(selector) { selector.find('.screenshot').slideUp('fast').next().val('').trigger('change'); } $('body').delegate('.upload_image_action .remove-image', 'click', function(event) { optionsframework_remove_file( $(this).parent().parent() ); }); $('body').delegate('.upload_image_action .add-image', 'click', function(event) { optionsframework_add_file(event, $(this).parent().parent()); }); });