bootstrap.js 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268
  1. /* ===================================================
  2. * bootstrap-transition.js v2.3.0
  3. * http://twitter.github.com/bootstrap/javascript.html#transitions
  4. * ===================================================
  5. * Copyright 2012 Twitter, Inc.
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. * ========================================================== */
  19. !function ($) {
  20. "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.0
  47. * http://twitter.github.com/bootstrap/javascript.html#alerts
  48. * ==========================================================
  49. * Copyright 2012 Twitter, Inc.
  50. *
  51. * Licensed under the Apache License, Version 2.0 (the "License");
  52. * you may not use this file except in compliance with the License.
  53. * You may obtain a copy of the License at
  54. *
  55. * http://www.apache.org/licenses/LICENSE-2.0
  56. *
  57. * Unless required by applicable law or agreed to in writing, software
  58. * distributed under the License is distributed on an "AS IS" BASIS,
  59. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  60. * See the License for the specific language governing permissions and
  61. * limitations under the License.
  62. * ========================================================== */
  63. !function ($) {
  64. "use strict"; // jshint ;_;
  65. /* ALERT CLASS DEFINITION
  66. * ====================== */
  67. var dismiss = '[data-dismiss="alert"]'
  68. , Alert = function (el) {
  69. $(el).on('click', dismiss, this.close)
  70. }
  71. Alert.prototype.close = function (e) {
  72. var $this = $(this)
  73. , selector = $this.attr('data-target')
  74. , $parent
  75. if (!selector) {
  76. selector = $this.attr('href')
  77. selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
  78. }
  79. $parent = $(selector)
  80. e && e.preventDefault()
  81. $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
  82. $parent.trigger(e = $.Event('close'))
  83. if (e.isDefaultPrevented()) return
  84. $parent.removeClass('in')
  85. function removeElement() {
  86. $parent
  87. .trigger('closed')
  88. .remove()
  89. }
  90. $.support.transition && $parent.hasClass('fade') ?
  91. $parent.on($.support.transition.end, removeElement) :
  92. removeElement()
  93. }
  94. /* ALERT PLUGIN DEFINITION
  95. * ======================= */
  96. 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.0
  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.0
  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()
  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.0
  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.0
  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('.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.0
  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.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.0
  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 self = $(e.currentTarget)[this.type](this._options).data(this.type)
  846. if (!self.options.delay || !self.options.delay.show) return self.show()
  847. clearTimeout(this.timeout)
  848. self.hoverState = 'in'
  849. this.timeout = setTimeout(function() {
  850. if (self.hoverState == 'in') self.show()
  851. }, self.options.delay.show)
  852. }
  853. , leave: function (e) {
  854. var self = $(e.currentTarget)[this.type](this._options).data(this.type)
  855. if (this.timeout) clearTimeout(this.timeout)
  856. if (!self.options.delay || !self.options.delay.hide) return self.hide()
  857. self.hoverState = 'out'
  858. this.timeout = setTimeout(function() {
  859. if (self.hoverState == 'out') self.hide()
  860. }, self.options.delay.hide)
  861. }
  862. , show: function () {
  863. var $tip
  864. , pos
  865. , actualWidth
  866. , actualHeight
  867. , placement
  868. , tp
  869. , e = $.Event('show')
  870. if (this.hasContent() && this.enabled) {
  871. this.$element.trigger(e)
  872. if (e.isDefaultPrevented()) return
  873. $tip = this.tip()
  874. this.setContent()
  875. if (this.options.animation) {
  876. $tip.addClass('fade')
  877. }
  878. placement = typeof this.options.placement == 'function' ?
  879. this.options.placement.call(this, $tip[0], this.$element[0]) :
  880. this.options.placement
  881. $tip
  882. .detach()
  883. .css({ top: 0, left: 0, display: 'block' })
  884. this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
  885. pos = this.getPosition()
  886. actualWidth = $tip[0].offsetWidth
  887. actualHeight = $tip[0].offsetHeight
  888. switch (placement) {
  889. case 'bottom':
  890. tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
  891. break
  892. case 'top':
  893. tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
  894. break
  895. case 'left':
  896. tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
  897. break
  898. case 'right':
  899. tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
  900. break
  901. }
  902. this.applyPlacement(tp, placement)
  903. this.$element.trigger('shown')
  904. }
  905. }
  906. , applyPlacement: function(offset, placement){
  907. var $tip = this.tip()
  908. , width = $tip[0].offsetWidth
  909. , height = $tip[0].offsetHeight
  910. , actualWidth
  911. , actualHeight
  912. , delta
  913. , replace
  914. $tip
  915. .offset(offset)
  916. .addClass(placement)
  917. .addClass('in')
  918. actualWidth = $tip[0].offsetWidth
  919. actualHeight = $tip[0].offsetHeight
  920. if (placement == 'top' && actualHeight != height) {
  921. offset.top = offset.top + height - actualHeight
  922. replace = true
  923. }
  924. if (placement == 'bottom' || placement == 'top') {
  925. delta = 0
  926. if (offset.left < 0){
  927. delta = offset.left * -2
  928. offset.left = 0
  929. $tip.offset(offset)
  930. actualWidth = $tip[0].offsetWidth
  931. actualHeight = $tip[0].offsetHeight
  932. }
  933. this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
  934. } else {
  935. this.replaceArrow(actualHeight - height, actualHeight, 'top')
  936. }
  937. if (replace) $tip.offset(offset)
  938. }
  939. , replaceArrow: function(delta, dimension, position){
  940. this
  941. .arrow()
  942. .css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
  943. }
  944. , setContent: function () {
  945. var $tip = this.tip()
  946. , title = this.getTitle()
  947. $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
  948. $tip.removeClass('fade in top bottom left right')
  949. }
  950. , hide: function () {
  951. var that = this
  952. , $tip = this.tip()
  953. , e = $.Event('hide')
  954. this.$element.trigger(e)
  955. if (e.isDefaultPrevented()) return
  956. $tip.removeClass('in')
  957. function removeWithAnimation() {
  958. var timeout = setTimeout(function () {
  959. $tip.off($.support.transition.end).detach()
  960. }, 500)
  961. $tip.one($.support.transition.end, function () {
  962. clearTimeout(timeout)
  963. $tip.detach()
  964. })
  965. }
  966. $.support.transition && this.$tip.hasClass('fade') ?
  967. removeWithAnimation() :
  968. $tip.detach()
  969. this.$element.trigger('hidden')
  970. return this
  971. }
  972. , fixTitle: function () {
  973. var $e = this.$element
  974. if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
  975. $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
  976. }
  977. }
  978. , hasContent: function () {
  979. return this.getTitle()
  980. }
  981. , getPosition: function () {
  982. var el = this.$element[0]
  983. return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
  984. width: el.offsetWidth
  985. , height: el.offsetHeight
  986. }, this.$element.offset())
  987. }
  988. , getTitle: function () {
  989. var title
  990. , $e = this.$element
  991. , o = this.options
  992. title = $e.attr('data-original-title')
  993. || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
  994. return title
  995. }
  996. , tip: function () {
  997. return this.$tip = this.$tip || $(this.options.template)
  998. }
  999. , arrow: function(){
  1000. return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow")
  1001. }
  1002. , validate: function () {
  1003. if (!this.$element[0].parentNode) {
  1004. this.hide()
  1005. this.$element = null
  1006. this.options = null
  1007. }
  1008. }
  1009. , enable: function () {
  1010. this.enabled = true
  1011. }
  1012. , disable: function () {
  1013. this.enabled = false
  1014. }
  1015. , toggleEnabled: function () {
  1016. this.enabled = !this.enabled
  1017. }
  1018. , toggle: function (e) {
  1019. var self = e ? $(e.currentTarget)[this.type](this._options).data(this.type) : this
  1020. self.tip().hasClass('in') ? self.hide() : self.show()
  1021. }
  1022. , destroy: function () {
  1023. this.hide().$element.off('.' + this.type).removeData(this.type)
  1024. }
  1025. }
  1026. /* TOOLTIP PLUGIN DEFINITION
  1027. * ========================= */
  1028. var old = $.fn.tooltip
  1029. $.fn.tooltip = function ( option ) {
  1030. return this.each(function () {
  1031. var $this = $(this)
  1032. , data = $this.data('tooltip')
  1033. , options = typeof option == 'object' && option
  1034. if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
  1035. if (typeof option == 'string') data[option]()
  1036. })
  1037. }
  1038. $.fn.tooltip.Constructor = Tooltip
  1039. $.fn.tooltip.defaults = {
  1040. animation: true
  1041. , placement: 'top'
  1042. , selector: false
  1043. , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
  1044. , trigger: 'hover focus'
  1045. , title: ''
  1046. , delay: 0
  1047. , html: false
  1048. , container: false
  1049. }
  1050. /* TOOLTIP NO CONFLICT
  1051. * =================== */
  1052. $.fn.tooltip.noConflict = function () {
  1053. $.fn.tooltip = old
  1054. return this
  1055. }
  1056. }(window.jQuery);
  1057. /* ===========================================================
  1058. * bootstrap-popover.js v2.3.0
  1059. * http://twitter.github.com/bootstrap/javascript.html#popovers
  1060. * ===========================================================
  1061. * Copyright 2012 Twitter, Inc.
  1062. *
  1063. * Licensed under the Apache License, Version 2.0 (the "License");
  1064. * you may not use this file except in compliance with the License.
  1065. * You may obtain a copy of the License at
  1066. *
  1067. * http://www.apache.org/licenses/LICENSE-2.0
  1068. *
  1069. * Unless required by applicable law or agreed to in writing, software
  1070. * distributed under the License is distributed on an "AS IS" BASIS,
  1071. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  1072. * See the License for the specific language governing permissions and
  1073. * limitations under the License.
  1074. * =========================================================== */
  1075. !function ($) {
  1076. "use strict"; // jshint ;_;
  1077. /* POPOVER PUBLIC CLASS DEFINITION
  1078. * =============================== */
  1079. var Popover = function (element, options) {
  1080. this.init('popover', element, options)
  1081. }
  1082. /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
  1083. ========================================== */
  1084. Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
  1085. constructor: Popover
  1086. , setContent: function () {
  1087. var $tip = this.tip()
  1088. , title = this.getTitle()
  1089. , content = this.getContent()
  1090. $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
  1091. $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)
  1092. $tip.removeClass('fade top bottom left right in')
  1093. }
  1094. , hasContent: function () {
  1095. return this.getTitle() || this.getContent()
  1096. }
  1097. , getContent: function () {
  1098. var content
  1099. , $e = this.$element
  1100. , o = this.options
  1101. content = (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
  1102. || $e.attr('data-content')
  1103. return content
  1104. }
  1105. , tip: function () {
  1106. if (!this.$tip) {
  1107. this.$tip = $(this.options.template)
  1108. }
  1109. return this.$tip
  1110. }
  1111. , destroy: function () {
  1112. this.hide().$element.off('.' + this.type).removeData(this.type)
  1113. }
  1114. })
  1115. /* POPOVER PLUGIN DEFINITION
  1116. * ======================= */
  1117. var old = $.fn.popover
  1118. $.fn.popover = function (option) {
  1119. return this.each(function () {
  1120. var $this = $(this)
  1121. , data = $this.data('popover')
  1122. , options = typeof option == 'object' && option
  1123. if (!data) $this.data('popover', (data = new Popover(this, options)))
  1124. if (typeof option == 'string') data[option]()
  1125. })
  1126. }
  1127. $.fn.popover.Constructor = Popover
  1128. $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
  1129. placement: 'right'
  1130. , trigger: 'click'
  1131. , content: ''
  1132. , template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
  1133. })
  1134. /* POPOVER NO CONFLICT
  1135. * =================== */
  1136. $.fn.popover.noConflict = function () {
  1137. $.fn.popover = old
  1138. return this
  1139. }
  1140. }(window.jQuery);
  1141. /* =============================================================
  1142. * bootstrap-scrollspy.js v2.3.0
  1143. * http://twitter.github.com/bootstrap/javascript.html#scrollspy
  1144. * =============================================================
  1145. * Copyright 2012 Twitter, Inc.
  1146. *
  1147. * Licensed under the Apache License, Version 2.0 (the "License");
  1148. * you may not use this file except in compliance with the License.
  1149. * You may obtain a copy of the License at
  1150. *
  1151. * http://www.apache.org/licenses/LICENSE-2.0
  1152. *
  1153. * Unless required by applicable law or agreed to in writing, software
  1154. * distributed under the License is distributed on an "AS IS" BASIS,
  1155. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  1156. * See the License for the specific language governing permissions and
  1157. * limitations under the License.
  1158. * ============================================================== */
  1159. !function ($) {
  1160. "use strict"; // jshint ;_;
  1161. /* SCROLLSPY CLASS DEFINITION
  1162. * ========================== */
  1163. function ScrollSpy(element, options) {
  1164. var process = $.proxy(this.process, this)
  1165. , $element = $(element).is('body') ? $(window) : $(element)
  1166. , href
  1167. this.options = $.extend({}, $.fn.scrollspy.defaults, options)
  1168. this.$scrollElement = $element.on('scroll.scroll-spy.data-api', process)
  1169. this.selector = (this.options.target
  1170. || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
  1171. || '') + ' .nav li > a'
  1172. this.$body = $('body')
  1173. this.refresh()
  1174. this.process()
  1175. }
  1176. ScrollSpy.prototype = {
  1177. constructor: ScrollSpy
  1178. , refresh: function () {
  1179. var self = this
  1180. , $targets
  1181. this.offsets = $([])
  1182. this.targets = $([])
  1183. $targets = this.$body
  1184. .find(this.selector)
  1185. .map(function () {
  1186. var $el = $(this)
  1187. , href = $el.data('target') || $el.attr('href')
  1188. , $href = /^#\w/.test(href) && $(href)
  1189. return ( $href
  1190. && $href.length
  1191. && [[ $href.position().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]] ) || null
  1192. })
  1193. .sort(function (a, b) { return a[0] - b[0] })
  1194. .each(function () {
  1195. self.offsets.push(this[0])
  1196. self.targets.push(this[1])
  1197. })
  1198. }
  1199. , process: function () {
  1200. var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
  1201. , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
  1202. , maxScroll = scrollHeight - this.$scrollElement.height()
  1203. , offsets = this.offsets
  1204. , targets = this.targets
  1205. , activeTarget = this.activeTarget
  1206. , i
  1207. if (scrollTop >= maxScroll) {
  1208. return activeTarget != (i = targets.last()[0])
  1209. && this.activate ( i )
  1210. }
  1211. for (i = offsets.length; i--;) {
  1212. activeTarget != targets[i]
  1213. && scrollTop >= offsets[i]
  1214. && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
  1215. && this.activate( targets[i] )
  1216. }
  1217. }
  1218. , activate: function (target) {
  1219. var active
  1220. , selector
  1221. this.activeTarget = target
  1222. $(this.selector)
  1223. .parent('.active')
  1224. .removeClass('active')
  1225. selector = this.selector
  1226. + '[data-target="' + target + '"],'
  1227. + this.selector + '[href="' + target + '"]'
  1228. active = $(selector)
  1229. .parent('li')
  1230. .addClass('active')
  1231. if (active.parent('.dropdown-menu').length) {
  1232. active = active.closest('li.dropdown').addClass('active')
  1233. }
  1234. active.trigger('activate')
  1235. }
  1236. }
  1237. /* SCROLLSPY PLUGIN DEFINITION
  1238. * =========================== */
  1239. var old = $.fn.scrollspy
  1240. $.fn.scrollspy = function (option) {
  1241. return this.each(function () {
  1242. var $this = $(this)
  1243. , data = $this.data('scrollspy')
  1244. , options = typeof option == 'object' && option
  1245. if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options)))
  1246. if (typeof option == 'string') data[option]()
  1247. })
  1248. }
  1249. $.fn.scrollspy.Constructor = ScrollSpy
  1250. $.fn.scrollspy.defaults = {
  1251. offset: 10
  1252. }
  1253. /* SCROLLSPY NO CONFLICT
  1254. * ===================== */
  1255. $.fn.scrollspy.noConflict = function () {
  1256. $.fn.scrollspy = old
  1257. return this
  1258. }
  1259. /* SCROLLSPY DATA-API
  1260. * ================== */
  1261. $(window).on('load', function () {
  1262. $('[data-spy="scroll"]').each(function () {
  1263. var $spy = $(this)
  1264. $spy.scrollspy($spy.data())
  1265. })
  1266. })
  1267. }(window.jQuery);/* ========================================================
  1268. * bootstrap-tab.js v2.3.0
  1269. * http://twitter.github.com/bootstrap/javascript.html#tabs
  1270. * ========================================================
  1271. * Copyright 2012 Twitter, Inc.
  1272. *
  1273. * Licensed under the Apache License, Version 2.0 (the "License");
  1274. * you may not use this file except in compliance with the License.
  1275. * You may obtain a copy of the License at
  1276. *
  1277. * http://www.apache.org/licenses/LICENSE-2.0
  1278. *
  1279. * Unless required by applicable law or agreed to in writing, software
  1280. * distributed under the License is distributed on an "AS IS" BASIS,
  1281. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  1282. * See the License for the specific language governing permissions and
  1283. * limitations under the License.
  1284. * ======================================================== */
  1285. !function ($) {
  1286. "use strict"; // jshint ;_;
  1287. /* TAB CLASS DEFINITION
  1288. * ==================== */
  1289. var Tab = function (element) {
  1290. this.element = $(element)
  1291. }
  1292. Tab.prototype = {
  1293. constructor: Tab
  1294. , show: function () {
  1295. var $this = this.element
  1296. , $ul = $this.closest('ul:not(.dropdown-menu)')
  1297. , selector = $this.attr('data-target')
  1298. , previous
  1299. , $target
  1300. , e
  1301. if (!selector) {
  1302. selector = $this.attr('href')
  1303. selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
  1304. }
  1305. if ( $this.parent('li').hasClass('active') ) return
  1306. previous = $ul.find('.active:last a')[0]
  1307. e = $.Event('show', {
  1308. relatedTarget: previous
  1309. })
  1310. $this.trigger(e)
  1311. if (e.isDefaultPrevented()) return
  1312. $target = $(selector)
  1313. this.activate($this.parent('li'), $ul)
  1314. this.activate($target, $target.parent(), function () {
  1315. $this.trigger({
  1316. type: 'shown'
  1317. , relatedTarget: previous
  1318. })
  1319. })
  1320. }
  1321. , activate: function ( element, container, callback) {
  1322. var $active = container.find('> .active')
  1323. , transition = callback
  1324. && $.support.transition
  1325. && $active.hasClass('fade')
  1326. function next() {
  1327. $active
  1328. .removeClass('active')
  1329. .find('> .dropdown-menu > .active')
  1330. .removeClass('active')
  1331. element.addClass('active')
  1332. if (transition) {
  1333. element[0].offsetWidth // reflow for transition
  1334. element.addClass('in')
  1335. } else {
  1336. element.removeClass('fade')
  1337. }
  1338. if ( element.parent('.dropdown-menu') ) {
  1339. element.closest('li.dropdown').addClass('active')
  1340. }
  1341. callback && callback()
  1342. }
  1343. transition ?
  1344. $active.one($.support.transition.end, next) :
  1345. next()
  1346. $active.removeClass('in')
  1347. }
  1348. }
  1349. /* TAB PLUGIN DEFINITION
  1350. * ===================== */
  1351. var old = $.fn.tab
  1352. $.fn.tab = function ( option ) {
  1353. return this.each(function () {
  1354. var $this = $(this)
  1355. , data = $this.data('tab')
  1356. if (!data) $this.data('tab', (data = new Tab(this)))
  1357. if (typeof option == 'string') data[option]()
  1358. })
  1359. }
  1360. $.fn.tab.Constructor = Tab
  1361. /* TAB NO CONFLICT
  1362. * =============== */
  1363. $.fn.tab.noConflict = function () {
  1364. $.fn.tab = old
  1365. return this
  1366. }
  1367. /* TAB DATA-API
  1368. * ============ */
  1369. $(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
  1370. e.preventDefault()
  1371. $(this).tab('show')
  1372. })
  1373. }(window.jQuery);/* =============================================================
  1374. * bootstrap-typeahead.js v2.3.0
  1375. * http://twitter.github.com/bootstrap/javascript.html#typeahead
  1376. * =============================================================
  1377. * Copyright 2012 Twitter, Inc.
  1378. *
  1379. * Licensed under the Apache License, Version 2.0 (the "License");
  1380. * you may not use this file except in compliance with the License.
  1381. * You may obtain a copy of the License at
  1382. *
  1383. * http://www.apache.org/licenses/LICENSE-2.0
  1384. *
  1385. * Unless required by applicable law or agreed to in writing, software
  1386. * distributed under the License is distributed on an "AS IS" BASIS,
  1387. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  1388. * See the License for the specific language governing permissions and
  1389. * limitations under the License.
  1390. * ============================================================ */
  1391. !function($){
  1392. "use strict"; // jshint ;_;
  1393. /* TYPEAHEAD PUBLIC CLASS DEFINITION
  1394. * ================================= */
  1395. var Typeahead = function (element, options) {
  1396. this.$element = $(element)
  1397. this.options = $.extend({}, $.fn.typeahead.defaults, options)
  1398. this.matcher = this.options.matcher || this.matcher
  1399. this.sorter = this.options.sorter || this.sorter
  1400. this.highlighter = this.options.highlighter || this.highlighter
  1401. this.updater = this.options.updater || this.updater
  1402. this.source = this.options.source
  1403. this.$menu = $(this.options.menu)
  1404. this.shown = false
  1405. this.listen()
  1406. }
  1407. Typeahead.prototype = {
  1408. constructor: Typeahead
  1409. , select: function () {
  1410. var val = this.$menu.find('.active').attr('data-value')
  1411. this.$element
  1412. .val(this.updater(val))
  1413. .change()
  1414. return this.hide()
  1415. }
  1416. , updater: function (item) {
  1417. return item
  1418. }
  1419. , show: function () {
  1420. var pos = $.extend({}, this.$element.position(), {
  1421. height: this.$element[0].offsetHeight
  1422. })
  1423. this.$menu
  1424. .insertAfter(this.$element)
  1425. .css({
  1426. top: pos.top + pos.height
  1427. , left: pos.left
  1428. })
  1429. .show()
  1430. this.shown = true
  1431. return this
  1432. }
  1433. , hide: function () {
  1434. this.$menu.hide()
  1435. this.shown = false
  1436. return this
  1437. }
  1438. , lookup: function (event) {
  1439. var items
  1440. this.query = this.$element.val()
  1441. if (!this.query || this.query.length < this.options.minLength) {
  1442. return this.shown ? this.hide() : this
  1443. }
  1444. items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source
  1445. return items ? this.process(items) : this
  1446. }
  1447. , process: function (items) {
  1448. var that = this
  1449. items = $.grep(items, function (item) {
  1450. return that.matcher(item)
  1451. })
  1452. items = this.sorter(items)
  1453. if (!items.length) {
  1454. return this.shown ? this.hide() : this
  1455. }
  1456. return this.render(items.slice(0, this.options.items)).show()
  1457. }
  1458. , matcher: function (item) {
  1459. return ~item.toLowerCase().indexOf(this.query.toLowerCase())
  1460. }
  1461. , sorter: function (items) {
  1462. var beginswith = []
  1463. , caseSensitive = []
  1464. , caseInsensitive = []
  1465. , item
  1466. while (item = items.shift()) {
  1467. if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item)
  1468. else if (~item.indexOf(this.query)) caseSensitive.push(item)
  1469. else caseInsensitive.push(item)
  1470. }
  1471. return beginswith.concat(caseSensitive, caseInsensitive)
  1472. }
  1473. , highlighter: function (item) {
  1474. var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&')
  1475. return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
  1476. return '<strong>' + match + '</strong>'
  1477. })
  1478. }
  1479. , render: function (items) {
  1480. var that = this
  1481. items = $(items).map(function (i, item) {
  1482. i = $(that.options.item).attr('data-value', item)
  1483. i.find('a').html(that.highlighter(item))
  1484. return i[0]
  1485. })
  1486. items.first().addClass('active')
  1487. this.$menu.html(items)
  1488. return this
  1489. }
  1490. , next: function (event) {
  1491. var active = this.$menu.find('.active').removeClass('active')
  1492. , next = active.next()
  1493. if (!next.length) {
  1494. next = $(this.$menu.find('li')[0])
  1495. }
  1496. next.addClass('active')
  1497. }
  1498. , prev: function (event) {
  1499. var active = this.$menu.find('.active').removeClass('active')
  1500. , prev = active.prev()
  1501. if (!prev.length) {
  1502. prev = this.$menu.find('li').last()
  1503. }
  1504. prev.addClass('active')
  1505. }
  1506. , listen: function () {
  1507. this.$element
  1508. .on('focus', $.proxy(this.focus, this))
  1509. .on('blur', $.proxy(this.blur, this))
  1510. .on('keypress', $.proxy(this.keypress, this))
  1511. .on('keyup', $.proxy(this.keyup, this))
  1512. if (this.eventSupported('keydown')) {
  1513. this.$element.on('keydown', $.proxy(this.keydown, this))
  1514. }
  1515. this.$menu
  1516. .on('click', $.proxy(this.click, this))
  1517. .on('mouseenter', 'li', $.proxy(this.mouseenter, this))
  1518. .on('mouseleave', 'li', $.proxy(this.mouseleave, this))
  1519. }
  1520. , eventSupported: function(eventName) {
  1521. var isSupported = eventName in this.$element
  1522. if (!isSupported) {
  1523. this.$element.setAttribute(eventName, 'return;')
  1524. isSupported = typeof this.$element[eventName] === 'function'
  1525. }
  1526. return isSupported
  1527. }
  1528. , move: function (e) {
  1529. if (!this.shown) return
  1530. switch(e.keyCode) {
  1531. case 9: // tab
  1532. case 13: // enter
  1533. case 27: // escape
  1534. e.preventDefault()
  1535. break
  1536. case 38: // up arrow
  1537. e.preventDefault()
  1538. this.prev()
  1539. break
  1540. case 40: // down arrow
  1541. e.preventDefault()
  1542. this.next()
  1543. break
  1544. }
  1545. e.stopPropagation()
  1546. }
  1547. , keydown: function (e) {
  1548. this.suppressKeyPressRepeat = ~$.inArray(e.keyCode, [40,38,9,13,27])
  1549. this.move(e)
  1550. }
  1551. , keypress: function (e) {
  1552. if (this.suppressKeyPressRepeat) return
  1553. this.move(e)
  1554. }
  1555. , keyup: function (e) {
  1556. switch(e.keyCode) {
  1557. case 40: // down arrow
  1558. case 38: // up arrow
  1559. case 16: // shift
  1560. case 17: // ctrl
  1561. case 18: // alt
  1562. break
  1563. case 9: // tab
  1564. case 13: // enter
  1565. if (!this.shown) return
  1566. this.select()
  1567. break
  1568. case 27: // escape
  1569. if (!this.shown) return
  1570. this.hide()
  1571. break
  1572. default:
  1573. this.lookup()
  1574. }
  1575. e.stopPropagation()
  1576. e.preventDefault()
  1577. }
  1578. , focus: function (e) {
  1579. this.focused = true
  1580. }
  1581. , blur: function (e) {
  1582. this.focused = false
  1583. if (!this.mousedover && this.shown) this.hide()
  1584. }
  1585. , click: function (e) {
  1586. e.stopPropagation()
  1587. e.preventDefault()
  1588. this.select()
  1589. this.$element.focus()
  1590. }
  1591. , mouseenter: function (e) {
  1592. this.mousedover = true
  1593. this.$menu.find('.active').removeClass('active')
  1594. $(e.currentTarget).addClass('active')
  1595. }
  1596. , mouseleave: function (e) {
  1597. this.mousedover = false
  1598. if (!this.focused && this.shown) this.hide()
  1599. }
  1600. }
  1601. /* TYPEAHEAD PLUGIN DEFINITION
  1602. * =========================== */
  1603. var old = $.fn.typeahead
  1604. $.fn.typeahead = function (option) {
  1605. return this.each(function () {
  1606. var $this = $(this)
  1607. , data = $this.data('typeahead')
  1608. , options = typeof option == 'object' && option
  1609. if (!data) $this.data('typeahead', (data = new Typeahead(this, options)))
  1610. if (typeof option == 'string') data[option]()
  1611. })
  1612. }
  1613. $.fn.typeahead.defaults = {
  1614. source: []
  1615. , items: 8
  1616. , menu: '<ul class="typeahead dropdown-menu"></ul>'
  1617. , item: '<li><a href="#"></a></li>'
  1618. , minLength: 1
  1619. }
  1620. $.fn.typeahead.Constructor = Typeahead
  1621. /* TYPEAHEAD NO CONFLICT
  1622. * =================== */
  1623. $.fn.typeahead.noConflict = function () {
  1624. $.fn.typeahead = old
  1625. return this
  1626. }
  1627. /* TYPEAHEAD DATA-API
  1628. * ================== */
  1629. $(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
  1630. var $this = $(this)
  1631. if ($this.data('typeahead')) return
  1632. $this.typeahead($this.data())
  1633. })
  1634. }(window.jQuery);
  1635. /* ==========================================================
  1636. * bootstrap-affix.js v2.3.0
  1637. * http://twitter.github.com/bootstrap/javascript.html#affix
  1638. * ==========================================================
  1639. * Copyright 2012 Twitter, Inc.
  1640. *
  1641. * Licensed under the Apache License, Version 2.0 (the "License");
  1642. * you may not use this file except in compliance with the License.
  1643. * You may obtain a copy of the License at
  1644. *
  1645. * http://www.apache.org/licenses/LICENSE-2.0
  1646. *
  1647. * Unless required by applicable law or agreed to in writing, software
  1648. * distributed under the License is distributed on an "AS IS" BASIS,
  1649. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  1650. * See the License for the specific language governing permissions and
  1651. * limitations under the License.
  1652. * ========================================================== */
  1653. !function ($) {
  1654. "use strict"; // jshint ;_;
  1655. /* AFFIX CLASS DEFINITION
  1656. * ====================== */
  1657. var Affix = function (element, options) {
  1658. this.options = $.extend({}, $.fn.affix.defaults, options)
  1659. this.$window = $(window)
  1660. .on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
  1661. .on('click.affix.data-api', $.proxy(function () { setTimeout($.proxy(this.checkPosition, this), 1) }, this))
  1662. this.$element = $(element)
  1663. this.checkPosition()
  1664. }
  1665. Affix.prototype.checkPosition = function () {
  1666. if (!this.$element.is(':visible')) return
  1667. var scrollHeight = $(document).height()
  1668. , scrollTop = this.$window.scrollTop()
  1669. , position = this.$element.offset()
  1670. , offset = this.options.offset
  1671. , offsetBottom = offset.bottom
  1672. , offsetTop = offset.top
  1673. , reset = 'affix affix-top affix-bottom'
  1674. , affix
  1675. if (typeof offset != 'object') offsetBottom = offsetTop = offset
  1676. if (typeof offsetTop == 'function') offsetTop = offset.top()
  1677. if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
  1678. affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ?
  1679. false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ?
  1680. 'bottom' : offsetTop != null && scrollTop <= offsetTop ?
  1681. 'top' : false
  1682. if (this.affixed === affix) return
  1683. this.affixed = affix
  1684. this.unpin = affix == 'bottom' ? position.top - scrollTop : null
  1685. this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : ''))
  1686. }
  1687. /* AFFIX PLUGIN DEFINITION
  1688. * ======================= */
  1689. var old = $.fn.affix
  1690. $.fn.affix = function (option) {
  1691. return this.each(function () {
  1692. var $this = $(this)
  1693. , data = $this.data('affix')
  1694. , options = typeof option == 'object' && option
  1695. if (!data) $this.data('affix', (data = new Affix(this, options)))
  1696. if (typeof option == 'string') data[option]()
  1697. })
  1698. }
  1699. $.fn.affix.Constructor = Affix
  1700. $.fn.affix.defaults = {
  1701. offset: 0
  1702. }
  1703. /* AFFIX NO CONFLICT
  1704. * ================= */
  1705. $.fn.affix.noConflict = function () {
  1706. $.fn.affix = old
  1707. return this
  1708. }
  1709. /* AFFIX DATA-API
  1710. * ============== */
  1711. $(window).on('load', function () {
  1712. $('[data-spy="affix"]').each(function () {
  1713. var $spy = $(this)
  1714. , data = $spy.data()
  1715. data.offset = data.offset || {}
  1716. data.offsetBottom && (data.offset.bottom = data.offsetBottom)
  1717. data.offsetTop && (data.offset.top = data.offsetTop)
  1718. $spy.affix(data)
  1719. })
  1720. })
  1721. }(window.jQuery);