bootstrap.js 74 KB

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