bootstrap.js 60 KB

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