You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
18 KiB

  1. "use strict";!function(){var t=ax5.ui,e=ax5.util,i=void 0;t.addClass({className:"modal"},function(){return function(){var o=this,d=void 0,a={mousedown:ax5.info.supportTouch?"touchstart":"mousedown",mousemove:ax5.info.supportTouch?"touchmove":"mousemove",mouseup:ax5.info.supportTouch?"touchend":"mouseup"},h=function(t){var e=t;return"changedTouches"in t&&t.changedTouches&&(e=t.changedTouches[0]),{clientX:e.clientX,clientY:e.clientY}};this.instanceId=ax5.getGuid(),this.config={id:"ax5-modal-"+this.instanceId,position:{left:"center",top:"middle",margin:10},minimizePosition:"bottom-right",clickEventName:"ontouchstart"in document.documentElement?"touchstart":"click",theme:"default",width:300,height:400,closeToEsc:!0,disableDrag:!1,disableResize:!1,animateTime:250,iframe:!1},this.activeModal=null,this.watingModal=!1,this.$={},d=this.config;var n=function(t,e){var i={resize:function(e){t&&t.onResize?t.onResize.call(e,e):this.onResize&&this.onResize.call(e,e)},move:function(){}};return e.state in i&&i[e.state].call(this,e),t&&t.onStateChanged?t.onStateChanged.call(e,e):this.onStateChanged&&this.onStateChanged.call(e,e),!0},s=function(t,e){var o={modalId:t,theme:e.theme,header:e.header,fullScreen:e.fullScreen?"fullscreen":"",styles:"",iframe:e.iframe,iframeLoadingMsg:e.iframeLoadingMsg,disableResize:e.disableResize};return e.zIndex&&(o.styles+="z-index:"+e.zIndex+";"),e.absolute&&(o.styles+="position:absolute;"),o.iframe&&"string"==typeof o.iframe.param&&(o.iframe.param=ax5.util.param(o.iframe.param)),i.tmpl.get.call(this,"content",o,{})},l=function(t,i){var d=void 0;jQuery(document.body).append(s.call(this,t.id,t)),this.activeModal=jQuery("#"+t.id),this.$={root:this.activeModal,header:this.activeModal.find('[data-modal-els="header"]'),body:this.activeModal.find('[data-modal-els="body"]')},t.iframe?(this.$["iframe-wrap"]=this.activeModal.find('[data-modal-els="iframe-wrap"]'),this.$.iframe=this.activeModal.find('[data-modal-els="iframe"]'),this.$["iframe-form"]=this.activeModal.find('[data-modal-els="iframe-form"]'),this.$["iframe-loading"]=this.activeModal.find('[data-modal-els="iframe-loading"]')):this.$["body-frame"]=this.activeModal.find('[data-modal-els="body-frame"]'),this.align(),d={self:this,id:t.id,theme:t.theme,width:t.width,height:t.height,state:"open",$:this.$},t.iframe&&(this.$["iframe-wrap"].css({height:t.height}),this.$.iframe.css({height:t.height}),this.$["iframe-form"].attr({method:t.iframe.method}),this.$["iframe-form"].attr({target:t.id+"-frame"}),this.$["iframe-form"].attr({action:t.iframe.url}),this.$.iframe.on("load",function(){d.state="load",t.iframeLoadingMsg&&this.$["iframe-loading"].hide(),n.call(this,t,d)}.bind(this)),t.iframeLoadingMsg||this.$.iframe.show(),this.$["iframe-form"].submit()),i&&i.call(d,d),this.watingModal||n.call(this,t,d),t.closeToEsc&&jQuery(window).bind("keydown.ax-modal",function(t){f.call(this,t||window.event)}.bind(this)),jQuery(window).bind("resize.ax-modal",function(t){this.align(null,t||window.event)}.bind(this)),this.$.header.off(a.mousedown).off("dragstart").on(a.mousedown,function(i){var d=e.findParentNode(i.target,function(t){if(t.getAttribute("data-modal-header-btn"))return!0});t.isFullScreen||d||1==t.disableDrag||(o.mousePosition=h(i),m.on.call(o)),d&&r.call(o,i||window.event,t)}).on("dragstart",function(t){return e.stopEvent(t.originalEvent),!1}),this.activeModal.off(a.mousedown).off("dragstart").on(a.mousedown,"[data-ax5modal-resizer]",function(e){return!t.disableDrag&&!t.isFullScreen&&(o.mousePosition=h(e),void u.on.call(o,this.getAttribute("data-ax5modal-resizer")))}).on("dragstart",function(t){return e.stopEvent(t.originalEvent),!1})},r=function(t,i,o,d,a){var h=void 0;t.srcElement&&(t.target=t.srcElement),d=e.findParentNode(t.target,function(t){if(t.getAttribute("data-modal-header-btn"))return!0}),d&&(a=d.getAttribute("data-modal-header-btn"),h={self:this,key:a,value:i.header.btns[a],dialogId:i.id,btnTarget:d},i.header.btns[a].onClick&&i.header.btns[a].onClick.call(h,a)),h=null,i=null,o=null,d=null,a=null},f=function(t){t.keyCode==ax5.info.eventKeys.ESC&&this.close(
  2. //# sourceMappingURL=ax5modal.min.js.map