Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

bootstrap.js 58KB

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