bootstrap.js 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437
  1. /* ===================================================
  2. * bootstrap-transition.js v2.3.2
  3. * http://getbootstrap.com/2.3.2/javascript.html#transitions
  4. * ===================================================
  5. * Copyright 2013 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. "use strict"; // jshint ;_;
  21. /* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
  22. * ======================================================= */
  23. $(function () {
  24. $.support.transition = (function () {
  25. var transitionEnd = (function () {
  26. var el = document.createElement('bootstrap')
  27. , transEndEventNames = {
  28. 'WebkitTransition' : 'webkitTransitionEnd'
  29. , 'MozTransition' : 'transitionend'
  30. , 'OTransition' : 'oTransitionEnd otransitionend'
  31. , 'transition' : 'transitionend'
  32. }
  33. , name
  34. for (name in transEndEventNames){
  35. if (el.style[name] !== undefined) {
  36. return transEndEventNames[name]
  37. }
  38. }
  39. }())
  40. return transitionEnd && {
  41. end: transitionEnd
  42. }
  43. })()
  44. })
  45. }(window.jQuery);
  46. /* =========================================================
  47. * bootstrap-modal.js v2.3.2
  48. * http://getbootstrap.com/2.3.2/javascript.html#modals
  49. * =========================================================
  50. * Copyright 2013 Twitter, Inc.
  51. *
  52. * Licensed under the Apache License, Version 2.0 (the "License");
  53. * you may not use this file except in compliance with the License.
  54. * You may obtain a copy of the License at
  55. *
  56. * http://www.apache.org/licenses/LICENSE-2.0
  57. *
  58. * Unless required by applicable law or agreed to in writing, software
  59. * distributed under the License is distributed on an "AS IS" BASIS,
  60. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  61. * See the License for the specific language governing permissions and
  62. * limitations under the License.
  63. * ========================================================= */
  64. !function ($) {
  65. "use strict"; // jshint ;_;
  66. /* MODAL CLASS DEFINITION
  67. * ====================== */
  68. var Modal = function (element, options) {
  69. this.options = options
  70. this.$element = $(element)
  71. .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
  72. this.options.remote && this.$element.find('.modal-body').load(this.options.remote)
  73. }
  74. Modal.prototype = {
  75. constructor: Modal
  76. , toggle: function () {
  77. return this[!this.isShown ? 'show' : 'hide']()
  78. }
  79. , show: function () {
  80. var that = this
  81. , e = $.Event('show')
  82. this.$element.trigger(e)
  83. if (this.isShown || e.isDefaultPrevented()) return
  84. this.isShown = true
  85. this.escape()
  86. this.backdrop(function () {
  87. var transition = $.support.transition && that.$element.hasClass('fade')
  88. if (!that.$element.parent().length) {
  89. that.$element.appendTo(document.body) //don't move modals dom position
  90. }
  91. that.$element.show()
  92. if (transition) {
  93. that.$element[0].offsetWidth // force reflow
  94. }
  95. that.$element
  96. .addClass('in')
  97. .attr('aria-hidden', false)
  98. that.enforceFocus()
  99. transition ?
  100. that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) :
  101. that.$element.focus().trigger('shown')
  102. })
  103. }
  104. , hide: function (e) {
  105. e && e.preventDefault()
  106. var that = this
  107. e = $.Event('hide')
  108. this.$element.trigger(e)
  109. if (!this.isShown || e.isDefaultPrevented()) return
  110. this.isShown = false
  111. this.escape()
  112. $(document).off('focusin.modal')
  113. this.$element
  114. .removeClass('in')
  115. .attr('aria-hidden', true)
  116. $.support.transition && this.$element.hasClass('fade') ?
  117. this.hideWithTransition() :
  118. this.hideModal()
  119. }
  120. , enforceFocus: function () {
  121. var that = this
  122. $(document).on('focusin.modal', function (e) {
  123. if (that.$element[0] !== e.target && !that.$element.has(e.target).length) {
  124. that.$element.focus()
  125. }
  126. })
  127. }
  128. , escape: function () {
  129. var that = this
  130. if (this.isShown && this.options.keyboard) {
  131. this.$element.on('keyup.dismiss.modal', function ( e ) {
  132. e.which == 27 && that.hide()
  133. })
  134. } else if (!this.isShown) {
  135. this.$element.off('keyup.dismiss.modal')
  136. }
  137. }
  138. , hideWithTransition: function () {
  139. var that = this
  140. , timeout = setTimeout(function () {
  141. that.$element.off($.support.transition.end)
  142. that.hideModal()
  143. }, 500)
  144. this.$element.one($.support.transition.end, function () {
  145. clearTimeout(timeout)
  146. that.hideModal()
  147. })
  148. }
  149. , hideModal: function () {
  150. var that = this
  151. this.$element.hide()
  152. this.backdrop(function () {
  153. that.removeBackdrop()
  154. that.$element.trigger('hidden')
  155. })
  156. }
  157. , removeBackdrop: function () {
  158. this.$backdrop && this.$backdrop.remove()
  159. this.$backdrop = null
  160. }
  161. , backdrop: function (callback) {
  162. var that = this
  163. , animate = this.$element.hasClass('fade') ? 'fade' : ''
  164. if (this.isShown && this.options.backdrop) {
  165. var doAnimate = $.support.transition && animate
  166. this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
  167. .appendTo(document.body)
  168. this.$backdrop.click(
  169. this.options.backdrop == 'static' ?
  170. $.proxy(this.$element[0].focus, this.$element[0])
  171. : $.proxy(this.hide, this)
  172. )
  173. if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
  174. this.$backdrop.addClass('in')
  175. if (!callback) return
  176. doAnimate ?
  177. this.$backdrop.one($.support.transition.end, callback) :
  178. callback()
  179. } else if (!this.isShown && this.$backdrop) {
  180. this.$backdrop.removeClass('in')
  181. $.support.transition && this.$element.hasClass('fade')?
  182. this.$backdrop.one($.support.transition.end, callback) :
  183. callback()
  184. } else if (callback) {
  185. callback()
  186. }
  187. }
  188. }
  189. /* MODAL PLUGIN DEFINITION
  190. * ======================= */
  191. var old = $.fn.modal
  192. $.fn.modal = function (option) {
  193. return this.each(function () {
  194. var $this = $(this)
  195. , data = $this.data('modal')
  196. , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
  197. if (!data) $this.data('modal', (data = new Modal(this, options)))
  198. if (typeof option == 'string') data[option]()
  199. else if (options.show) data.show()
  200. })
  201. }
  202. $.fn.modal.defaults = {
  203. backdrop: true
  204. , keyboard: true
  205. , show: true
  206. }
  207. $.fn.modal.Constructor = Modal
  208. /* MODAL NO CONFLICT
  209. * ================= */
  210. $.fn.modal.noConflict = function () {
  211. $.fn.modal = old
  212. return this
  213. }
  214. /* MODAL DATA-API
  215. * ============== */
  216. $(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) {
  217. var $this = $(this)
  218. , href = $this.attr('href')
  219. , $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
  220. , option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data())
  221. e.preventDefault()
  222. $target
  223. .modal(option)
  224. .one('hide', function () {
  225. $this.focus()
  226. })
  227. })
  228. }(window.jQuery);
  229. /* ============================================================
  230. * bootstrap-dropdown.js v2.3.2
  231. * http://getbootstrap.com/2.3.2/javascript.html#dropdowns
  232. * ============================================================
  233. * Copyright 2013 Twitter, Inc.
  234. *
  235. * Licensed under the Apache License, Version 2.0 (the "License");
  236. * you may not use this file except in compliance with the License.
  237. * You may obtain a copy of the License at
  238. *
  239. * http://www.apache.org/licenses/LICENSE-2.0
  240. *
  241. * Unless required by applicable law or agreed to in writing, software
  242. * distributed under the License is distributed on an "AS IS" BASIS,
  243. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  244. * See the License for the specific language governing permissions and
  245. * limitations under the License.
  246. * ============================================================ */
  247. !function ($) {
  248. "use strict"; // jshint ;_;
  249. /* DROPDOWN CLASS DEFINITION
  250. * ========================= */
  251. var toggle = '[data-toggle=dropdown]'
  252. , Dropdown = function (element) {
  253. var $el = $(element).on('click.dropdown.data-api', this.toggle)
  254. $('html').on('click.dropdown.data-api', function () {
  255. $el.parent().removeClass('open')
  256. })
  257. }
  258. Dropdown.prototype = {
  259. constructor: Dropdown
  260. , toggle: function (e) {
  261. var $this = $(this)
  262. , $parent
  263. , isActive
  264. if ($this.is('.disabled, :disabled')) return
  265. $parent = getParent($this)
  266. isActive = $parent.hasClass('open')
  267. clearMenus()
  268. if (!isActive) {
  269. if ('ontouchstart' in document.documentElement) {
  270. // if mobile we we use a backdrop because click events don't delegate
  271. $('<div class="dropdown-backdrop"/>').insertBefore($(this)).on('click', clearMenus)
  272. }
  273. $parent.toggleClass('open')
  274. }
  275. $this.focus()
  276. return false
  277. }
  278. , keydown: function (e) {
  279. var $this
  280. , $items
  281. , $active
  282. , $parent
  283. , isActive
  284. , index
  285. if (!/(38|40|27)/.test(e.keyCode)) return
  286. $this = $(this)
  287. e.preventDefault()
  288. e.stopPropagation()
  289. if ($this.is('.disabled, :disabled')) return
  290. $parent = getParent($this)
  291. isActive = $parent.hasClass('open')
  292. if (!isActive || (isActive && e.keyCode == 27)) {
  293. if (e.which == 27) $parent.find(toggle).focus()
  294. return $this.click()
  295. }
  296. $items = $('[role=menu] li:not(.divider):visible a', $parent)
  297. if (!$items.length) return
  298. index = $items.index($items.filter(':focus'))
  299. if (e.keyCode == 38 && index > 0) index-- // up
  300. if (e.keyCode == 40 && index < $items.length - 1) index++ // down
  301. if (!~index) index = 0
  302. $items
  303. .eq(index)
  304. .focus()
  305. }
  306. }
  307. function clearMenus() {
  308. $('.dropdown-backdrop').remove()
  309. $(toggle).each(function () {
  310. getParent($(this)).removeClass('open')
  311. })
  312. }
  313. function getParent($this) {
  314. var selector = $this.attr('data-target')
  315. , $parent
  316. if (!selector) {
  317. selector = $this.attr('href')
  318. selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
  319. }
  320. $parent = selector && $(selector)
  321. if (!$parent || !$parent.length) $parent = $this.parent()
  322. return $parent
  323. }
  324. /* DROPDOWN PLUGIN DEFINITION
  325. * ========================== */
  326. var old = $.fn.dropdown
  327. $.fn.dropdown = function (option) {
  328. return this.each(function () {
  329. var $this = $(this)
  330. , data = $this.data('dropdown')
  331. if (!data) $this.data('dropdown', (data = new Dropdown(this)))
  332. if (typeof option == 'string') data[option].call($this)
  333. })
  334. }
  335. $.fn.dropdown.Constructor = Dropdown
  336. /* DROPDOWN NO CONFLICT
  337. * ==================== */
  338. $.fn.dropdown.noConflict = function () {
  339. $.fn.dropdown = old
  340. return this
  341. }
  342. /* APPLY TO STANDARD DROPDOWN ELEMENTS
  343. * =================================== */
  344. $(document)
  345. .on('click.dropdown.data-api', clearMenus)
  346. .on('click.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
  347. .on('click.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
  348. .on('keydown.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
  349. }(window.jQuery);
  350. /* ===========================================================
  351. * bootstrap-tooltip.js v2.3.2
  352. * http://getbootstrap.com/2.3.2/javascript.html#tooltips
  353. * Inspired by the original jQuery.tipsy by Jason Frame
  354. * ===========================================================
  355. * Copyright 2013 Twitter, Inc.
  356. *
  357. * Licensed under the Apache License, Version 2.0 (the "License");
  358. * you may not use this file except in compliance with the License.
  359. * You may obtain a copy of the License at
  360. *
  361. * http://www.apache.org/licenses/LICENSE-2.0
  362. *
  363. * Unless required by applicable law or agreed to in writing, software
  364. * distributed under the License is distributed on an "AS IS" BASIS,
  365. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  366. * See the License for the specific language governing permissions and
  367. * limitations under the License.
  368. * ========================================================== */
  369. !function ($) {
  370. "use strict"; // jshint ;_;
  371. /* TOOLTIP PUBLIC CLASS DEFINITION
  372. * =============================== */
  373. var Tooltip = function (element, options) {
  374. this.init('tooltip', element, options)
  375. }
  376. Tooltip.prototype = {
  377. constructor: Tooltip
  378. , init: function (type, element, options) {
  379. var eventIn
  380. , eventOut
  381. , triggers
  382. , trigger
  383. , i
  384. this.type = type
  385. this.$element = $(element)
  386. this.options = this.getOptions(options)
  387. this.enabled = true
  388. triggers = this.options.trigger.split(' ')
  389. for (i = triggers.length; i--;) {
  390. trigger = triggers[i]
  391. if (trigger == 'click') {
  392. this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
  393. } else if (trigger != 'manual') {
  394. eventIn = trigger == 'hover' ? 'mouseenter' : 'focus'
  395. eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
  396. this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
  397. this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
  398. }
  399. }
  400. this.options.selector ?
  401. (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
  402. this.fixTitle()
  403. }
  404. , getOptions: function (options) {
  405. options = $.extend({}, $.fn[this.type].defaults, this.$element.data(), options)
  406. if (options.delay && typeof options.delay == 'number') {
  407. options.delay = {
  408. show: options.delay
  409. , hide: options.delay
  410. }
  411. }
  412. return options
  413. }
  414. , enter: function (e) {
  415. var defaults = $.fn[this.type].defaults
  416. , options = {}
  417. , self
  418. this._options && $.each(this._options, function (key, value) {
  419. if (defaults[key] != value) options[key] = value
  420. }, this)
  421. self = $(e.currentTarget)[this.type](options).data(this.type)
  422. if (!self.options.delay || !self.options.delay.show) return self.show()
  423. clearTimeout(this.timeout)
  424. self.hoverState = 'in'
  425. this.timeout = setTimeout(function() {
  426. if (self.hoverState == 'in') self.show()
  427. }, self.options.delay.show)
  428. }
  429. , leave: function (e) {
  430. var self = $(e.currentTarget)[this.type](this._options).data(this.type)
  431. if (this.timeout) clearTimeout(this.timeout)
  432. if (!self.options.delay || !self.options.delay.hide) return self.hide()
  433. self.hoverState = 'out'
  434. this.timeout = setTimeout(function() {
  435. if (self.hoverState == 'out') self.hide()
  436. }, self.options.delay.hide)
  437. }
  438. , show: function () {
  439. var $tip
  440. , pos
  441. , actualWidth
  442. , actualHeight
  443. , placement
  444. , tp
  445. , e = $.Event('show')
  446. if (this.hasContent() && this.enabled) {
  447. this.$element.trigger(e)
  448. if (e.isDefaultPrevented()) return
  449. $tip = this.tip()
  450. this.setContent()
  451. if (this.options.animation) {
  452. $tip.addClass('fade')
  453. }
  454. placement = typeof this.options.placement == 'function' ?
  455. this.options.placement.call(this, $tip[0], this.$element[0]) :
  456. this.options.placement
  457. $tip
  458. .detach()
  459. .css({ top: 0, left: 0, display: 'block' })
  460. this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
  461. pos = this.getPosition()
  462. actualWidth = $tip[0].offsetWidth
  463. actualHeight = $tip[0].offsetHeight
  464. switch (placement) {
  465. case 'bottom':
  466. tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
  467. break
  468. case 'top':
  469. tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
  470. break
  471. case 'left':
  472. tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
  473. break
  474. case 'right':
  475. tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
  476. break
  477. }
  478. this.applyPlacement(tp, placement)
  479. this.$element.trigger('shown')
  480. }
  481. }
  482. , applyPlacement: function(offset, placement){
  483. var $tip = this.tip()
  484. , width = $tip[0].offsetWidth
  485. , height = $tip[0].offsetHeight
  486. , actualWidth
  487. , actualHeight
  488. , delta
  489. , replace
  490. $tip
  491. .offset(offset)
  492. .addClass(placement)
  493. .addClass('in')
  494. actualWidth = $tip[0].offsetWidth
  495. actualHeight = $tip[0].offsetHeight
  496. if (placement == 'top' && actualHeight != height) {
  497. offset.top = offset.top + height - actualHeight
  498. replace = true
  499. }
  500. if (placement == 'bottom' || placement == 'top') {
  501. delta = 0
  502. if (offset.left < 0){
  503. delta = offset.left * -2
  504. offset.left = 0
  505. $tip.offset(offset)
  506. actualWidth = $tip[0].offsetWidth
  507. actualHeight = $tip[0].offsetHeight
  508. }
  509. this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
  510. } else {
  511. this.replaceArrow(actualHeight - height, actualHeight, 'top')
  512. }
  513. if (replace) $tip.offset(offset)
  514. }
  515. , replaceArrow: function(delta, dimension, position){
  516. this
  517. .arrow()
  518. .css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
  519. }
  520. , setContent: function () {
  521. var $tip = this.tip()
  522. , title = this.getTitle()
  523. $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
  524. $tip.removeClass('fade in top bottom left right')
  525. }
  526. , hide: function () {
  527. var that = this
  528. , $tip = this.tip()
  529. , e = $.Event('hide')
  530. this.$element.trigger(e)
  531. if (e.isDefaultPrevented()) return
  532. $tip.removeClass('in')
  533. function removeWithAnimation() {
  534. var timeout = setTimeout(function () {
  535. $tip.off($.support.transition.end).detach()
  536. }, 500)
  537. $tip.one($.support.transition.end, function () {
  538. clearTimeout(timeout)
  539. $tip.detach()
  540. })
  541. }
  542. $.support.transition && this.$tip.hasClass('fade') ?
  543. removeWithAnimation() :
  544. $tip.detach()
  545. this.$element.trigger('hidden')
  546. return this
  547. }
  548. , fixTitle: function () {
  549. var $e = this.$element
  550. if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
  551. $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
  552. }
  553. }
  554. , hasContent: function () {
  555. return this.getTitle()
  556. }
  557. , getPosition: function () {
  558. var el = this.$element[0]
  559. return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
  560. width: el.offsetWidth
  561. , height: el.offsetHeight
  562. }, this.$element.offset())
  563. }
  564. , getTitle: function () {
  565. var title
  566. , $e = this.$element
  567. , o = this.options
  568. title = $e.attr('data-original-title')
  569. || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
  570. return title
  571. }
  572. , tip: function () {
  573. return this.$tip = this.$tip || $(this.options.template)
  574. }
  575. , arrow: function(){
  576. return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow")
  577. }
  578. , validate: function () {
  579. if (!this.$element[0].parentNode) {
  580. this.hide()
  581. this.$element = null
  582. this.options = null
  583. }
  584. }
  585. , enable: function () {
  586. this.enabled = true
  587. }
  588. , disable: function () {
  589. this.enabled = false
  590. }
  591. , toggleEnabled: function () {
  592. this.enabled = !this.enabled
  593. }
  594. , toggle: function (e) {
  595. var self = e ? $(e.currentTarget)[this.type](this._options).data(this.type) : this
  596. self.tip().hasClass('in') ? self.hide() : self.show()
  597. }
  598. , destroy: function () {
  599. this.hide().$element.off('.' + this.type).removeData(this.type)
  600. }
  601. }
  602. /* TOOLTIP PLUGIN DEFINITION
  603. * ========================= */
  604. var old = $.fn.tooltip
  605. $.fn.tooltip = function ( option ) {
  606. return this.each(function () {
  607. var $this = $(this)
  608. , data = $this.data('tooltip')
  609. , options = typeof option == 'object' && option
  610. if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
  611. if (typeof option == 'string') data[option]()
  612. })
  613. }
  614. $.fn.tooltip.Constructor = Tooltip
  615. $.fn.tooltip.defaults = {
  616. animation: true
  617. , placement: 'top'
  618. , selector: false
  619. , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
  620. , trigger: 'hover focus'
  621. , title: ''
  622. , delay: 0
  623. , html: false
  624. , container: false
  625. }
  626. /* TOOLTIP NO CONFLICT
  627. * =================== */
  628. $.fn.tooltip.noConflict = function () {
  629. $.fn.tooltip = old
  630. return this
  631. }
  632. }(window.jQuery);
  633. /* ===========================================================
  634. * bootstrap-popover.js v2.3.2
  635. * http://getbootstrap.com/2.3.2/javascript.html#popovers
  636. * ===========================================================
  637. * Copyright 2013 Twitter, Inc.
  638. *
  639. * Licensed under the Apache License, Version 2.0 (the "License");
  640. * you may not use this file except in compliance with the License.
  641. * You may obtain a copy of the License at
  642. *
  643. * http://www.apache.org/licenses/LICENSE-2.0
  644. *
  645. * Unless required by applicable law or agreed to in writing, software
  646. * distributed under the License is distributed on an "AS IS" BASIS,
  647. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  648. * See the License for the specific language governing permissions and
  649. * limitations under the License.
  650. * =========================================================== */
  651. !function ($) {
  652. "use strict"; // jshint ;_;
  653. /* POPOVER PUBLIC CLASS DEFINITION
  654. * =============================== */
  655. var Popover = function (element, options) {
  656. this.init('popover', element, options)
  657. }
  658. /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
  659. ========================================== */
  660. Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
  661. constructor: Popover
  662. , setContent: function () {
  663. var $tip = this.tip()
  664. , title = this.getTitle()
  665. , content = this.getContent()
  666. $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
  667. $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)
  668. $tip.removeClass('fade top bottom left right in')
  669. }
  670. , hasContent: function () {
  671. return this.getTitle() || this.getContent()
  672. }
  673. , getContent: function () {
  674. var content
  675. , $e = this.$element
  676. , o = this.options
  677. content = (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
  678. || $e.attr('data-content')
  679. return content
  680. }
  681. , tip: function () {
  682. if (!this.$tip) {
  683. this.$tip = $(this.options.template)
  684. }
  685. return this.$tip
  686. }
  687. , destroy: function () {
  688. this.hide().$element.off('.' + this.type).removeData(this.type)
  689. }
  690. })
  691. /* POPOVER PLUGIN DEFINITION
  692. * ======================= */
  693. var old = $.fn.popover
  694. $.fn.popover = function (option) {
  695. return this.each(function () {
  696. var $this = $(this)
  697. , data = $this.data('popover')
  698. , options = typeof option == 'object' && option
  699. if (!data) $this.data('popover', (data = new Popover(this, options)))
  700. if (typeof option == 'string') data[option]()
  701. })
  702. }
  703. $.fn.popover.Constructor = Popover
  704. $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
  705. placement: 'right'
  706. , trigger: 'click'
  707. , content: ''
  708. , template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
  709. })
  710. /* POPOVER NO CONFLICT
  711. * =================== */
  712. $.fn.popover.noConflict = function () {
  713. $.fn.popover = old
  714. return this
  715. }
  716. }(window.jQuery);
  717. /* ==========================================================
  718. * bootstrap-alert.js v2.3.2
  719. * http://getbootstrap.com/2.3.2/javascript.html#alerts
  720. * ==========================================================
  721. * Copyright 2013 Twitter, Inc.
  722. *
  723. * Licensed under the Apache License, Version 2.0 (the "License");
  724. * you may not use this file except in compliance with the License.
  725. * You may obtain a copy of the License at
  726. *
  727. * http://www.apache.org/licenses/LICENSE-2.0
  728. *
  729. * Unless required by applicable law or agreed to in writing, software
  730. * distributed under the License is distributed on an "AS IS" BASIS,
  731. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  732. * See the License for the specific language governing permissions and
  733. * limitations under the License.
  734. * ========================================================== */
  735. !function ($) {
  736. "use strict"; // jshint ;_;
  737. /* ALERT CLASS DEFINITION
  738. * ====================== */
  739. var dismiss = '[data-dismiss="alert"]'
  740. , Alert = function (el) {
  741. $(el).on('click', dismiss, this.close)
  742. }
  743. Alert.prototype.close = function (e) {
  744. var $this = $(this)
  745. , selector = $this.attr('data-target')
  746. , $parent
  747. if (!selector) {
  748. selector = $this.attr('href')
  749. selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
  750. }
  751. $parent = $(selector)
  752. e && e.preventDefault()
  753. $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
  754. $parent.trigger(e = $.Event('close'))
  755. if (e.isDefaultPrevented()) return
  756. $parent.removeClass('in')
  757. function removeElement() {
  758. $parent
  759. .trigger('closed')
  760. .remove()
  761. }
  762. $.support.transition && $parent.hasClass('fade') ?
  763. $parent.on($.support.transition.end, removeElement) :
  764. removeElement()
  765. }
  766. /* ALERT PLUGIN DEFINITION
  767. * ======================= */
  768. var old = $.fn.alert
  769. $.fn.alert = function (option) {
  770. return this.each(function () {
  771. var $this = $(this)
  772. , data = $this.data('alert')
  773. if (!data) $this.data('alert', (data = new Alert(this)))
  774. if (typeof option == 'string') data[option].call($this)
  775. })
  776. }
  777. $.fn.alert.Constructor = Alert
  778. /* ALERT NO CONFLICT
  779. * ================= */
  780. $.fn.alert.noConflict = function () {
  781. $.fn.alert = old
  782. return this
  783. }
  784. /* ALERT DATA-API
  785. * ============== */
  786. $(document).on('click.alert.data-api', dismiss, Alert.prototype.close)
  787. }(window.jQuery);
  788. /* ============================================================
  789. * bootstrap-button.js v2.3.2
  790. * http://getbootstrap.com/2.3.2/javascript.html#buttons
  791. * ============================================================
  792. * Copyright 2013 Twitter, Inc.
  793. *
  794. * Licensed under the Apache License, Version 2.0 (the "License");
  795. * you may not use this file except in compliance with the License.
  796. * You may obtain a copy of the License at
  797. *
  798. * http://www.apache.org/licenses/LICENSE-2.0
  799. *
  800. * Unless required by applicable law or agreed to in writing, software
  801. * distributed under the License is distributed on an "AS IS" BASIS,
  802. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  803. * See the License for the specific language governing permissions and
  804. * limitations under the License.
  805. * ============================================================ */
  806. !function ($) {
  807. "use strict"; // jshint ;_;
  808. /* BUTTON PUBLIC CLASS DEFINITION
  809. * ============================== */
  810. var Button = function (element, options) {
  811. this.$element = $(element)
  812. this.options = $.extend({}, $.fn.button.defaults, options)
  813. }
  814. Button.prototype.setState = function (state) {
  815. var d = 'disabled'
  816. , $el = this.$element
  817. , data = $el.data()
  818. , val = $el.is('input') ? 'val' : 'html'
  819. state = state + 'Text'
  820. data.resetText || $el.data('resetText', $el[val]())
  821. $el[val](data[state] || this.options[state])
  822. // push to event loop to allow forms to submit
  823. setTimeout(function () {
  824. state == 'loadingText' ?
  825. $el.addClass(d).attr(d, d) :
  826. $el.removeClass(d).removeAttr(d)
  827. }, 0)
  828. }
  829. Button.prototype.toggle = function () {
  830. var $parent = this.$element.closest('[data-toggle="buttons-radio"]')
  831. $parent && $parent
  832. .find('.active')
  833. .removeClass('active')
  834. this.$element.toggleClass('active')
  835. }
  836. /* BUTTON PLUGIN DEFINITION
  837. * ======================== */
  838. var old = $.fn.button
  839. $.fn.button = function (option) {
  840. return this.each(function () {
  841. var $this = $(this)
  842. , data = $this.data('button')
  843. , options = typeof option == 'object' && option
  844. if (!data) $this.data('button', (data = new Button(this, options)))
  845. if (option == 'toggle') data.toggle()
  846. else if (option) data.setState(option)
  847. })
  848. }
  849. $.fn.button.defaults = {
  850. loadingText: 'loading...'
  851. }
  852. $.fn.button.Constructor = Button
  853. /* BUTTON NO CONFLICT
  854. * ================== */
  855. $.fn.button.noConflict = function () {
  856. $.fn.button = old
  857. return this
  858. }
  859. /* BUTTON DATA-API
  860. * =============== */
  861. $(document).on('click.button.data-api', '[data-toggle^=button]', function (e) {
  862. var $btn = $(e.target)
  863. if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
  864. $btn.button('toggle')
  865. })
  866. }(window.jQuery);
  867. /* ==========================================================
  868. * bootstrap-affix.js v2.3.2
  869. * http://getbootstrap.com/2.3.2/javascript.html#affix
  870. * ==========================================================
  871. * Copyright 2013 Twitter, Inc.
  872. *
  873. * Licensed under the Apache License, Version 2.0 (the "License");
  874. * you may not use this file except in compliance with the License.
  875. * You may obtain a copy of the License at
  876. *
  877. * http://www.apache.org/licenses/LICENSE-2.0
  878. *
  879. * Unless required by applicable law or agreed to in writing, software
  880. * distributed under the License is distributed on an "AS IS" BASIS,
  881. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  882. * See the License for the specific language governing permissions and
  883. * limitations under the License.
  884. * ========================================================== */
  885. !function ($) {
  886. "use strict"; // jshint ;_;
  887. /* AFFIX CLASS DEFINITION
  888. * ====================== */
  889. var Affix = function (element, options) {
  890. this.options = $.extend({}, $.fn.affix.defaults, options)
  891. this.$window = $(window)
  892. .on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
  893. .on('click.affix.data-api', $.proxy(function () { setTimeout($.proxy(this.checkPosition, this), 1) }, this))
  894. this.$element = $(element)
  895. this.checkPosition()
  896. }
  897. Affix.prototype.checkPosition = function () {
  898. if (!this.$element.is(':visible')) return
  899. var scrollHeight = $(document).height()
  900. , scrollTop = this.$window.scrollTop()
  901. , position = this.$element.offset()
  902. , offset = this.options.offset
  903. , offsetBottom = offset.bottom
  904. , offsetTop = offset.top
  905. , reset = 'affix affix-top affix-bottom'
  906. , affix
  907. if (typeof offset != 'object') offsetBottom = offsetTop = offset
  908. if (typeof offsetTop == 'function') offsetTop = offset.top()
  909. if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
  910. affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ?
  911. false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ?
  912. 'bottom' : offsetTop != null && scrollTop <= offsetTop ?
  913. 'top' : false
  914. if (this.affixed === affix) return
  915. this.affixed = affix
  916. this.unpin = affix == 'bottom' ? position.top - scrollTop : null
  917. this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : ''))
  918. }
  919. /* AFFIX PLUGIN DEFINITION
  920. * ======================= */
  921. var old = $.fn.affix
  922. $.fn.affix = function (option) {
  923. return this.each(function () {
  924. var $this = $(this)
  925. , data = $this.data('affix')
  926. , options = typeof option == 'object' && option
  927. if (!data) $this.data('affix', (data = new Affix(this, options)))
  928. if (typeof option == 'string') data[option]()
  929. })
  930. }
  931. $.fn.affix.Constructor = Affix
  932. $.fn.affix.defaults = {
  933. offset: 0
  934. }
  935. /* AFFIX NO CONFLICT
  936. * ================= */
  937. $.fn.affix.noConflict = function () {
  938. $.fn.affix = old
  939. return this
  940. }
  941. /* AFFIX DATA-API
  942. * ============== */
  943. $(window).on('load', function () {
  944. $('[data-spy="affix"]').each(function () {
  945. var $spy = $(this)
  946. , data = $spy.data()
  947. data.offset = data.offset || {}
  948. data.offsetBottom && (data.offset.bottom = data.offsetBottom)
  949. data.offsetTop && (data.offset.top = data.offsetTop)
  950. $spy.affix(data)
  951. })
  952. })
  953. }(window.jQuery);
  954. /* =============================================================
  955. * bootstrap-scrollspy.js v2.3.2
  956. * http://getbootstrap.com/2.3.2/javascript.html#scrollspy
  957. * =============================================================
  958. * Copyright 2013 Twitter, Inc.
  959. *
  960. * Licensed under the Apache License, Version 2.0 (the "License");
  961. * you may not use this file except in compliance with the License.
  962. * You may obtain a copy of the License at
  963. *
  964. * http://www.apache.org/licenses/LICENSE-2.0
  965. *
  966. * Unless required by applicable law or agreed to in writing, software
  967. * distributed under the License is distributed on an "AS IS" BASIS,
  968. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  969. * See the License for the specific language governing permissions and
  970. * limitations under the License.
  971. * ============================================================== */
  972. !function ($) {
  973. "use strict"; // jshint ;_;
  974. /* SCROLLSPY CLASS DEFINITION
  975. * ========================== */
  976. function ScrollSpy(element, options) {
  977. var process = $.proxy(this.process, this)
  978. , $element = $(element).is('body') ? $(window) : $(element)
  979. , href
  980. this.options = $.extend({}, $.fn.scrollspy.defaults, options)
  981. this.$scrollElement = $element.on('scroll.scroll-spy.data-api', process)
  982. this.selector = (this.options.target
  983. || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
  984. || '') + ' .inav li > a'
  985. this.$body = $('body')
  986. this.refresh()
  987. this.process()
  988. }
  989. ScrollSpy.prototype = {
  990. constructor: ScrollSpy
  991. , refresh: function () {
  992. var self = this
  993. , $targets
  994. this.offsets = $([])
  995. this.targets = $([])
  996. $targets = this.$body
  997. .find(this.selector)
  998. .map(function () {
  999. var $el = $(this)
  1000. , href = $el.data('target') || $el.attr('href')
  1001. , $href = /^#\w/.test(href) && $(href)
  1002. return ( $href
  1003. && $href.length
  1004. && [[ $href.position().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]] ) || null
  1005. })
  1006. .sort(function (a, b) { return a[0] - b[0] })
  1007. .each(function () {
  1008. self.offsets.push(this[0])
  1009. self.targets.push(this[1])
  1010. })
  1011. }
  1012. , process: function () {
  1013. var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
  1014. , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
  1015. , maxScroll = scrollHeight - this.$scrollElement.height()
  1016. , offsets = this.offsets
  1017. , targets = this.targets
  1018. , activeTarget = this.activeTarget
  1019. , i
  1020. if (scrollTop >= maxScroll) {
  1021. return activeTarget != (i = targets.last()[0])
  1022. && this.activate ( i )
  1023. }
  1024. for (i = offsets.length; i--;) {
  1025. activeTarget != targets[i]
  1026. && scrollTop >= offsets[i]
  1027. && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
  1028. && this.activate( targets[i] )
  1029. }
  1030. }
  1031. , activate: function (target) {
  1032. var active
  1033. , selector
  1034. this.activeTarget = target
  1035. $(this.selector)
  1036. .parent('.active')
  1037. .removeClass('active')
  1038. selector = this.selector
  1039. + '[data-target="' + target + '"],'
  1040. + this.selector + '[href="' + target + '"]'
  1041. active = $(selector)
  1042. .parent('li')
  1043. .addClass('active')
  1044. if (active.parent('.dropdown-menu').length) {
  1045. active = active.closest('li.dropdown').addClass('active')
  1046. }
  1047. active.trigger('activate')
  1048. }
  1049. }
  1050. /* SCROLLSPY PLUGIN DEFINITION
  1051. * =========================== */
  1052. var old = $.fn.scrollspy
  1053. $.fn.scrollspy = function (option) {
  1054. return this.each(function () {
  1055. var $this = $(this)
  1056. , data = $this.data('scrollspy')
  1057. , options = typeof option == 'object' && option
  1058. if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options)))
  1059. if (typeof option == 'string') data[option]()
  1060. })
  1061. }
  1062. $.fn.scrollspy.Constructor = ScrollSpy
  1063. $.fn.scrollspy.defaults = {
  1064. offset: 10
  1065. }
  1066. /* SCROLLSPY NO CONFLICT
  1067. * ===================== */
  1068. $.fn.scrollspy.noConflict = function () {
  1069. $.fn.scrollspy = old
  1070. return this
  1071. }
  1072. /* SCROLLSPY DATA-API
  1073. * ================== */
  1074. $(window).on('load', function () {
  1075. $('[data-spy="scroll"]').each(function () {
  1076. var $spy = $(this)
  1077. $spy.scrollspy($spy.data())
  1078. })
  1079. })
  1080. }(window.jQuery);