OwlCyberSecurity - MANAGER
Edit File: redux-background.min.js
!function(o){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.background=redux.field_objects.background||{},redux.field_objects.background.init=function(e){e=o.redux.getSelector(e,"background"),o(e).each(function(){var d=o(this),e=d;(e=d.hasClass("redux-field-container")?e:d.parents(".redux-field-container:first")).is(":hidden")||e.hasClass("redux-field-init")&&(e.removeClass("redux-field-init"),d.find(".redux-remove-background").off("click").on("click",function(e){return e.preventDefault(),redux.field_objects.background.removeImage(o(this).parents(".redux-container-background:first")),redux.field_objects.background.preview(o(this)),!1}),d.find(".redux-background-upload").off().on("click",function(e){redux.field_objects.background.addImage(e,o(this).parents(".redux-container-background:first"))}),d.find(".redux-background-input").on("change",function(){redux.field_objects.background.preview(o(this))}),d.find(".redux-color").wpColorPicker({change:function(e,i){o(this).val(i.color.toString()),redux_change(o(this)),o("#"+e.target.id+"-transparency").prop("checked",!1),redux.field_objects.background.preview(o(this))},clear:function(e){redux_change(o(this).parent().find(".redux-color-init")),redux.field_objects.background.preview(o(this))}}),d.find(".redux-color").on("blur",function(){var e=o(this).val(),i="#"+o(this).attr("id");"transparent"===e?(o(this).parent().parent().find(".wp-color-result").css("background-color","transparent"),d.find(i+"-transparency").prop("checked",!0)):(colorValidate(this)===e&&0!==e.indexOf("#")&&o(this).val(o(this).data("oldcolor")),d.find(i+"-transparency").prop("checked",!1))}),d.find(".redux-color").on("focus",function(){o(this).data("oldcolor",o(this).val())}),d.find(".redux-color").on("keyup",function(){var e=o(this).val(),i=colorValidate(this),r="#"+o(this).attr("id");"transparent"===e?(o(this).parent().parent().find(".wp-color-result").css("background-color","transparent"),d.find(r+"-transparency").prop("checked",!0)):(d.find(r+"-transparency").prop("checked",!1),i&&i!==o(this).val()&&o(this).val(i))}),d.find(".color-transparency").on("click",function(){var e;o(this).is(":checked")?(d.find(".redux-saved-color").val(o("#"+o(this).data("id")).val()),d.find("#"+o(this).data("id")).val("transparent"),d.find("#"+o(this).data("id")).parents(".redux-field-container").find(".wp-color-result").css("background-color","transparent")):(""===(e=o(this).parents(".redux-field-container").find(".redux-saved-color").val())&&(e=o("#"+o(this).data("id")).data("default-color")),d.find("#"+o(this).data("id")).parents(".redux-field-container").find(".wp-color-result").css("background-color",e),d.find("#"+o(this).data("id")).val(e)),redux_change(o(this))}),d.find(" .redux-background-repeat, .redux-background-clip, .redux-background-origin, .redux-background-size, .redux-background-attachment, .redux-background-position").select2())})},redux.field_objects.background.preview=function(e){var i,r=!0,e=o(e).parents(".redux-container-background:first"),d=o(e).find(".background-preview");d&&(i="height:"+d.height()+"px;",o(e).find(".redux-background-input").each(function(){var e=o(this).serializeArray();(e=e[0])&&-1!==e.name.indexOf("[background-")&&""!==e.value&&(r=!1,e.name=e.name.split("[background-"),e.name="background-"+e.name[1].replace("]",""),"background-image"===e.name?i+=e.name+':url("'+e.value+'");':i+=e.name+":"+e.value+";")}),r?d.slideUp():d.attr("style",i).fadeIn())},redux.field_objects.background.addImage=function(e,a){var n,i=o(this);e.preventDefault(),(n=wp.media({multiple:!1,library:{},title:i.data("choose"),button:{text:i.data("update")}})).on("select",function(){var e,i,r,d,t=n.state().get("selection").first();if(n.close(),"image"===t.attributes.type){if(a.find(".upload").val(t.attributes.url),a.find(".upload-id").val(t.attributes.id),a.find(".upload-height").val(t.attributes.height),a.find(".upload-width").val(t.attributes.width),redux_change(o(a).find(".upload-id")),e=t.attributes.url,void 0!==t.attributes.sizes&&void 0!==t.attributes.sizes.thumbnail)e=t.attributes.sizes.thumbnail.url;else if(void 0!==t.attributes.sizes)for(r in i=t.attributes.height,t.attributes.sizes)t.attributes.sizes.hasOwnProperty(r)&&(d=t.attributes.sizes[r]).height<i&&(i=d.height,e=d.url);else e=t.attributes.icon;a.find(".upload-thumbnail").val(e),a.find(".upload").hasClass("noPreview")||a.find(".screenshot").empty().hide().append('<img class="redux-option-image" src="'+e+'">').slideDown("fast"),a.find(".redux-remove-background").removeClass("hide"),a.find(".redux-background-input-properties").slideDown(),redux.field_objects.background.preview(a.find(".upload"))}}),n.open()},redux.field_objects.background.removeImage=function(e){e.find(".redux-remove-background").addClass("hide")&&(e.find(".redux-remove-background").addClass("hide"),e.find(".upload").val(""),e.find(".upload-id").val(""),e.find(".upload-height").val(""),e.find(".upload-width").val(""),redux_change(o(e).find(".upload-id")),e.find(".redux-background-input-properties").hide(),e.find(".screenshot").slideUp(),e.find(".remove-file").off(),0<o(".section-upload .upload-notice").length)&&o(".redux-background-upload").remove()}}(jQuery);