mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-12-29 11:01:34 +08:00
6 lines
6 KiB
JavaScript
6 lines
6 KiB
JavaScript
/*!
|
|
* Bootstrap.js by @fat & @mdo
|
|
* Copyright 2013 Twitter, Inc.
|
|
* http://www.apache.org/licenses/LICENSE-2.0.txt
|
|
*/
|
|
!function(t){"use strict";var e="[data-toggle=dropdown]",o=function(e){var o=t(e).on("click.dropdown.data-api",this.toggle);t("html").on("click.dropdown.data-api",function(){o.parent().removeClass("open")})};function n(){t(".dropdown-backdrop").remove(),t(e).each(function(){i(t(this)).removeClass("open")})}function i(e){var o,n=e.attr("data-target");return n||(n=(n=e.attr("href"))&&/#/.test(n)&&n.replace(/.*(?=#[^\s]*$)/,"")),(o=n&&1<n.length&&t(n))&&o.length||(o=e.parent()),o}o.prototype={constructor:o,toggle:function(e){var o,a,s=t(this);if(!s.is(".disabled, :disabled"))return a=(o=i(s)).hasClass("open"),n(),a||("ontouchstart"in document.documentElement&&t('<div class="dropdown-backdrop"/>').insertBefore(t(this)).on("click",n),o.toggleClass("open")),s.focus(),!1},keydown:function(o){var n,a,s,d,r;if(/(38|40|27)/.test(o.keyCode)&&(n=t(this),o.preventDefault(),o.stopPropagation(),!n.is(".disabled, :disabled"))){if(!(d=(s=i(n)).hasClass("open"))||d&&27==o.keyCode)return 27==o.which&&s.find(e).focus(),n.click();(a=t("[role=menu] li:not(.divider):visible a",s)).length&&(r=a.index(a.filter(":focus")),38==o.keyCode&&r>0&&r--,40==o.keyCode&&r<a.length-1&&r++,~r||(r=0),a.eq(r).focus())}}};t.fn.dropdown;t.fn.dropdown=function(e){return this.each(function(){var n=t(this),i=n.data("dropdown");i||n.data("dropdown",i=new o(this)),"string"==typeof e&&i[e].call(n)})},t.fn.dropdown.Constructor=o,t(document).on("click.dropdown.data-api",n).on("click.dropdown.data-api",".dropdown form",function(t){t.stopPropagation()}).on("click.dropdown.data-api",e,o.prototype.toggle).on("keydown.dropdown.data-api",e+", [role=menu]",o.prototype.keydown)}(window.jQuery),function(t){"use strict";var e=function(e,o){this.options=o,this.$element=t(e).on("click.dismiss.modal",'[data-dismiss="modal"]',this.hide.bind(this)),this.options.remote&&this.$element.find(".modal-body").on("load",this.options.remote)};e.prototype={constructor:e,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var e=this,o=t.Event("show");this.$element.trigger(o),this.isShown||o.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.backdrop(function(){var t=e.$element.hasClass("fade");e.$element.parent().length||e.$element.appendTo(document.body),e.$element.show(),t&&e.$element[0].offsetWidth,e.$element.addClass("in").attr("aria-hidden",!1),e.enforceFocus(),t?e.$element.one("transitionend",function(){e.$element.focus().trigger("shown")}):e.$element.focus().trigger("shown")}))},hide:function(e){e&&e.preventDefault();e=t.Event("hide"),this.$element.trigger(e),this.isShown&&!e.isDefaultPrevented()&&(this.isShown=!1,this.escape(),t(document).off("focusin.modal"),this.$element.removeClass("in").attr("aria-hidden",!0),this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal())},enforceFocus:function(){var e=this;t(document).on("focusin.modal",function(t){e.$element[0]===t.target||e.$element.has(t.target).length||e.$element.focus()})},escape:function(){var t=this;this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.modal",function(e){27==e.which&&t.hide()}):this.isShown||this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var t=this,e=setTimeout(function(){t.$element.off("transitionend"),t.hideModal()},500);this.$element.one("transitionend",function(){clearTimeout(e),t.hideModal()})},hideModal:function(){var t=this;this.$element.hide(),this.backdrop(function(){t.removeBackdrop(),t.$element.trigger("hidden")})},removeBackdrop:function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},backdrop:function(e){var o=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var n=o;if(this.$backdrop=t('<div class="modal-backdrop '+o+'" />').appendTo(document.body),this.$backdrop.click("static"==this.options.backdrop?this.$element[0].focus.bind(this.$element[0]):this.hide.bind(this)),n&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!e)return;n?this.$backdrop.one("transitionend",e):e()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),this.$element.hasClass("fade")?this.$backdrop.one("transitionend",e):e()):e&&e()}};t.fn.modal;t.fn.modal=function(o){return this.each(function(){var n=t(this),i=n.data("modal"),a=t.extend({},t.fn.modal.defaults,n.data(),"object"==typeof o&&o);i||n.data("modal",i=new e(this,a)),"string"==typeof o?i[o]():a.show&&i.show()})},t.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},t.fn.modal.Constructor=e,t(document).on("click.modal.data-api",'[data-toggle="modal"]',function(e){var o=t(this),n=o.attr("href"),i=t(o.attr("data-target")||n&&n.replace(/.*(?=#[^\s]+$)/,"")),a=i.data("modal")?"toggle":t.extend({remote:!/#/.test(n)&&n},i.data(),o.data());e.preventDefault(),i.modal(a).one("hide",function(){o.focus()})})}(window.jQuery),function(t){"use strict";var e=function(e){this.element=t(e)};e.prototype={constructor:e,show:function(){var e,o,n,i=this.element,a=i.closest("ul:not(.dropdown-menu)"),s=i.attr("data-target");s||(s=(s=i.attr("href"))&&s.replace(/.*(?=#[^\s]*$)/,"")),i.parent("li").hasClass("active")||(e=a.find(".active:last a")[0],n=t.Event("show",{relatedTarget:e}),i.trigger(n),n.isDefaultPrevented()||(o=t(s),this.activate(i.parent("li"),a),this.activate(o,o.parent(),function(){i.trigger({type:"shown",relatedTarget:e})})))},activate:function(t,e,o){var n=e.find("> .active"),i=o&&n.hasClass("fade");function a(){n.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),t.addClass("active"),i?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu")&&t.closest("li.dropdown").addClass("active"),o&&o()}i?n.one("transitionend",a):a(),n.removeClass("in")}};t.fn.tab;t.fn.tab=function(o){return this.each(function(){var n=t(this),i=n.data("tab");i||n.data("tab",i=new e(this)),"string"==typeof o&&i[o]()})},t.fn.tab.Constructor=e,t(document).on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(e){e.preventDefault(),t(this).tab("show")})}(window.jQuery);
|