bootstrap.js 54 KB

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