bootstrap.js 57 KB

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