bootstrap.js 60 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140
  1. /*!
  2. * Bootstrap v3.2.0 (http://getbootstrap.com)
  3. * Copyright 2011-2014 Twitter, Inc.
  4. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  5. */
  6. /*!
  7. * Generated using the Bootstrap Customizer (http://v3.bootcss.com/customize/?id=8209b1a3199f3dc2fb60)
  8. * Config saved to config.json and https://gist.github.com/8209b1a3199f3dc2fb60
  9. */
  10. if (typeof jQuery === "undefined") { throw new Error("Bootstrap's JavaScript requires jQuery") }
  11. /* ========================================================================
  12. * Bootstrap: alert.js v3.2.0
  13. * http://getbootstrap.com/javascript/#alerts
  14. * ========================================================================
  15. * Copyright 2011-2014 Twitter, Inc.
  16. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  17. * ======================================================================== */
  18. +function ($) {
  19. 'use strict';
  20. // ALERT CLASS DEFINITION
  21. // ======================
  22. var dismiss = '[data-dismiss="alert"]'
  23. var Alert = function (el) {
  24. $(el).on('click', dismiss, this.close)
  25. }
  26. Alert.VERSION = '3.2.0'
  27. Alert.prototype.close = function (e) {
  28. var $this = $(this)
  29. var selector = $this.attr('data-target')
  30. if (!selector) {
  31. selector = $this.attr('href')
  32. selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  33. }
  34. var $parent = $(selector)
  35. if (e) e.preventDefault()
  36. if (!$parent.length) {
  37. $parent = $this.hasClass('alert') ? $this : $this.parent()
  38. }
  39. $parent.trigger(e = $.Event('close.bs.alert'))
  40. if (e.isDefaultPrevented()) return
  41. $parent.removeClass('in')
  42. function removeElement() {
  43. // detach from parent, fire event then clean up data
  44. $parent.detach().trigger('closed.bs.alert').remove()
  45. }
  46. $.support.transition && $parent.hasClass('fade') ?
  47. $parent
  48. .one('bsTransitionEnd', removeElement)
  49. .emulateTransitionEnd(150) :
  50. removeElement()
  51. }
  52. // ALERT PLUGIN DEFINITION
  53. // =======================
  54. function Plugin(option) {
  55. return this.each(function () {
  56. var $this = $(this)
  57. var data = $this.data('bs.alert')
  58. if (!data) $this.data('bs.alert', (data = new Alert(this)))
  59. if (typeof option == 'string') data[option].call($this)
  60. })
  61. }
  62. var old = $.fn.alert
  63. $.fn.alert = Plugin
  64. $.fn.alert.Constructor = Alert
  65. // ALERT NO CONFLICT
  66. // =================
  67. $.fn.alert.noConflict = function () {
  68. $.fn.alert = old
  69. return this
  70. }
  71. // ALERT DATA-API
  72. // ==============
  73. $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
  74. }(jQuery);
  75. /* ========================================================================
  76. * Bootstrap: button.js v3.2.0
  77. * http://getbootstrap.com/javascript/#buttons
  78. * ========================================================================
  79. * Copyright 2011-2014 Twitter, Inc.
  80. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  81. * ======================================================================== */
  82. +function ($) {
  83. 'use strict';
  84. // BUTTON PUBLIC CLASS DEFINITION
  85. // ==============================
  86. var Button = function (element, options) {
  87. this.$element = $(element)
  88. this.options = $.extend({}, Button.DEFAULTS, options)
  89. this.isLoading = false
  90. }
  91. Button.VERSION = '3.2.0'
  92. Button.DEFAULTS = {
  93. loadingText: 'loading...'
  94. }
  95. Button.prototype.setState = function (state) {
  96. var d = 'disabled'
  97. var $el = this.$element
  98. var val = $el.is('input') ? 'val' : 'html'
  99. var data = $el.data()
  100. state = state + 'Text'
  101. if (data.resetText == null) $el.data('resetText', $el[val]())
  102. $el[val](data[state] == null ? this.options[state] : data[state])
  103. // push to event loop to allow forms to submit
  104. setTimeout($.proxy(function () {
  105. if (state == 'loadingText') {
  106. this.isLoading = true
  107. $el.addClass(d).attr(d, d)
  108. } else if (this.isLoading) {
  109. this.isLoading = false
  110. $el.removeClass(d).removeAttr(d)
  111. }
  112. }, this), 0)
  113. }
  114. Button.prototype.toggle = function () {
  115. var changed = true
  116. var $parent = this.$element.closest('[data-toggle="buttons"]')
  117. if ($parent.length) {
  118. var $input = this.$element.find('input')
  119. if ($input.prop('type') == 'radio') {
  120. if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
  121. else $parent.find('.active').removeClass('active')
  122. }
  123. if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
  124. }
  125. if (changed) this.$element.toggleClass('active')
  126. }
  127. // BUTTON PLUGIN DEFINITION
  128. // ========================
  129. function Plugin(option) {
  130. return this.each(function () {
  131. var $this = $(this)
  132. var data = $this.data('bs.button')
  133. var options = typeof option == 'object' && option
  134. if (!data) $this.data('bs.button', (data = new Button(this, options)))
  135. if (option == 'toggle') data.toggle()
  136. else if (option) data.setState(option)
  137. })
  138. }
  139. var old = $.fn.button
  140. $.fn.button = Plugin
  141. $.fn.button.Constructor = Button
  142. // BUTTON NO CONFLICT
  143. // ==================
  144. $.fn.button.noConflict = function () {
  145. $.fn.button = old
  146. return this
  147. }
  148. // FOCUS SHIM (FOR BUTTON GROUPS)
  149. // ==============================
  150. function getBtnTarget(target) {
  151. var $target = $(target)
  152. return $target.hasClass('btn') ? $target : $target.parent('.btn')
  153. }
  154. // BUTTON DATA-API
  155. // ===============
  156. $(document)
  157. .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
  158. var $btn = $(e.target)
  159. if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
  160. Plugin.call($btn, 'toggle')
  161. e.preventDefault()
  162. })
  163. .on('focus.bs.button.data-api', '[data-toggle^="button"]', function (e) {
  164. getBtnTarget(e.target).addClass('focus')
  165. })
  166. .on('blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
  167. getBtnTarget(e.target).removeClass('focus')
  168. })
  169. }(jQuery);
  170. /* ========================================================================
  171. * Bootstrap: carousel.js v3.2.0
  172. * http://getbootstrap.com/javascript/#carousel
  173. * ========================================================================
  174. * Copyright 2011-2014 Twitter, Inc.
  175. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  176. * ======================================================================== */
  177. +function ($) {
  178. 'use strict';
  179. // CAROUSEL CLASS DEFINITION
  180. // =========================
  181. var Carousel = function (element, options) {
  182. this.$element = $(element).on('keydown.bs.carousel', $.proxy(this.keydown, this))
  183. this.$indicators = this.$element.find('.carousel-indicators')
  184. this.options = options
  185. this.paused =
  186. this.sliding =
  187. this.interval =
  188. this.$active =
  189. this.$items = null
  190. this.options.pause == 'hover' && this.$element
  191. .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
  192. .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
  193. }
  194. Carousel.VERSION = '3.2.0'
  195. Carousel.DEFAULTS = {
  196. interval: 5000,
  197. pause: 'hover',
  198. wrap: true
  199. }
  200. Carousel.prototype.keydown = function (e) {
  201. switch (e.which) {
  202. case 37: this.prev(); break
  203. case 39: this.next(); break
  204. default: return
  205. }
  206. e.preventDefault()
  207. }
  208. Carousel.prototype.cycle = function (e) {
  209. e || (this.paused = false)
  210. this.interval && clearInterval(this.interval)
  211. this.options.interval
  212. && !this.paused
  213. && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
  214. return this
  215. }
  216. Carousel.prototype.getItemIndex = function (item) {
  217. this.$items = item.parent().children('.item')
  218. return this.$items.index(item || this.$active)
  219. }
  220. Carousel.prototype.to = function (pos) {
  221. var that = this
  222. var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
  223. if (pos > (this.$items.length - 1) || pos < 0) return
  224. if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
  225. if (activeIndex == pos) return this.pause().cycle()
  226. return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
  227. }
  228. Carousel.prototype.pause = function (e) {
  229. e || (this.paused = true)
  230. if (this.$element.find('.next, .prev').length && $.support.transition) {
  231. this.$element.trigger($.support.transition.end)
  232. this.cycle(true)
  233. }
  234. this.interval = clearInterval(this.interval)
  235. return this
  236. }
  237. Carousel.prototype.next = function () {
  238. if (this.sliding) return
  239. return this.slide('next')
  240. }
  241. Carousel.prototype.prev = function () {
  242. if (this.sliding) return
  243. return this.slide('prev')
  244. }
  245. Carousel.prototype.slide = function (type, next) {
  246. var $active = this.$element.find('.item.active')
  247. var $next = next || $active[type]()
  248. var isCycling = this.interval
  249. var direction = type == 'next' ? 'left' : 'right'
  250. var fallback = type == 'next' ? 'first' : 'last'
  251. var that = this
  252. if (!$next.length) {
  253. if (!this.options.wrap) return
  254. $next = this.$element.find('.item')[fallback]()
  255. }
  256. if ($next.hasClass('active')) return (this.sliding = false)
  257. var relatedTarget = $next[0]
  258. var slideEvent = $.Event('slide.bs.carousel', {
  259. relatedTarget: relatedTarget,
  260. direction: direction
  261. })
  262. this.$element.trigger(slideEvent)
  263. if (slideEvent.isDefaultPrevented()) return
  264. this.sliding = true
  265. isCycling && this.pause()
  266. if (this.$indicators.length) {
  267. this.$indicators.find('.active').removeClass('active')
  268. var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
  269. $nextIndicator && $nextIndicator.addClass('active')
  270. }
  271. var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
  272. if ($.support.transition && this.$element.hasClass('slide')) {
  273. $next.addClass(type)
  274. $next[0].offsetWidth // force reflow
  275. $active.addClass(direction)
  276. $next.addClass(direction)
  277. $active
  278. .one('bsTransitionEnd', function () {
  279. $next.removeClass([type, direction].join(' ')).addClass('active')
  280. $active.removeClass(['active', direction].join(' '))
  281. that.sliding = false
  282. setTimeout(function () {
  283. that.$element.trigger(slidEvent)
  284. }, 0)
  285. })
  286. .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)
  287. } else {
  288. $active.removeClass('active')
  289. $next.addClass('active')
  290. this.sliding = false
  291. this.$element.trigger(slidEvent)
  292. }
  293. isCycling && this.cycle()
  294. return this
  295. }
  296. // CAROUSEL PLUGIN DEFINITION
  297. // ==========================
  298. function Plugin(option) {
  299. return this.each(function () {
  300. var $this = $(this)
  301. var data = $this.data('bs.carousel')
  302. var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
  303. var action = typeof option == 'string' ? option : options.slide
  304. if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
  305. if (typeof option == 'number') data.to(option)
  306. else if (action) data[action]()
  307. else if (options.interval) data.pause().cycle()
  308. })
  309. }
  310. var old = $.fn.carousel
  311. $.fn.carousel = Plugin
  312. $.fn.carousel.Constructor = Carousel
  313. // CAROUSEL NO CONFLICT
  314. // ====================
  315. $.fn.carousel.noConflict = function () {
  316. $.fn.carousel = old
  317. return this
  318. }
  319. // CAROUSEL DATA-API
  320. // =================
  321. $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
  322. var href
  323. var $this = $(this)
  324. var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
  325. if (!$target.hasClass('carousel')) return
  326. var options = $.extend({}, $target.data(), $this.data())
  327. var slideIndex = $this.attr('data-slide-to')
  328. if (slideIndex) options.interval = false
  329. Plugin.call($target, options)
  330. if (slideIndex) {
  331. $target.data('bs.carousel').to(slideIndex)
  332. }
  333. e.preventDefault()
  334. })
  335. $(window).on('load', function () {
  336. $('[data-ride="carousel"]').each(function () {
  337. var $carousel = $(this)
  338. Plugin.call($carousel, $carousel.data())
  339. })
  340. })
  341. }(jQuery);
  342. /* ========================================================================
  343. * Bootstrap: dropdown.js v3.2.0
  344. * http://getbootstrap.com/javascript/#dropdowns
  345. * ========================================================================
  346. * Copyright 2011-2014 Twitter, Inc.
  347. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  348. * ======================================================================== */
  349. +function ($) {
  350. 'use strict';
  351. // DROPDOWN CLASS DEFINITION
  352. // =========================
  353. var backdrop = '.dropdown-backdrop'
  354. var toggle = '[data-toggle="dropdown"]'
  355. var Dropdown = function (element) {
  356. $(element).on('click.bs.dropdown', this.toggle)
  357. }
  358. Dropdown.VERSION = '3.2.0'
  359. Dropdown.prototype.toggle = function (e) {
  360. var $this = $(this)
  361. if ($this.is('.disabled, :disabled')) return
  362. var $parent = getParent($this)
  363. var isActive = $parent.hasClass('open')
  364. clearMenus()
  365. if (!isActive) {
  366. if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
  367. // if mobile we use a backdrop because click events don't delegate
  368. $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
  369. }
  370. var relatedTarget = { relatedTarget: this }
  371. $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
  372. if (e.isDefaultPrevented()) return
  373. $this.trigger('focus')
  374. $parent
  375. .toggleClass('open')
  376. .trigger('shown.bs.dropdown', relatedTarget)
  377. }
  378. return false
  379. }
  380. Dropdown.prototype.keydown = function (e) {
  381. if (!/(38|40|27)/.test(e.keyCode)) return
  382. var $this = $(this)
  383. e.preventDefault()
  384. e.stopPropagation()
  385. if ($this.is('.disabled, :disabled')) return
  386. var $parent = getParent($this)
  387. var isActive = $parent.hasClass('open')
  388. if (!isActive || (isActive && e.keyCode == 27)) {
  389. if (e.which == 27) $parent.find(toggle).trigger('focus')
  390. return $this.trigger('click')
  391. }
  392. var desc = ' li:not(.divider):visible a'
  393. var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc)
  394. if (!$items.length) return
  395. var index = $items.index($items.filter(':focus'))
  396. if (e.keyCode == 38 && index > 0) index-- // up
  397. if (e.keyCode == 40 && index < $items.length - 1) index++ // down
  398. if (!~index) index = 0
  399. $items.eq(index).trigger('focus')
  400. }
  401. function clearMenus(e) {
  402. if (e && e.which === 3) return
  403. $(backdrop).remove()
  404. $(toggle).each(function () {
  405. var $parent = getParent($(this))
  406. var relatedTarget = { relatedTarget: this }
  407. if (!$parent.hasClass('open')) return
  408. $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
  409. if (e.isDefaultPrevented()) return
  410. $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
  411. })
  412. }
  413. function getParent($this) {
  414. var selector = $this.attr('data-target')
  415. if (!selector) {
  416. selector = $this.attr('href')
  417. selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  418. }
  419. var $parent = selector && $(selector)
  420. return $parent && $parent.length ? $parent : $this.parent()
  421. }
  422. // DROPDOWN PLUGIN DEFINITION
  423. // ==========================
  424. function Plugin(option) {
  425. return this.each(function () {
  426. var $this = $(this)
  427. var data = $this.data('bs.dropdown')
  428. if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
  429. if (typeof option == 'string') data[option].call($this)
  430. })
  431. }
  432. var old = $.fn.dropdown
  433. $.fn.dropdown = Plugin
  434. $.fn.dropdown.Constructor = Dropdown
  435. // DROPDOWN NO CONFLICT
  436. // ====================
  437. $.fn.dropdown.noConflict = function () {
  438. $.fn.dropdown = old
  439. return this
  440. }
  441. // APPLY TO STANDARD DROPDOWN ELEMENTS
  442. // ===================================
  443. $(document)
  444. .on('click.bs.dropdown.data-api', clearMenus)
  445. .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
  446. .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
  447. .on('keydown.bs.dropdown.data-api', toggle + ', [role="menu"], [role="listbox"]', Dropdown.prototype.keydown)
  448. }(jQuery);
  449. /* ========================================================================
  450. * Bootstrap: modal.js v3.2.0
  451. * http://getbootstrap.com/javascript/#modals
  452. * ========================================================================
  453. * Copyright 2011-2014 Twitter, Inc.
  454. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  455. * ======================================================================== */
  456. +function ($) {
  457. 'use strict';
  458. // MODAL CLASS DEFINITION
  459. // ======================
  460. var Modal = function (element, options) {
  461. this.options = options
  462. this.$body = $(document.body)
  463. this.$element = $(element)
  464. this.$backdrop =
  465. this.isShown = null
  466. this.scrollbarWidth = 0
  467. if (this.options.remote) {
  468. this.$element
  469. .find('.modal-content')
  470. .load(this.options.remote, $.proxy(function () {
  471. this.$element.trigger('loaded.bs.modal')
  472. }, this))
  473. }
  474. }
  475. Modal.VERSION = '3.2.0'
  476. Modal.DEFAULTS = {
  477. backdrop: true,
  478. keyboard: true,
  479. show: true
  480. }
  481. Modal.prototype.toggle = function (_relatedTarget) {
  482. return this.isShown ? this.hide() : this.show(_relatedTarget)
  483. }
  484. Modal.prototype.show = function (_relatedTarget) {
  485. var that = this
  486. var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
  487. this.$element.trigger(e)
  488. if (this.isShown || e.isDefaultPrevented()) return
  489. this.isShown = true
  490. this.checkScrollbar()
  491. this.$body.addClass('modal-open')
  492. this.setScrollbar()
  493. this.escape()
  494. this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
  495. this.backdrop(function () {
  496. var transition = $.support.transition && that.$element.hasClass('fade')
  497. if (!that.$element.parent().length) {
  498. that.$element.appendTo(that.$body) // don't move modals dom position
  499. }
  500. that.$element
  501. .show()
  502. .scrollTop(0)
  503. if (transition) {
  504. that.$element[0].offsetWidth // force reflow
  505. }
  506. that.$element
  507. .addClass('in')
  508. .attr('aria-hidden', false)
  509. that.enforceFocus()
  510. var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
  511. transition ?
  512. that.$element.find('.modal-dialog') // wait for modal to slide in
  513. .one('bsTransitionEnd', function () {
  514. that.$element.trigger('focus').trigger(e)
  515. })
  516. .emulateTransitionEnd(300) :
  517. that.$element.trigger('focus').trigger(e)
  518. })
  519. }
  520. Modal.prototype.hide = function (e) {
  521. if (e) e.preventDefault()
  522. e = $.Event('hide.bs.modal')
  523. this.$element.trigger(e)
  524. if (!this.isShown || e.isDefaultPrevented()) return
  525. this.isShown = false
  526. this.$body.removeClass('modal-open')
  527. this.resetScrollbar()
  528. this.escape()
  529. $(document).off('focusin.bs.modal')
  530. this.$element
  531. .removeClass('in')
  532. .attr('aria-hidden', true)
  533. .off('click.dismiss.bs.modal')
  534. $.support.transition && this.$element.hasClass('fade') ?
  535. this.$element
  536. .one('bsTransitionEnd', $.proxy(this.hideModal, this))
  537. .emulateTransitionEnd(300) :
  538. this.hideModal()
  539. }
  540. Modal.prototype.enforceFocus = function () {
  541. $(document)
  542. .off('focusin.bs.modal') // guard against infinite focus loop
  543. .on('focusin.bs.modal', $.proxy(function (e) {
  544. if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
  545. this.$element.trigger('focus')
  546. }
  547. }, this))
  548. }
  549. Modal.prototype.escape = function () {
  550. if (this.isShown && this.options.keyboard) {
  551. this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
  552. e.which == 27 && this.hide()
  553. }, this))
  554. } else if (!this.isShown) {
  555. this.$element.off('keydown.dismiss.bs.modal')
  556. }
  557. }
  558. Modal.prototype.hideModal = function () {
  559. var that = this
  560. this.$element.hide()
  561. this.backdrop(function () {
  562. that.$element.trigger('hidden.bs.modal')
  563. })
  564. }
  565. Modal.prototype.removeBackdrop = function () {
  566. this.$backdrop && this.$backdrop.remove()
  567. this.$backdrop = null
  568. }
  569. Modal.prototype.backdrop = function (callback) {
  570. var that = this
  571. var animate = this.$element.hasClass('fade') ? 'fade' : ''
  572. if (this.isShown && this.options.backdrop) {
  573. var doAnimate = $.support.transition && animate
  574. this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
  575. .appendTo(this.$body)
  576. this.$element.on('mousedown.dismiss.bs.modal', $.proxy(function (e) {
  577. if (e.target !== e.currentTarget) return
  578. this.options.backdrop == 'static'
  579. ? this.$element[0].focus.call(this.$element[0])
  580. : this.hide.call(this)
  581. }, this))
  582. if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
  583. this.$backdrop.addClass('in')
  584. if (!callback) return
  585. doAnimate ?
  586. this.$backdrop
  587. .one('bsTransitionEnd', callback)
  588. .emulateTransitionEnd(150) :
  589. callback()
  590. } else if (!this.isShown && this.$backdrop) {
  591. this.$backdrop.removeClass('in')
  592. var callbackRemove = function () {
  593. that.removeBackdrop()
  594. callback && callback()
  595. }
  596. $.support.transition && this.$element.hasClass('fade') ?
  597. this.$backdrop
  598. .one('bsTransitionEnd', callbackRemove)
  599. .emulateTransitionEnd(150) :
  600. callbackRemove()
  601. } else if (callback) {
  602. callback()
  603. }
  604. }
  605. Modal.prototype.checkScrollbar = function () {
  606. if (document.body.clientWidth >= window.innerWidth) return
  607. this.scrollbarWidth = this.scrollbarWidth || this.measureScrollbar()
  608. }
  609. Modal.prototype.setScrollbar = function () {
  610. var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
  611. if (this.scrollbarWidth) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
  612. }
  613. Modal.prototype.resetScrollbar = function () {
  614. this.$body.css('padding-right', '')
  615. }
  616. Modal.prototype.measureScrollbar = function () { // thx walsh
  617. var scrollDiv = document.createElement('div')
  618. scrollDiv.className = 'modal-scrollbar-measure'
  619. this.$body.append(scrollDiv)
  620. var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
  621. this.$body[0].removeChild(scrollDiv)
  622. return scrollbarWidth
  623. }
  624. // MODAL PLUGIN DEFINITION
  625. // =======================
  626. function Plugin(option, _relatedTarget) {
  627. return this.each(function () {
  628. var $this = $(this)
  629. var data = $this.data('bs.modal')
  630. var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
  631. if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
  632. if (typeof option == 'string') data[option](_relatedTarget)
  633. else if (options.show) data.show(_relatedTarget)
  634. })
  635. }
  636. var old = $.fn.modal
  637. $.fn.modal = Plugin
  638. $.fn.modal.Constructor = Modal
  639. // MODAL NO CONFLICT
  640. // =================
  641. $.fn.modal.noConflict = function () {
  642. $.fn.modal = old
  643. return this
  644. }
  645. // MODAL DATA-API
  646. // ==============
  647. $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
  648. var $this = $(this)
  649. var href = $this.attr('href')
  650. var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
  651. var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
  652. if ($this.is('a')) e.preventDefault()
  653. $target.one('show.bs.modal', function (showEvent) {
  654. if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
  655. $target.one('hidden.bs.modal', function () {
  656. $this.is(':visible') && $this.trigger('focus')
  657. })
  658. })
  659. Plugin.call($target, option, this)
  660. })
  661. }(jQuery);
  662. /* ========================================================================
  663. * Bootstrap: tooltip.js v3.2.0
  664. * http://getbootstrap.com/javascript/#tooltip
  665. * Inspired by the original jQuery.tipsy by Jason Frame
  666. * ========================================================================
  667. * Copyright 2011-2014 Twitter, Inc.
  668. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  669. * ======================================================================== */
  670. +function ($) {
  671. 'use strict';
  672. // TOOLTIP PUBLIC CLASS DEFINITION
  673. // ===============================
  674. var Tooltip = function (element, options) {
  675. this.type =
  676. this.options =
  677. this.enabled =
  678. this.timeout =
  679. this.hoverState =
  680. this.$element = null
  681. this.init('tooltip', element, options)
  682. }
  683. Tooltip.VERSION = '3.2.0'
  684. Tooltip.DEFAULTS = {
  685. animation: true,
  686. placement: 'top',
  687. selector: false,
  688. template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
  689. trigger: 'hover focus',
  690. title: '',
  691. delay: 0,
  692. html: false,
  693. container: false,
  694. viewport: {
  695. selector: 'body',
  696. padding: 0
  697. }
  698. }
  699. Tooltip.prototype.init = function (type, element, options) {
  700. this.enabled = true
  701. this.type = type
  702. this.$element = $(element)
  703. this.options = this.getOptions(options)
  704. this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport)
  705. var triggers = this.options.trigger.split(' ')
  706. for (var i = triggers.length; i--;) {
  707. var trigger = triggers[i]
  708. if (trigger == 'click') {
  709. this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
  710. } else if (trigger != 'manual') {
  711. var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
  712. var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
  713. this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
  714. this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
  715. }
  716. }
  717. this.options.selector ?
  718. (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
  719. this.fixTitle()
  720. }
  721. Tooltip.prototype.getDefaults = function () {
  722. return Tooltip.DEFAULTS
  723. }
  724. Tooltip.prototype.getOptions = function (options) {
  725. options = $.extend({}, this.getDefaults(), this.$element.data(), options)
  726. if (options.delay && typeof options.delay == 'number') {
  727. options.delay = {
  728. show: options.delay,
  729. hide: options.delay
  730. }
  731. }
  732. return options
  733. }
  734. Tooltip.prototype.getDelegateOptions = function () {
  735. var options = {}
  736. var defaults = this.getDefaults()
  737. this._options && $.each(this._options, function (key, value) {
  738. if (defaults[key] != value) options[key] = value
  739. })
  740. return options
  741. }
  742. Tooltip.prototype.enter = function (obj) {
  743. var self = obj instanceof this.constructor ?
  744. obj : $(obj.currentTarget).data('bs.' + this.type)
  745. if (!self) {
  746. self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
  747. $(obj.currentTarget).data('bs.' + this.type, self)
  748. }
  749. clearTimeout(self.timeout)
  750. self.hoverState = 'in'
  751. if (!self.options.delay || !self.options.delay.show) return self.show()
  752. self.timeout = setTimeout(function () {
  753. if (self.hoverState == 'in') self.show()
  754. }, self.options.delay.show)
  755. }
  756. Tooltip.prototype.leave = function (obj) {
  757. var self = obj instanceof this.constructor ?
  758. obj : $(obj.currentTarget).data('bs.' + this.type)
  759. if (!self) {
  760. self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
  761. $(obj.currentTarget).data('bs.' + this.type, self)
  762. }
  763. clearTimeout(self.timeout)
  764. self.hoverState = 'out'
  765. if (!self.options.delay || !self.options.delay.hide) return self.hide()
  766. self.timeout = setTimeout(function () {
  767. if (self.hoverState == 'out') self.hide()
  768. }, self.options.delay.hide)
  769. }
  770. Tooltip.prototype.show = function () {
  771. var e = $.Event('show.bs.' + this.type)
  772. if (this.hasContent() && this.enabled) {
  773. this.$element.trigger(e)
  774. var inDom = $.contains(document.documentElement, this.$element[0])
  775. if (e.isDefaultPrevented() || !inDom) return
  776. var that = this
  777. var $tip = this.tip()
  778. var tipId = this.getUID(this.type)
  779. this.setContent()
  780. $tip.attr('id', tipId)
  781. this.$element.attr('aria-describedby', tipId)
  782. if (this.options.animation) $tip.addClass('fade')
  783. var placement = typeof this.options.placement == 'function' ?
  784. this.options.placement.call(this, $tip[0], this.$element[0]) :
  785. this.options.placement
  786. var autoToken = /\s?auto?\s?/i
  787. var autoPlace = autoToken.test(placement)
  788. if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
  789. $tip
  790. .detach()
  791. .css({ top: 0, left: 0, display: 'block' })
  792. .addClass(placement)
  793. .data('bs.' + this.type, this)
  794. this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
  795. var pos = this.getPosition()
  796. var actualWidth = $tip[0].offsetWidth
  797. var actualHeight = $tip[0].offsetHeight
  798. if (autoPlace) {
  799. var orgPlacement = placement
  800. var $parent = this.$element.parent()
  801. var parentDim = this.getPosition($parent)
  802. placement = placement == 'bottom' && pos.top + pos.height + actualHeight - parentDim.scroll > parentDim.height ? 'top' :
  803. placement == 'top' && pos.top - parentDim.scroll - actualHeight < 0 ? 'bottom' :
  804. placement == 'right' && pos.right + actualWidth > parentDim.width ? 'left' :
  805. placement == 'left' && pos.left - actualWidth < parentDim.left ? 'right' :
  806. placement
  807. $tip
  808. .removeClass(orgPlacement)
  809. .addClass(placement)
  810. }
  811. var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
  812. this.applyPlacement(calculatedOffset, placement)
  813. var complete = function () {
  814. that.$element.trigger('shown.bs.' + that.type)
  815. that.hoverState = null
  816. }
  817. $.support.transition && this.$tip.hasClass('fade') ?
  818. $tip
  819. .one('bsTransitionEnd', complete)
  820. .emulateTransitionEnd(150) :
  821. complete()
  822. }
  823. }
  824. Tooltip.prototype.applyPlacement = function (offset, placement) {
  825. var $tip = this.tip()
  826. var width = $tip[0].offsetWidth
  827. var height = $tip[0].offsetHeight
  828. // manually read margins because getBoundingClientRect includes difference
  829. var marginTop = parseInt($tip.css('margin-top'), 10)
  830. var marginLeft = parseInt($tip.css('margin-left'), 10)
  831. // we must check for NaN for ie 8/9
  832. if (isNaN(marginTop)) marginTop = 0
  833. if (isNaN(marginLeft)) marginLeft = 0
  834. offset.top = offset.top + marginTop
  835. offset.left = offset.left + marginLeft
  836. // $.fn.offset doesn't round pixel values
  837. // so we use setOffset directly with our own function B-0
  838. $.offset.setOffset($tip[0], $.extend({
  839. using: function (props) {
  840. $tip.css({
  841. top: Math.round(props.top),
  842. left: Math.round(props.left)
  843. })
  844. }
  845. }, offset), 0)
  846. $tip.addClass('in')
  847. // check to see if placing tip in new offset caused the tip to resize itself
  848. var actualWidth = $tip[0].offsetWidth
  849. var actualHeight = $tip[0].offsetHeight
  850. if (placement == 'top' && actualHeight != height) {
  851. offset.top = offset.top + height - actualHeight
  852. }
  853. var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
  854. if (delta.left) offset.left += delta.left
  855. else offset.top += delta.top
  856. var arrowDelta = delta.left ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
  857. var arrowPosition = delta.left ? 'left' : 'top'
  858. var arrowOffsetPosition = delta.left ? 'offsetWidth' : 'offsetHeight'
  859. $tip.offset(offset)
  860. this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], arrowPosition)
  861. }
  862. Tooltip.prototype.replaceArrow = function (delta, dimension, position) {
  863. this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + '%') : '')
  864. }
  865. Tooltip.prototype.setContent = function () {
  866. var $tip = this.tip()
  867. var title = this.getTitle()
  868. $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
  869. $tip.removeClass('fade in top bottom left right')
  870. }
  871. Tooltip.prototype.hide = function () {
  872. var that = this
  873. var $tip = this.tip()
  874. var e = $.Event('hide.bs.' + this.type)
  875. this.$element.removeAttr('aria-describedby')
  876. function complete() {
  877. if (that.hoverState != 'in') $tip.detach()
  878. that.$element.trigger('hidden.bs.' + that.type)
  879. }
  880. this.$element.trigger(e)
  881. if (e.isDefaultPrevented()) return
  882. $tip.removeClass('in')
  883. $.support.transition && this.$tip.hasClass('fade') ?
  884. $tip
  885. .one('bsTransitionEnd', complete)
  886. .emulateTransitionEnd(150) :
  887. complete()
  888. this.hoverState = null
  889. return this
  890. }
  891. Tooltip.prototype.fixTitle = function () {
  892. var $e = this.$element
  893. if ($e.attr('title') || typeof ($e.attr('data-original-title')) != 'string') {
  894. $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
  895. }
  896. }
  897. Tooltip.prototype.hasContent = function () {
  898. return this.getTitle()
  899. }
  900. Tooltip.prototype.getPosition = function ($element) {
  901. $element = $element || this.$element
  902. var el = $element[0]
  903. var isBody = el.tagName == 'BODY'
  904. var isSvg = window.SVGElement && el instanceof window.SVGElement
  905. var elRect = el.getBoundingClientRect ? el.getBoundingClientRect() : null
  906. var elOffset = isBody ? { top: 0, left: 0 } : $element.offset()
  907. var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
  908. var outerDims = isSvg ? {} : {
  909. width: isBody ? $(window).width() : $element.outerWidth(),
  910. height: isBody ? $(window).height() : $element.outerHeight()
  911. }
  912. return $.extend({}, elRect, scroll, outerDims, elOffset)
  913. }
  914. Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
  915. return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
  916. placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
  917. placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
  918. /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
  919. }
  920. Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
  921. var delta = { top: 0, left: 0 }
  922. if (!this.$viewport) return delta
  923. var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
  924. var viewportDimensions = this.getPosition(this.$viewport)
  925. if (/right|left/.test(placement)) {
  926. var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll
  927. var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
  928. if (topEdgeOffset < viewportDimensions.top) { // top overflow
  929. delta.top = viewportDimensions.top - topEdgeOffset
  930. } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
  931. delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
  932. }
  933. } else {
  934. var leftEdgeOffset = pos.left - viewportPadding
  935. var rightEdgeOffset = pos.left + viewportPadding + actualWidth
  936. if (leftEdgeOffset < viewportDimensions.left) { // left overflow
  937. delta.left = viewportDimensions.left - leftEdgeOffset
  938. } else if (rightEdgeOffset > viewportDimensions.width) { // right overflow
  939. delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
  940. }
  941. }
  942. return delta
  943. }
  944. Tooltip.prototype.getTitle = function () {
  945. var title
  946. var $e = this.$element
  947. var o = this.options
  948. title = $e.attr('data-original-title')
  949. || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
  950. return title
  951. }
  952. Tooltip.prototype.getUID = function (prefix) {
  953. do prefix += ~~(Math.random() * 1000000)
  954. while (document.getElementById(prefix))
  955. return prefix
  956. }
  957. Tooltip.prototype.tip = function () {
  958. return (this.$tip = this.$tip || $(this.options.template))
  959. }
  960. Tooltip.prototype.arrow = function () {
  961. return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
  962. }
  963. Tooltip.prototype.validate = function () {
  964. if (!this.$element[0].parentNode) {
  965. this.hide()
  966. this.$element = null
  967. this.options = null
  968. }
  969. }
  970. Tooltip.prototype.enable = function () {
  971. this.enabled = true
  972. }
  973. Tooltip.prototype.disable = function () {
  974. this.enabled = false
  975. }
  976. Tooltip.prototype.toggleEnabled = function () {
  977. this.enabled = !this.enabled
  978. }
  979. Tooltip.prototype.toggle = function (e) {
  980. var self = this
  981. if (e) {
  982. self = $(e.currentTarget).data('bs.' + this.type)
  983. if (!self) {
  984. self = new this.constructor(e.currentTarget, this.getDelegateOptions())
  985. $(e.currentTarget).data('bs.' + this.type, self)
  986. }
  987. }
  988. self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
  989. }
  990. Tooltip.prototype.destroy = function () {
  991. clearTimeout(this.timeout)
  992. this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
  993. }
  994. // TOOLTIP PLUGIN DEFINITION
  995. // =========================
  996. function Plugin(option) {
  997. return this.each(function () {
  998. var $this = $(this)
  999. var data = $this.data('bs.tooltip')
  1000. var options = typeof option == 'object' && option
  1001. if (!data && option == 'destroy') return
  1002. if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
  1003. if (typeof option == 'string') data[option]()
  1004. })
  1005. }
  1006. var old = $.fn.tooltip
  1007. $.fn.tooltip = Plugin
  1008. $.fn.tooltip.Constructor = Tooltip
  1009. // TOOLTIP NO CONFLICT
  1010. // ===================
  1011. $.fn.tooltip.noConflict = function () {
  1012. $.fn.tooltip = old
  1013. return this
  1014. }
  1015. }(jQuery);
  1016. /* ========================================================================
  1017. * Bootstrap: popover.js v3.2.0
  1018. * http://getbootstrap.com/javascript/#popovers
  1019. * ========================================================================
  1020. * Copyright 2011-2014 Twitter, Inc.
  1021. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  1022. * ======================================================================== */
  1023. +function ($) {
  1024. 'use strict';
  1025. // POPOVER PUBLIC CLASS DEFINITION
  1026. // ===============================
  1027. var Popover = function (element, options) {
  1028. this.init('popover', element, options)
  1029. }
  1030. if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
  1031. Popover.VERSION = '3.2.0'
  1032. Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
  1033. placement: 'right',
  1034. trigger: 'click',
  1035. content: '',
  1036. template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
  1037. })
  1038. // NOTE: POPOVER EXTENDS tooltip.js
  1039. // ================================
  1040. Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
  1041. Popover.prototype.constructor = Popover
  1042. Popover.prototype.getDefaults = function () {
  1043. return Popover.DEFAULTS
  1044. }
  1045. Popover.prototype.setContent = function () {
  1046. var $tip = this.tip()
  1047. var title = this.getTitle()
  1048. var content = this.getContent()
  1049. $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
  1050. $tip.find('.popover-content').empty()[ // we use append for html objects to maintain js events
  1051. this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
  1052. ](content)
  1053. $tip.removeClass('fade top bottom left right in')
  1054. // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
  1055. // this manually by checking the contents.
  1056. if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
  1057. }
  1058. Popover.prototype.hasContent = function () {
  1059. return this.getTitle() || this.getContent()
  1060. }
  1061. Popover.prototype.getContent = function () {
  1062. var $e = this.$element
  1063. var o = this.options
  1064. return $e.attr('data-content')
  1065. || (typeof o.content == 'function' ?
  1066. o.content.call($e[0]) :
  1067. o.content)
  1068. }
  1069. Popover.prototype.arrow = function () {
  1070. return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
  1071. }
  1072. Popover.prototype.tip = function () {
  1073. if (!this.$tip) this.$tip = $(this.options.template)
  1074. return this.$tip
  1075. }
  1076. // POPOVER PLUGIN DEFINITION
  1077. // =========================
  1078. function Plugin(option) {
  1079. return this.each(function () {
  1080. var $this = $(this)
  1081. var data = $this.data('bs.popover')
  1082. var options = typeof option == 'object' && option
  1083. if (!data && option == 'destroy') return
  1084. if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
  1085. if (typeof option == 'string') data[option]()
  1086. })
  1087. }
  1088. var old = $.fn.popover
  1089. $.fn.popover = Plugin
  1090. $.fn.popover.Constructor = Popover
  1091. // POPOVER NO CONFLICT
  1092. // ===================
  1093. $.fn.popover.noConflict = function () {
  1094. $.fn.popover = old
  1095. return this
  1096. }
  1097. }(jQuery);
  1098. /* ========================================================================
  1099. * Bootstrap: tab.js v3.2.0
  1100. * http://getbootstrap.com/javascript/#tabs
  1101. * ========================================================================
  1102. * Copyright 2011-2014 Twitter, Inc.
  1103. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  1104. * ======================================================================== */
  1105. +function ($) {
  1106. 'use strict';
  1107. // TAB CLASS DEFINITION
  1108. // ====================
  1109. var Tab = function (element) {
  1110. this.element = $(element)
  1111. }
  1112. Tab.VERSION = '3.2.0'
  1113. Tab.prototype.show = function () {
  1114. var $this = this.element
  1115. var $ul = $this.closest('ul:not(.dropdown-menu)')
  1116. var selector = $this.data('target')
  1117. if (!selector) {
  1118. selector = $this.attr('href')
  1119. selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  1120. }
  1121. if ($this.parent('li').hasClass('active')) return
  1122. var previous = $ul.find('.active:last a')[0]
  1123. var e = $.Event('show.bs.tab', {
  1124. relatedTarget: previous
  1125. })
  1126. $this.trigger(e)
  1127. if (e.isDefaultPrevented()) return
  1128. var $target = $(selector)
  1129. this.activate($this.closest('li'), $ul)
  1130. this.activate($target, $target.parent(), function () {
  1131. $this.trigger({
  1132. type: 'shown.bs.tab',
  1133. relatedTarget: previous
  1134. })
  1135. })
  1136. }
  1137. Tab.prototype.activate = function (element, container, callback) {
  1138. var $active = container.find('> .active')
  1139. var transition = callback
  1140. && $.support.transition
  1141. && (($active.length && $active.hasClass('fade')) || !!container.find('> .fade').length)
  1142. function next() {
  1143. $active
  1144. .removeClass('active')
  1145. .find('> .dropdown-menu > .active')
  1146. .removeClass('active')
  1147. element.addClass('active')
  1148. if (transition) {
  1149. element[0].offsetWidth // reflow for transition
  1150. element.addClass('in')
  1151. } else {
  1152. element.removeClass('fade')
  1153. }
  1154. if (element.parent('.dropdown-menu')) {
  1155. element.closest('li.dropdown').addClass('active')
  1156. }
  1157. callback && callback()
  1158. }
  1159. $active.length && transition ?
  1160. $active
  1161. .one('bsTransitionEnd', next)
  1162. .emulateTransitionEnd(150) :
  1163. next()
  1164. $active.removeClass('in')
  1165. }
  1166. // TAB PLUGIN DEFINITION
  1167. // =====================
  1168. function Plugin(option) {
  1169. return this.each(function () {
  1170. var $this = $(this)
  1171. var data = $this.data('bs.tab')
  1172. if (!data) $this.data('bs.tab', (data = new Tab(this)))
  1173. if (typeof option == 'string') data[option]()
  1174. })
  1175. }
  1176. var old = $.fn.tab
  1177. $.fn.tab = Plugin
  1178. $.fn.tab.Constructor = Tab
  1179. // TAB NO CONFLICT
  1180. // ===============
  1181. $.fn.tab.noConflict = function () {
  1182. $.fn.tab = old
  1183. return this
  1184. }
  1185. // TAB DATA-API
  1186. // ============
  1187. $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
  1188. e.preventDefault()
  1189. Plugin.call($(this), 'show')
  1190. })
  1191. }(jQuery);
  1192. /* ========================================================================
  1193. * Bootstrap: affix.js v3.2.0
  1194. * http://getbootstrap.com/javascript/#affix
  1195. * ========================================================================
  1196. * Copyright 2011-2014 Twitter, Inc.
  1197. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  1198. * ======================================================================== */
  1199. +function ($) {
  1200. 'use strict';
  1201. // AFFIX CLASS DEFINITION
  1202. // ======================
  1203. var Affix = function (element, options) {
  1204. this.options = $.extend({}, Affix.DEFAULTS, options)
  1205. this.$target = $(this.options.target)
  1206. .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
  1207. .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
  1208. this.$element = $(element)
  1209. this.affixed =
  1210. this.unpin =
  1211. this.pinnedOffset = null
  1212. this.checkPosition()
  1213. }
  1214. Affix.VERSION = '3.2.0'
  1215. Affix.RESET = 'affix affix-top affix-bottom'
  1216. Affix.DEFAULTS = {
  1217. offset: 0,
  1218. target: window
  1219. }
  1220. Affix.prototype.getPinnedOffset = function () {
  1221. if (this.pinnedOffset) return this.pinnedOffset
  1222. this.$element.removeClass(Affix.RESET).addClass('affix')
  1223. var scrollTop = this.$target.scrollTop()
  1224. var position = this.$element.offset()
  1225. return (this.pinnedOffset = position.top - scrollTop)
  1226. }
  1227. Affix.prototype.checkPositionWithEventLoop = function () {
  1228. setTimeout($.proxy(this.checkPosition, this), 1)
  1229. }
  1230. Affix.prototype.checkPosition = function () {
  1231. if (!this.$element.is(':visible')) return
  1232. var scrollHeight = $(document).height()
  1233. var scrollTop = this.$target.scrollTop()
  1234. var position = this.$element.offset()
  1235. var offset = this.options.offset
  1236. var offsetTop = offset.top
  1237. var offsetBottom = offset.bottom
  1238. if (typeof offset != 'object') offsetBottom = offsetTop = offset
  1239. if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
  1240. if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
  1241. var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
  1242. offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
  1243. offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
  1244. if (this.affixed === affix) return
  1245. if (this.unpin != null) this.$element.css('top', '')
  1246. var affixType = 'affix' + (affix ? '-' + affix : '')
  1247. var e = $.Event(affixType + '.bs.affix')
  1248. this.$element.trigger(e)
  1249. if (e.isDefaultPrevented()) return
  1250. this.affixed = affix
  1251. this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
  1252. this.$element
  1253. .removeClass(Affix.RESET)
  1254. .addClass(affixType)
  1255. .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
  1256. if (affix == 'bottom') {
  1257. this.$element.offset({
  1258. top: scrollHeight - this.$element.height() - offsetBottom
  1259. })
  1260. }
  1261. }
  1262. // AFFIX PLUGIN DEFINITION
  1263. // =======================
  1264. function Plugin(option) {
  1265. return this.each(function () {
  1266. var $this = $(this)
  1267. var data = $this.data('bs.affix')
  1268. var options = typeof option == 'object' && option
  1269. if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
  1270. if (typeof option == 'string') data[option]()
  1271. })
  1272. }
  1273. var old = $.fn.affix
  1274. $.fn.affix = Plugin
  1275. $.fn.affix.Constructor = Affix
  1276. // AFFIX NO CONFLICT
  1277. // =================
  1278. $.fn.affix.noConflict = function () {
  1279. $.fn.affix = old
  1280. return this
  1281. }
  1282. // AFFIX DATA-API
  1283. // ==============
  1284. $(window).on('load', function () {
  1285. $('[data-spy="affix"]').each(function () {
  1286. var $spy = $(this)
  1287. var data = $spy.data()
  1288. data.offset = data.offset || {}
  1289. if (data.offsetBottom) data.offset.bottom = data.offsetBottom
  1290. if (data.offsetTop) data.offset.top = data.offsetTop
  1291. Plugin.call($spy, data)
  1292. })
  1293. })
  1294. }(jQuery);
  1295. /* ========================================================================
  1296. * Bootstrap: collapse.js v3.2.0
  1297. * http://getbootstrap.com/javascript/#collapse
  1298. * ========================================================================
  1299. * Copyright 2011-2014 Twitter, Inc.
  1300. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  1301. * ======================================================================== */
  1302. +function ($) {
  1303. 'use strict';
  1304. // COLLAPSE PUBLIC CLASS DEFINITION
  1305. // ================================
  1306. var Collapse = function (element, options) {
  1307. this.$element = $(element)
  1308. this.options = $.extend({}, Collapse.DEFAULTS, options)
  1309. this.transitioning = null
  1310. if (this.options.parent) this.$parent = $(this.options.parent)
  1311. if (this.options.toggle) this.toggle()
  1312. }
  1313. Collapse.VERSION = '3.2.0'
  1314. Collapse.DEFAULTS = {
  1315. toggle: true
  1316. }
  1317. Collapse.prototype.dimension = function () {
  1318. var hasWidth = this.$element.hasClass('width')
  1319. return hasWidth ? 'width' : 'height'
  1320. }
  1321. Collapse.prototype.show = function () {
  1322. if (this.transitioning || this.$element.hasClass('in')) return
  1323. var startEvent = $.Event('show.bs.collapse')
  1324. this.$element.trigger(startEvent)
  1325. if (startEvent.isDefaultPrevented()) return
  1326. var actives = this.$parent && this.$parent.find('> .panel > .in')
  1327. if (actives && actives.length) {
  1328. var hasData = actives.data('bs.collapse')
  1329. if (hasData && hasData.transitioning) return
  1330. Plugin.call(actives, 'hide')
  1331. hasData || actives.data('bs.collapse', null)
  1332. }
  1333. var dimension = this.dimension()
  1334. this.$element
  1335. .removeClass('collapse')
  1336. .addClass('collapsing')[dimension](0)
  1337. this.transitioning = 1
  1338. var complete = function () {
  1339. this.$element
  1340. .removeClass('collapsing')
  1341. .addClass('collapse in')[dimension]('')
  1342. this.transitioning = 0
  1343. this.$element
  1344. .trigger('shown.bs.collapse')
  1345. }
  1346. if (!$.support.transition) return complete.call(this)
  1347. var scrollSize = $.camelCase(['scroll', dimension].join('-'))
  1348. this.$element
  1349. .one('bsTransitionEnd', $.proxy(complete, this))
  1350. .emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize])
  1351. }
  1352. Collapse.prototype.hide = function () {
  1353. if (this.transitioning || !this.$element.hasClass('in')) return
  1354. var startEvent = $.Event('hide.bs.collapse')
  1355. this.$element.trigger(startEvent)
  1356. if (startEvent.isDefaultPrevented()) return
  1357. var dimension = this.dimension()
  1358. this.$element[dimension](this.$element[dimension]())[0].offsetHeight
  1359. this.$element
  1360. .addClass('collapsing')
  1361. .removeClass('collapse in')
  1362. this.transitioning = 1
  1363. var complete = function () {
  1364. this.transitioning = 0
  1365. this.$element
  1366. .trigger('hidden.bs.collapse')
  1367. .removeClass('collapsing')
  1368. .addClass('collapse')
  1369. }
  1370. if (!$.support.transition) return complete.call(this)
  1371. this.$element
  1372. [dimension](0)
  1373. .one('bsTransitionEnd', $.proxy(complete, this))
  1374. .emulateTransitionEnd(350)
  1375. }
  1376. Collapse.prototype.toggle = function () {
  1377. this[this.$element.hasClass('in') ? 'hide' : 'show']()
  1378. }
  1379. // COLLAPSE PLUGIN DEFINITION
  1380. // ==========================
  1381. function Plugin(option) {
  1382. return this.each(function () {
  1383. var $this = $(this)
  1384. var data = $this.data('bs.collapse')
  1385. var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
  1386. if (!data && options.toggle && option == 'show') option = !option
  1387. if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
  1388. if (typeof option == 'string') data[option]()
  1389. })
  1390. }
  1391. var old = $.fn.collapse
  1392. $.fn.collapse = Plugin
  1393. $.fn.collapse.Constructor = Collapse
  1394. // COLLAPSE NO CONFLICT
  1395. // ====================
  1396. $.fn.collapse.noConflict = function () {
  1397. $.fn.collapse = old
  1398. return this
  1399. }
  1400. // COLLAPSE DATA-API
  1401. // =================
  1402. $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
  1403. var href
  1404. var $this = $(this)
  1405. var target = $this.attr('data-target')
  1406. || e.preventDefault()
  1407. || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
  1408. var $target = $(target)
  1409. var data = $target.data('bs.collapse')
  1410. var option = data ? 'toggle' : $this.data()
  1411. var parent = $this.attr('data-parent')
  1412. var $parent = parent && $(parent)
  1413. if (!data || !data.transitioning) {
  1414. if ($parent) $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
  1415. $this.toggleClass('collapsed', $target.hasClass('in'))
  1416. }
  1417. Plugin.call($target, option)
  1418. })
  1419. }(jQuery);
  1420. /* ========================================================================
  1421. * Bootstrap: scrollspy.js v3.2.0
  1422. * http://getbootstrap.com/javascript/#scrollspy
  1423. * ========================================================================
  1424. * Copyright 2011-2014 Twitter, Inc.
  1425. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  1426. * ======================================================================== */
  1427. +function ($) {
  1428. 'use strict';
  1429. // SCROLLSPY CLASS DEFINITION
  1430. // ==========================
  1431. function ScrollSpy(element, options) {
  1432. var process = $.proxy(this.process, this)
  1433. this.$body = $('body')
  1434. this.$scrollElement = $(element).is('body') ? $(window) : $(element)
  1435. this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
  1436. this.selector = (this.options.target || '') + ' .nav li > a'
  1437. this.offsets = []
  1438. this.targets = []
  1439. this.activeTarget = null
  1440. this.scrollHeight = 0
  1441. this.$scrollElement.on('scroll.bs.scrollspy', process)
  1442. this.refresh()
  1443. this.process()
  1444. }
  1445. ScrollSpy.VERSION = '3.2.0'
  1446. ScrollSpy.DEFAULTS = {
  1447. offset: 10
  1448. }
  1449. ScrollSpy.prototype.getScrollHeight = function () {
  1450. return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
  1451. }
  1452. ScrollSpy.prototype.refresh = function () {
  1453. var offsetMethod = 'offset'
  1454. var offsetBase = 0
  1455. if (!$.isWindow(this.$scrollElement[0])) {
  1456. offsetMethod = 'position'
  1457. offsetBase = this.$scrollElement.scrollTop()
  1458. }
  1459. this.offsets = []
  1460. this.targets = []
  1461. this.scrollHeight = this.getScrollHeight()
  1462. var self = this
  1463. this.$body
  1464. .find(this.selector)
  1465. .map(function () {
  1466. var $el = $(this)
  1467. var href = $el.data('target') || $el.attr('href')
  1468. var $href = /^#./.test(href) && $(href)
  1469. return ($href
  1470. && $href.length
  1471. && $href.is(':visible')
  1472. && [[$href[offsetMethod]().top + offsetBase, href]]) || null
  1473. })
  1474. .sort(function (a, b) { return a[0] - b[0] })
  1475. .each(function () {
  1476. self.offsets.push(this[0])
  1477. self.targets.push(this[1])
  1478. })
  1479. }
  1480. ScrollSpy.prototype.process = function () {
  1481. var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
  1482. var scrollHeight = this.getScrollHeight()
  1483. var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
  1484. var offsets = this.offsets
  1485. var targets = this.targets
  1486. var activeTarget = this.activeTarget
  1487. var i
  1488. if (this.scrollHeight != scrollHeight) {
  1489. this.refresh()
  1490. }
  1491. if (scrollTop >= maxScroll) {
  1492. return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
  1493. }
  1494. if (activeTarget && scrollTop <= offsets[0]) {
  1495. return activeTarget != (i = targets[0]) && this.activate(i)
  1496. }
  1497. for (i = offsets.length; i--;) {
  1498. activeTarget != targets[i]
  1499. && scrollTop >= offsets[i]
  1500. && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
  1501. && this.activate(targets[i])
  1502. }
  1503. }
  1504. ScrollSpy.prototype.activate = function (target) {
  1505. this.activeTarget = target
  1506. $(this.selector)
  1507. .parentsUntil(this.options.target, '.active')
  1508. .removeClass('active')
  1509. var selector = this.selector +
  1510. '[data-target="' + target + '"],' +
  1511. this.selector + '[href="' + target + '"]'
  1512. var active = $(selector)
  1513. .parents('li')
  1514. .addClass('active')
  1515. if (active.parent('.dropdown-menu').length) {
  1516. active = active
  1517. .closest('li.dropdown')
  1518. .addClass('active')
  1519. }
  1520. active.trigger('activate.bs.scrollspy')
  1521. }
  1522. // SCROLLSPY PLUGIN DEFINITION
  1523. // ===========================
  1524. function Plugin(option) {
  1525. return this.each(function () {
  1526. var $this = $(this)
  1527. var data = $this.data('bs.scrollspy')
  1528. var options = typeof option == 'object' && option
  1529. if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
  1530. if (typeof option == 'string') data[option]()
  1531. })
  1532. }
  1533. var old = $.fn.scrollspy
  1534. $.fn.scrollspy = Plugin
  1535. $.fn.scrollspy.Constructor = ScrollSpy
  1536. // SCROLLSPY NO CONFLICT
  1537. // =====================
  1538. $.fn.scrollspy.noConflict = function () {
  1539. $.fn.scrollspy = old
  1540. return this
  1541. }
  1542. // SCROLLSPY DATA-API
  1543. // ==================
  1544. $(window).on('load.bs.scrollspy.data-api', function () {
  1545. $('[data-spy="scroll"]').each(function () {
  1546. var $spy = $(this)
  1547. Plugin.call($spy, $spy.data())
  1548. })
  1549. })
  1550. }(jQuery);
  1551. /* ========================================================================
  1552. * Bootstrap: transition.js v3.2.0
  1553. * http://getbootstrap.com/javascript/#transitions
  1554. * ========================================================================
  1555. * Copyright 2011-2014 Twitter, Inc.
  1556. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  1557. * ======================================================================== */
  1558. +function ($) {
  1559. 'use strict';
  1560. // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
  1561. // ============================================================
  1562. function transitionEnd() {
  1563. var el = document.createElement('bootstrap')
  1564. var transEndEventNames = {
  1565. WebkitTransition : 'webkitTransitionEnd',
  1566. MozTransition : 'transitionend',
  1567. OTransition : 'oTransitionEnd otransitionend',
  1568. transition : 'transitionend'
  1569. }
  1570. for (var name in transEndEventNames) {
  1571. if (el.style[name] !== undefined) {
  1572. return { end: transEndEventNames[name] }
  1573. }
  1574. }
  1575. return false // explicit for ie8 ( ._.)
  1576. }
  1577. // http://blog.alexmaccaw.com/css-transitions
  1578. $.fn.emulateTransitionEnd = function (duration) {
  1579. var called = false
  1580. var $el = this
  1581. $(this).one('bsTransitionEnd', function () { called = true })
  1582. var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
  1583. setTimeout(callback, duration)
  1584. return this
  1585. }
  1586. $(function () {
  1587. $.support.transition = transitionEnd()
  1588. if (!$.support.transition) return
  1589. $.event.special.bsTransitionEnd = {
  1590. bindType: $.support.transition.end,
  1591. delegateType: $.support.transition.end,
  1592. handle: function (e) {
  1593. if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
  1594. }
  1595. }
  1596. })
  1597. }(jQuery);