bootstrap.js 55 KB

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