bootstrap.js 60KB

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