/** * BSDialog * @version v0.1.0.029 (2019/09/24 1112) */ var BSDialog={Create:function(d,o,t,e,a,s){var l=this;l.id=d,l.title=o,l.url=t,l.isBig=void 0!==e&&1==e,l.showSize=void 0===s||1==s;var n=void 0===a||1==a;l.Exists(d)||l.renderContent(null),null!=t&&$.ajax({url:t,cache:!1,timeout:6e4,success:function(o,t,e){200==e.status||302==e.status||301==e.status?n?l.updateContentBody(d,o):$("#dlg"+d).find(".modal-content").html(o):l.updateContentBody(d,e.statusText+" ("+e.status+")")},error:function(o){l.updateContentBody(d,o.statusText+" ("+o.status+")")},complete:function(o,t){}}),l.initialiseComponents()},Close:function(o){$("#dlg"+o).modal("hide")},Clear:function(){$("body > div[class~='modal'][role='dialog']").remove(),$("body > div[class~='modal-backdrop']").remove(),$("body").removeClass("modal-open")},ShowToast:function(o,t,e,d){var a=this;a.Exists(o)||(a.id=o,a.title=t,a.url=null,a.isBig=void 0!==d&&1==d,a.renderContent(e),a.initialiseComponents())},Exists:function(o){return 0<$("body > div[id='dlg"+o+"']").length},generateModalHtml:function(o){var t=this,e=1==t.isBig?"lg":"md",d="";return d+='
"},renderContent:function(o){$("body").append(this.generateModalHtml(o))},initialiseComponents:function(){var o=this,d=o.getElement();if(o.showSize){var t=$(d).find("button[data-modal-action='restore']");0<$(t).length&&($(t).off("click"),$(t).on("click",function(){o.toggleSize()}))}$(d).modal("show"),$(d).off("hide.bs.modal"),$(d).on("hide.bs.modal",function(){$(d).next().is("div[class~='modal-backdrop']")&&$(d).next().remove(),$(d).remove()}),$(d).find(".modal-header").off("mousedown"),$(d).find(".modal-header").on("mousedown",function(o){var t=o.pageX-$(this).offset().left,e=o.pageY-$(this).offset().top;$("body").off("mousemove.draggable"),$("body").on("mousemove.draggable",function(o){$(d).children(".modal-dialog").offset({left:o.pageX-t,top:o.pageY-e})}),$("body").off("mouseup"),$("body").on("mouseup",function(){$("body").off("mousemove.draggable")}),$(d).off("bs.modal.hide"),$(d).on("bs.modal.hide",function(){$("body").off("mousemove.draggable")})})},updateContentBody:function(o,t){var e=$("#dlg"+o).find(".modal-body");$(e).hasClass("custom-loading")&&$(e).removeClass("custom-loading"),$(e).html(t)},getElement:function(){return $("#dlg"+this.id)},toggleSize:function(){var o=$(this.getElement()).find("div[class^='modal-dialog']");$(o).length<=0||($(o).hasClass("modal-md")?($(o).removeClass("modal-md"),$(o).addClass("modal-lg")):$(o).hasClass("modal-lg")&&($(o).removeClass("modal-lg"),$(o).addClass("modal-md")))}};