Git based wiki inspired by Gollum
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.

2000 lines
57KB

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