"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()},c={"top-left":function(){this.align({left:"left",top:"top"})},"top-right":function(){this.align({left:"right",top:"top"})},"bottom-left":function(){this.align({left:"left",top:"bottom"})},"bottom-right":function(){this.align({left:"right",top:"bottom"})},"center-middle":function(){this.align({left:"center",top:"middle"})}},m={on:function(){var t=this.activeModal.css("z-index"),e=this.activeModal.offset(),i={width:this.activeModal.outerWidth(),height:this.activeModal.outerHeight()},d={width:jQuery(window).width(),height:jQuery(window).height(),scrollLeft:jQuery(document).scrollLeft(),scrollTop:jQuery(document).scrollTop()},h=function(t){return o.__dx=t.clientX-o.mousePosition.clientX,o.__dy=t.clientY-o.mousePosition.clientY,{left:e.left+o.__dx,top:e.top+o.__dy}};d.width-i.width,d.height-i.height;o.__dx=0,o.__dy=0,o.resizerBg=jQuery('
'),o.resizer=jQuery(''),o.resizerBg.css({zIndex:t}),o.resizer.css({left:e.left,top:e.top,width:i.width,height:i.height,zIndex:t+1}),jQuery(document.body).append(o.resizerBg).append(o.resizer),o.activeModal.addClass("draged"),jQuery(document.body).on(a.mousemove+".ax5modal-move-"+this.instanceId,function(t){o.resizer.css(h(t))}).on(a.mouseup+".ax5modal-move-"+this.instanceId,function(t){m.off.call(o)}).on("mouseleave.ax5modal-move-"+this.instanceId,function(t){m.off.call(o)}),jQuery(document.body).attr("unselectable","on").css("user-select","none").on("selectstart",!1)},off:function(){var t=function(){var t=this.resizer.offset();this.modalConfig.absolute||(t.left-=jQuery(document).scrollLeft(),t.top-=jQuery(document).scrollTop()),this.activeModal.css(t),this.modalConfig.left=t.left,this.modalConfig.top=t.top,t=null};this.activeModal.removeClass("draged"),t.call(this),this.resizer.remove(),this.resizer=null,this.resizerBg.remove(),this.resizerBg=null,jQuery(document.body).off(a.mousemove+".ax5modal-move-"+this.instanceId).off(a.mouseup+".ax5modal-move-"+this.instanceId).off("mouseleave.ax5modal-move-"+this.instanceId),jQuery(document.body).removeAttr("unselectable").css("user-select","auto").off("selectstart"),n.call(this,o.modalConfig,{self:this,state:"move"})}},u={on:function(t){var e=this.activeModal.css("z-index"),i=this.activeModal.offset(),d={width:this.activeModal.outerWidth(),height:this.activeModal.outerHeight()},h=({width:jQuery(window).width(),height:jQuery(window).height(),scrollLeft:jQuery(document).scrollLeft(),scrollTop:jQuery(document).scrollTop()},{top:function(t){return l>d.height-o.__dy&&(o.__dy=d.height-l),t.shiftKey?(l>d.height-2*o.__dy&&(o.__dy=(d.height-l)/2),{left:i.left,top:i.top+o.__dy,width:d.width,height:d.height-2*o.__dy}):t.altKey?(l>d.height-2*o.__dy&&(o.__dy=(d.height-l)/2),{left:i.left+o.__dy,top:i.top+o.__dy,width:d.width-2*o.__dy,height:d.height-2*o.__dy}):{left:i.left,top:i.top+o.__dy,width:d.width,height:d.height-o.__dy}},bottom:function(t){return l>d.height+o.__dy&&(o.__dy=-d.height+l),t.shiftKey?(l>d.height+2*o.__dy&&(o.__dy=(-d.height+l)/2),{left:i.left,top:i.top-o.__dy,width:d.width,height:d.height+2*o.__dy}):t.altKey?(l>d.height+2*o.__dy&&(o.__dy=(-d.height+l)/2),{left:i.left-o.__dy,top:i.top-o.__dy,width:d.width+2*o.__dy,height:d.height+2*o.__dy}):{left:i.left,top:i.top,width:d.width,height:d.height+o.__dy}},left:function(t){return s>d.width-o.__dx&&(o.__dx=d.width-s),t.shiftKey?(s>d.width-2*o.__dx&&(o.__dx=(d.width-s)/2),{left:i.left+o.__dx,top:i.top,width:d.width-2*o.__dx,height:d.height}):t.altKey?(s>d.width-2*o.__dx&&(o.__dx=(d.width-s)/2),{left:i.left+o.__dx,top:i.top+o.__dx,width:d.width-2*o.__dx,height:d.height-2*o.__dx}):{left:i.left+o.__dx,top:i.top,width:d.width-o.__dx,height:d.height}},right:function(t){return s>d.width+o.__dx&&(o.__dx=-d.width+s),t.shiftKey?(s>d.width+2*o.__dx&&(o.__dx=(-d.width+s)/2),{left:i.left-o.__dx,top:i.top,width:d.width+2*o.__dx,height:d.height}):t.altKey?(s>d.width+2*o.__dx&&(o.__dx=(-d.width+s)/2),{left:i.left-o.__dx,top:i.top-o.__dx,width:d.width+2*o.__dx,height:d.height+2*o.__dx}):{left:i.left,top:i.top,width:d.width+o.__dx,height:d.height}},"top-left":function(t){return s>d.width-o.__dx&&(o.__dx=d.width-s),l>d.height-o.__dy&&(o.__dy=d.height-l),t.shiftKey||t.altKey?(l>d.height-2*o.__dy&&(o.__dy=(d.height-l)/2),s>d.width-2*o.__dx&&(o.__dx=(d.width-s)/2),{left:i.left+o.__dx,top:i.top+o.__dy,width:d.width-2*o.__dx,height:d.height-2*o.__dy}):(l>d.height-2*o.__dy&&(o.__dy=(d.height-l)/2),s>d.width-2*o.__dx&&(o.__dx=(d.width-s)/2),{left:i.left+o.__dx,top:i.top+o.__dy,width:d.width-o.__dx,height:d.height-o.__dy})},"top-right":function(t){return s>d.width+o.__dx&&(o.__dx=-d.width+s),l>d.height-o.__dy&&(o.__dy=d.height-l),t.shiftKey||t.altKey?(l>d.height-2*o.__dy&&(o.__dy=(d.height-l)/2),s>d.width+2*o.__dx&&(o.__dx=(-d.width+s)/2),{left:i.left-o.__dx,top:i.top+o.__dy,width:d.width+2*o.__dx,height:d.height-2*o.__dy}):{left:i.left,top:i.top+o.__dy,width:d.width+o.__dx,height:d.height-o.__dy}},"bottom-left":function(t){return s>d.width-o.__dx&&(o.__dx=d.width-s),l>d.height+o.__dy&&(o.__dy=-d.height+l),t.shiftKey||t.altKey?(s>d.width-2*o.__dx&&(o.__dx=(d.width-s)/2),l>d.height+2*o.__dy&&(o.__dy=(-d.height+l)/2),{left:i.left+o.__dx,top:i.top-o.__dy,width:d.width-2*o.__dx,height:d.height+2*o.__dy}):{left:i.left+o.__dx,top:i.top,width:d.width-o.__dx,height:d.height+o.__dy}},"bottom-right":function(t){return s>d.width+o.__dx&&(o.__dx=-d.width+s),l>d.height+o.__dy&&(o.__dy=-d.height+l),t.shiftKey||t.altKey?(s>d.width+2*o.__dx&&(o.__dx=(-d.width+s)/2),l>d.height+2*o.__dy&&(o.__dy=(-d.height+l)/2),{left:i.left-o.__dx,top:i.top-o.__dy,width:d.width+2*o.__dx,height:d.height+2*o.__dy}):{left:i.left,top:i.top,width:d.width+o.__dx,height:d.height+o.__dy}}}),n=function(e){return o.__dx=e.clientX-o.mousePosition.clientX,o.__dy=e.clientY-o.mousePosition.clientY,h[t](e)},s=100,l=100,r={top:"row-resize",bottom:"row-resize",left:"col-resize",right:"col-resize","top-left":"nwse-resize","top-right":"nesw-resize","bottom-left":"nesw-resize","bottom-right":"nwse-resize"};o.__dx=0,o.__dy=0,o.resizerBg=jQuery(''),o.resizer=jQuery(''),o.resizerBg.css({zIndex:e,cursor:r[t]}),o.resizer.css({left:i.left,top:i.top,width:d.width,height:d.height,zIndex:e+1,cursor:r[t]}),jQuery(document.body).append(o.resizerBg).append(o.resizer),o.activeModal.addClass("draged"),jQuery(document.body).bind(a.mousemove+".ax5modal-resize-"+this.instanceId,function(t){o.resizer.css(n(t))}).bind(a.mouseup+".ax5modal-resize-"+this.instanceId,function(t){u.off.call(o)}).bind("mouseleave.ax5modal-resize-"+this.instanceId,function(t){u.off.call(o)}),jQuery(document.body).attr("unselectable","on").css("user-select","none").bind("selectstart",!1)},off:function(){var t=function(){var t=this.resizer.offset();jQuery.extend(t,{width:this.resizer.width(),height:this.resizer.height()}),this.modalConfig.absolute||(t.left-=jQuery(document).scrollLeft(),t.top-=jQuery(document).scrollTop()),this.activeModal.css(t),this.modalConfig.left=t.left,this.modalConfig.top=t.top,this.modalConfig.width=t.width,this.modalConfig.height=t.height,this.$.body.css({height:t.height-this.modalConfig.headerHeight}),this.modalConfig.iframe&&(this.$["iframe-wrap"].css({height:t.height-this.modalConfig.headerHeight}),this.$.iframe.css({height:t.height-this.modalConfig.headerHeight})),t=null};this.activeModal.removeClass("draged"),t.call(this),this.resizer.remove(),this.resizer=null,this.resizerBg.remove(),this.resizerBg=null,n.call(this,o.modalConfig,{self:this,state:"resize"}),jQuery(document.body).unbind(a.mousemove+".ax5modal-resize-"+this.instanceId).unbind(a.mouseup+".ax5modal-resize-"+this.instanceId).unbind("mouseleave.ax5modal-resize-"+this.instanceId),jQuery(document.body).removeAttr("unselectable").css("user-select","auto").unbind("selectstart")}};this.init=function(){this.onStateChanged=d.onStateChanged,this.onResize=d.onResize},this.open=function(t,e,i){return"undefined"==typeof i&&(i=0),this.activeModal?i<3?(this.watingModal=!0,setTimeout(function(){this.open(t,e,i+1)}.bind(this),d.animateTime)):this.watingModal=!1:(t=o.modalConfig=jQuery.extend(!0,{},d,t),l.call(this,t,e),this.watingModal=!1),this},this.close=function(t){var i=void 0,a=void 0;return this.activeModal&&(i=o.modalConfig,this.activeModal.addClass("destroy"),jQuery(window).unbind("keydown.ax-modal"),jQuery(window).unbind("resize.ax-modal"),setTimeout(function(){if(i.iframe){var o=this.$.iframe;if(o){var d=o.get(0),h=d.contentDocument?d.contentDocument:d.contentWindow.document;try{$(h.body).children().each(function(){$(this).remove()})}catch(s){}h.innerHTML="",o.attr("src","about:blank").remove(),window.CollectGarbage&&window.CollectGarbage()}}this.activeModal.remove(),this.activeModal=null,this.watingModal||n.call(this,i,{self:this,state:"close"}),t&&e.isFunction(t.callback)&&(a={self:this,id:i.id,theme:i.theme,width:i.width,height:i.height,state:"close",$:this.$},t.callback.call(a,a))}.bind(this),d.animateTime)),this.minimized=!1,this},this.minimize=function(){return function(t){if(this.minimized!==!0){var e=o.modalConfig;"undefined"==typeof t&&(t=d.minimizePosition),this.minimized=!0,this.$.body.hide(),o.modalConfig.originalHeight=e.height,o.modalConfig.height=0,c[t].call(this),n.call(this,e,{self:this,state:"minimize"})}return this}}(),this.restore=function(){var t=o.modalConfig;return this.minimized&&(this.minimized=!1,this.$.body.show(),o.modalConfig.height=o.modalConfig.originalHeight,o.modalConfig.originalHeight=void 0,this.align({left:"center",top:"middle"}),n.call(this,t,{self:this,state:"restore"})),this},this.css=function(t){return this.activeModal&&!o.fullScreen&&(this.activeModal.css(t),"undefined"!=typeof t.width&&(o.modalConfig.width=t.width),"undefined"!=typeof t.height&&(o.modalConfig.height=t.height),this.align()),this},this.setModalConfig=function(t){return o.modalConfig=jQuery.extend({},o.modalConfig,t),this.align(),this},this.align=function(){return function(t,i){if(!this.activeModal)return this;var d=o.modalConfig,a={width:d.width,height:d.height},h=d.isFullScreen=function(t){return"undefined"!=typeof t&&(e.isFunction(t)?t():void 0)}(d.fullScreen);return h?(d.header&&this.$.header.show(),d.header?(d.headerHeight=this.$.header.outerHeight(),a.height+=d.headerHeight):d.headerHeight=0,a.width=jQuery(window).width(),a.height=d.height,a.left=0,a.top=0):(d.header&&this.$.header.show(),t&&jQuery.extend(!0,d.position,t),d.header?(d.headerHeight=this.$.header.outerHeight(),a.height+=d.headerHeight):d.headerHeight=0,"left"==d.position.left?a.left=d.position.margin||0:"right"==d.position.left?a.left=jQuery(window).width()-a.width-(d.position.margin||0):"center"==d.position.left?a.left=jQuery(window).width()/2-a.width/2:a.left=d.position.left||0,"top"==d.position.top?a.top=d.position.margin||0:"bottom"==d.position.top?a.top=jQuery(window).height()-a.height-(d.position.margin||0):"middle"==d.position.top?a.top=jQuery(window).height()/2-a.height/2:a.top=d.position.top||0,a.left<0&&(a.left=0),a.top<0&&(a.top=0),d.absolute&&(a.top+=jQuery(window).scrollTop(),a.left+=jQuery(window).scrollLeft())),this.activeModal.css(a),this.$.body.css({height:a.height-(d.headerHeight||0)}),d.iframe&&(this.$["iframe-wrap"].css({height:a.height-d.headerHeight}),this.$.iframe.css({height:a.height-d.headerHeight})),this}}(),this.main=function(){t.modal_instance=t.modal_instance||[],t.modal_instance.push(this),arguments&&e.isObject(arguments[0])&&this.setConfig(arguments[0])}.apply(this,arguments)}}()),i=ax5.ui.modal}(),function(){var t=ax5.ui.modal,e=function(){return' \n{{{iframeLoadingMsg}}} |