bootstrap.js 59 KB

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