Sha256: 0a8fe029dcbd9b252df33f2ca1ef88af4affe72399c3b9968fe3da5c388a71d1

Contents?: true

Size: 1.79 KB

Versions: 113

Compression:

Stored size: 1.79 KB

Contents

+function ($) {
  'use strict';

  // ALERT CLASS DEFINITION
  // ======================

  var dismiss = '[data-dismiss="alert"]'
  var Alert   = function (el) {
    $(el).on('click', dismiss, this.close)
  }

  Alert.VERSION = '3.3.2'

  Alert.TRANSITION_DURATION = 150

  Alert.prototype.close = function (e) {
    var $this    = $(this)
    var selector = $this.attr('data-target')

    if (!selector) {
      selector = $this.attr('href')
      selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
    }

    var $parent = $(selector)

    if (e) e.preventDefault()

    if (!$parent.length) {
      $parent = $this.closest('.alert')
    }

    $parent.trigger(e = $.Event('close.bs.alert'))

    if (e.isDefaultPrevented()) return

    $parent.removeClass('in')

    function removeElement() {
      // detach from parent, fire event then clean up data
      $parent.detach().trigger('closed.bs.alert').remove()
    }

    $.support.transition && $parent.hasClass('fade') ?
      $parent
        .one('bsTransitionEnd', removeElement)
        .emulateTransitionEnd(Alert.TRANSITION_DURATION) :
      removeElement()
  }


  // ALERT PLUGIN DEFINITION
  // =======================

  function Plugin(option) {
    return this.each(function () {
      var $this = $(this)
      var data  = $this.data('bs.alert')

      if (!data) $this.data('bs.alert', (data = new Alert(this)))
      if (typeof option == 'string') data[option].call($this)
    })
  }

  var old = $.fn.alert

  $.fn.alert             = Plugin
  $.fn.alert.Constructor = Alert


  // ALERT NO CONFLICT
  // =================

  $.fn.alert.noConflict = function () {
    $.fn.alert = old
    return this
  }


  // ALERT DATA-API
  // ==============

  $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)

}(jQuery);

Version data entries

113 entries across 113 versions & 2 rubygems

Version Path
active_frontend-12.1.18 vendor/assets/javascripts/_alert.js
active_frontend-12.1.17 vendor/assets/javascripts/_alert.js
active_frontend-12.1.16 vendor/assets/javascripts/_alert.js
active_frontend-12.1.15 vendor/assets/javascripts/_alert.js
active_frontend-12.1.14 vendor/assets/javascripts/_alert.js
active_frontend-12.1.13 vendor/assets/javascripts/_alert.js
active_frontend-12.1.12 vendor/assets/javascripts/_alert.js
active_frontend-12.1.11 vendor/assets/javascripts/_alert.js
active_frontend-12.1.10 vendor/assets/javascripts/_alert.js
active_frontend-12.1.9 vendor/assets/javascripts/_alert.js
active_frontend-12.1.8 vendor/assets/javascripts/_alert.js
active_frontend-12.1.7 vendor/assets/javascripts/_alert.js
active_frontend-12.1.6 vendor/assets/javascripts/_alert.js
active_frontend-12.1.5 vendor/assets/javascripts/_alert.js
active_frontend-12.1.4 vendor/assets/javascripts/_alert.js
active_frontend-12.1.2 vendor/assets/javascripts/_alert.js
active_frontend-12.1.1 vendor/assets/javascripts/_alert.js
active_frontend-12.1.0 vendor/assets/javascripts/_alert.js
active_frontend-12.0.3 vendor/assets/javascripts/_alert.js
active_frontend-12.0.2 vendor/assets/javascripts/_alert.js