src/ztfy/myams/resources/js/ext/bootstrap-modal.min.js
changeset 206 02a40997d8cb
parent 174 8d81f90f1d08
equal deleted inserted replaced
205:27ed26ca8623 206:02a40997d8cb
     1 !function(b){var a=function(d,c){this.init(d,c)};a.prototype={constructor:a,init:function(e,c){var f=this;this.options=c;this.$element=b(e).delegate('[data-dismiss="modal"]',"click.dismiss.modal",b.proxy(this.hide,this));this.options.remote&&this.$element.find(".modal-body").load(this.options.remote,function(){var g=b.Event("loaded");f.$element.trigger(g)});var d=typeof this.options.manager==="function"?this.options.manager.call(this):this.options.manager;d=d.appendModal?d:b(d).modalmanager().data("modalmanager");d.appendModal(this)},toggle:function(){return this[!this.isShown?"show":"hide"]()},show:function(){var c=b.Event("show");if(this.isShown){return}this.$element.trigger(c);if(c.isDefaultPrevented()){return}this.escape();this.tab();this.options.loading&&this.loading()},hide:function(c){c&&c.preventDefault();c=b.Event("hide");this.$element.trigger(c);if(!this.isShown||c.isDefaultPrevented()){return(this.isShown=false)}this.isShown=false;this.escape();this.tab();this.isLoading&&this.loading();b(document).off("focusin.modal");this.$element.removeClass("in").removeClass("animated").removeClass(this.options.attentionAnimation).removeClass("modal-overflow").attr("aria-hidden",true);b.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal()},layout:function(){var g=this.options.height?"height":"max-height",e=this.options.height||this.options.maxHeight;if(this.options.width){this.$element.css("width",this.options.width);var d=this;this.$element.css("margin-left",function(){if(/%/ig.test(d.options.width)){return -(parseInt(d.options.width)/2)+"%"}else{return -(b(this).width()/2)+"px"}})}else{this.$element.css("width","");this.$element.css("margin-left","")}this.$element.find(this.options.overflow).css("overflow","").css(g,"");if(e){var c=this.$element.find(this.options.overflow);if(c.css("overflow")===undefined){c.style("overflow","auto","important")}c.style(g,(typeof(e)=="function"?e():e)+"px","important")}var f=b(window).height()-10<this.$element.height();this.$element.css("margin-top",0).addClass("modal-overflow")},tab:function(){var c=this;if(this.isShown&&this.options.consumeTab){this.$element.on("keydown.tabindex.modal","[data-tabindex]",function(h){if(h.keyCode&&h.keyCode==9){var g=[],f=Number(b(this).data("tabindex"));c.$element.find("[data-tabindex]:enabled:visible:not([readonly])").each(function(e){g.push(Number(b(this).data("tabindex")))});g.sort(function(i,e){return i-e});var d=b.inArray(f,g);if(!h.shiftKey){d<g.length-1?c.$element.find("[data-tabindex="+g[d+1]+"]").focus():c.$element.find("[data-tabindex="+g[0]+"]").focus()}else{d==0?c.$element.find("[data-tabindex="+g[g.length-1]+"]").focus():c.$element.find("[data-tabindex="+g[d-1]+"]").focus()}h.preventDefault()}})}else{if(!this.isShown){this.$element.off("keydown.tabindex.modal")}}},escape:function(){var c=this;if(this.isShown&&this.options.keyboard){if(!this.$element.attr("tabindex")){this.$element.attr("tabindex",-1)}this.$element.on("keyup.dismiss.modal",function(d){d.which==27&&c.hide()})}else{if(!this.isShown){this.$element.off("keyup.dismiss.modal")}}},hideWithTransition:function(){var c=this,d=setTimeout(function(){c.$element.off(b.support.transition.end);c.hideModal()},500);this.$element.one(b.support.transition.end,function(){clearTimeout(d);c.hideModal()})},hideModal:function(){var d=this.options.height?"height":"max-height";var c=this.options.height||this.options.maxHeight;if(c){this.$element.find(this.options.overflow).css("overflow","").css(d,"")}this.$element.hide().trigger("hidden")},removeLoading:function(){this.$loading.remove();this.$loading=null;this.isLoading=false},loading:function(f){f=f||function(){};var d=this.$element.hasClass("fade")?"fade":"";if(!this.isLoading){var c=b.support.transition&&d;this.$loading=b('<div class="loading-mask '+d+'">').append(this.options.spinner).appendTo(this.$element);if(c){this.$loading[0].offsetWidth}this.$loading.addClass("in");this.isLoading=true;c?this.$loading.one(b.support.transition.end,f):f()}else{if(this.isLoading&&this.$loading){this.$loading.removeClass("in");var e=this;b.support.transition&&this.$element.hasClass("fade")?this.$loading.one(b.support.transition.end,function(){e.removeLoading()}):e.removeLoading()}else{if(f){f(this.isLoading)}}}},focus:function(){var c=this.$element.find(this.options.focusOn);c=c.length?c:this.$element;c.focus()},attention:function(){if(this.options.attentionAnimation){this.$element.removeClass("animated").removeClass(this.options.attentionAnimation);var c=this;setTimeout(function(){c.$element.addClass("animated").addClass(c.options.attentionAnimation)},0)}this.focus()},destroy:function(){var c=b.Event("destroy");this.$element.trigger(c);if(c.isDefaultPrevented()){return}this.$element.off(".modal").removeData("modal").removeClass("in").attr("aria-hidden",true);if(this.$parent!==this.$element.parent()){this.$element.appendTo(this.$parent)}else{if(!this.$parent.length){this.$element.remove();this.$element=null}}this.$element.trigger("destroyed")}};b.fn.modal=function(d,c){return this.each(function(){var g=b(this),f=g.data("modal"),e=b.extend({},b.fn.modal.defaults,g.data(),typeof d=="object"&&d);if(!f){g.data("modal",(f=new a(this,e)))}if(typeof d=="string"){f[d].apply(f,[].concat(c))}else{if(e.show){f.show()}}})};b.fn.modal.defaults={keyboard:true,backdrop:true,loading:false,show:true,width:null,height:null,maxHeight:null,modalOverflow:false,consumeTab:true,focusOn:null,replace:false,resize:false,overflow:".modal-body",attentionAnimation:"shake",manager:"body",spinner:'<div class="loading-spinner" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="bar" style="width: 100%;"></div></div></div>',backdropTemplate:'<div class="modal-backdrop" />'};b.fn.modal.Constructor=a;b(function(){b(document).off("click.modal").on("click.modal.data-api",'[data-toggle="modal"]',function(h){var g=b(this),d=g.attr("href"),c=b(g.attr("data-target")||(d&&d.replace(/.*(?=#[^\s]+$)/,""))),f=c.data("modal")?"toggle":b.extend({remote:!/#/.test(d)&&d},c.data(),g.data());h.preventDefault();c.modal(f).one("hide",function(){g.focus()})})})}(window.jQuery);
     1 !function(t){"use strict";var i=function(t,i){this.init(t,i)};i.prototype={constructor:i,init:function(i,e){var n=this;this.options=e,this.$element=t(i).delegate('[data-dismiss="modal"]',"click.dismiss.modal",t.proxy(this.hide,this)),this.options.remote&&this.$element.find(".modal-body").load(this.options.remote,function(){var i=t.Event("loaded");n.$element.trigger(i)});var s="function"==typeof this.options.manager?this.options.manager.call(this):this.options.manager;(s=s.appendModal?s:t(s).modalmanager().data("modalmanager")).appendModal(this)},toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var i=t.Event("show");this.isShown||(this.$element.trigger(i),i.isDefaultPrevented()||(this.escape(),this.tab(),this.options.loading&&this.loading()))},hide:function(i){if(i&&i.preventDefault(),i=t.Event("hide"),this.$element.trigger(i),!this.isShown||i.isDefaultPrevented())return this.isShown=!1;this.isShown=!1,this.escape(),this.tab(),this.isLoading&&this.loading(),t(document).off("focusin.modal"),this.$element.removeClass("in").removeClass("animated").removeClass(this.options.attentionAnimation).removeClass("modal-overflow").attr("aria-hidden",!0),t.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal()},layout:function(){var i=this.options.height?"height":"max-height",e=this.options.height||this.options.maxHeight;if(this.options.width){this.$element.css("width",this.options.width);var n=this;this.$element.css("margin-left",function(){return/%/gi.test(n.options.width)?-parseInt(n.options.width)/2+"%":-t(this).width()/2+"px"})}else this.$element.css("width",""),this.$element.css("margin-left","");if(this.$element.find(this.options.overflow).css("overflow","").css(i,""),e){var s=this.$element.find(this.options.overflow);void 0===s.css("overflow")&&s.style("overflow","auto","important"),s.style(i,("function"==typeof e?e():e)+"px","important")}t(window).height(),this.$element.height();this.$element.css("margin-top",0).addClass("modal-overflow")},tab:function(){var i=this;this.isShown&&this.options.consumeTab?this.$element.on("keydown.tabindex.modal","[data-tabindex]",function(e){if(e.keyCode&&9==e.keyCode){var n=[],s=Number(t(this).data("tabindex"));i.$element.find("[data-tabindex]:enabled:visible:not([readonly])").each(function(i){n.push(Number(t(this).data("tabindex")))}),n.sort(function(t,i){return t-i});var o=t.inArray(s,n);e.shiftKey?0==o?i.$element.find("[data-tabindex="+n[n.length-1]+"]").focus():i.$element.find("[data-tabindex="+n[o-1]+"]").focus():o<n.length-1?i.$element.find("[data-tabindex="+n[o+1]+"]").focus():i.$element.find("[data-tabindex="+n[0]+"]").focus(),e.preventDefault()}}):this.isShown||this.$element.off("keydown.tabindex.modal")},escape:function(){var t=this;this.isShown&&this.options.keyboard?(this.$element.attr("tabindex")||this.$element.attr("tabindex",-1),this.$element.on("keyup.dismiss.modal",function(i){27==i.which&&t.hide()})):this.isShown||this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var i=this,e=setTimeout(function(){i.$element.off(t.support.transition.end),i.hideModal()},500);this.$element.one(t.support.transition.end,function(){clearTimeout(e),i.hideModal()})},hideModal:function(){var t=this.options.height?"height":"max-height";(this.options.height||this.options.maxHeight)&&this.$element.find(this.options.overflow).css("overflow","").css(t,""),this.$element.hide().trigger("hidden")},removeLoading:function(){this.$loading.remove(),this.$loading=null,this.isLoading=!1},loading:function(i){i=i||function(){};var e=this.$element.hasClass("fade")?"fade":"";if(this.isLoading)if(this.isLoading&&this.$loading){this.$loading.removeClass("in");var n=this;t.support.transition&&this.$element.hasClass("fade")?this.$loading.one(t.support.transition.end,function(){n.removeLoading()}):n.removeLoading()}else i&&i(this.isLoading);else{var s=t.support.transition&&e;this.$loading=t('<div class="loading-mask '+e+'">').append(this.options.spinner).appendTo(this.$element),s&&this.$loading[0].offsetWidth,this.$loading.addClass("in"),this.isLoading=!0,s?this.$loading.one(t.support.transition.end,i):i()}},focus:function(){var t=this.$element.find(this.options.focusOn);(t=t.length?t:this.$element).focus()},attention:function(){if(this.options.attentionAnimation){this.$element.removeClass("animated").removeClass(this.options.attentionAnimation);var t=this;setTimeout(function(){t.$element.addClass("animated").addClass(t.options.attentionAnimation)},0)}this.focus()},destroy:function(){var i=t.Event("destroy");this.$element.trigger(i),i.isDefaultPrevented()||(this.$element.off(".modal").removeData("modal").removeClass("in").attr("aria-hidden",!0),this.$parent!==this.$element.parent()?this.$element.appendTo(this.$parent):this.$parent.length||(this.$element.remove(),this.$element=null),this.$element.trigger("destroyed"))}},t.fn.modal=function(e,n){return this.each(function(){var s=t(this),o=s.data("modal"),a=t.extend({},t.fn.modal.defaults,s.data(),"object"==typeof e&&e);o||s.data("modal",o=new i(this,a)),"string"==typeof e?o[e].apply(o,[].concat(n)):a.show&&o.show()})},t.fn.modal.defaults={keyboard:!0,backdrop:!0,loading:!1,show:!0,width:null,height:null,maxHeight:null,modalOverflow:!1,consumeTab:!0,focusOn:null,replace:!1,resize:!1,overflow:".modal-body",attentionAnimation:"shake",manager:"body",spinner:'<div class="loading-spinner" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="bar" style="width: 100%;"></div></div></div>',backdropTemplate:'<div class="modal-backdrop" />'},t.fn.modal.Constructor=i,t(function(){t(document).off("click.modal").on("click.modal.data-api",'[data-toggle="modal"]',function(i){var e=t(this),n=e.attr("href"),s=t(e.attr("data-target")||n&&n.replace(/.*(?=#[^\s]+$)/,"")),o=s.data("modal")?"toggle":t.extend({remote:!/#/.test(n)&&n},s.data(),e.data());i.preventDefault(),s.modal(o).one("hide",function(){e.focus()})})})}(window.jQuery);