bootstrap.js 68 KB

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