CoreFiles by mySites.guru
custom-background.js63 lines, 1,362 bytes, from wordpress-3.5-RC3.zip
Raw History Compare with 3.5-RC2
md5
90f66640a77e3680b345cc1adf1967b5
sha1
e97bb4f02978106ed3148a9f60b5a52f6d782556
sha256
2755a025b3f73601465653332dd99675659e58e81703bbadc50d09736a6be533
(function($) {
	$(document).ready(function() {
		var bgImage = $("#custom-background-image"),
			frame;

		$('#background-color').wpColorPicker({
			change: function( event, ui ) {
				bgImage.css('background-color', ui.color.toString());
			},
			clear: function() {
				bgImage.css('background-color', '');
			}
		});

		$('input[name="background-position-x"]').change(function() {
			bgImage.css('background-position', $(this).val() + ' top');
		});

		$('input[name="background-repeat"]').change(function() {
			bgImage.css('background-repeat', $(this).val());
		});

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

			event.preventDefault();

			if ( frame ) {
				frame.open();
				return;
			}

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

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

						click: function() {
							var attachment = frame.state().get('selection').first();
							$.post( ajaxurl, {
								action: 'set-background-image',
								attachment_id: attachment.id,
								size: 'full'
							}, function() {
								window.location.reload();
							});
						}
					}
				});
			});

			frame.setState('library').open();
		});
	});
})(jQuery);

No other release has this exact content. See every version of this file.