1/* ========================================================== 2 * bootstrap-alert.js v2.0.0 3 * http://twitter.github.com/bootstrap/javascript.html#alerts 4 * ========================================================== 5 * Copyright 2012 Twitter, Inc. 6 * 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 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 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 * ========================================================== */ 19 20 21!function( $ ){ 22 23 "use strict" 24 25 /* ALERT CLASS DEFINITION 26 * ====================== */ 27 28 var dismiss = '[data-dismiss="alert"]' 29 , Alert = function ( el ) { 30 $(el).on('click', dismiss, this.close) 31 } 32 33 Alert.prototype = { 34 35 constructor: Alert 36 37 , close: function ( e ) { 38 var $this = $(this) 39 , selector = $this.attr('data-target') 40 , $parent 41 42 if (!selector) { 43 selector = $this.attr('href') 44 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 45 } 46 47 $parent = $(selector) 48 $parent.trigger('close') 49 50 e && e.preventDefault() 51 52 $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent()) 53 54 $parent.removeClass('in') 55 56 function removeElement() { 57 $parent.remove() 58 $parent.trigger('closed') 59 } 60 61 $.support.transition && $parent.hasClass('fade') ? 62 $parent.on($.support.transition.end, removeElement) : 63 removeElement() 64 } 65 66 } 67 68 69 /* ALERT PLUGIN DEFINITION 70 * ======================= */ 71 72 $.fn.alert = function ( option ) { 73 return this.each(function () { 74 var $this = $(this) 75 , data = $this.data('alert') 76 if (!data) $this.data('alert', (data = new Alert(this))) 77 if (typeof option == 'string') data[option].call($this) 78 }) 79 } 80 81 $.fn.alert.Constructor = Alert 82 83 84 /* ALERT DATA-API 85 * ============== */ 86 87 $(function () { 88 $('body').on('click.alert.data-api', dismiss, Alert.prototype.close) 89 }) 90 91}( window.jQuery )
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.