bootstrap.js 64 KB

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