bootstrap.js 59 KB

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