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.

1728 lines
47 KiB

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