bootstrap.js 51 KB

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