- md5
- 9fc07d8c5a3b7de645c0fa8315ebe851
- sha1
- ee9e1212ad8d983dfd312b10c1bd6c10524c500d
- sha256
- da65357363ea0699c25989a5b2c7ce635984b163666cb9c1199d7ef241e5ac34
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
(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.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();
$.post( ajaxurl, {
action: 'set-background-image',
attachment_id: attachment.id,
size: 'full'
}, function() {
window.location.reload();
});
}
}
});
});
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.