bootstrap.js 56 KB

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