From efb738763a70c7c16d19f61e7f55371f165bd816 Mon Sep 17 00:00:00 2001 From: Thomas Jang Date: Sun, 19 Feb 2017 23:17:02 +0900 Subject: [PATCH] 1.3.96 RELEASED --- bower.json | 2 +- dist/ax5modal.js | 2 +- dist/ax5modal.min.js | 3 +-- package.json | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/bower.json b/bower.json index 97413f7..1047e5e 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ax5ui-modal", - "version": "1.3.95", + "version": "1.3.96", "authors": [ "ThomasJ " ], diff --git a/dist/ax5modal.js b/dist/ax5modal.js index 8d97704..6dab09f 100755 --- a/dist/ax5modal.js +++ b/dist/ax5modal.js @@ -9,7 +9,7 @@ UI.addClass({ className: "modal", - version: "${VERSION}" + version: "1.3.96" }, function () { /** * @class ax5modal diff --git a/dist/ax5modal.min.js b/dist/ax5modal.min.js index 4f1ba79..8e1755c 100755 --- a/dist/ax5modal.min.js +++ b/dist/ax5modal.min.js @@ -1,2 +1 @@ -"use strict";!function(){var t,e=ax5.ui,i=ax5.util;e.addClass({className:"modal",version:"${VERSION}"},function(){var o=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&&(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:"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(t){this.onResize&&this.onResize.call(t,t)},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(e,i){var o={modalId:e,theme:i.theme,header:i.header,fullScreen:i.fullScreen?"fullscreen":"",styles:"",iframe:i.iframe,iframeLoadingMsg:i.iframeLoadingMsg,disableResize:i.disableResize};return i.zIndex&&(o.styles+="z-index:"+i.zIndex+";"),i.absolute&&(o.styles+="position:absolute;"),o.iframe&&"string"==typeof o.iframe.param&&(o.iframe.param=ax5.util.param(o.iframe.param)),t.tmpl.get.call(this,"content",o,{})},l=function(t,e){var l=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(),l={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(){l.state="load",t.iframeLoadingMsg&&this.$["iframe-loading"].hide(),n.call(this,t,l)}.bind(this)),t.iframeLoadingMsg||this.$.iframe.show(),this.$["iframe-form"].submit()),e&&e.call(l,l),this.watingModal||n.call(this,t,l),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.activeModal.on(d.clickEventName,"[data-modal-header-btn]",function(e){r.call(this,e||window.event,t)}.bind(this)),this.$.header.off(a.mousedown).off("dragstart").on(a.mousedown,function(e){if(t.isFullScreen)return!1;var d=i.findParentNode(e.target,function(t){if(t.getAttribute("data-modal-header-btn"))return!0});d||1==t.disableDrag||(o.mousePosition=h(e),m.on.call(o))}).on("dragstart",function(t){return i.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 i.stopEvent(t.originalEvent),!1})},r=function(t,e,o,d,a){var h=void 0;t.srcElement&&(t.target=t.srcElement),d=i.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:e.header.btns[a],dialogId:e.id,btnTarget:d},e.header.btns[a].onClick&&e.header.btns[a].onClick.call(h,a)),h=null,e=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.position(),i={width:this.activeModal.outerWidth(),height:this.activeModal.outerHeight()},h={width:jQuery(window).width(),height:jQuery(window).height(),scrollLeft:o.modalConfig.absolute?0:jQuery(document).scrollLeft(),scrollTop:o.modalConfig.absolute?0:jQuery(document).scrollTop()},n=function(t){return o.__dx=t.clientX-o.mousePosition.clientX,o.__dy=t.clientY-o.mousePosition.clientY,s>e.left+o.__dx?o.__dx=-e.left:le.top+o.__dy?o.__dy=-e.top:f'),o.resizer=jQuery('
'),o.resizerBg.css({zIndex:t}),o.resizer.css({left:e.left+h.scrollLeft,top:e.top+h.scrollTop,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).bind(a.mousemove+".ax5modal-"+d.id,function(t){o.resizer.css(n(t))}).bind(a.mouseup+".ax5layout-"+this.instanceId,function(t){m.off.call(o)}).bind("mouseleave.ax5layout-"+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),t=null};this.resizer&&(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:"move"})),jQuery(document.body).unbind(a.mousemove+".ax5modal-"+d.id).unbind(a.mouseup+".ax5modal-"+d.id).unbind("mouseleave.ax5modal-"+d.id),jQuery(document.body).removeAttr("unselectable").css("user-select","auto").off("selectstart")}},u={on:function(t){var e=this.activeModal.css("z-index"),i=this.activeModal.position(),h={width:this.activeModal.outerWidth(),height:this.activeModal.outerHeight()},n={width:jQuery(window).width(),height:jQuery(window).height(),scrollLeft:this.modalConfig.absolute?0:jQuery(document).scrollLeft(),scrollTop:this.modalConfig.absolute?0:jQuery(document).scrollTop()},s={top:function(t){return f>h.height-o.__dy&&(o.__dy=h.height-f),t.shiftKey?(f>h.height-2*o.__dy&&(o.__dy=(h.height-f)/2),{left:i.left,top:i.top+o.__dy,width:h.width,height:h.height-2*o.__dy}):t.altKey?(f>h.height-2*o.__dy&&(o.__dy=(h.height-f)/2),{left:i.left+o.__dy,top:i.top+o.__dy,width:h.width-2*o.__dy,height:h.height-2*o.__dy}):{left:i.left,top:i.top+o.__dy,width:h.width,height:h.height-o.__dy}},bottom:function(t){return f>h.height+o.__dy&&(o.__dy=-h.height+f),t.shiftKey?(f>h.height+2*o.__dy&&(o.__dy=(-h.height+f)/2),{left:i.left,top:i.top-o.__dy,width:h.width,height:h.height+2*o.__dy}):t.altKey?(f>h.height+2*o.__dy&&(o.__dy=(-h.height+f)/2),{left:i.left-o.__dy,top:i.top-o.__dy,width:h.width+2*o.__dy,height:h.height+2*o.__dy}):{left:i.left,top:i.top,width:h.width,height:h.height+o.__dy}},left:function(t){return r>h.width-o.__dx&&(o.__dx=h.width-r),t.shiftKey?(r>h.width-2*o.__dx&&(o.__dx=(h.width-r)/2),{left:i.left+o.__dx,top:i.top,width:h.width-2*o.__dx,height:h.height}):t.altKey?(r>h.width-2*o.__dx&&(o.__dx=(h.width-r)/2),{left:i.left+o.__dx,top:i.top+o.__dx,width:h.width-2*o.__dx,height:h.height-2*o.__dx}):{left:i.left+o.__dx,top:i.top,width:h.width-o.__dx,height:h.height}},right:function(t){return r>h.width+o.__dx&&(o.__dx=-h.width+r),t.shiftKey?(r>h.width+2*o.__dx&&(o.__dx=(-h.width+r)/2),{left:i.left-o.__dx,top:i.top,width:h.width+2*o.__dx,height:h.height}):t.altKey?(r>h.width+2*o.__dx&&(o.__dx=(-h.width+r)/2),{left:i.left-o.__dx,top:i.top-o.__dx,width:h.width+2*o.__dx,height:h.height+2*o.__dx}):{left:i.left,top:i.top,width:h.width+o.__dx,height:h.height}},"top-left":function(t){return r>h.width-o.__dx&&(o.__dx=h.width-r),f>h.height-o.__dy&&(o.__dy=h.height-f),t.shiftKey||t.altKey?(f>h.height-2*o.__dy&&(o.__dy=(h.height-f)/2),r>h.width-2*o.__dx&&(o.__dx=(h.width-r)/2),{left:i.left+o.__dx,top:i.top+o.__dy,width:h.width-2*o.__dx,height:h.height-2*o.__dy}):(f>h.height-2*o.__dy&&(o.__dy=(h.height-f)/2),r>h.width-2*o.__dx&&(o.__dx=(h.width-r)/2),{left:i.left+o.__dx,top:i.top+o.__dy,width:h.width-o.__dx,height:h.height-o.__dy})},"top-right":function(t){return r>h.width+o.__dx&&(o.__dx=-h.width+r),f>h.height-o.__dy&&(o.__dy=h.height-f),t.shiftKey||t.altKey?(f>h.height-2*o.__dy&&(o.__dy=(h.height-f)/2),r>h.width+2*o.__dx&&(o.__dx=(-h.width+r)/2),{left:i.left-o.__dx,top:i.top+o.__dy,width:h.width+2*o.__dx,height:h.height-2*o.__dy}):{left:i.left,top:i.top+o.__dy,width:h.width+o.__dx,height:h.height-o.__dy}},"bottom-left":function(t){return r>h.width-o.__dx&&(o.__dx=h.width-r),f>h.height+o.__dy&&(o.__dy=-h.height+f),t.shiftKey||t.altKey?(r>h.width-2*o.__dx&&(o.__dx=(h.width-r)/2),f>h.height+2*o.__dy&&(o.__dy=(-h.height+f)/2),{left:i.left+o.__dx,top:i.top-o.__dy,width:h.width-2*o.__dx,height:h.height+2*o.__dy}):{left:i.left+o.__dx,top:i.top,width:h.width-o.__dx,height:h.height+o.__dy}},"bottom-right":function(t){return r>h.width+o.__dx&&(o.__dx=-h.width+r),f>h.height+o.__dy&&(o.__dy=-h.height+f),t.shiftKey||t.altKey?(r>h.width+2*o.__dx&&(o.__dx=(-h.width+r)/2),f>h.height+2*o.__dy&&(o.__dy=(-h.height+f)/2),{left:i.left-o.__dx,top:i.top-o.__dy,width:h.width+2*o.__dx,height:h.height+2*o.__dy}):{left:i.left,top:i.top,width:h.width+o.__dx,height:h.height+o.__dy}}},l=function(e){return o.__dx=e.clientX-o.mousePosition.clientX,o.__dy=e.clientY-o.mousePosition.clientY,s[t](e)};this.modalConfig.absolute||(i.left+=n.scrollLeft,i.top+=n.scrollTop);var r=100,f=100,c={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.resizer||(o.resizerBg=jQuery('
'),o.resizer=jQuery('
'),o.resizerBg.css({zIndex:e,cursor:c[t]}),o.resizer.css({left:i.left,top:i.top,width:h.width,height:h.height,zIndex:e+1,cursor:c[t]}),jQuery(document.body).append(o.resizerBg).append(o.resizer),o.activeModal.addClass("draged")),jQuery(document.body).on(a.mousemove+".ax5modal-"+d.id,function(t){o.resizer.css(l(t))}).on(a.mouseup+".ax5layout-"+this.instanceId,function(t){u.off.call(o)}).on("mouseleave.ax5layout-"+this.instanceId,function(t){u.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();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.iframe&&(this.$["iframe-wrap"].css({height:t.height-this.modalConfig.headerHeight}),this.$.iframe.css({height:t.height-this.modalConfig.headerHeight})),t=null};this.resizer&&(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).off(a.mousemove+".ax5modal-"+d.id).off(a.mouseup+".ax5modal-"+d.id).off("mouseleave.ax5modal-"+d.id),jQuery(document.body).removeAttr("unselectable").css("user-select","auto").off("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)):(t=o.modalConfig=jQuery.extend(!0,{},d,t),l.call(this,t,e),this.watingModal=!1),this},this.close=function(t){return this.activeModal&&(t=o.modalConfig,this.activeModal.addClass("destroy"),jQuery(window).unbind("keydown.ax-modal"),jQuery(window).unbind("resize.ax-modal"),setTimeout(function(){if(this.activeModal){if(t.iframe){var e=this.$.iframe;if(e){var i=e.get(0),o=i.contentDocument?i.contentDocument:i.contentWindow.document;try{$(o.body).children().each(function(){$(this).remove()})}catch(d){}o.innerHTML="",e.attr("src","about:blank").remove(),window.CollectGarbage&&window.CollectGarbage()}}this.activeModal.remove(),this.activeModal=null}this.watingModal||n.call(this,t,{self:this,state:"close"})}.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),t.width&&(o.modalConfig.width=this.activeModal.width()),t.height&&(o.modalConfig.height=this.activeModal.height(),this.$.iframe&&(this.$["iframe-wrap"].css({height:o.modalConfig.height}),this.$.iframe.css({height:o.modalConfig.height})))),this},this.setModalConfig=function(t){return o.modalConfig=jQuery.extend({},o.modalConfig,t),this.align(),this},this.align=function(){return function(t,e){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&&(i.isFunction(t)?t():void 0)}(d.fullScreen);return h?(d.header&&this.$.header.show(),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)),this.activeModal.css(a),d.iframe&&(this.$["iframe-wrap"].css({height:a.height-d.headerHeight}),this.$.iframe.css({height:a.height-d.headerHeight})),this}}(),this.main=function(){e.modal_instance=e.modal_instance||[],e.modal_instance.push(this),arguments&&i.isObject(arguments[0])&&this.setConfig(arguments[0])}.apply(this,arguments)};return o}()),t=ax5.ui.modal}(),function(){var t=ax5.ui.modal,e=function(){return' \n
\n {{#header}}\n
\n {{{title}}}\n {{#btns}}\n
\n {{#@each}}\n \n {{/@each}}\n
\n {{/btns}}\n
\n {{/header}}\n
\n {{#iframe}}\n
\n
{{{iframeLoadingMsg}}}
\n \n
\n
\n \n {{#param}}\n {{#@each}}\n \n {{/@each}}\n {{/param}}\n
\n {{/iframe}}\n {{^iframe}}\n
\n {{/iframe}}\n
\n {{^disableResize}}\n
\n
\n
\n
\n
\n
\n
\n
\n {{/disableResize}}\n
\n '};t.tmpl={content:e,get:function(e,i,o){return ax5.mustache.render(t.tmpl[e].call(this,o),i)}}}(); -//# sourceMappingURL=ax5modal.min.js.map +"use strict";!function(){var t,e=ax5.ui,i=ax5.util;e.addClass({className:"modal",version:"1.3.96"},function(){var o=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&&(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:"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(t){this.onResize&&this.onResize.call(t,t)},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(e,i){var o={modalId:e,theme:i.theme,header:i.header,fullScreen:i.fullScreen?"fullscreen":"",styles:"",iframe:i.iframe,iframeLoadingMsg:i.iframeLoadingMsg,disableResize:i.disableResize};return i.zIndex&&(o.styles+="z-index:"+i.zIndex+";"),i.absolute&&(o.styles+="position:absolute;"),o.iframe&&"string"==typeof o.iframe.param&&(o.iframe.param=ax5.util.param(o.iframe.param)),t.tmpl.get.call(this,"content",o,{})},l=function(t,e){var l=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(),l={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(){l.state="load",t.iframeLoadingMsg&&this.$["iframe-loading"].hide(),n.call(this,t,l)}.bind(this)),t.iframeLoadingMsg||this.$.iframe.show(),this.$["iframe-form"].submit()),e&&e.call(l,l),this.watingModal||n.call(this,t,l),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.activeModal.on(d.clickEventName,"[data-modal-header-btn]",function(e){r.call(this,e||window.event,t)}.bind(this)),this.$.header.off(a.mousedown).off("dragstart").on(a.mousedown,function(e){if(t.isFullScreen)return!1;var d=i.findParentNode(e.target,function(t){if(t.getAttribute("data-modal-header-btn"))return!0});d||1==t.disableDrag||(o.mousePosition=h(e),m.on.call(o))}).on("dragstart",function(t){return i.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 i.stopEvent(t.originalEvent),!1})},r=function(t,e,o,d,a){var h=void 0;t.srcElement&&(t.target=t.srcElement),d=i.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:e.header.btns[a],dialogId:e.id,btnTarget:d},e.header.btns[a].onClick&&e.header.btns[a].onClick.call(h,a)),h=null,e=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.position(),i={width:this.activeModal.outerWidth(),height:this.activeModal.outerHeight()},h={width:jQuery(window).width(),height:jQuery(window).height(),scrollLeft:o.modalConfig.absolute?0:jQuery(document).scrollLeft(),scrollTop:o.modalConfig.absolute?0:jQuery(document).scrollTop()},n=function(t){return o.__dx=t.clientX-o.mousePosition.clientX,o.__dy=t.clientY-o.mousePosition.clientY,s>e.left+o.__dx?o.__dx=-e.left:le.top+o.__dy?o.__dy=-e.top:f'),o.resizer=jQuery('
'),o.resizerBg.css({zIndex:t}),o.resizer.css({left:e.left+h.scrollLeft,top:e.top+h.scrollTop,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).bind(a.mousemove+".ax5modal-"+d.id,function(t){o.resizer.css(n(t))}).bind(a.mouseup+".ax5layout-"+this.instanceId,function(t){m.off.call(o)}).bind("mouseleave.ax5layout-"+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),t=null};this.resizer&&(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:"move"})),jQuery(document.body).unbind(a.mousemove+".ax5modal-"+d.id).unbind(a.mouseup+".ax5modal-"+d.id).unbind("mouseleave.ax5modal-"+d.id),jQuery(document.body).removeAttr("unselectable").css("user-select","auto").off("selectstart")}},u={on:function(t){var e=this.activeModal.css("z-index"),i=this.activeModal.position(),h={width:this.activeModal.outerWidth(),height:this.activeModal.outerHeight()},n={width:jQuery(window).width(),height:jQuery(window).height(),scrollLeft:this.modalConfig.absolute?0:jQuery(document).scrollLeft(),scrollTop:this.modalConfig.absolute?0:jQuery(document).scrollTop()},s={top:function(t){return f>h.height-o.__dy&&(o.__dy=h.height-f),t.shiftKey?(f>h.height-2*o.__dy&&(o.__dy=(h.height-f)/2),{left:i.left,top:i.top+o.__dy,width:h.width,height:h.height-2*o.__dy}):t.altKey?(f>h.height-2*o.__dy&&(o.__dy=(h.height-f)/2),{left:i.left+o.__dy,top:i.top+o.__dy,width:h.width-2*o.__dy,height:h.height-2*o.__dy}):{left:i.left,top:i.top+o.__dy,width:h.width,height:h.height-o.__dy}},bottom:function(t){return f>h.height+o.__dy&&(o.__dy=-h.height+f),t.shiftKey?(f>h.height+2*o.__dy&&(o.__dy=(-h.height+f)/2),{left:i.left,top:i.top-o.__dy,width:h.width,height:h.height+2*o.__dy}):t.altKey?(f>h.height+2*o.__dy&&(o.__dy=(-h.height+f)/2),{left:i.left-o.__dy,top:i.top-o.__dy,width:h.width+2*o.__dy,height:h.height+2*o.__dy}):{left:i.left,top:i.top,width:h.width,height:h.height+o.__dy}},left:function(t){return r>h.width-o.__dx&&(o.__dx=h.width-r),t.shiftKey?(r>h.width-2*o.__dx&&(o.__dx=(h.width-r)/2),{left:i.left+o.__dx,top:i.top,width:h.width-2*o.__dx,height:h.height}):t.altKey?(r>h.width-2*o.__dx&&(o.__dx=(h.width-r)/2),{left:i.left+o.__dx,top:i.top+o.__dx,width:h.width-2*o.__dx,height:h.height-2*o.__dx}):{left:i.left+o.__dx,top:i.top,width:h.width-o.__dx,height:h.height}},right:function(t){return r>h.width+o.__dx&&(o.__dx=-h.width+r),t.shiftKey?(r>h.width+2*o.__dx&&(o.__dx=(-h.width+r)/2),{left:i.left-o.__dx,top:i.top,width:h.width+2*o.__dx,height:h.height}):t.altKey?(r>h.width+2*o.__dx&&(o.__dx=(-h.width+r)/2),{left:i.left-o.__dx,top:i.top-o.__dx,width:h.width+2*o.__dx,height:h.height+2*o.__dx}):{left:i.left,top:i.top,width:h.width+o.__dx,height:h.height}},"top-left":function(t){return r>h.width-o.__dx&&(o.__dx=h.width-r),f>h.height-o.__dy&&(o.__dy=h.height-f),t.shiftKey||t.altKey?(f>h.height-2*o.__dy&&(o.__dy=(h.height-f)/2),r>h.width-2*o.__dx&&(o.__dx=(h.width-r)/2),{left:i.left+o.__dx,top:i.top+o.__dy,width:h.width-2*o.__dx,height:h.height-2*o.__dy}):(f>h.height-2*o.__dy&&(o.__dy=(h.height-f)/2),r>h.width-2*o.__dx&&(o.__dx=(h.width-r)/2),{left:i.left+o.__dx,top:i.top+o.__dy,width:h.width-o.__dx,height:h.height-o.__dy})},"top-right":function(t){return r>h.width+o.__dx&&(o.__dx=-h.width+r),f>h.height-o.__dy&&(o.__dy=h.height-f),t.shiftKey||t.altKey?(f>h.height-2*o.__dy&&(o.__dy=(h.height-f)/2),r>h.width+2*o.__dx&&(o.__dx=(-h.width+r)/2),{left:i.left-o.__dx,top:i.top+o.__dy,width:h.width+2*o.__dx,height:h.height-2*o.__dy}):{left:i.left,top:i.top+o.__dy,width:h.width+o.__dx,height:h.height-o.__dy}},"bottom-left":function(t){return r>h.width-o.__dx&&(o.__dx=h.width-r),f>h.height+o.__dy&&(o.__dy=-h.height+f),t.shiftKey||t.altKey?(r>h.width-2*o.__dx&&(o.__dx=(h.width-r)/2),f>h.height+2*o.__dy&&(o.__dy=(-h.height+f)/2),{left:i.left+o.__dx,top:i.top-o.__dy,width:h.width-2*o.__dx,height:h.height+2*o.__dy}):{left:i.left+o.__dx,top:i.top,width:h.width-o.__dx,height:h.height+o.__dy}},"bottom-right":function(t){return r>h.width+o.__dx&&(o.__dx=-h.width+r),f>h.height+o.__dy&&(o.__dy=-h.height+f),t.shiftKey||t.altKey?(r>h.width+2*o.__dx&&(o.__dx=(-h.width+r)/2),f>h.height+2*o.__dy&&(o.__dy=(-h.height+f)/2),{left:i.left-o.__dx,top:i.top-o.__dy,width:h.width+2*o.__dx,height:h.height+2*o.__dy}):{left:i.left,top:i.top,width:h.width+o.__dx,height:h.height+o.__dy}}},l=function(e){return o.__dx=e.clientX-o.mousePosition.clientX,o.__dy=e.clientY-o.mousePosition.clientY,s[t](e)};this.modalConfig.absolute||(i.left+=n.scrollLeft,i.top+=n.scrollTop);var r=100,f=100,c={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.resizer||(o.resizerBg=jQuery('
'),o.resizer=jQuery('
'),o.resizerBg.css({zIndex:e,cursor:c[t]}),o.resizer.css({left:i.left,top:i.top,width:h.width,height:h.height,zIndex:e+1,cursor:c[t]}),jQuery(document.body).append(o.resizerBg).append(o.resizer),o.activeModal.addClass("draged")),jQuery(document.body).on(a.mousemove+".ax5modal-"+d.id,function(t){o.resizer.css(l(t))}).on(a.mouseup+".ax5layout-"+this.instanceId,function(t){u.off.call(o)}).on("mouseleave.ax5layout-"+this.instanceId,function(t){u.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();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.iframe&&(this.$["iframe-wrap"].css({height:t.height-this.modalConfig.headerHeight}),this.$.iframe.css({height:t.height-this.modalConfig.headerHeight})),t=null};this.resizer&&(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).off(a.mousemove+".ax5modal-"+d.id).off(a.mouseup+".ax5modal-"+d.id).off("mouseleave.ax5modal-"+d.id),jQuery(document.body).removeAttr("unselectable").css("user-select","auto").off("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)):(t=o.modalConfig=jQuery.extend(!0,{},d,t),l.call(this,t,e),this.watingModal=!1),this},this.close=function(t){return this.activeModal&&(t=o.modalConfig,this.activeModal.addClass("destroy"),jQuery(window).unbind("keydown.ax-modal"),jQuery(window).unbind("resize.ax-modal"),setTimeout(function(){if(this.activeModal){if(t.iframe){var e=this.$.iframe;if(e){var i=e.get(0),o=i.contentDocument?i.contentDocument:i.contentWindow.document;try{$(o.body).children().each(function(){$(this).remove()})}catch(d){}o.innerHTML="",e.attr("src","about:blank").remove(),window.CollectGarbage&&window.CollectGarbage()}}this.activeModal.remove(),this.activeModal=null}this.watingModal||n.call(this,t,{self:this,state:"close"})}.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),t.width&&(o.modalConfig.width=this.activeModal.width()),t.height&&(o.modalConfig.height=this.activeModal.height(),this.$.iframe&&(this.$["iframe-wrap"].css({height:o.modalConfig.height}),this.$.iframe.css({height:o.modalConfig.height})))),this},this.setModalConfig=function(t){return o.modalConfig=jQuery.extend({},o.modalConfig,t),this.align(),this},this.align=function(){return function(t,e){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&&(i.isFunction(t)?t():void 0)}(d.fullScreen);return h?(d.header&&this.$.header.show(),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)),this.activeModal.css(a),d.iframe&&(this.$["iframe-wrap"].css({height:a.height-d.headerHeight}),this.$.iframe.css({height:a.height-d.headerHeight})),this}}(),this.main=function(){e.modal_instance=e.modal_instance||[],e.modal_instance.push(this),arguments&&i.isObject(arguments[0])&&this.setConfig(arguments[0])}.apply(this,arguments)};return o}()),t=ax5.ui.modal}(),function(){var t=ax5.ui.modal,e=function(){return' \n
\n {{#header}}\n
\n {{{title}}}\n {{#btns}}\n
\n {{#@each}}\n \n {{/@each}}\n
\n {{/btns}}\n
\n {{/header}}\n
\n {{#iframe}}\n
\n
{{{iframeLoadingMsg}}}
\n \n
\n
\n \n {{#param}}\n {{#@each}}\n \n {{/@each}}\n {{/param}}\n
\n {{/iframe}}\n {{^iframe}}\n
\n {{/iframe}}\n
\n {{^disableResize}}\n
\n
\n
\n
\n
\n
\n
\n
\n {{/disableResize}}\n
\n '};t.tmpl={content:e,get:function(e,i,o){return ax5.mustache.render(t.tmpl[e].call(this,o),i)}}}(); \ No newline at end of file diff --git a/package.json b/package.json index fa52ed4..4a4d66a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ax5ui-modal", - "version": "1.3.95", + "version": "1.3.96", "description": "A modal plugin that works with Bootstrap & jQuery", "license": "MIT", "repository": {