/* =================================================== * bootstrap-transition.js v2.3.1 * http://twitter.github.com/bootstrap/javascript.html#transitions * =================================================== * copyright 2012 twitter, inc. * * licensed under the apache license, version 2.0 (the "license"); * you may not use this file except in compliance with the license. * you may obtain a copy of the license at * * http://www.apache.org/licenses/license-2.0 * * unless required by applicable law or agreed to in writing, software * distributed under the license is distributed on an "as is" basis, * without warranties or conditions of any kind, either express or implied. * see the license for the specific language governing permissions and * limitations under the license. * ========================================================== */ !function ($) { "use strict"; // jshint ;_; /* css transition support (http://www.modernizr.com/) * ======================================================= */ $(function () { $.support.transition = (function () { var transitionend = (function () { var el = document.createelement('bootstrap') , transendeventnames = { 'webkittransition' : 'webkittransitionend' , 'moztransition' : 'transitionend' , 'otransition' : 'otransitionend otransitionend' , 'transition' : 'transitionend' } , name for (name in transendeventnames){ if (el.style[name] !== undefined) { return transendeventnames[name] } } }()) return transitionend && { end: transitionend } })() }) }(window.jquery);/* ========================================================== * bootstrap-alert.js v2.3.1 * http://twitter.github.com/bootstrap/javascript.html#alerts * ========================================================== * copyright 2012 twitter, inc. * * licensed under the apache license, version 2.0 (the "license"); * you may not use this file except in compliance with the license. * you may obtain a copy of the license at * * http://www.apache.org/licenses/license-2.0 * * unless required by applicable law or agreed to in writing, software * distributed under the license is distributed on an "as is" basis, * without warranties or conditions of any kind, either express or implied. * see the license for the specific language governing permissions and * limitations under the license. * ========================================================== */ !function ($) { "use strict"; // jshint ;_; /* alert class definition * ====================== */ var dismiss = '[data-dismiss="alert"]' , alert = function (el) { $(el).on('click', dismiss, this.close) } alert.prototype.close = function (e) { var $this = $(this) , selector = $this.attr('data-target') , $parent if (!selector) { selector = $this.attr('href') selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 } $parent = $(selector) e && e.preventdefault() $parent.length || ($parent = $this.hasclass('alert') ? $this : $this.parent()) $parent.trigger(e = $.event('close')) if (e.isdefaultprevented()) return $parent.removeclass('in') function removeelement() { $parent .trigger('closed') .remove() } $.support.transition && $parent.hasclass('fade') ? $parent.on($.support.transition.end, removeelement) : removeelement() } /* alert plugin definition * ======================= */ var old = $.fn.alert $.fn.alert = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('alert') if (!data) $this.data('alert', (data = new alert(this))) if (typeof option == 'string') data[option].call($this) }) } $.fn.alert.constructor = alert /* alert no conflict * ================= */ $.fn.alert.noconflict = function () { $.fn.alert = old return this } /* alert data-api * ============== */ $(document).on('click.alert.data-api', dismiss, alert.prototype.close) }(window.jquery);/* ============================================================ * bootstrap-button.js v2.3.1 * http://twitter.github.com/bootstrap/javascript.html#buttons * ============================================================ * copyright 2012 twitter, inc. * * licensed under the apache license, version 2.0 (the "license"); * you may not use this file except in compliance with the license. * you may obtain a copy of the license at * * http://www.apache.org/licenses/license-2.0 * * unless required by applicable law or agreed to in writing, software * distributed under the license is distributed on an "as is" basis, * without warranties or conditions of any kind, either express or implied. * see the license for the specific language governing permissions and * limitations under the license. * ============================================================ */ !function ($) { "use strict"; // jshint ;_; /* button public class definition * ============================== */ var button = function (element, options) { this.$element = $(element) this.options = $.extend({}, $.fn.button.defaults, options) } button.prototype.setstate = function (state) { var d = 'disabled' , $el = this.$element , data = $el.data() , val = $el.is('input') ? 'val' : 'html' state = state + 'text' data.resettext || $el.data('resettext', $el[val]()) $el[val](data[state] || this.options[state]) // push to event loop to allow forms to submit settimeout(function () { state == 'loadingtext' ? $el.addclass(d).attr(d, d) : $el.removeclass(d).removeattr(d) }, 0) } button.prototype.toggle = function () { var $parent = this.$element.closest('[data-toggle="buttons-radio"]') $parent && $parent .find('.active') .removeclass('active') this.$element.toggleclass('active') } /* button plugin definition * ======================== */ var old = $.fn.button $.fn.button = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('button') , options = typeof option == 'object' && option if (!data) $this.data('button', (data = new button(this, options))) if (option == 'toggle') data.toggle() else if (option) data.setstate(option) }) } $.fn.button.defaults = { loadingtext: 'loading...' } $.fn.button.constructor = button /* button no conflict * ================== */ $.fn.button.noconflict = function () { $.fn.button = old return this } /* button data-api * =============== */ $(document).on('click.button.data-api', '[data-toggle^=button]', function (e) { var $btn = $(e.target) if (!$btn.hasclass('btn')) $btn = $btn.closest('.btn') $btn.button('toggle') }) }(window.jquery);/* ========================================================== * bootstrap-carousel.js v2.3.1 * http://twitter.github.com/bootstrap/javascript.html#carousel * ========================================================== * copyright 2012 twitter, inc. * * licensed under the apache license, version 2.0 (the "license"); * you may not use this file except in compliance with the license. * you may obtain a copy of the license at * * http://www.apache.org/licenses/license-2.0 * * unless required by applicable law or agreed to in writing, software * distributed under the license is distributed on an "as is" basis, * without warranties or conditions of any kind, either express or implied. * see the license for the specific language governing permissions and * limitations under the license. * ========================================================== */ !function ($) { "use strict"; // jshint ;_; /* carousel class definition * ========================= */ var carousel = function (element, options) { this.$element = $(element) this.$indicators = this.$element.find('.carousel-indicators') this.options = options this.options.pause == 'hover' && this.$element .on('mouseenter', $.proxy(this.pause, this)) .on('mouseleave', $.proxy(this.cycle, this)) } carousel.prototype = { cycle: function (e) { if (!e) this.paused = false if (this.interval) clearinterval(this.interval); this.options.interval && !this.paused && (this.interval = setinterval($.proxy(this.next, this), this.options.interval)) return this } , getactiveindex: function () { this.$active = this.$element.find('.item.active') this.$items = this.$active.parent().children() return this.$items.index(this.$active) } , to: function (pos) { var activeindex = this.getactiveindex() , that = this if (pos > (this.$items.length - 1) || pos < 0) return if (this.sliding) { return this.$element.one('slid', function () { that.to(pos) }) } if (activeindex == pos) { return this.pause().cycle() } return this.slide(pos > activeindex ? 'next' : 'prev', $(this.$items[pos])) } , pause: function (e) { if (!e) this.paused = true if (this.$element.find('.next, .prev').length && $.support.transition.end) { this.$element.trigger($.support.transition.end) this.cycle(true) } clearinterval(this.interval) this.interval = null return this } , next: function () { if (this.sliding) return return this.slide('next') } , prev: function () { if (this.sliding) return return this.slide('prev') } , slide: function (type, next) { var $active = this.$element.find('.item.active') , $next = next || $active[type]() , iscycling = this.interval , direction = type == 'next' ? 'left' : 'right' , fallback = type == 'next' ? 'first' : 'last' , that = this , e this.sliding = true iscycling && this.pause() $next = $next.length ? $next : this.$element.find('.item')[fallback]() e = $.event('slide', { relatedtarget: $next[0] , direction: direction }) if ($next.hasclass('active')) return if (this.$indicators.length) { this.$indicators.find('.active').removeclass('active') this.$element.one('slid', function () { var $nextindicator = $(that.$indicators.children()[that.getactiveindex()]) $nextindicator && $nextindicator.addclass('active') }) } if ($.support.transition && this.$element.hasclass('slide')) { this.$element.trigger(e) if (e.isdefaultprevented()) return $next.addclass(type) $next[0].offsetwidth // force reflow $active.addclass(direction) $next.addclass(direction) this.$element.one($.support.transition.end, function () { $next.removeclass([type, direction].join(' ')).addclass('active') $active.removeclass(['active', direction].join(' ')) that.sliding = false settimeout(function () { that.$element.trigger('slid') }, 0) }) } else { this.$element.trigger(e) if (e.isdefaultprevented()) return $active.removeclass('active') $next.addclass('active') this.sliding = false this.$element.trigger('slid') } iscycling && this.cycle() return this } } /* carousel plugin definition * ========================== */ var old = $.fn.carousel $.fn.carousel = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('carousel') , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option) , action = typeof option == 'string' ? option : options.slide if (!data) $this.data('carousel', (data = new carousel(this, options))) if (typeof option == 'number') data.to(option) else if (action) data[action]() else if (options.interval) data.pause().cycle() }) } $.fn.carousel.defaults = { interval: 5000 , pause: 'hover' } $.fn.carousel.constructor = carousel /* carousel no conflict * ==================== */ $.fn.carousel.noconflict = function () { $.fn.carousel = old return this } /* carousel data-api * ================= */ $(document).on('click.carousel.data-api', '[data-slide], [data-slide-to]', function (e) { var $this = $(this), href , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 , options = $.extend({}, $target.data(), $this.data()) , slideindex $target.carousel(options) if (slideindex = $this.attr('data-slide-to')) { $target.data('carousel').pause().to(slideindex).cycle() } e.preventdefault() }) }(window.jquery);/* ============================================================= * bootstrap-collapse.js v2.3.1 * http://twitter.github.com/bootstrap/javascript.html#collapse * ============================================================= * copyright 2012 twitter, inc. * * licensed under the apache license, version 2.0 (the "license"); * you may not use this file except in compliance with the license. * you may obtain a copy of the license at * * http://www.apache.org/licenses/license-2.0 * * unless required by applicable law or agreed to in writing, software * distributed under the license is distributed on an "as is" basis, * without warranties or conditions of any kind, either express or implied. * see the license for the specific language governing permissions and * limitations under the license. * ============================================================ */ !function ($) { "use strict"; // jshint ;_; /* collapse public class definition * ================================ */ var collapse = function (element, options) { this.$element = $(element) this.options = $.extend({}, $.fn.collapse.defaults, options) if (this.options.parent) { this.$parent = $(this.options.parent) } this.options.toggle && this.toggle() } collapse.prototype = { constructor: collapse , dimension: function () { var haswidth = this.$element.hasclass('width') return haswidth ? 'width' : 'height' } , show: function () { var dimension , scroll , actives , hasdata if (this.transitioning || this.$element.hasclass('in')) return dimension = this.dimension() scroll = $.camelcase(['scroll', dimension].join('-')) actives = this.$parent && this.$parent.find('> .accordion-group > .in') if (actives && actives.length) { hasdata = actives.data('collapse') if (hasdata && hasdata.transitioning) return actives.collapse('hide') hasdata || actives.data('collapse', null) } this.$element[dimension](0) this.transition('addclass', $.event('show'), 'shown') $.support.transition && this.$element[dimension](this.$element[0][scroll]) } , hide: function () { var dimension if (this.transitioning || !this.$element.hasclass('in')) return dimension = this.dimension() this.reset(this.$element[dimension]()) this.transition('removeclass', $.event('hide'), 'hidden') this.$element[dimension](0) } , reset: function (size) { var dimension = this.dimension() this.$element .removeclass('collapse') [dimension](size || 'auto') [0].offsetwidth this.$element[size !== null ? 'addclass' : 'removeclass']('collapse') return this } , transition: function (method, startevent, completeevent) { var that = this , complete = function () { if (startevent.type == 'show') that.reset() that.transitioning = 0 that.$element.trigger(completeevent) } this.$element.trigger(startevent) if (startevent.isdefaultprevented()) return this.transitioning = 1 this.$element[method]('in') $.support.transition && this.$element.hasclass('collapse') ? this.$element.one($.support.transition.end, complete) : complete() } , toggle: function () { this[this.$element.hasclass('in') ? 'hide' : 'show']() } } /* collapse plugin definition * ========================== */ var old = $.fn.collapse $.fn.collapse = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('collapse') , options = $.extend({}, $.fn.collapse.defaults, $this.data(), typeof option == 'object' && option) if (!data) $this.data('collapse', (data = new collapse(this, options))) if (typeof option == 'string') data[option]() }) } $.fn.collapse.defaults = { toggle: true } $.fn.collapse.constructor = collapse /* collapse no conflict * ==================== */ $.fn.collapse.noconflict = function () { $.fn.collapse = old return this } /* collapse data-api * ================= */ $(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) { var $this = $(this), href , target = $this.attr('data-target') || e.preventdefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 , option = $(target).data('collapse') ? 'toggle' : $this.data() $this[$(target).hasclass('in') ? 'addclass' : 'removeclass']('collapsed') $(target).collapse(option) }) }(window.jquery);/* ============================================================ * bootstrap-dropdown.js v2.3.1 * http://twitter.github.com/bootstrap/javascript.html#dropdowns * ============================================================ * copyright 2012 twitter, inc. * * licensed under the apache license, version 2.0 (the "license"); * you may not use this file except in compliance with the license. * you may obtain a copy of the license at * * http://www.apache.org/licenses/license-2.0 * * unless required by applicable law or agreed to in writing, software * distributed under the license is distributed on an "as is" basis, * without warranties or conditions of any kind, either express or implied. * see the license for the specific language governing permissions and * limitations under the license. * ============================================================ */ !function ($) { "use strict"; // jshint ;_; /* dropdown class definition * ========================= */ var toggle = '[data-toggle=dropdown]' , dropdown = function (element) { var $el = $(element).on('click.dropdown.data-api', this.toggle) $('html').on('click.dropdown.data-api', function () { $el.parent().removeclass('open') }) } dropdown.prototype = { constructor: dropdown , toggle: function (e) { var $this = $(this) , $parent , isactive if ($this.is('.disabled, :disabled')) return $parent = getparent($this) isactive = $parent.hasclass('open') clearmenus() if (!isactive) { $parent.toggleclass('open') } $this.focus() return false } , keydown: function (e) { var $this , $items , $active , $parent , isactive , index if (!/(38|40|27)/.test(e.keycode)) return $this = $(this) e.preventdefault() e.stoppropagation() if ($this.is('.disabled, :disabled')) return $parent = getparent($this) isactive = $parent.hasclass('open') if (!isactive || (isactive && e.keycode == 27)) { if (e.which == 27) $parent.find(toggle).focus() return $this.click() } $items = $('[role=menu] li:not(.divider):visible a', $parent) if (!$items.length) return index = $items.index($items.filter(':focus')) if (e.keycode == 38 && index > 0) index-- // up if (e.keycode == 40 && index < $items.length - 1) index++ // down if (!~index) index = 0 $items .eq(index) .focus() } } function clearmenus() { $(toggle).each(function () { getparent($(this)).removeclass('open') }) } function getparent($this) { var selector = $this.attr('data-target') , $parent if (!selector) { selector = $this.attr('href') selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 } $parent = selector && $(selector) if (!$parent || !$parent.length) $parent = $this.parent() return $parent } /* dropdown plugin definition * ========================== */ var old = $.fn.dropdown $.fn.dropdown = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('dropdown') if (!data) $this.data('dropdown', (data = new dropdown(this))) if (typeof option == 'string') data[option].call($this) }) } $.fn.dropdown.constructor = dropdown /* dropdown no conflict * ==================== */ $.fn.dropdown.noconflict = function () { $.fn.dropdown = old return this } /* apply to standard dropdown elements * =================================== */ $(document) .on('click.dropdown.data-api', clearmenus) .on('click.dropdown.data-api', '.dropdown form', function (e) { e.stoppropagation() }) .on('click.dropdown-menu', function (e) { e.stoppropagation() }) .on('click.dropdown.data-api' , toggle, dropdown.prototype.toggle) .on('keydown.dropdown.data-api', toggle + ', [role=menu]' , dropdown.prototype.keydown) }(window.jquery); /* ========================================================= * bootstrap-modal.js v2.3.1 * http://twitter.github.com/bootstrap/javascript.html#modals * ========================================================= * copyright 2012 twitter, inc. * * licensed under the apache license, version 2.0 (the "license"); * you may not use this file except in compliance with the license. * you may obtain a copy of the license at * * http://www.apache.org/licenses/license-2.0 * * unless required by applicable law or agreed to in writing, software * distributed under the license is distributed on an "as is" basis, * without warranties or conditions of any kind, either express or implied. * see the license for the specific language governing permissions and * limitations under the license. * ========================================================= */ !function ($) { "use strict"; // jshint ;_; /* modal class definition * ====================== */ var modal = function (element, options) { this.options = options this.$element = $(element) .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)) this.options.remote && this.$element.find('.modal-body').load(this.options.remote) } modal.prototype = { constructor: modal , toggle: function () { return this[!this.isshown ? 'show' : 'hide']() } , show: function () { var that = this , e = $.event('show') this.$element.trigger(e) if (this.isshown || e.isdefaultprevented()) return this.isshown = true this.escape() this.backdrop(function () { var transition = $.support.transition && that.$element.hasclass('fade') if (!that.$element.parent().length) { that.$element.appendto(document.body) //don't move modals dom position } that.$element.show() if (transition) { that.$element[0].offsetwidth // force reflow } that.$element .addclass('in') .attr('aria-hidden', false) that.enforcefocus() transition ? that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) : that.$element.focus().trigger('shown') }) } , hide: function (e) { e && e.preventdefault() var that = this e = $.event('hide') this.$element.trigger(e) if (!this.isshown || e.isdefaultprevented()) return this.isshown = false this.escape() $(document).off('focusin.modal') this.$element .removeclass('in') .attr('aria-hidden', true) $.support.transition && this.$element.hasclass('fade') ? this.hidewithtransition() : this.hidemodal() } , enforcefocus: function () { var that = this $(document).on('focusin.modal', function (e) { if (that.$element[0] !== e.target && !that.$element.has(e.target).length) { that.$element.focus() } }) } , escape: function () { var that = this if (this.isshown && this.options.keyboard) { this.$element.on('keyup.dismiss.modal', function ( e ) { e.which == 27 && that.hide() }) } else if (!this.isshown) { this.$element.off('keyup.dismiss.modal') } } , hidewithtransition: function () { var that = this , timeout = settimeout(function () { that.$element.off($.support.transition.end) that.hidemodal() }, 500) this.$element.one($.support.transition.end, function () { cleartimeout(timeout) that.hidemodal() }) } , hidemodal: function () { var that = this this.$element.hide() this.backdrop(function () { that.removebackdrop() that.$element.trigger('hidden') }) } , removebackdrop: function () { this.$backdrop && this.$backdrop.remove() this.$backdrop = null } , backdrop: function (callback) { var that = this , animate = this.$element.hasclass('fade') ? 'fade' : '' if (this.isshown && this.options.backdrop) { var doanimate = $.support.transition && animate this.$backdrop = $('
') .appendto(document.body) this.$backdrop.click( this.options.backdrop == 'static' ? $.proxy(this.$element[0].focus, this.$element[0]) : $.proxy(this.hide, this) ) if (doanimate) this.$backdrop[0].offsetwidth // force reflow this.$backdrop.addclass('in') if (!callback) return doanimate ? this.$backdrop.one($.support.transition.end, callback) : callback() } else if (!this.isshown && this.$backdrop) { this.$backdrop.removeclass('in') $.support.transition && this.$element.hasclass('fade')? this.$backdrop.one($.support.transition.end, callback) : callback() } else if (callback) { callback() } } } /* modal plugin definition * ======================= */ var old = $.fn.modal $.fn.modal = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('modal') , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option) if (!data) $this.data('modal', (data = new modal(this, options))) if (typeof option == 'string') data[option]() else if (options.show) data.show() }) } $.fn.modal.defaults = { backdrop: true , keyboard: true , show: true } $.fn.modal.constructor = modal /* modal no conflict * ================= */ $.fn.modal.noconflict = function () { $.fn.modal = old return this } /* modal data-api * ============== */ $(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) { var $this = $(this) , href = $this.attr('href') , $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7 , option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data()) e.preventdefault() $target .modal(option) .one('hide', function () { $this.focus() }) }) }(window.jquery); /* =========================================================== * bootstrap-tooltip.js v2.3.1 * http://twitter.github.com/bootstrap/javascript.html#tooltips * inspired by the original jquery.tipsy by jason frame * =========================================================== * copyright 2012 twitter, inc. * * licensed under the apache license, version 2.0 (the "license"); * you may not use this file except in compliance with the license. * you may obtain a copy of the license at * * http://www.apache.org/licenses/license-2.0 * * unless required by applicable law or agreed to in writing, software * distributed under the license is distributed on an "as is" basis, * without warranties or conditions of any kind, either express or implied. * see the license for the specific language governing permissions and * limitations under the license. * ========================================================== */ !function ($) { "use strict"; // jshint ;_; /* tooltip public class definition * =============================== */ var tooltip = function (element, options) { this.init('tooltip', element, options) } tooltip.prototype = { constructor: tooltip , init: function (type, element, options) { var eventin , eventout , triggers , trigger , i this.type = type this.$element = $(element) this.options = this.getoptions(options) this.enabled = true triggers = this.options.trigger.split(' ') for (i = triggers.length; i--;) { trigger = triggers[i] if (trigger == 'click') { this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) } else if (trigger != 'manual') { eventin = trigger == 'hover' ? 'mouseenter' : 'focus' eventout = trigger == 'hover' ? 'mouseleave' : 'blur' this.$element.on(eventin + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) this.$element.on(eventout + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) } } this.options.selector ? (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : this.fixtitle() } , getoptions: function (options) { options = $.extend({}, $.fn[this.type].defaults, this.$element.data(), options) if (options.delay && typeof options.delay == 'number') { options.delay = { show: options.delay , hide: options.delay } } return options } , enter: function (e) { var defaults = $.fn[this.type].defaults , options = {} , self this._options && $.each(this._options, function (key, value) { if (defaults[key] != value) options[key] = value }, this) self = $(e.currenttarget)[this.type](options).data(this.type) if (!self.options.delay || !self.options.delay.show) return self.show() cleartimeout(this.timeout) self.hoverstate = 'in' this.timeout = settimeout(function() { if (self.hoverstate == 'in') self.show() }, self.options.delay.show) } , leave: function (e) { var self = $(e.currenttarget)[this.type](this._options).data(this.type) if (this.timeout) cleartimeout(this.timeout) if (!self.options.delay || !self.options.delay.hide) return self.hide() self.hoverstate = 'out' this.timeout = settimeout(function() { if (self.hoverstate == 'out') self.hide() }, self.options.delay.hide) } , show: function () { var $tip , pos , actualwidth , actualheight , placement , tp , e = $.event('show') if (this.hascontent() && this.enabled) { this.$element.trigger(e) if (e.isdefaultprevented()) return $tip = this.tip() this.setcontent() if (this.options.animation) { $tip.addclass('fade') } placement = typeof this.options.placement == 'function' ? this.options.placement.call(this, $tip[0], this.$element[0]) : this.options.placement $tip .detach() .css({ top: 0, left: 0, display: 'block' }) this.options.container ? $tip.appendto(this.options.container) : $tip.insertafter(this.$element) pos = this.getposition() actualwidth = $tip[0].offsetwidth actualheight = $tip[0].offsetheight switch (placement) { case 'bottom': tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualwidth / 2} break case 'top': tp = {top: pos.top - actualheight, left: pos.left + pos.width / 2 - actualwidth / 2} break case 'left': tp = {top: pos.top + pos.height / 2 - actualheight / 2, left: pos.left - actualwidth} break case 'right': tp = {top: pos.top + pos.height / 2 - actualheight / 2, left: pos.left + pos.width} break } this.applyplacement(tp, placement) this.$element.trigger('shown') } } , applyplacement: function(offset, placement){ var $tip = this.tip() , width = $tip[0].offsetwidth , height = $tip[0].offsetheight , actualwidth , actualheight , delta , replace $tip .offset(offset) .addclass(placement) .addclass('in') actualwidth = $tip[0].offsetwidth actualheight = $tip[0].offsetheight if (placement == 'top' && actualheight != height) { offset.top = offset.top + height - actualheight replace = true } if (placement == 'bottom' || placement == 'top') { delta = 0 if (offset.left < 0){ delta = offset.left * -2 offset.left = 0 $tip.offset(offset) actualwidth = $tip[0].offsetwidth actualheight = $tip[0].offsetheight } this.replacearrow(delta - width + actualwidth, actualwidth, 'left') } else { this.replacearrow(actualheight - height, actualheight, 'top') } if (replace) $tip.offset(offset) } , replacearrow: function(delta, dimension, position){ this .arrow() .css(position, delta ? (50 * (1 - delta / dimension) + "%") : '') } , setcontent: function () { var $tip = this.tip() , title = this.gettitle() $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) $tip.removeclass('fade in top bottom left right') } , hide: function () { var that = this , $tip = this.tip() , e = $.event('hide') this.$element.trigger(e) if (e.isdefaultprevented()) return $tip.removeclass('in') function removewithanimation() { var timeout = settimeout(function () { $tip.off($.support.transition.end).detach() }, 500) $tip.one($.support.transition.end, function () { cleartimeout(timeout) $tip.detach() }) } $.support.transition && this.$tip.hasclass('fade') ? removewithanimation() : $tip.detach() this.$element.trigger('hidden') return this } , fixtitle: function () { var $e = this.$element if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') { $e.attr('data-original-title', $e.attr('title') || '').attr('title', '') } } , hascontent: function () { return this.gettitle() } , getposition: function () { var el = this.$element[0] return $.extend({}, (typeof el.getboundingclientrect == 'function') ? el.getboundingclientrect() : { width: el.offsetwidth , height: el.offsetheight }, this.$element.offset()) } , gettitle: function () { var title , $e = this.$element , o = this.options title = $e.attr('data-original-title') || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) return title } , tip: function () { return this.$tip = this.$tip || $(this.options.template) } , arrow: function(){ return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow") } , validate: function () { if (!this.$element[0].parentnode) { this.hide() this.$element = null this.options = null } } , enable: function () { this.enabled = true } , disable: function () { this.enabled = false } , toggleenabled: function () { this.enabled = !this.enabled } , toggle: function (e) { var self = e ? $(e.currenttarget)[this.type](this._options).data(this.type) : this self.tip().hasclass('in') ? self.hide() : self.show() } , destroy: function () { this.hide().$element.off('.' + this.type).removedata(this.type) } } /* tooltip plugin definition * ========================= */ var old = $.fn.tooltip $.fn.tooltip = function ( option ) { return this.each(function () { var $this = $(this) , data = $this.data('tooltip') , options = typeof option == 'object' && option if (!data) $this.data('tooltip', (data = new tooltip(this, options))) if (typeof option == 'string') data[option]() }) } $.fn.tooltip.constructor = tooltip $.fn.tooltip.defaults = { animation: true , placement: 'top' , selector: false , template: '