ad_login/wwwroot/BackEnd/assets/javascript/pages/user-settings-demo.min.js

3 lines
1.7 KiB
JavaScript

"use strict";function _classCallCheck(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,a){for(var r=0;r<a.length;r++){var t=a[r];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}function _createClass(e,a,r){return a&&_defineProperties(e.prototype,a),r&&_defineProperties(e,r),e}var ProfileSettingsDemo=function(){function e(){_classCallCheck(this,e),this.init()}return _createClass(e,[{key:"init",value:function(){this.handleFileUploadAvatar()}},{key:"handleFileUploadAvatar",value:function(){var n=$("#fileupload-avatar").parents(".card-body"),l=$("<div>").addClass("alert alert-danger alert-dismissible"),i='<button type="button" class="close" data-dismiss="alert" aria-label="Close">\n <span aria-hidden="true">&times;</span>\n </button>';$("#fileupload-avatar").fileupload({url:"//jquery-file-upload.appspot.com/",dropZone:null,dataType:"json",autoUpload:!0,acceptFileTypes:/(\.|\/)(gif|jpe?g|png)$/i,maxFileSize:2e6}).on("fileuploadprocessalways",function(e,a){var r=a.index,t=a.files[r];l.remove(),t.error&&(l.text(t.error).prepend(i),n.prepend(l))}).on("fileuploadprogressall",function(e,a){var r=parseInt(a.loaded/a.total*100,10);$("#progress-avatar").addClass("show").children().css("width",r+"%")}).on("fileuploaddone",function(e,a){var r=a.result.files[0],t=$(this).parent().children("img");t.prop("src");r.url?t.prop("src",r.url):r.error&&(l.text(r.error).prepend(i),n.prepend(l)),$("#progress-avatar").removeClass("show").children().css("width",0)})}}]),e}();$(document).on("theme:init",function(){new ProfileSettingsDemo});
//# sourceMappingURL=../../sourcemaps/pages/user-settings-demo.min.js.map