old_contents: function loadPreview(){"undefined"!=typeof document.getElementById("avatar").files[0]&&($("#loading").show(),previewImage())}function loadPreviewSquare(){"undefined"!=typeof document.getElementById("avatar").files[0]&&($("#loading").show(),previewImageSquare())}!function(e){function o(){var e=new FileReader;e.readAsDataURL(document.getElementById("avatar").files[0]),e.onload=function(e){document.getElementById("uploadPreview").src=e.target.result;var o,t,n,i=document.getElementById("uploadPreview");$("<img/>").attr("src",$(i).attr("src")).load(function(){o=this.width,t=this.height,n=o>t?(t-100)/2:(o-100)/2,jQuery(function(e){e("#uploadPreview").Jcrop({onSelect:a,onChange:a,bgColor:"black",bgOpacity:.4,minSize:[100,100],setSelect:[o/2-n,t/2-n,o/2+n,t/2+n],aspectRatio:1,boxWidth:450})})}),$("#modal").modal("show")}}function a(e){$("#x1").val(Math.floor(e.x)),$("#y1").val(Math.floor(e.y)),$("#x2").val(Math.floor(e.x2)),$("#y2").val(Math.floor(e.y2))}e=e||{},e.previewImage=o}(window),function(e){e=e||{},e.previewImage=_previewImage}(window),$("#modal").on("hidden.bs.modal",function(){JcropAPI=$("#uploadPreview").data("Jcrop"),JcropAPI.destroy()}),$("#modal").on("shown.bs.modal",function(){$("#loading").hide()});
new_contents: function loadPreview(){"undefined"!=typeof document.getElementById("avatar").files[0]&&($("#loading").show(),previewImage())}function loadPreviewSquare(){"undefined"!=typeof document.getElementById("avatar").files[0]&&($("#loading").show(),previewImageSquare())}!function(e){function t(){var e=new FileReader;e.readAsDataURL(document.getElementById("avatar").files[0]),e.onload=function(e){document.getElementById("uploadPreview").src=e.target.result;var t,o,n,i=document.getElementById("uploadPreview");$("<img/>").attr("src",$(i).attr("src")).load(function(){t=this.width,o=this.height,n=t>o?(o-100)/2:(t-100)/2,jQuery(function(e){e("#uploadPreview").Jcrop({onSelect:a,onChange:a,bgColor:"black",bgOpacity:.4,minSize:[100,100],setSelect:[t/2-n,o/2-n,t/2+n,o/2+n],aspectRatio:1,boxWidth:450})})}),$("#modal").modal("show")}}function o(){var e=new FileReader;e.readAsDataURL(document.getElementById("avatar").files[0]),e.onload=function(e){document.getElementById("uploadPreview").src=e.target.result;var t=document.getElementById("uploadPreview"),o=t.clientWidth,n=t.clientHeight;o>n?o=n-100:n=o-100,jQuery(function(e){e("#uploadPreview").Jcrop({onSelect:a,onChange:a,bgColor:"black",bgOpacity:.4,minSize:[100,100],setSelect:[0,0,o/2,n/2],aspectRatio:1,boxWidth:450})})}}function a(e){$("#x1").val(Math.floor(e.x)),$("#y1").val(Math.floor(e.y)),$("#x2").val(Math.floor(e.x2)),$("#y2").val(Math.floor(e.y2))}e=e||{},e.previewImage=t,e.previewImageSquare=o}(window),$("#modal").on("hidden.bs.modal",function(){JcropAPI=$("#uploadPreview").data("Jcrop"),JcropAPI.destroy()}),$("#modal").on("shown.bs.modal",function(){$("#loading").hide()});
subject: Correct global variable