(function($){var taxonomyTermImageText=TaxonomyTermImageText||{};var taxonomyTermImage={file_frame:null,settings:{title:taxonomyTermImageText.modalTitle||"Select or upload a video",button:{text:taxonomyTermImageText.modalButton||"Attach"},multiple:false,library:{type:"image"}},init:function(){var _this=this;$("body").on("click",".taxonomy-term-image-attach",function(event){event.preventDefault();_this.openModal()});$(".taxonomy-term-image-remove").click(_this.removeImage)},removeImage:function(){$("#taxonomy-term-image-container").html("");$("#taxonomy-term-image-id").val("")},openModal:function(){var _this=this;if(_this.file_frame){_this.file_frame.open();return}_this.file_frame=wp.media.frames.file_frame=wp.media(_this.settings);_this.file_frame.on("select",function(){_this.file_frame.state().get("selection").map(_this.updateImage)});_this.file_frame.open()},updateImage:function(attachment){var image=attachment.toJSON();var sizes=attachment.get("sizes");var size=typeof sizes.thumbnail==="undefined"?sizes.full:sizes.thumbnail;$("#taxonomy-term-image-id").val(image.id);$("#taxonomy-term-image-container").html("")}};$(document).ready(function(){taxonomyTermImage.init()})})(jQuery);