wp/wp-admin/js/custom-header.js
changeset 9 177826044cd9
parent 5 5e2f62d02dcd
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
       
     1 /**
       
     2  * @output wp-admin/js/custom-header.js
       
     3  */
       
     4 
     1 /* global isRtl */
     5 /* global isRtl */
       
     6 
       
     7 /**
       
     8  * Initializes the custom header selection page.
       
     9  *
       
    10  * @since 3.5.0
       
    11  *
       
    12  * @deprecated 4.1.0 The page this is used on is never linked to from the UI.
       
    13  *             Setting a custom header is completely handled by the Customizer.
       
    14  */
     2 (function($) {
    15 (function($) {
     3 	var frame;
    16 	var frame;
     4 
    17 
     5 	$( function() {
    18 	$( function() {
     6 		// Fetch available headers and apply jQuery.masonry
    19 		// Fetch available headers.
     7 		// once the images have loaded.
       
     8 		var $headers = $('.available-headers');
    20 		var $headers = $('.available-headers');
     9 
    21 
       
    22 		// Apply jQuery.masonry once the images have loaded.
    10 		$headers.imagesLoaded( function() {
    23 		$headers.imagesLoaded( function() {
    11 			$headers.masonry({
    24 			$headers.masonry({
    12 				itemSelector: '.default-header',
    25 				itemSelector: '.default-header',
    13 				isRTL: !! ( 'undefined' != typeof isRtl && isRtl )
    26 				isRTL: !! ( 'undefined' != typeof isRtl && isRtl )
    14 			});
    27 			});
    15 		});
    28 		});
    16 
    29 
    17 		// Build the choose from library frame.
    30 		/**
       
    31 		 * Opens the 'choose from library' frame and creates it if it doesn't exist.
       
    32 		 *
       
    33 		 * @since 3.5.0
       
    34 		 * @deprecated 4.1.0
       
    35 		 *
       
    36 		 * @returns {void}
       
    37 		 */
    18 		$('#choose-from-library-link').click( function( event ) {
    38 		$('#choose-from-library-link').click( function( event ) {
    19 			var $el = $(this);
    39 			var $el = $(this);
    20 			event.preventDefault();
    40 			event.preventDefault();
    21 
    41 
    22 			// If the media frame already exists, reopen it.
    42 			// If the media frame already exists, reopen it.
    43 					// going to refresh the page when the image is selected.
    63 					// going to refresh the page when the image is selected.
    44 					close: false
    64 					close: false
    45 				}
    65 				}
    46 			});
    66 			});
    47 
    67 
    48 			// When an image is selected, run a callback.
    68 			/**
       
    69 			 * Updates the window location to include the selected attachment.
       
    70 			 *
       
    71 			 * @since 3.5.0
       
    72 			 * @deprecated 4.1.0
       
    73 			 *
       
    74 			 * @returns {void}
       
    75 			 */
    49 			frame.on( 'select', function() {
    76 			frame.on( 'select', function() {
    50 				// Grab the selected attachment.
    77 				// Grab the selected attachment.
    51 				var attachment = frame.state().get('selection').first(),
    78 				var attachment = frame.state().get('selection').first(),
    52 					link = $el.data('updateLink');
    79 					link = $el.data('updateLink');
    53 
    80