bootstrap.js 67 KB

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