info@54: /* ======================================================================== info@54: * Bootstrap: alert.js v3.0.3 info@54: * http://getbootstrap.com/javascript/#alerts info@54: * ======================================================================== info@54: * Copyright 2013 Twitter, Inc. info@54: * info@54: * Licensed under the Apache License, Version 2.0 (the "License"); info@54: * you may not use this file except in compliance with the License. info@54: * You may obtain a copy of the License at info@54: * info@54: * http://www.apache.org/licenses/LICENSE-2.0 info@54: * info@54: * Unless required by applicable law or agreed to in writing, software info@54: * distributed under the License is distributed on an "AS IS" BASIS, info@54: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. info@54: * See the License for the specific language governing permissions and info@54: * limitations under the License. info@54: * ======================================================================== */ info@54: info@54: info@54: +function ($) { "use strict"; info@54: info@54: // ALERT CLASS DEFINITION info@54: // ====================== info@54: info@54: var dismiss = '[data-dismiss="alert"]' info@54: var Alert = function (el) { info@54: $(el).on('click', dismiss, this.close) info@54: } info@54: info@54: Alert.prototype.close = function (e) { info@54: var $this = $(this) info@54: var selector = $this.attr('data-target') info@54: info@54: if (!selector) { info@54: selector = $this.attr('href') info@54: selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 info@54: } info@54: info@54: var $parent = $(selector) info@54: info@54: if (e) e.preventDefault() info@54: info@54: if (!$parent.length) { info@54: $parent = $this.hasClass('alert') ? $this : $this.parent() info@54: } info@54: info@54: $parent.trigger(e = $.Event('close.bs.alert')) info@54: info@54: if (e.isDefaultPrevented()) return info@54: info@54: $parent.removeClass('in') info@54: info@54: function removeElement() { info@54: $parent.trigger('closed.bs.alert').remove() info@54: } info@54: info@54: $.support.transition && $parent.hasClass('fade') ? info@54: $parent info@54: .one($.support.transition.end, removeElement) info@54: .emulateTransitionEnd(150) : info@54: removeElement() info@54: } info@54: info@54: info@54: // ALERT PLUGIN DEFINITION info@54: // ======================= info@54: info@54: var old = $.fn.alert info@54: info@54: $.fn.alert = function (option) { info@54: return this.each(function () { info@54: var $this = $(this) info@54: var data = $this.data('bs.alert') info@54: info@54: if (!data) $this.data('bs.alert', (data = new Alert(this))) info@54: if (typeof option == 'string') data[option].call($this) info@54: }) info@54: } info@54: info@54: $.fn.alert.Constructor = Alert info@54: info@54: info@54: // ALERT NO CONFLICT info@54: // ================= info@54: info@54: $.fn.alert.noConflict = function () { info@54: $.fn.alert = old info@54: return this info@54: } info@54: info@54: info@54: // ALERT DATA-API info@54: // ============== info@54: info@54: $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) info@54: info@54: }(jQuery);