vis.js is a dynamic, browser-based visualization library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2306 lines
65 KiB

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