CoreFiles by mySites.guru
custom-header.js46 lines, 971 bytes, from wordpress-3.5-beta3.zip
Raw History Compare with 3.5-beta2
md5
b12d3bdb29ddc48380a3f9b2e1c73d66
sha1
4673a1814c8c644fd27e56cfaa6e6db531cde15b
sha256
61f61e9f75662cfda7ce25994813eb77b12f2e3428a9fd545fb5705dc3f17672
(function($) {
	var frame;

	$( function() {
		// Fetch available headers and apply jQuery.masonry
		// once the images have loaded.
		var $headers = $('.available-headers');

		$headers.imagesLoaded( function() {
			$headers.masonry({
				itemSelector: '.default-header'
			});
		});

		// Build the choose from library frame.
		$('#choose-from-library-link').click( function( event ) {
			var $el = $(this);
			event.preventDefault();

			frame = wp.media({
				title:     $el.data('choose'),
				library:   {
					type: 'image'
				}
			});

			frame.toolbar.on( 'activate:select', function() {
				frame.toolbar.view().set({
					select: {
						style: 'primary',
						text:  $el.data('update'),

						click: function() {
							var attachment = frame.state().get('selection').first(),
								link = $el.data('updateLink');

							window.location = link + '&file=' + attachment.id;
						}
					}
				});
			});

			frame.state('library');
		});
	});
}(jQuery));

The same content is in 3 releases, WordPress 3.5-beta3 to 3.5-RC2. See them all, or every version of this file.