1 /* ========================================================================
 
     2  * Bootstrap: alert.js v3.0.3
 
     3  * http://getbootstrap.com/javascript/#alerts
 
     4  * ========================================================================
 
     5  * Copyright 2013 Twitter, Inc.
 
     7  * Licensed under the Apache License, Version 2.0 (the "License");
 
     8  * you may not use this file except in compliance with the License.
 
     9  * You may obtain a copy of the License at
 
    11  * http://www.apache.org/licenses/LICENSE-2.0
 
    13  * Unless required by applicable law or agreed to in writing, software
 
    14  * distributed under the License is distributed on an "AS IS" BASIS,
 
    15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
    16  * See the License for the specific language governing permissions and
 
    17  * limitations under the License.
 
    18  * ======================================================================== */
 
    21 +function ($) { "use strict";
 
    23   // ALERT CLASS DEFINITION
 
    24   // ======================
 
    26   var dismiss = '[data-dismiss="alert"]'
 
    27   var Alert   = function (el) {
 
    28     $(el).on('click', dismiss, this.close)
 
    31   Alert.prototype.close = function (e) {
 
    33     var selector = $this.attr('data-target')
 
    36       selector = $this.attr('href')
 
    37       selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
 
    40     var $parent = $(selector)
 
    42     if (e) e.preventDefault()
 
    44     if (!$parent.length) {
 
    45       $parent = $this.hasClass('alert') ? $this : $this.parent()
 
    48     $parent.trigger(e = $.Event('close.bs.alert'))
 
    50     if (e.isDefaultPrevented()) return
 
    52     $parent.removeClass('in')
 
    54     function removeElement() {
 
    55       $parent.trigger('closed.bs.alert').remove()
 
    58     $.support.transition && $parent.hasClass('fade') ?
 
    60         .one($.support.transition.end, removeElement)
 
    61         .emulateTransitionEnd(150) :
 
    66   // ALERT PLUGIN DEFINITION
 
    67   // =======================
 
    71   $.fn.alert = function (option) {
 
    72     return this.each(function () {
 
    74       var data  = $this.data('bs.alert')
 
    76       if (!data) $this.data('bs.alert', (data = new Alert(this)))
 
    77       if (typeof option == 'string') data[option].call($this)
 
    81   $.fn.alert.Constructor = Alert
 
    87   $.fn.alert.noConflict = function () {
 
    96   $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)