1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/bootstrap-source/bootstrap-3.0.3/js/alert.js Fri Dec 20 22:49:16 2013 +0100
1.3 @@ -0,0 +1,98 @@
1.4 +/* ========================================================================
1.5 + * Bootstrap: alert.js v3.0.3
1.6 + * http://getbootstrap.com/javascript/#alerts
1.7 + * ========================================================================
1.8 + * Copyright 2013 Twitter, Inc.
1.9 + *
1.10 + * Licensed under the Apache License, Version 2.0 (the "License");
1.11 + * you may not use this file except in compliance with the License.
1.12 + * You may obtain a copy of the License at
1.13 + *
1.14 + * http://www.apache.org/licenses/LICENSE-2.0
1.15 + *
1.16 + * Unless required by applicable law or agreed to in writing, software
1.17 + * distributed under the License is distributed on an "AS IS" BASIS,
1.18 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1.19 + * See the License for the specific language governing permissions and
1.20 + * limitations under the License.
1.21 + * ======================================================================== */
1.22 +
1.23 +
1.24 ++function ($) { "use strict";
1.25 +
1.26 + // ALERT CLASS DEFINITION
1.27 + // ======================
1.28 +
1.29 + var dismiss = '[data-dismiss="alert"]'
1.30 + var Alert = function (el) {
1.31 + $(el).on('click', dismiss, this.close)
1.32 + }
1.33 +
1.34 + Alert.prototype.close = function (e) {
1.35 + var $this = $(this)
1.36 + var selector = $this.attr('data-target')
1.37 +
1.38 + if (!selector) {
1.39 + selector = $this.attr('href')
1.40 + selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
1.41 + }
1.42 +
1.43 + var $parent = $(selector)
1.44 +
1.45 + if (e) e.preventDefault()
1.46 +
1.47 + if (!$parent.length) {
1.48 + $parent = $this.hasClass('alert') ? $this : $this.parent()
1.49 + }
1.50 +
1.51 + $parent.trigger(e = $.Event('close.bs.alert'))
1.52 +
1.53 + if (e.isDefaultPrevented()) return
1.54 +
1.55 + $parent.removeClass('in')
1.56 +
1.57 + function removeElement() {
1.58 + $parent.trigger('closed.bs.alert').remove()
1.59 + }
1.60 +
1.61 + $.support.transition && $parent.hasClass('fade') ?
1.62 + $parent
1.63 + .one($.support.transition.end, removeElement)
1.64 + .emulateTransitionEnd(150) :
1.65 + removeElement()
1.66 + }
1.67 +
1.68 +
1.69 + // ALERT PLUGIN DEFINITION
1.70 + // =======================
1.71 +
1.72 + var old = $.fn.alert
1.73 +
1.74 + $.fn.alert = function (option) {
1.75 + return this.each(function () {
1.76 + var $this = $(this)
1.77 + var data = $this.data('bs.alert')
1.78 +
1.79 + if (!data) $this.data('bs.alert', (data = new Alert(this)))
1.80 + if (typeof option == 'string') data[option].call($this)
1.81 + })
1.82 + }
1.83 +
1.84 + $.fn.alert.Constructor = Alert
1.85 +
1.86 +
1.87 + // ALERT NO CONFLICT
1.88 + // =================
1.89 +
1.90 + $.fn.alert.noConflict = function () {
1.91 + $.fn.alert = old
1.92 + return this
1.93 + }
1.94 +
1.95 +
1.96 + // ALERT DATA-API
1.97 + // ==============
1.98 +
1.99 + $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
1.100 +
1.101 +}(jQuery);