bootstrap.js 65 KB

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