bootstrap.js 57 KB

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