Нет описания

bootstrap.js 67KB

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