bootstrap.js 64 KB

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