function redux_add_file(a,b){a.preventDefault();var c,d=jQuery(this);return c?void c.open():(c=wp.media({multiple:!1,library:{},title:d.data("choose"),button:{text:d.data("update")}}),c.on("select",function(){var a=c.state().get("selection").first();if(c.close(),"undefined"==typeof redux.media&&(redux.media={}),"undefined"==typeof redux.media[jQuery(b).attr("data-id")]&&(redux.media[jQuery(b).attr("data-id")]={},redux.media[jQuery(b).attr("data-id")].mode="image"),redux.media[jQuery(b).attr("data-id")].mode===!1||a.attributes.type===redux.media[jQuery(b).attr("data-id")].mode){b.find(".upload").val(a.attributes.url),b.find(".upload-id").val(a.attributes.id),b.find(".upload-height").val(a.attributes.height),b.find(".upload-width").val(a.attributes.width),redux_change(jQuery(b).find(".upload-id"));var d=a.attributes.url;if("undefined"!=typeof a.attributes.sizes&&"undefined"!=typeof a.attributes.sizes.thumbnail)d=a.attributes.sizes.thumbnail.url;else if("undefined"!=typeof a.attributes.sizes){var e=a.attributes.height;for(var f in a.attributes.sizes){var g=a.attributes.sizes[f];g.height').slideDown("fast"),b.find(".remove-image").removeClass("hide"),b.find(".redux-background-properties").slideDown()}}),void c.open())}function redux_remove_file(a){if(a.find(".remove-image").addClass("hide")){a.find(".remove-image").addClass("hide"),a.find(".upload").val(""),a.find(".upload-id").val(""),a.find(".upload-height").val(""),a.find(".upload-width").val(""),a.find(".upload-thumbnail").val(""),redux_change(jQuery(a).find(".upload-id")),a.find(".redux-background-properties").hide();var b=a.find(".screenshot");b.slideUp(),a.find(".remove-file").unbind(),jQuery(".section-upload .upload-notice").length>0&&jQuery(".media_upload_button").remove()}}!function(a){"use strict";a.redux=a.redux||{},a(document).ready(function(){a.redux.media()}),a.redux.media=function(){a(".remove-image, .remove-file").unbind("click").on("click",function(){redux_remove_file(a(this).parents("fieldset.redux-field:first"))}),a(".media_upload_button").unbind().on("click",function(b){redux_add_file(b,a(this).parents("fieldset.redux-field:first"))})}}(jQuery);