bootstrap.js 64 KB

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