bootstrap.js 57 KB

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