1
0

bootstrap.js 68 KB

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