bootstrap.js 66 KB

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