diff --git a/bower.json b/bower.json index 22abe29..52bdd54 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ax5ui-modal", - "version": "1.3.44", + "version": "1.3.45", "authors": [ "ThomasJ " ], diff --git a/dist/ax5modal.js b/dist/ax5modal.js index 1fd208e..b005329 100755 --- a/dist/ax5modal.js +++ b/dist/ax5modal.js @@ -9,7 +9,7 @@ UI.addClass({ className: "modal", - version: "1.3.44" + version: "1.3.45" }, function () { /** * @class ax5modal diff --git a/dist/ax5modal.min.js b/dist/ax5modal.min.js index 0b2b252..823dc4e 100755 --- a/dist/ax5modal.min.js +++ b/dist/ax5modal.min.js @@ -1 +1 @@ -"use strict";!function(){var t,e=ax5.ui,i=ax5.util;e.addClass({className:"modal",version:"1.3.44"},function(){var a=function(){var a,o=this,n={mousedown:ax5.info.supportTouch?"touchstart":"mousedown",mousemove:ax5.info.supportTouch?"touchmove":"mousemove",mouseup:ax5.info.supportTouch?"touchend":"mouseup"},d=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,animateTime:250},this.activeModal=null,this.$={},a=this.config;var s=function(t,e){return t&&t.onStateChanged?t.onStateChanged.call(e,e):this.onStateChanged&&this.onStateChanged.call(e,e),!0},l=function(e,i){var a={modalId:e,theme:i.theme,header:i.header,fullScreen:i.fullScreen?"fullscreen":"",styles:"",iframe:i.iframe,iframeLoadingMsg:i.iframeLoadingMsg};return i.zIndex&&(a.styles+="z-index:"+i.zIndex+";"),i.absolute&&(a.styles+="position:absolute;"),a.iframe&&"string"==typeof a.iframe.param&&(a.iframe.param=ax5.util.param(a.iframe.param)),t.tmpl.get.call(this,"content",a,{})},r=function(t,e){var r;jQuery(document.body).append(l.call(this,t.id,t)),this.activeModal=jQuery("#"+t.id),this.$={root:this.activeModal.find('[data-modal-els="root"]'),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.align(),r={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(){r.state="load",t.iframeLoadingMsg&&this.$["iframe-loading"].hide(),s.call(this,t,r)}.bind(this)),t.iframeLoadingMsg||this.$.iframe.show(),this.$["iframe-form"].submit()),e&&e.call(r),s.call(this,t,r),t.closeToEsc&&jQuery(window).bind("keydown.ax-modal",function(t){m.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.find("[data-modal-header-btn]").on(a.clickEventName,function(e){h.call(this,e||window.event,t)}.bind(this)),this.$.header.bind(n.mousedown,function(e){if(t.isFullScreen)return!1;var a=i.findParentNode(e.target,function(t){if(t.getAttribute("data-modal-header-btn"))return!0});a||(o.mousePosition=d(e),f.on.call(o))}).bind("dragstart",function(t){return i.stopEvent(t),!1})},h=function(t,e,a,o,n){var d;t.srcElement&&(t.target=t.srcElement),o=i.findParentNode(t.target,function(t){if(t.getAttribute("data-modal-header-btn"))return!0}),o&&(n=o.getAttribute("data-modal-header-btn"),d={self:this,key:n,value:e.header.btns[n],dialogId:e.id,btnTarget:o},e.header.btns[n].onClick&&e.header.btns[n].onClick.call(d,n)),d=null,e=null,a=null,o=null,n=null},m=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"})}},f={on:function(){var t=this.activeModal.css("z-index"),e=this.activeModal.position(),i={width:this.activeModal.outerWidth(),height:this.activeModal.outerHeight()},d={width:jQuery(window).width(),height:jQuery(window).height()},s=function(t){o.__dx=t.clientX-o.mousePosition.clientX,o.__dy=t.clientY-o.mousePosition.clientY;var a=0,n=d.width-i.width,s=0,l=d.height-i.height;return a>e.left+o.__dx?o.__dx=-e.left:ne.top+o.__dy?o.__dy=-e.top:l'),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")),o.resizer.css(s(a))}).bind(n.mouseup+".ax5layout-"+this.instanceId,function(t){f.off.call(o)}).bind("mouseleave.ax5layout-"+this.instanceId,function(t){f.off.call(o)}),jQuery(document.body).attr("unselectable","on").css("user-select","none").on("selectstart",!1)},off:function(){var t=function(){var t=this.activeModal.offset();t.left+=this.__dx-$(document).scrollLeft(),t.top+=this.__dy-$(document).scrollTop(),this.activeModal.css(t)};this.resizer&&(this.activeModal.removeClass("draged"),this.resizer.remove(),this.resizer=null,this.resizerBg.remove(),this.resizerBg=null,t.call(this)),jQuery(document.body).unbind(n.mousemove+".ax5modal-"+a.id).unbind(n.mouseup+".ax5modal-"+a.id).unbind("mouseleave.ax5modal-"+a.id),jQuery(document.body).removeAttr("unselectable").css("user-select","auto").off("selectstart")}};this.init=function(){this.onStateChanged=a.onStateChanged},this.open=function(t,e){return this.activeModal||(t=o.modalConfig=jQuery.extend(!0,{},a,t),r.call(this,t,e)),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),a=i.contentDocument?i.contentDocument:i.contentWindow.document;try{$(a.body).children().each(function(){$(this).remove()})}catch(o){}a.innerHTML="",e.attr("src","about:blank").remove(),window.CollectGarbage&&window.CollectGarbage()}}this.activeModal.remove(),this.activeModal=null}s.call(this,t,{self:this,state:"close"})}.bind(this),a.animateTime)),this.minimized=!1,this},this.minimize=function(){return function(t){if(this.minimized!==!0){var e=o.modalConfig;"undefined"==typeof t&&(t=a.minimizePosition),this.minimized=!0,this.$.body.hide(),o.modalConfig.originalHeight=e.height,o.modalConfig.height=0,c[t].call(this),s.call(this,e,{self:this,state:"minimize"})}return this}}(),this.maximize=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"}),s.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 a=o.modalConfig,n={width:a.width,height:a.height},d=a.isFullScreen=function(t){return"undefined"!=typeof t&&(i.isFunction(t)?t():void 0)}(a.fullScreen);return d?(a.header&&this.$.header.show(),n.width=jQuery(window).width(),n.height=a.height,n.left=0,n.top=0):(a.header&&this.$.header.show(),t&&jQuery.extend(!0,a.position,t),a.header?(a.headerHeight=this.$.header.outerHeight(),n.height+=a.headerHeight):a.headerHeight=0,"left"==a.position.left?n.left=a.position.margin||0:"right"==a.position.left?n.left=jQuery(window).width()-n.width-(a.position.margin||0):"center"==a.position.left?n.left=jQuery(window).width()/2-n.width/2:n.left=a.position.left||0,"top"==a.position.top?n.top=a.position.margin||0:"bottom"==a.position.top?n.top=jQuery(window).height()-n.height-(a.position.margin||0):"middle"==a.position.top?n.top=jQuery(window).height()/2-n.height/2:n.top=a.position.top||0,n.left<0&&(n.left=0),n.top<0&&(n.top=0)),this.activeModal.css(n),a.iframe&&(this.$["iframe-wrap"].css({height:n.height-a.headerHeight}),this.$.iframe.css({height:n.height-a.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 a}()),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
\n
{{{iframeLoadingMsg}}}
\n \n
\n
\n \n {{#param}}\n {{#@each}}\n \n {{/@each}}\n {{/param}}\n
\n {{/iframe}}\n
\n
\n
\n '};t.tmpl={content:e,get:function(e,i,a){return ax5.mustache.render(t.tmpl[e].call(this,a),i)}}}(); \ No newline at end of file +"use strict";!function(){var t,e=ax5.ui,i=ax5.util;e.addClass({className:"modal",version:"1.3.45"},function(){var a=function(){var a,o=this,n={mousedown:ax5.info.supportTouch?"touchstart":"mousedown",mousemove:ax5.info.supportTouch?"touchmove":"mousemove",mouseup:ax5.info.supportTouch?"touchend":"mouseup"},d=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,animateTime:250},this.activeModal=null,this.$={},a=this.config;var s=function(t,e){return t&&t.onStateChanged?t.onStateChanged.call(e,e):this.onStateChanged&&this.onStateChanged.call(e,e),!0},l=function(e,i){var a={modalId:e,theme:i.theme,header:i.header,fullScreen:i.fullScreen?"fullscreen":"",styles:"",iframe:i.iframe,iframeLoadingMsg:i.iframeLoadingMsg};return i.zIndex&&(a.styles+="z-index:"+i.zIndex+";"),i.absolute&&(a.styles+="position:absolute;"),a.iframe&&"string"==typeof a.iframe.param&&(a.iframe.param=ax5.util.param(a.iframe.param)),t.tmpl.get.call(this,"content",a,{})},r=function(t,e){var r;jQuery(document.body).append(l.call(this,t.id,t)),this.activeModal=jQuery("#"+t.id),this.$={root:this.activeModal.find('[data-modal-els="root"]'),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.align(),r={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(){r.state="load",t.iframeLoadingMsg&&this.$["iframe-loading"].hide(),s.call(this,t,r)}.bind(this)),t.iframeLoadingMsg||this.$.iframe.show(),this.$["iframe-form"].submit()),e&&e.call(r),s.call(this,t,r),t.closeToEsc&&jQuery(window).bind("keydown.ax-modal",function(t){m.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.find("[data-modal-header-btn]").on(a.clickEventName,function(e){h.call(this,e||window.event,t)}.bind(this)),this.$.header.bind(n.mousedown,function(e){if(t.isFullScreen)return!1;var a=i.findParentNode(e.target,function(t){if(t.getAttribute("data-modal-header-btn"))return!0});a||(o.mousePosition=d(e),f.on.call(o))}).bind("dragstart",function(t){return i.stopEvent(t),!1})},h=function(t,e,a,o,n){var d;t.srcElement&&(t.target=t.srcElement),o=i.findParentNode(t.target,function(t){if(t.getAttribute("data-modal-header-btn"))return!0}),o&&(n=o.getAttribute("data-modal-header-btn"),d={self:this,key:n,value:e.header.btns[n],dialogId:e.id,btnTarget:o},e.header.btns[n].onClick&&e.header.btns[n].onClick.call(d,n)),d=null,e=null,a=null,o=null,n=null},m=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"})}},f={on:function(){var t=this.activeModal.css("z-index"),e=this.activeModal.position(),i={width:this.activeModal.outerWidth(),height:this.activeModal.outerHeight()},d={width:jQuery(window).width(),height:jQuery(window).height()},s=function(t){o.__dx=t.clientX-o.mousePosition.clientX,o.__dy=t.clientY-o.mousePosition.clientY;var a=0,n=d.width-i.width,s=0,l=d.height-i.height;return a>e.left+o.__dx?o.__dx=-e.left:ne.top+o.__dy?o.__dy=-e.top:l'),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")),o.resizer.css(s(a))}).bind(n.mouseup+".ax5layout-"+this.instanceId,function(t){f.off.call(o)}).bind("mouseleave.ax5layout-"+this.instanceId,function(t){f.off.call(o)}),jQuery(document.body).attr("unselectable","on").css("user-select","none").on("selectstart",!1)},off:function(){var t=function(){var t=this.activeModal.offset();t.left+=this.__dx-$(document).scrollLeft(),t.top+=this.__dy-$(document).scrollTop(),this.activeModal.css(t)};this.resizer&&(this.activeModal.removeClass("draged"),this.resizer.remove(),this.resizer=null,this.resizerBg.remove(),this.resizerBg=null,t.call(this)),jQuery(document.body).unbind(n.mousemove+".ax5modal-"+a.id).unbind(n.mouseup+".ax5modal-"+a.id).unbind("mouseleave.ax5modal-"+a.id),jQuery(document.body).removeAttr("unselectable").css("user-select","auto").off("selectstart")}};this.init=function(){this.onStateChanged=a.onStateChanged},this.open=function(t,e){return this.activeModal||(t=o.modalConfig=jQuery.extend(!0,{},a,t),r.call(this,t,e)),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),a=i.contentDocument?i.contentDocument:i.contentWindow.document;try{$(a.body).children().each(function(){$(this).remove()})}catch(o){}a.innerHTML="",e.attr("src","about:blank").remove(),window.CollectGarbage&&window.CollectGarbage()}}this.activeModal.remove(),this.activeModal=null}s.call(this,t,{self:this,state:"close"})}.bind(this),a.animateTime)),this.minimized=!1,this},this.minimize=function(){return function(t){if(this.minimized!==!0){var e=o.modalConfig;"undefined"==typeof t&&(t=a.minimizePosition),this.minimized=!0,this.$.body.hide(),o.modalConfig.originalHeight=e.height,o.modalConfig.height=0,c[t].call(this),s.call(this,e,{self:this,state:"minimize"})}return this}}(),this.maximize=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"}),s.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 a=o.modalConfig,n={width:a.width,height:a.height},d=a.isFullScreen=function(t){return"undefined"!=typeof t&&(i.isFunction(t)?t():void 0)}(a.fullScreen);return d?(a.header&&this.$.header.show(),n.width=jQuery(window).width(),n.height=a.height,n.left=0,n.top=0):(a.header&&this.$.header.show(),t&&jQuery.extend(!0,a.position,t),a.header?(a.headerHeight=this.$.header.outerHeight(),n.height+=a.headerHeight):a.headerHeight=0,"left"==a.position.left?n.left=a.position.margin||0:"right"==a.position.left?n.left=jQuery(window).width()-n.width-(a.position.margin||0):"center"==a.position.left?n.left=jQuery(window).width()/2-n.width/2:n.left=a.position.left||0,"top"==a.position.top?n.top=a.position.margin||0:"bottom"==a.position.top?n.top=jQuery(window).height()-n.height-(a.position.margin||0):"middle"==a.position.top?n.top=jQuery(window).height()/2-n.height/2:n.top=a.position.top||0,n.left<0&&(n.left=0),n.top<0&&(n.top=0)),this.activeModal.css(n),a.iframe&&(this.$["iframe-wrap"].css({height:n.height-a.headerHeight}),this.$.iframe.css({height:n.height-a.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 a}()),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
\n
{{{iframeLoadingMsg}}}
\n \n
\n
\n \n {{#param}}\n {{#@each}}\n \n {{/@each}}\n {{/param}}\n
\n {{/iframe}}\n
\n
\n
\n '};t.tmpl={content:e,get:function(e,i,a){return ax5.mustache.render(t.tmpl[e].call(this,a),i)}}}(); \ No newline at end of file diff --git a/package.json b/package.json index 54f3bba..a672820 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ax5ui-modal", - "version": "1.3.44", + "version": "1.3.45", "description": "A modal plugin that works with Bootstrap & jQuery", "license": "MIT", "repository": {