1
0

bootstrap.js 61 KB

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