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.

2006 lines
57 KiB

  1. /*!
  2. * Bootstrap v3.0.3 (http://getbootstrap.com)
  3. * Copyright 2013 Twitter, Inc.
  4. * Licensed under http://www.apache.org/licenses/LICENSE-2.0
  5. */
  6. if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery") }
  7. /* ========================================================================
  8. * Bootstrap: transition.js v3.0.3
  9. * http://getbootstrap.com/javascript/#transitions
  10. * ========================================================================
  11. * Copyright 2013 Twitter, Inc.
  12. *
  13. * Licensed under the Apache License, Version 2.0 (the "License");
  14. * you may not use this file except in compliance with the License.
  15. * You may obtain a copy of the License at
  16. *
  17. * http://www.apache.org/licenses/LICENSE-2.0
  18. *
  19. * Unless required by applicable law or agreed to in writing, software
  20. * distributed under the License is distributed on an "AS IS" BASIS,
  21. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  22. * See the License for the specific language governing permissions and
  23. * limitations under the License.
  24. * ======================================================================== */
  25. +function ($) { "use strict";
  26. // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
  27. // ============================================================
  28. function transitionEnd() {
  29. var el = document.createElement('bootstrap')
  30. var transEndEventNames = {
  31. 'WebkitTransition' : 'webkitTransitionEnd'
  32. , 'MozTransition' : 'transitionend'
  33. , 'OTransition' : 'oTransitionEnd otransitionend'
  34. , 'transition' : 'transitionend'
  35. }
  36. for (var name in transEndEventNames) {
  37. if (el.style[name] !== undefined) {
  38. return { end: transEndEventNames[name] }
  39. }
  40. }
  41. }
  42. // http://blog.alexmaccaw.com/css-transitions
  43. $.fn.emulateTransitionEnd = function (duration) {
  44. var called = false, $el = this
  45. $(this).one($.support.transition.end, function () { called = true })
  46. var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
  47. setTimeout(callback, duration)
  48. return this
  49. }
  50. $(function () {
  51. $.support.transition = transitionEnd()
  52. })
  53. }(jQuery);
  54. /* ========================================================================
  55. * Bootstrap: alert.js v3.0.3
  56. * http://getbootstrap.com/javascript/#alerts
  57. * ========================================================================
  58. * Copyright 2013 Twitter, Inc.
  59. *
  60. * Licensed under the Apache License, Version 2.0 (the "License");
  61. * you may not use this file except in compliance with the License.
  62. * You may obtain a copy of the License at
  63. *
  64. * http://www.apache.org/licenses/LICENSE-2.0
  65. *
  66. * Unless required by applicable law or agreed to in writing, software
  67. * distributed under the License is distributed on an "AS IS" BASIS,
  68. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  69. * See the License for the specific language governing permissions and
  70. * limitations under the License.
  71. * ======================================================================== */
  72. +function ($) { "use strict";
  73. // ALERT CLASS DEFINITION
  74. // ======================
  75. var dismiss = '[data-dismiss="alert"]'
  76. var Alert = function (el) {
  77. $(el).on('click', dismiss, this.close)
  78. }
  79. Alert.prototype.close = function (e) {
  80. var $this = $(this)
  81. var selector = $this.attr('data-target')
  82. if (!selector) {
  83. selector = $this.attr('href')
  84. selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  85. }
  86. var $parent = $(selector)
  87. if (e) e.preventDefault()
  88. if (!$parent.length) {
  89. $parent = $this.hasClass('alert') ? $this : $this.parent()
  90. }
  91. $parent.trigger(e = $.Event('close.bs.alert'))
  92. if (e.isDefaultPrevented()) return
  93. $parent.removeClass('in')
  94. function removeElement() {
  95. $parent.trigger('closed.bs.alert').remove()
  96. }
  97. $.support.transition && $parent.hasClass('fade') ?
  98. $parent
  99. .one($.support.transition.end, removeElement)
  100. .emulateTransitionEnd(150) :
  101. removeElement()
  102. }
  103. // ALERT PLUGIN DEFINITION
  104. // =======================
  105. var old = $.fn.alert
  106. $.fn.alert = function (option) {
  107. return this.each(function () {
  108. var $this = $(this)
  109. var data = $this.data('bs.alert')
  110. if (!data) $this.data('bs.alert', (data = new Alert(this)))
  111. if (typeof option == 'string') data[option].call($this)
  112. })
  113. }
  114. $.fn.alert.Constructor = Alert
  115. // ALERT NO CONFLICT
  116. // =================
  117. $.fn.alert.noConflict = function () {
  118. $.fn.alert = old
  119. return this
  120. }
  121. // ALERT DATA-API
  122. // ==============
  123. $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
  124. }(jQuery);
  125. /* ========================================================================
  126. * Bootstrap: button.js v3.0.3
  127. * http://getbootstrap.com/javascript/#buttons
  128. * ========================================================================
  129. * Copyright 2013 Twitter, Inc.
  130. *
  131. * Licensed under the Apache License, Version 2.0 (the "License");
  132. * you may not use this file except in compliance with the License.
  133. * You may obtain a copy of the License at
  134. *
  135. * http://www.apache.org/licenses/LICENSE-2.0
  136. *
  137. * Unless required by applicable law or agreed to in writing, software
  138. * distributed under the License is distributed on an "AS IS" BASIS,
  139. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  140. * See the License for the specific language governing permissions and
  141. * limitations under the License.
  142. * ======================================================================== */
  143. +function ($) { "use strict";
  144. // BUTTON PUBLIC CLASS DEFINITION
  145. // ==============================
  146. var Button = function (element, options) {
  147. this.$element = $(element)
  148. this.options = $.extend({}, Button.DEFAULTS, options)
  149. }
  150. Button.DEFAULTS = {
  151. loadingText: 'loading...'
  152. }
  153. Button.prototype.setState = function (state) {
  154. var d = 'disabled'
  155. var $el = this.$element
  156. var val = $el.is('input') ? 'val' : 'html'
  157. var data = $el.data()
  158. state = state + 'Text'
  159. if (!data.resetText) $el.data('resetText', $el[val]())
  160. $el[val](data[state] || this.options[state])
  161. // push to event loop to allow forms to submit
  162. setTimeout(function () {
  163. state == 'loadingText' ?
  164. $el.addClass(d).attr(d, d) :
  165. $el.removeClass(d).removeAttr(d);
  166. }, 0)
  167. }
  168. Button.prototype.toggle = function () {
  169. var $parent = this.$element.closest('[data-toggle="buttons"]')
  170. var changed = true
  171. if ($parent.length) {
  172. var $input = this.$element.find('input')
  173. if ($input.prop('type') === 'radio') {
  174. // see if clicking on current one
  175. if ($input.prop('checked') && this.$element.hasClass('active'))
  176. changed = false
  177. else
  178. $parent.find('.active').removeClass('active')
  179. }
  180. if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
  181. }
  182. if (changed) this.$element.toggleClass('active')
  183. }
  184. // BUTTON PLUGIN DEFINITION
  185. // ========================
  186. var old = $.fn.button
  187. $.fn.button = function (option) {
  188. return this.each(function () {
  189. var $this = $(this)
  190. var data = $this.data('bs.button')
  191. var options = typeof option == 'object' && option
  192. if (!data) $this.data('bs.button', (data = new Button(this, options)))
  193. if (option == 'toggle') data.toggle()
  194. else if (option) data.setState(option)
  195. })
  196. }
  197. $.fn.button.Constructor = Button
  198. // BUTTON NO CONFLICT
  199. // ==================
  200. $.fn.button.noConflict = function () {
  201. $.fn.button = old
  202. return this
  203. }
  204. // BUTTON DATA-API
  205. // ===============
  206. $(document).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. $btn.button('toggle')
  210. e.preventDefault()
  211. })
  212. }(jQuery);
  213. /* ========================================================================
  214. * Bootstrap: carousel.js v3.0.3
  215. * http://getbootstrap.com/javascript/#carousel
  216. * ========================================================================
  217. * Copyright 2013 Twitter, Inc.
  218. *
  219. * Licensed under the Apache License, Version 2.0 (the "License");
  220. * you may not use this file except in compliance with the License.
  221. * You may obtain a copy of the License at
  222. *
  223. * http://www.apache.org/licenses/LICENSE-2.0
  224. *
  225. * Unless required by applicable law or agreed to in writing, software
  226. * distributed under the License is distributed on an "AS IS" BASIS,
  227. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  228. * See the License for the specific language governing permissions and
  229. * limitations under the License.
  230. * ======================================================================== */
  231. +function ($) { "use strict";
  232. // CAROUSEL CLASS DEFINITION
  233. // =========================
  234. var Carousel = function (element, options) {
  235. this.$element = $(element)
  236. this.$indicators = this.$element.find('.carousel-indicators')
  237. this.options = options
  238. this.paused =
  239. this.sliding =
  240. this.interval =
  241. this.$active =
  242. this.$items = null
  243. this.options.pause == 'hover' && this.$element
  244. .on('mouseenter', $.proxy(this.pause, this))
  245. .on('mouseleave', $.proxy(this.cycle, this))
  246. }
  247. Carousel.DEFAULTS = {
  248. interval: 5000
  249. , pause: 'hover'
  250. , wrap: true
  251. }
  252. Carousel.prototype.cycle = function (e) {
  253. e || (this.paused = false)
  254. this.interval && clearInterval(this.interval)
  255. this.options.interval
  256. && !this.paused
  257. && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
  258. return this
  259. }
  260. Carousel.prototype.getActiveIndex = function () {
  261. this.$active = this.$element.find('.item.active')
  262. this.$items = this.$active.parent().children()
  263. return this.$items.index(this.$active)
  264. }
  265. Carousel.prototype.to = function (pos) {
  266. var that = this
  267. var activeIndex = this.getActiveIndex()
  268. if (pos > (this.$items.length - 1) || pos < 0) return
  269. if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) })
  270. if (activeIndex == pos) return this.pause().cycle()
  271. return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
  272. }
  273. Carousel.prototype.pause = function (e) {
  274. e || (this.paused = true)
  275. if (this.$element.find('.next, .prev').length && $.support.transition.end) {
  276. this.$element.trigger($.support.transition.end)
  277. this.cycle(true)
  278. }
  279. this.interval = clearInterval(this.interval)
  280. return this
  281. }
  282. Carousel.prototype.next = function () {
  283. if (this.sliding) return
  284. return this.slide('next')
  285. }
  286. Carousel.prototype.prev = function () {
  287. if (this.sliding) return
  288. return this.slide('prev')
  289. }
  290. Carousel.prototype.slide = function (type, next) {
  291. var $active = this.$element.find('.item.active')
  292. var $next = next || $active[type]()
  293. var isCycling = this.interval
  294. var direction = type == 'next' ? 'left' : 'right'
  295. var fallback = type == 'next' ? 'first' : 'last'
  296. var that = this
  297. if (!$next.length) {
  298. if (!this.options.wrap) return
  299. $next = this.$element.find('.item')[fallback]()
  300. }
  301. this.sliding = true
  302. isCycling && this.pause()
  303. var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction })
  304. if ($next.hasClass('active')) return
  305. if (this.$indicators.length) {
  306. this.$indicators.find('.active').removeClass('active')
  307. this.$element.one('slid.bs.carousel', function () {
  308. var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
  309. $nextIndicator && $nextIndicator.addClass('active')
  310. })
  311. }
  312. if ($.support.transition && this.$element.hasClass('slide')) {
  313. this.$element.trigger(e)
  314. if (e.isDefaultPrevented()) return
  315. $next.addClass(type)
  316. $next[0].offsetWidth // force reflow
  317. $active.addClass(direction)
  318. $next.addClass(direction)
  319. $active
  320. .one($.support.transition.end, function () {
  321. $next.removeClass([type, direction].join(' ')).addClass('active')
  322. $active.removeClass(['active', direction].join(' '))
  323. that.sliding = false
  324. setTimeout(function () { that.$element.trigger('slid.bs.carousel') }, 0)
  325. })
  326. .emulateTransitionEnd(600)
  327. } else {
  328. this.$element.trigger(e)
  329. if (e.isDefaultPrevented()) return
  330. $active.removeClass('active')
  331. $next.addClass('active')
  332. this.sliding = false
  333. this.$element.trigger('slid.bs.carousel')
  334. }
  335. isCycling && this.cycle()
  336. return this
  337. }
  338. // CAROUSEL PLUGIN DEFINITION
  339. // ==========================
  340. var old = $.fn.carousel
  341. $.fn.carousel = function (option) {
  342. return this.each(function () {
  343. var $this = $(this)
  344. var data = $this.data('bs.carousel')
  345. var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
  346. var action = typeof option == 'string' ? option : options.slide
  347. if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
  348. if (typeof option == 'number') data.to(option)
  349. else if (action) data[action]()
  350. else if (options.interval) data.pause().cycle()
  351. })
  352. }
  353. $.fn.carousel.Constructor = Carousel
  354. // CAROUSEL NO CONFLICT
  355. // ====================
  356. $.fn.carousel.noConflict = function () {
  357. $.fn.carousel = old
  358. return this
  359. }
  360. // CAROUSEL DATA-API
  361. // =================
  362. $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
  363. var $this = $(this), href
  364. var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
  365. var options = $.extend({}, $target.data(), $this.data())
  366. var slideIndex = $this.attr('data-slide-to')
  367. if (slideIndex) options.interval = false
  368. $target.carousel(options)
  369. if (slideIndex = $this.attr('data-slide-to')) {
  370. $target.data('bs.carousel').to(slideIndex)
  371. }
  372. e.preventDefault()
  373. })
  374. $(window).on('load', function () {
  375. $('[data-ride="carousel"]').each(function () {
  376. var $carousel = $(this)
  377. $carousel.carousel($carousel.data())
  378. })
  379. })
  380. }(jQuery);
  381. /* ========================================================================
  382. * Bootstrap: collapse.js v3.0.3
  383. * http://getbootstrap.com/javascript/#collapse
  384. * ========================================================================
  385. * Copyright 2013 Twitter, Inc.
  386. *
  387. * Licensed under the Apache License, Version 2.0 (the "License");
  388. * you may not use this file except in compliance with the License.
  389. * You may obtain a copy of the License at
  390. *
  391. * http://www.apache.org/licenses/LICENSE-2.0
  392. *
  393. * Unless required by applicable law or agreed to in writing, software
  394. * distributed under the License is distributed on an "AS IS" BASIS,
  395. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  396. * See the License for the specific language governing permissions and
  397. * limitations under the License.
  398. * ======================================================================== */
  399. +function ($) { "use strict";
  400. // COLLAPSE PUBLIC CLASS DEFINITION
  401. // ================================
  402. var Collapse = function (element, options) {
  403. this.$element = $(element)
  404. this.options = $.extend({}, Collapse.DEFAULTS, options)
  405. this.transitioning = null
  406. if (this.options.parent) this.$parent = $(this.options.parent)
  407. if (this.options.toggle) this.toggle()
  408. }
  409. Collapse.DEFAULTS = {
  410. toggle: true
  411. }
  412. Collapse.prototype.dimension = function () {
  413. var hasWidth = this.$element.hasClass('width')
  414. return hasWidth ? 'width' : 'height'
  415. }
  416. Collapse.prototype.show = function () {
  417. if (this.transitioning || this.$element.hasClass('in')) return
  418. var startEvent = $.Event('show.bs.collapse')
  419. this.$element.trigger(startEvent)
  420. if (startEvent.isDefaultPrevented()) return
  421. var actives = this.$parent && this.$parent.find('> .panel > .in')
  422. if (actives && actives.length) {
  423. var hasData = actives.data('bs.collapse')
  424. if (hasData && hasData.transitioning) return
  425. actives.collapse('hide')
  426. hasData || actives.data('bs.collapse', null)
  427. }
  428. var dimension = this.dimension()
  429. this.$element
  430. .removeClass('collapse')
  431. .addClass('collapsing')
  432. [dimension](0)
  433. this.transitioning = 1
  434. var complete = function () {
  435. this.$element
  436. .removeClass('collapsing')
  437. .addClass('in')
  438. [dimension]('auto')
  439. this.transitioning = 0
  440. this.$element.trigger('shown.bs.collapse')
  441. }
  442. if (!$.support.transition) return complete.call(this)
  443. var scrollSize = $.camelCase(['scroll', dimension].join('-'))
  444. this.$element
  445. .one($.support.transition.end, $.proxy(complete, this))
  446. .emulateTransitionEnd(350)
  447. [dimension](this.$element[0][scrollSize])
  448. }
  449. Collapse.prototype.hide = function () {
  450. if (this.transitioning || !this.$element.hasClass('in')) return
  451. var startEvent = $.Event('hide.bs.collapse')
  452. this.$element.trigger(startEvent)
  453. if (startEvent.isDefaultPrevented()) return
  454. var dimension = this.dimension()
  455. this.$element
  456. [dimension](this.$element[dimension]())
  457. [0].offsetHeight
  458. this.$element
  459. .addClass('collapsing')
  460. .removeClass('collapse')
  461. .removeClass('in')
  462. this.transitioning = 1
  463. var complete = function () {
  464. this.transitioning = 0
  465. this.$element
  466. .trigger('hidden.bs.collapse')
  467. .removeClass('collapsing')
  468. .addClass('collapse')
  469. }
  470. if (!$.support.transition) return complete.call(this)
  471. this.$element
  472. [dimension](0)
  473. .one($.support.transition.end, $.proxy(complete, this))
  474. .emulateTransitionEnd(350)
  475. }
  476. Collapse.prototype.toggle = function () {
  477. this[this.$element.hasClass('in') ? 'hide' : 'show']()
  478. }
  479. // COLLAPSE PLUGIN DEFINITION
  480. // ==========================
  481. var old = $.fn.collapse
  482. $.fn.collapse = function (option) {
  483. return this.each(function () {
  484. var $this = $(this)
  485. var data = $this.data('bs.collapse')
  486. var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
  487. if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
  488. if (typeof option == 'string') data[option]()
  489. })
  490. }
  491. $.fn.collapse.Constructor = Collapse
  492. // COLLAPSE NO CONFLICT
  493. // ====================
  494. $.fn.collapse.noConflict = function () {
  495. $.fn.collapse = old
  496. return this
  497. }
  498. // COLLAPSE DATA-API
  499. // =================
  500. $(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {
  501. var $this = $(this), href
  502. var target = $this.attr('data-target')
  503. || e.preventDefault()
  504. || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
  505. var $target = $(target)
  506. var data = $target.data('bs.collapse')
  507. var option = data ? 'toggle' : $this.data()
  508. var parent = $this.attr('data-parent')
  509. var $parent = parent && $(parent)
  510. if (!data || !data.transitioning) {
  511. if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed')
  512. $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
  513. }
  514. $target.collapse(option)
  515. })
  516. }(jQuery);
  517. /* ========================================================================
  518. * Bootstrap: dropdown.js v3.0.3
  519. * http://getbootstrap.com/javascript/#dropdowns
  520. * ========================================================================
  521. * Copyright 2013 Twitter, Inc.
  522. *
  523. * Licensed under the Apache License, Version 2.0 (the "License");
  524. * you may not use this file except in compliance with the License.
  525. * You may obtain a copy of the License at
  526. *
  527. * http://www.apache.org/licenses/LICENSE-2.0
  528. *
  529. * Unless required by applicable law or agreed to in writing, software
  530. * distributed under the License is distributed on an "AS IS" BASIS,
  531. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  532. * See the License for the specific language governing permissions and
  533. * limitations under the License.
  534. * ======================================================================== */
  535. +function ($) { "use strict";
  536. // DROPDOWN CLASS DEFINITION
  537. // =========================
  538. var backdrop = '.dropdown-backdrop'
  539. var toggle = '[data-toggle=dropdown]'
  540. var Dropdown = function (element) {
  541. $(element).on('click.bs.dropdown', this.toggle)
  542. }
  543. Dropdown.prototype.toggle = function (e) {
  544. var $this = $(this)
  545. if ($this.is('.disabled, :disabled')) return
  546. var $parent = getParent($this)
  547. var isActive = $parent.hasClass('open')
  548. clearMenus()
  549. if (!isActive) {
  550. if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
  551. // if mobile we use a backdrop because click events don't delegate
  552. $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
  553. }
  554. $parent.trigger(e = $.Event('show.bs.dropdown'))
  555. if (e.isDefaultPrevented()) return
  556. $parent
  557. .toggleClass('open')
  558. .trigger('shown.bs.dropdown')
  559. $this.focus()
  560. }
  561. return false
  562. }
  563. Dropdown.prototype.keydown = function (e) {
  564. if (!/(38|40|27)/.test(e.keyCode)) return
  565. var $this = $(this)
  566. e.preventDefault()
  567. e.stopPropagation()
  568. if ($this.is('.disabled, :disabled')) return
  569. var $parent = getParent($this)
  570. var isActive = $parent.hasClass('open')
  571. if (!isActive || (isActive && e.keyCode == 27)) {
  572. if (e.which == 27) $parent.find(toggle).focus()
  573. return $this.click()
  574. }
  575. var $items = $('[role=menu] li:not(.divider):visible a', $parent)
  576. if (!$items.length) return
  577. var index = $items.index($items.filter(':focus'))
  578. if (e.keyCode == 38 && index > 0) index-- // up
  579. if (e.keyCode == 40 && index < $items.length - 1) index++ // down
  580. if (!~index) index=0
  581. $items.eq(index).focus()
  582. }
  583. function clearMenus() {
  584. $(backdrop).remove()
  585. $(toggle).each(function (e) {
  586. var $parent = getParent($(this))
  587. if (!$parent.hasClass('open')) return
  588. $parent.trigger(e = $.Event('hide.bs.dropdown'))
  589. if (e.isDefaultPrevented()) return
  590. $parent.removeClass('open').trigger('hidden.bs.dropdown')
  591. })
  592. }
  593. function getParent($this) {
  594. var selector = $this.attr('data-target')
  595. if (!selector) {
  596. selector = $this.attr('href')
  597. selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
  598. }
  599. var $parent = selector && $(selector)
  600. return $parent && $parent.length ? $parent : $this.parent()
  601. }
  602. // DROPDOWN PLUGIN DEFINITION
  603. // ==========================
  604. var old = $.fn.dropdown
  605. $.fn.dropdown = function (option) {
  606. return this.each(function () {
  607. var $this = $(this)
  608. var data = $this.data('bs.dropdown')
  609. if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
  610. if (typeof option == 'string') data[option].call($this)
  611. })
  612. }
  613. $.fn.dropdown.Constructor = Dropdown
  614. // DROPDOWN NO CONFLICT
  615. // ====================
  616. $.fn.dropdown.noConflict = function () {
  617. $.fn.dropdown = old
  618. return this
  619. }
  620. // APPLY TO STANDARD DROPDOWN ELEMENTS
  621. // ===================================
  622. $(document)
  623. .on('click.bs.dropdown.data-api', clearMenus)
  624. .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
  625. .on('click.bs.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
  626. .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
  627. }(jQuery);
  628. /* ========================================================================
  629. * Bootstrap: modal.js v3.0.3
  630. * http://getbootstrap.com/javascript/#modals
  631. * ========================================================================
  632. * Copyright 2013 Twitter, Inc.
  633. *
  634. * Licensed under the Apache License, Version 2.0 (the "License");
  635. * you may not use this file except in compliance with the License.
  636. * You may obtain a copy of the License at
  637. *
  638. * http://www.apache.org/licenses/LICENSE-2.0
  639. *
  640. * Unless required by applicable law or agreed to in writing, software
  641. * distributed under the License is distributed on an "AS IS" BASIS,
  642. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  643. * See the License for the specific language governing permissions and
  644. * limitations under the License.
  645. * ======================================================================== */
  646. +function ($) { "use strict";
  647. // MODAL CLASS DEFINITION
  648. // ======================
  649. var Modal = function (element, options) {
  650. this.options = options
  651. this.$element = $(element)
  652. this.$backdrop =
  653. this.isShown = null
  654. if (this.options.remote) this.$element.load(this.options.remote)
  655. }
  656. Modal.DEFAULTS = {
  657. backdrop: true
  658. , keyboard: true
  659. , show: true
  660. }
  661. Modal.prototype.toggle = function (_relatedTarget) {
  662. return this[!this.isShown ? 'show' : 'hide'](_relatedTarget)
  663. }
  664. Modal.prototype.show = function (_relatedTarget) {
  665. var that = this
  666. var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
  667. this.$element.trigger(e)
  668. if (this.isShown || e.isDefaultPrevented()) return
  669. this.isShown = true
  670. this.escape()
  671. this.$element.on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
  672. this.backdrop(function () {
  673. var transition = $.support.transition && that.$element.hasClass('fade')
  674. if (!that.$element.parent().length) {
  675. that.$element.appendTo(document.body) // don't move modals dom position
  676. }
  677. that.$element.show()
  678. if (transition) {
  679. that.$element[0].offsetWidth // force reflow
  680. }
  681. that.$element
  682. .addClass('in')
  683. .attr('aria-hidden', false)
  684. that.enforceFocus()
  685. var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
  686. transition ?
  687. that.$element.find('.modal-dialog') // wait for modal to slide in
  688. .one($.support.transition.end, function () {
  689. that.$element.focus().trigger(e)
  690. })
  691. .emulateTransitionEnd(300) :
  692. that.$element.focus().trigger(e)
  693. })
  694. }
  695. Modal.prototype.hide = function (e) {
  696. if (e) e.preventDefault()
  697. e = $.Event('hide.bs.modal')
  698. this.$element.trigger(e)
  699. if (!this.isShown || e.isDefaultPrevented()) return
  700. this.isShown = false
  701. this.escape()
  702. $(document).off('focusin.bs.modal')
  703. this.$element
  704. .removeClass('in')
  705. .attr('aria-hidden', true)
  706. .off('click.dismiss.modal')
  707. $.support.transition && this.$element.hasClass('fade') ?
  708. this.$element
  709. .one($.support.transition.end, $.proxy(this.hideModal, this))
  710. .emulateTransitionEnd(300) :
  711. this.hideModal()
  712. }
  713. Modal.prototype.enforceFocus = function () {
  714. $(document)
  715. .off('focusin.bs.modal') // guard against infinite focus loop
  716. .on('focusin.bs.modal', $.proxy(function (e) {
  717. if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
  718. this.$element.focus()
  719. }
  720. }, this))
  721. }
  722. Modal.prototype.escape = function () {
  723. if (this.isShown && this.options.keyboard) {
  724. this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
  725. e.which == 27 && this.hide()
  726. }, this))
  727. } else if (!this.isShown) {
  728. this.$element.off('keyup.dismiss.bs.modal')
  729. }
  730. }
  731. Modal.prototype.hideModal = function () {
  732. var that = this
  733. this.$element.hide()
  734. this.backdrop(function () {
  735. that.removeBackdrop()
  736. that.$element.trigger('hidden.bs.modal')
  737. })
  738. }
  739. Modal.prototype.removeBackdrop = function () {
  740. this.$backdrop && this.$backdrop.remove()
  741. this.$backdrop = null
  742. }
  743. Modal.prototype.backdrop = function (callback) {
  744. var that = this
  745. var animate = this.$element.hasClass('fade') ? 'fade' : ''
  746. if (this.isShown && this.options.backdrop) {
  747. var doAnimate = $.support.transition && animate
  748. this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
  749. .appendTo(document.body)
  750. this.$element.on('click.dismiss.modal', $.proxy(function (e) {
  751. if (e.target !== e.currentTarget) return
  752. this.options.backdrop == 'static'
  753. ? this.$element[0].focus.call(this.$element[0])
  754. : this.hide.call(this)
  755. }, this))
  756. if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
  757. this.$backdrop.addClass('in')
  758. if (!callback) return
  759. doAnimate ?
  760. this.$backdrop
  761. .one($.support.transition.end, callback)
  762. .emulateTransitionEnd(150) :
  763. callback()
  764. } else if (!this.isShown && this.$backdrop) {
  765. this.$backdrop.removeClass('in')
  766. $.support.transition && this.$element.hasClass('fade')?
  767. this.$backdrop
  768. .one($.support.transition.end, callback)
  769. .emulateTransitionEnd(150) :
  770. callback()
  771. } else if (callback) {
  772. callback()
  773. }
  774. }
  775. // MODAL PLUGIN DEFINITION
  776. // =======================
  777. var old = $.fn.modal
  778. $.fn.modal = function (option, _relatedTarget) {
  779. return this.each(function () {
  780. var $this = $(this)
  781. var data = $this.data('bs.modal')
  782. var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
  783. if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
  784. if (typeof option == 'string') data[option](_relatedTarget)
  785. else if (options.show) data.show(_relatedTarget)
  786. })
  787. }
  788. $.fn.modal.Constructor = Modal
  789. // MODAL NO CONFLICT
  790. // =================
  791. $.fn.modal.noConflict = function () {
  792. $.fn.modal = old
  793. return this
  794. }
  795. // MODAL DATA-API
  796. // ==============
  797. $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
  798. var $this = $(this)
  799. var href = $this.attr('href')
  800. var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
  801. var option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
  802. e.preventDefault()
  803. $target
  804. .modal(option, this)
  805. .one('hide', function () {
  806. $this.is(':visible') && $this.focus()
  807. })
  808. })
  809. $(document)
  810. .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
  811. .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
  812. }(jQuery);
  813. /* ========================================================================
  814. * Bootstrap: tooltip.js v3.0.3
  815. * http://getbootstrap.com/javascript/#tooltip
  816. * Inspired by the original jQuery.tipsy by Jason Frame
  817. * ========================================================================
  818. * Copyright 2013 Twitter, Inc.
  819. *
  820. * Licensed under the Apache License, Version 2.0 (the "License");
  821. * you may not use this file except in compliance with the License.
  822. * You may obtain a copy of the License at
  823. *
  824. * http://www.apache.org/licenses/LICENSE-2.0
  825. *
  826. * Unless required by applicable law or agreed to in writing, software
  827. * distributed under the License is distributed on an "AS IS" BASIS,
  828. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  829. * See the License for the specific language governing permissions and
  830. * limitations under the License.
  831. * ======================================================================== */
  832. +function ($) { "use strict";
  833. // TOOLTIP PUBLIC CLASS DEFINITION
  834. // ===============================
  835. var Tooltip = function (element, options) {
  836. this.type =
  837. this.options =
  838. this.enabled =
  839. this.timeout =
  840. this.hoverState =
  841. this.$element = null
  842. this.init('tooltip', element, options)
  843. }
  844. Tooltip.DEFAULTS = {
  845. animation: true
  846. , placement: 'top'
  847. , selector: false
  848. , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
  849. , trigger: 'hover focus'
  850. , title: ''
  851. , delay: 0
  852. , html: false
  853. , container: false
  854. }
  855. Tooltip.prototype.init = function (type, element, options) {
  856. this.enabled = true
  857. this.type = type
  858. this.$element = $(element)
  859. this.options = this.getOptions(options)
  860. var triggers = this.options.trigger.split(' ')
  861. for (var i = triggers.length; i--;) {
  862. var trigger = triggers[i]
  863. if (trigger == 'click') {
  864. this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
  865. } else if (trigger != 'manual') {
  866. var eventIn = trigger == 'hover' ? 'mouseenter' : 'focus'
  867. var eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
  868. this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
  869. this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
  870. }
  871. }
  872. this.options.selector ?
  873. (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
  874. this.fixTitle()
  875. }
  876. Tooltip.prototype.getDefaults = function () {
  877. return Tooltip.DEFAULTS
  878. }
  879. Tooltip.prototype.getOptions = function (options) {
  880. options = $.extend({}, this.getDefaults(), this.$element.data(), options)
  881. if (options.delay && typeof options.delay == 'number') {
  882. options.delay = {
  883. show: options.delay
  884. , hide: options.delay
  885. }
  886. }
  887. return options
  888. }
  889. Tooltip.prototype.getDelegateOptions = function () {
  890. var options = {}
  891. var defaults = this.getDefaults()
  892. this._options && $.each(this._options, function (key, value) {
  893. if (defaults[key] != value) options[key] = value
  894. })
  895. return options
  896. }
  897. Tooltip.prototype.enter = function (obj) {
  898. var self = obj instanceof this.constructor ?
  899. obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
  900. clearTimeout(self.timeout)
  901. self.hoverState = 'in'
  902. if (!self.options.delay || !self.options.delay.show) return self.show()
  903. self.timeout = setTimeout(function () {
  904. if (self.hoverState == 'in') self.show()
  905. }, self.options.delay.show)
  906. }
  907. Tooltip.prototype.leave = function (obj) {
  908. var self = obj instanceof this.constructor ?
  909. obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
  910. clearTimeout(self.timeout)
  911. self.hoverState = 'out'
  912. if (!self.options.delay || !self.options.delay.hide) return self.hide()
  913. self.timeout = setTimeout(function () {
  914. if (self.hoverState == 'out') self.hide()
  915. }, self.options.delay.hide)
  916. }
  917. Tooltip.prototype.show = function () {
  918. var e = $.Event('show.bs.'+ this.type)
  919. if (this.hasContent() && this.enabled) {
  920. this.$element.trigger(e)
  921. if (e.isDefaultPrevented()) return
  922. var $tip = this.tip()
  923. this.setContent()
  924. if (this.options.animation) $tip.addClass('fade')
  925. var placement = typeof this.options.placement == 'function' ?
  926. this.options.placement.call(this, $tip[0], this.$element[0]) :
  927. this.options.placement
  928. var autoToken = /\s?auto?\s?/i
  929. var autoPlace = autoToken.test(placement)
  930. if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
  931. $tip
  932. .detach()
  933. .css({ top: 0, left: 0, display: 'block' })
  934. .addClass(placement)
  935. this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
  936. var pos = this.getPosition()
  937. var actualWidth = $tip[0].offsetWidth
  938. var actualHeight = $tip[0].offsetHeight
  939. if (autoPlace) {
  940. var $parent = this.$element.parent()
  941. var orgPlacement = placement
  942. var docScroll = document.documentElement.scrollTop || document.body.scrollTop
  943. var parentWidth = this.options.container == 'body' ? window.innerWidth : $parent.outerWidth()
  944. var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight()
  945. var parentLeft = this.options.container == 'body' ? 0 : $parent.offset().left
  946. placement = placement == 'bottom' && pos.top + pos.height + actualHeight - docScroll > parentHeight ? 'top' :
  947. placement == 'top' && pos.top - docScroll - actualHeight < 0 ? 'bottom' :
  948. placement == 'right' && pos.right + actualWidth > parentWidth ? 'left' :
  949. placement == 'left' && pos.left - actualWidth < parentLeft ? 'right' :
  950. placement
  951. $tip
  952. .removeClass(orgPlacement)
  953. .addClass(placement)
  954. }
  955. var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
  956. this.applyPlacement(calculatedOffset, placement)
  957. this.$element.trigger('shown.bs.' + this.type)
  958. }
  959. }
  960. Tooltip.prototype.applyPlacement = function(offset, placement) {
  961. var replace
  962. var $tip = this.tip()
  963. var width = $tip[0].offsetWidth
  964. var height = $tip[0].offsetHeight
  965. // manually read margins because getBoundingClientRect includes difference
  966. var marginTop = parseInt($tip.css('margin-top'), 10)
  967. var marginLeft = parseInt($tip.css('margin-left'), 10)
  968. // we must check for NaN for ie 8/9
  969. if (isNaN(marginTop)) marginTop = 0
  970. if (isNaN(marginLeft)) marginLeft = 0
  971. offset.top = offset.top + marginTop
  972. offset.left = offset.left + marginLeft
  973. $tip
  974. .offset(offset)
  975. .addClass('in')
  976. // check to see if placing tip in new offset caused the tip to resize itself
  977. var actualWidth = $tip[0].offsetWidth
  978. var actualHeight = $tip[0].offsetHeight
  979. if (placement == 'top' && actualHeight != height) {
  980. replace = true
  981. offset.top = offset.top + height - actualHeight
  982. }
  983. if (/bottom|top/.test(placement)) {
  984. var delta = 0
  985. if (offset.left < 0) {
  986. delta = offset.left * -2
  987. offset.left = 0
  988. $tip.offset(offset)
  989. actualWidth = $tip[0].offsetWidth
  990. actualHeight = $tip[0].offsetHeight
  991. }
  992. this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
  993. } else {
  994. this.replaceArrow(actualHeight - height, actualHeight, 'top')
  995. }
  996. if (replace) $tip.offset(offset)
  997. }
  998. Tooltip.prototype.replaceArrow = function(delta, dimension, position) {
  999. this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
  1000. }
  1001. Tooltip.prototype.setContent = function () {
  1002. var $tip = this.tip()
  1003. var title = this.getTitle()
  1004. $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
  1005. $tip.removeClass('fade in top bottom left right')
  1006. }
  1007. Tooltip.prototype.hide = function () {
  1008. var that = this
  1009. var $tip = this.tip()
  1010. var e = $.Event('hide.bs.' + this.type)
  1011. function complete() {
  1012. if (that.hoverState != 'in') $tip.detach()
  1013. }
  1014. this.$element.trigger(e)
  1015. if (e.isDefaultPrevented()) return
  1016. $tip.removeClass('in')
  1017. $.support.transition && this.$tip.hasClass('fade') ?
  1018. $tip
  1019. .one($.support.transition.end, complete)
  1020. .emulateTransitionEnd(150) :
  1021. complete()
  1022. this.$element.trigger('hidden.bs.' + this.type)
  1023. return this
  1024. }
  1025. Tooltip.prototype.fixTitle = function () {
  1026. var $e = this.$element
  1027. if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
  1028. $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
  1029. }
  1030. }
  1031. Tooltip.prototype.hasContent = function () {
  1032. return this.getTitle()
  1033. }
  1034. Tooltip.prototype.getPosition = function () {
  1035. var el = this.$element[0]
  1036. return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
  1037. width: el.offsetWidth
  1038. , height: el.offsetHeight
  1039. }, this.$element.offset())
  1040. }
  1041. Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
  1042. return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
  1043. placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
  1044. placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
  1045. /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
  1046. }
  1047. Tooltip.prototype.getTitle = function () {
  1048. var title
  1049. var $e = this.$element
  1050. var o = this.options
  1051. title = $e.attr('data-original-title')
  1052. || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
  1053. return title
  1054. }
  1055. Tooltip.prototype.tip = function () {
  1056. return this.$tip = this.$tip || $(this.options.template)
  1057. }
  1058. Tooltip.prototype.arrow = function () {
  1059. return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')
  1060. }
  1061. Tooltip.prototype.validate = function () {
  1062. if (!this.$element[0].parentNode) {
  1063. this.hide()
  1064. this.$element = null
  1065. this.options = null
  1066. }
  1067. }
  1068. Tooltip.prototype.enable = function () {
  1069. this.enabled = true
  1070. }
  1071. Tooltip.prototype.disable = function () {
  1072. this.enabled = false
  1073. }
  1074. Tooltip.prototype.toggleEnabled = function () {
  1075. this.enabled = !this.enabled
  1076. }
  1077. Tooltip.prototype.toggle = function (e) {
  1078. var self = e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) : this
  1079. self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
  1080. }
  1081. Tooltip.prototype.destroy = function () {
  1082. this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
  1083. }
  1084. // TOOLTIP PLUGIN DEFINITION
  1085. // =========================
  1086. var old = $.fn.tooltip
  1087. $.fn.tooltip = function (option) {
  1088. return this.each(function () {
  1089. var $this = $(this)
  1090. var data = $this.data('bs.tooltip')
  1091. var options = typeof option == 'object' && option
  1092. if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
  1093. if (typeof option == 'string') data[option]()
  1094. })
  1095. }
  1096. $.fn.tooltip.Constructor = Tooltip
  1097. // TOOLTIP NO CONFLICT
  1098. // ===================
  1099. $.fn.tooltip.noConflict = function () {
  1100. $.fn.tooltip = old
  1101. return this
  1102. }
  1103. }(jQuery);
  1104. /* ========================================================================
  1105. * Bootstrap: popover.js v3.0.3
  1106. * http://getbootstrap.com/javascript/#popovers
  1107. * ========================================================================
  1108. * Copyright 2013 Twitter, Inc.
  1109. *
  1110. * Licensed under the Apache License, Version 2.0 (the "License");
  1111. * you may not use this file except in compliance with the License.
  1112. * You may obtain a copy of the License at
  1113. *
  1114. * http://www.apache.org/licenses/LICENSE-2.0
  1115. *
  1116. * Unless required by applicable law or agreed to in writing, software
  1117. * distributed under the License is distributed on an "AS IS" BASIS,
  1118. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  1119. * See the License for the specific language governing permissions and
  1120. * limitations under the License.
  1121. * ======================================================================== */
  1122. +function ($) { "use strict";
  1123. // POPOVER PUBLIC CLASS DEFINITION
  1124. // ===============================
  1125. var Popover = function (element, options) {
  1126. this.init('popover', element, options)
  1127. }
  1128. if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
  1129. Popover.DEFAULTS = $.extend({} , $.fn.tooltip.Constructor.DEFAULTS, {
  1130. placement: 'right'
  1131. , trigger: 'click'
  1132. , content: ''
  1133. , template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
  1134. })
  1135. // NOTE: POPOVER EXTENDS tooltip.js
  1136. // ================================
  1137. Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
  1138. Popover.prototype.constructor = Popover
  1139. Popover.prototype.getDefaults = function () {
  1140. return Popover.DEFAULTS
  1141. }
  1142. Popover.prototype.setContent = function () {
  1143. var $tip = this.tip()
  1144. var title = this.getTitle()
  1145. var content = this.getContent()
  1146. $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
  1147. $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)
  1148. $tip.removeClass('fade top bottom left right in')
  1149. // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
  1150. // this manually by checking the contents.
  1151. if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
  1152. }
  1153. Popover.prototype.hasContent = function () {
  1154. return this.getTitle() || this.getContent()
  1155. }
  1156. Popover.prototype.getContent = function () {
  1157. var $e = this.$element
  1158. var o = this.options
  1159. return $e.attr('data-content')
  1160. || (typeof o.content == 'function' ?
  1161. o.content.call($e[0]) :
  1162. o.content)
  1163. }
  1164. Popover.prototype.arrow = function () {
  1165. return this.$arrow = this.$arrow || this.tip().find('.arrow')
  1166. }
  1167. Popover.prototype.tip = function () {
  1168. if (!this.$tip) this.$tip = $(this.options.template)
  1169. return this.$tip
  1170. }
  1171. // POPOVER PLUGIN DEFINITION
  1172. // =========================
  1173. var old = $.fn.popover
  1174. $.fn.popover = function (option) {
  1175. return this.each(function () {
  1176. var $this = $(this)
  1177. var data = $this.data('bs.popover')
  1178. var options = typeof option == 'object' && option
  1179. if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
  1180. if (typeof option == 'string') data[option]()
  1181. })
  1182. }
  1183. $.fn.popover.Constructor = Popover
  1184. // POPOVER NO CONFLICT
  1185. // ===================
  1186. $.fn.popover.noConflict = function () {
  1187. $.fn.popover = old
  1188. return this
  1189. }
  1190. }(jQuery);
  1191. /* ========================================================================
  1192. * Bootstrap: scrollspy.js v3.0.3
  1193. * http://getbootstrap.com/javascript/#scrollspy
  1194. * ========================================================================
  1195. * Copyright 2013 Twitter, Inc.
  1196. *
  1197. * Licensed under the Apache License, Version 2.0 (the "License");
  1198. * you may not use this file except in compliance with the License.
  1199. * You may obtain a copy of the License at
  1200. *
  1201. * http://www.apache.org/licenses/LICENSE-2.0
  1202. *
  1203. * Unless required by applicable law or agreed to in writing, software
  1204. * distributed under the License is distributed on an "AS IS" BASIS,
  1205. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  1206. * See the License for the specific language governing permissions and
  1207. * limitations under the License.
  1208. * ======================================================================== */
  1209. +function ($) { "use strict";
  1210. // SCROLLSPY CLASS DEFINITION
  1211. // ==========================
  1212. function ScrollSpy(element, options) {
  1213. var href
  1214. var process = $.proxy(this.process, this)
  1215. this.$element = $(element).is('body') ? $(window) : $(element)
  1216. this.$body = $('body')
  1217. this.$scrollElement = this.$element.on('scroll.bs.scroll-spy.data-api', process)
  1218. this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
  1219. this.selector = (this.options.target
  1220. || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
  1221. || '') + ' .nav li > a'
  1222. this.offsets = $([])
  1223. this.targets = $([])
  1224. this.activeTarget = null
  1225. this.refresh()
  1226. this.process()
  1227. }
  1228. ScrollSpy.DEFAULTS = {
  1229. offset: 10
  1230. }
  1231. ScrollSpy.prototype.refresh = function () {
  1232. var offsetMethod = this.$element[0] == window ? 'offset' : 'position'
  1233. this.offsets = $([])
  1234. this.targets = $([])
  1235. var self = this
  1236. var $targets = this.$body
  1237. .find(this.selector)
  1238. .map(function () {
  1239. var $el = $(this)
  1240. var href = $el.data('target') || $el.attr('href')
  1241. var $href = /^#\w/.test(href) && $(href)
  1242. return ($href
  1243. && $href.length
  1244. && [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null
  1245. })
  1246. .sort(function (a, b) { return a[0] - b[0] })
  1247. .each(function () {
  1248. self.offsets.push(this[0])
  1249. self.targets.push(this[1])
  1250. })
  1251. }
  1252. ScrollSpy.prototype.process = function () {
  1253. var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
  1254. var scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
  1255. var maxScroll = scrollHeight - this.$scrollElement.height()
  1256. var offsets = this.offsets
  1257. var targets = this.targets
  1258. var activeTarget = this.activeTarget
  1259. var i
  1260. if (scrollTop >= maxScroll) {
  1261. return activeTarget != (i = targets.last()[0]) && this.activate(i)
  1262. }
  1263. for (i = offsets.length; i--;) {
  1264. activeTarget != targets[i]
  1265. && scrollTop >= offsets[i]
  1266. && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
  1267. && this.activate( targets[i] )
  1268. }
  1269. }
  1270. ScrollSpy.prototype.activate = function (target) {
  1271. this.activeTarget = target
  1272. $(this.selector)
  1273. .parents('.active')
  1274. .removeClass('active')
  1275. var selector = this.selector
  1276. + '[data-target="' + target + '"],'
  1277. + this.selector + '[href="' + target + '"]'
  1278. var active = $(selector)
  1279. .parents('li')
  1280. .addClass('active')
  1281. if (active.parent('.dropdown-menu').length) {
  1282. active = active
  1283. .closest('li.dropdown')
  1284. .addClass('active')
  1285. }
  1286. active.trigger('activate.bs.scrollspy')
  1287. }
  1288. // SCROLLSPY PLUGIN DEFINITION
  1289. // ===========================
  1290. var old = $.fn.scrollspy
  1291. $.fn.scrollspy = function (option) {
  1292. return this.each(function () {
  1293. var $this = $(this)
  1294. var data = $this.data('bs.scrollspy')
  1295. var options = typeof option == 'object' && option
  1296. if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
  1297. if (typeof option == 'string') data[option]()
  1298. })
  1299. }
  1300. $.fn.scrollspy.Constructor = ScrollSpy
  1301. // SCROLLSPY NO CONFLICT
  1302. // =====================
  1303. $.fn.scrollspy.noConflict = function () {
  1304. $.fn.scrollspy = old
  1305. return this
  1306. }
  1307. // SCROLLSPY DATA-API
  1308. // ==================
  1309. $(window).on('load', function () {
  1310. $('[data-spy="scroll"]').each(function () {
  1311. var $spy = $(this)
  1312. $spy.scrollspy($spy.data())
  1313. })
  1314. })
  1315. }(jQuery);
  1316. /* ========================================================================
  1317. * Bootstrap: tab.js v3.0.3
  1318. * http://getbootstrap.com/javascript/#tabs
  1319. * ========================================================================
  1320. * Copyright 2013 Twitter, Inc.
  1321. *
  1322. * Licensed under the Apache License, Version 2.0 (the "License");
  1323. * you may not use this file except in compliance with the License.
  1324. * You may obtain a copy of the License at
  1325. *
  1326. * http://www.apache.org/licenses/LICENSE-2.0
  1327. *
  1328. * Unless required by applicable law or agreed to in writing, software
  1329. * distributed under the License is distributed on an "AS IS" BASIS,
  1330. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  1331. * See the License for the specific language governing permissions and
  1332. * limitations under the License.
  1333. * ======================================================================== */
  1334. +function ($) { "use strict";
  1335. // TAB CLASS DEFINITION
  1336. // ====================
  1337. var Tab = function (element) {
  1338. this.element = $(element)
  1339. }
  1340. Tab.prototype.show = function () {
  1341. var $this = this.element
  1342. var $ul = $this.closest('ul:not(.dropdown-menu)')
  1343. var selector = $this.data('target')
  1344. if (!selector) {
  1345. selector = $this.attr('href')
  1346. selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
  1347. }
  1348. if ($this.parent('li').hasClass('active')) return
  1349. var previous = $ul.find('.active:last a')[0]
  1350. var e = $.Event('show.bs.tab', {
  1351. relatedTarget: previous
  1352. })
  1353. $this.trigger(e)
  1354. if (e.isDefaultPrevented()) return
  1355. var $target = $(selector)
  1356. this.activate($this.parent('li'), $ul)
  1357. this.activate($target, $target.parent(), function () {
  1358. $this.trigger({
  1359. type: 'shown.bs.tab'
  1360. , relatedTarget: previous
  1361. })
  1362. })
  1363. }
  1364. Tab.prototype.activate = function (element, container, callback) {
  1365. var $active = container.find('> .active')
  1366. var transition = callback
  1367. && $.support.transition
  1368. && $active.hasClass('fade')
  1369. function next() {
  1370. $active
  1371. .removeClass('active')
  1372. .find('> .dropdown-menu > .active')
  1373. .removeClass('active')
  1374. element.addClass('active')
  1375. if (transition) {
  1376. element[0].offsetWidth // reflow for transition
  1377. element.addClass('in')
  1378. } else {
  1379. element.removeClass('fade')
  1380. }
  1381. if (element.parent('.dropdown-menu')) {
  1382. element.closest('li.dropdown').addClass('active')
  1383. }
  1384. callback && callback()
  1385. }
  1386. transition ?
  1387. $active
  1388. .one($.support.transition.end, next)
  1389. .emulateTransitionEnd(150) :
  1390. next()
  1391. $active.removeClass('in')
  1392. }
  1393. // TAB PLUGIN DEFINITION
  1394. // =====================
  1395. var old = $.fn.tab
  1396. $.fn.tab = function ( option ) {
  1397. return this.each(function () {
  1398. var $this = $(this)
  1399. var data = $this.data('bs.tab')
  1400. if (!data) $this.data('bs.tab', (data = new Tab(this)))
  1401. if (typeof option == 'string') data[option]()
  1402. })
  1403. }
  1404. $.fn.tab.Constructor = Tab
  1405. // TAB NO CONFLICT
  1406. // ===============
  1407. $.fn.tab.noConflict = function () {
  1408. $.fn.tab = old
  1409. return this
  1410. }
  1411. // TAB DATA-API
  1412. // ============
  1413. $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
  1414. e.preventDefault()
  1415. $(this).tab('show')
  1416. })
  1417. }(jQuery);
  1418. /* ========================================================================
  1419. * Bootstrap: affix.js v3.0.3
  1420. * http://getbootstrap.com/javascript/#affix
  1421. * ========================================================================
  1422. * Copyright 2013 Twitter, Inc.
  1423. *
  1424. * Licensed under the Apache License, Version 2.0 (the "License");
  1425. * you may not use this file except in compliance with the License.
  1426. * You may obtain a copy of the License at
  1427. *
  1428. * http://www.apache.org/licenses/LICENSE-2.0
  1429. *
  1430. * Unless required by applicable law or agreed to in writing, software
  1431. * distributed under the License is distributed on an "AS IS" BASIS,
  1432. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  1433. * See the License for the specific language governing permissions and
  1434. * limitations under the License.
  1435. * ======================================================================== */
  1436. +function ($) { "use strict";
  1437. // AFFIX CLASS DEFINITION
  1438. // ======================
  1439. var Affix = function (element, options) {
  1440. this.options = $.extend({}, Affix.DEFAULTS, options)
  1441. this.$window = $(window)
  1442. .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
  1443. .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
  1444. this.$element = $(element)
  1445. this.affixed =
  1446. this.unpin = null
  1447. this.checkPosition()
  1448. }
  1449. Affix.RESET = 'affix affix-top affix-bottom'
  1450. Affix.DEFAULTS = {
  1451. offset: 0
  1452. }
  1453. Affix.prototype.checkPositionWithEventLoop = function () {
  1454. setTimeout($.proxy(this.checkPosition, this), 1)
  1455. }
  1456. Affix.prototype.checkPosition = function () {
  1457. if (!this.$element.is(':visible')) return
  1458. var scrollHeight = $(document).height()
  1459. var scrollTop = this.$window.scrollTop()
  1460. var position = this.$element.offset()
  1461. var offset = this.options.offset
  1462. var offsetTop = offset.top
  1463. var offsetBottom = offset.bottom
  1464. if (typeof offset != 'object') offsetBottom = offsetTop = offset
  1465. if (typeof offsetTop == 'function') offsetTop = offset.top()
  1466. if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
  1467. var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
  1468. offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
  1469. offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
  1470. if (this.affixed === affix) return
  1471. if (this.unpin) this.$element.css('top', '')
  1472. this.affixed = affix
  1473. this.unpin = affix == 'bottom' ? position.top - scrollTop : null
  1474. this.$element.removeClass(Affix.RESET).addClass('affix' + (affix ? '-' + affix : ''))
  1475. if (affix == 'bottom') {
  1476. this.$element.offset({ top: document.body.offsetHeight - offsetBottom - this.$element.height() })
  1477. }
  1478. }
  1479. // AFFIX PLUGIN DEFINITION
  1480. // =======================
  1481. var old = $.fn.affix
  1482. $.fn.affix = function (option) {
  1483. return this.each(function () {
  1484. var $this = $(this)
  1485. var data = $this.data('bs.affix')
  1486. var options = typeof option == 'object' && option
  1487. if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
  1488. if (typeof option == 'string') data[option]()
  1489. })
  1490. }
  1491. $.fn.affix.Constructor = Affix
  1492. // AFFIX NO CONFLICT
  1493. // =================
  1494. $.fn.affix.noConflict = function () {
  1495. $.fn.affix = old
  1496. return this
  1497. }
  1498. // AFFIX DATA-API
  1499. // ==============
  1500. $(window).on('load', function () {
  1501. $('[data-spy="affix"]').each(function () {
  1502. var $spy = $(this)
  1503. var data = $spy.data()
  1504. data.offset = data.offset || {}
  1505. if (data.offsetBottom) data.offset.bottom = data.offsetBottom
  1506. if (data.offsetTop) data.offset.top = data.offsetTop
  1507. $spy.affix(data)
  1508. })
  1509. })
  1510. }(jQuery);