bootstrap.js 72 KB

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