bootstrap.js 57 KB

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