25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

2359 satır
67 KiB

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