bootstrap.js 57 KB

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