Sha256: 389fabab26f5a48bd767deb508258cbda57369335c7296e56857b55805cd1e83

Contents?: true

Size: 1.79 KB

Versions: 11

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.2.0'

  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

11 entries across 11 versions & 1 rubygems

Version Path
flashgrid-3.2.1 vendor/assets/javascripts/alert.js
flashgrid-3.2.0 vendor/assets/javascripts/alert.js
flashgrid-3.1.1 vendor/assets/javascripts/alert.js
flashgrid-3.1.0 vendor/assets/javascripts/alert.js
flashgrid-3.0.5 vendor/assets/javascripts/alert.js
flashgrid-3.0.4 vendor/assets/javascripts/alert.js
flashgrid-3.0.3 vendor/assets/javascripts/alert.js
flashgrid-3.0.2 vendor/assets/javascripts/alert.js
flashgrid-3.0.1 vendor/assets/javascripts/alert.js
flashgrid-3.0.0 vendor/assets/javascripts/alert.js
flashgrid-2.3.0 vendor/assets/javascripts/alert.js