Edit File by line
/home/barbar84/public_h.../wp-admin/js
File: custom-header.js
/**
[0] Fix | Delete
* @output wp-admin/js/custom-header.js
[1] Fix | Delete
*/
[2] Fix | Delete
[3] Fix | Delete
/* global isRtl */
[4] Fix | Delete
[5] Fix | Delete
/**
[6] Fix | Delete
* Initializes the custom header selection page.
[7] Fix | Delete
*
[8] Fix | Delete
* @since 3.5.0
[9] Fix | Delete
*
[10] Fix | Delete
* @deprecated 4.1.0 The page this is used on is never linked to from the UI.
[11] Fix | Delete
* Setting a custom header is completely handled by the Customizer.
[12] Fix | Delete
*/
[13] Fix | Delete
(function($) {
[14] Fix | Delete
var frame;
[15] Fix | Delete
[16] Fix | Delete
$( function() {
[17] Fix | Delete
// Fetch available headers.
[18] Fix | Delete
var $headers = $('.available-headers');
[19] Fix | Delete
[20] Fix | Delete
// Apply jQuery.masonry once the images have loaded.
[21] Fix | Delete
$headers.imagesLoaded( function() {
[22] Fix | Delete
$headers.masonry({
[23] Fix | Delete
itemSelector: '.default-header',
[24] Fix | Delete
isRTL: !! ( 'undefined' != typeof isRtl && isRtl )
[25] Fix | Delete
});
[26] Fix | Delete
});
[27] Fix | Delete
[28] Fix | Delete
/**
[29] Fix | Delete
* Opens the 'choose from library' frame and creates it if it doesn't exist.
[30] Fix | Delete
*
[31] Fix | Delete
* @since 3.5.0
[32] Fix | Delete
* @deprecated 4.1.0
[33] Fix | Delete
*
[34] Fix | Delete
* @return {void}
[35] Fix | Delete
*/
[36] Fix | Delete
$('#choose-from-library-link').on( 'click', function( event ) {
[37] Fix | Delete
var $el = $(this);
[38] Fix | Delete
event.preventDefault();
[39] Fix | Delete
[40] Fix | Delete
// If the media frame already exists, reopen it.
[41] Fix | Delete
if ( frame ) {
[42] Fix | Delete
frame.open();
[43] Fix | Delete
return;
[44] Fix | Delete
}
[45] Fix | Delete
[46] Fix | Delete
// Create the media frame.
[47] Fix | Delete
frame = wp.media.frames.customHeader = wp.media({
[48] Fix | Delete
// Set the title of the modal.
[49] Fix | Delete
title: $el.data('choose'),
[50] Fix | Delete
[51] Fix | Delete
// Tell the modal to show only images.
[52] Fix | Delete
library: {
[53] Fix | Delete
type: 'image'
[54] Fix | Delete
},
[55] Fix | Delete
[56] Fix | Delete
// Customize the submit button.
[57] Fix | Delete
button: {
[58] Fix | Delete
// Set the text of the button.
[59] Fix | Delete
text: $el.data('update'),
[60] Fix | Delete
// Tell the button not to close the modal, since we're
[61] Fix | Delete
// going to refresh the page when the image is selected.
[62] Fix | Delete
close: false
[63] Fix | Delete
}
[64] Fix | Delete
});
[65] Fix | Delete
[66] Fix | Delete
/**
[67] Fix | Delete
* Updates the window location to include the selected attachment.
[68] Fix | Delete
*
[69] Fix | Delete
* @since 3.5.0
[70] Fix | Delete
* @deprecated 4.1.0
[71] Fix | Delete
*
[72] Fix | Delete
* @return {void}
[73] Fix | Delete
*/
[74] Fix | Delete
frame.on( 'select', function() {
[75] Fix | Delete
// Grab the selected attachment.
[76] Fix | Delete
var attachment = frame.state().get('selection').first(),
[77] Fix | Delete
link = $el.data('updateLink');
[78] Fix | Delete
[79] Fix | Delete
// Tell the browser to navigate to the crop step.
[80] Fix | Delete
window.location = link + '&file=' + attachment.id;
[81] Fix | Delete
});
[82] Fix | Delete
[83] Fix | Delete
frame.open();
[84] Fix | Delete
});
[85] Fix | Delete
});
[86] Fix | Delete
}(jQuery));
[87] Fix | Delete
[88] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function