40dad409f4
git-svn-id: https://develop.svn.wordpress.org/trunk@23093 602fd350-edb4-49c9-b593-d223f7449a82
1 line
896 B
JavaScript
1 line
896 B
JavaScript
(function(a){a(document).ready(function(){var b=a("#custom-background-image"),c;a("#background-color").wpColorPicker({change:function(d,e){b.css("background-color",e.color.toString())},clear:function(){b.css("background-color","")}});a('input[name="background-position-x"]').change(function(){b.css("background-position",a(this).val()+" top")});a('input[name="background-repeat"]').change(function(){b.css("background-repeat",a(this).val())});a("#choose-from-library-link").click(function(e){var d=a(this);e.preventDefault();if(c){c.open();return}c=wp.media.frames.customBackground=wp.media({title:d.data("choose"),library:{type:"image"},button:{text:d.data("update"),close:false}});c.on("select",function(){var f=c.state().get("selection").first();a.post(ajaxurl,{action:"set-background-image",attachment_id:f.id,size:"full"}).done(function(){window.location.reload()})});c.open()})})})(jQuery); |