1
0

bootstrap.js 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280
  1. /* ===================================================
  2. * bootstrap-transition.js v2.3.2
  3. * http://getbootstrap.com/2.3.2/javascript.html#transitions
  4. * ===================================================
  5. * Copyright 2013 Twitter, Inc.
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. * ========================================================== */
  19. !function ($) {
  20. "use strict"; // jshint ;_;
  21. /* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
  22. * ======================================================= */
  23. $(function () {
  24. $.support.transition = (function () {
  25. var transitionEnd = (function () {
  26. var el = document.createElement('bootstrap')
  27. , transEndEventNames = {
  28. 'WebkitTransition' : 'webkitTransitionEnd'
  29. , 'MozTransition' : 'transitionend'
  30. , 'OTransition' : 'oTransitionEnd otransitionend'
  31. , 'transition' : 'transitionend'
  32. }
  33. , name
  34. for (name in transEndEventNames){
  35. if (el.style[name] !== undefined) {
  36. return transEndEventNames[name]
  37. }
  38. }
  39. }())
  40. return transitionEnd && {
  41. end: transitionEnd
  42. }
  43. })()
  44. })
  45. }(window.jQuery);/* ==========================================================
  46. * bootstrap-alert.js v2.3.2
  47. * http://getbootstrap.com/2.3.2/javascript.html#alerts
  48. * ==========================================================
  49. * Copyright 2013 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.2
  117. * http://getbootstrap.com/2.3.2/javascript.html#buttons
  118. * ============================================================
  119. * Copyright 2013 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.2
  195. * http://getbootstrap.com/2.3.2/javascript.html#carousel
  196. * ==========================================================
  197. * Copyright 2013 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.2
  358. * http://getbootstrap.com/2.3.2/javascript.html#collapse
  359. * =============================================================
  360. * Copyright 2013 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.2
  482. * http://getbootstrap.com/2.3.2/javascript.html#dropdowns
  483. * ============================================================
  484. * Copyright 2013 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. if ('ontouchstart' in document.documentElement) {
  521. // if mobile we we use a backdrop because click events don't delegate
  522. $('<div class="dropdown-backdrop"/>').insertBefore($(this)).on('click', clearMenus)
  523. }
  524. $parent.toggleClass('open')
  525. }
  526. $this.focus()
  527. return false
  528. }
  529. , keydown: function (e) {
  530. var $this
  531. , $items
  532. , $active
  533. , $parent
  534. , isActive
  535. , index
  536. if (!/(38|40|27)/.test(e.keyCode)) return
  537. $this = $(this)
  538. e.preventDefault()
  539. e.stopPropagation()
  540. if ($this.is('.disabled, :disabled')) return
  541. $parent = getParent($this)
  542. isActive = $parent.hasClass('open')
  543. if (!isActive || (isActive && e.keyCode == 27)) {
  544. if (e.which == 27) $parent.find(toggle).focus()
  545. return $this.click()
  546. }
  547. $items = $('[role=menu] li:not(.divider):visible a', $parent)
  548. if (!$items.length) return
  549. index = $items.index($items.filter(':focus'))
  550. if (e.keyCode == 38 && index > 0) index-- // up
  551. if (e.keyCode == 40 && index < $items.length - 1) index++ // down
  552. if (!~index) index = 0
  553. $items
  554. .eq(index)
  555. .focus()
  556. }
  557. }
  558. function clearMenus() {
  559. $('.dropdown-backdrop').remove()
  560. $(toggle).each(function () {
  561. getParent($(this)).removeClass('open')
  562. })
  563. }
  564. function getParent($this) {
  565. var selector = $this.attr('data-target')
  566. , $parent
  567. if (!selector) {
  568. selector = $this.attr('href')
  569. selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
  570. }
  571. $parent = selector && $(selector)
  572. if (!$parent || !$parent.length) $parent = $this.parent()
  573. return $parent
  574. }
  575. /* DROPDOWN PLUGIN DEFINITION
  576. * ========================== */
  577. var old = $.fn.dropdown
  578. $.fn.dropdown = function (option) {
  579. return this.each(function () {
  580. var $this = $(this)
  581. , data = $this.data('dropdown')
  582. if (!data) $this.data('dropdown', (data = new Dropdown(this)))
  583. if (typeof option == 'string') data[option].call($this)
  584. })
  585. }
  586. $.fn.dropdown.Constructor = Dropdown
  587. /* DROPDOWN NO CONFLICT
  588. * ==================== */
  589. $.fn.dropdown.noConflict = function () {
  590. $.fn.dropdown = old
  591. return this
  592. }
  593. /* APPLY TO STANDARD DROPDOWN ELEMENTS
  594. * =================================== */
  595. $(document)
  596. .on('click.dropdown.data-api', clearMenus)
  597. .on('click.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
  598. .on('click.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
  599. .on('keydown.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
  600. }(window.jQuery);
  601. /* =========================================================
  602. * bootstrap-modal.js v2.3.2
  603. * http://getbootstrap.com/2.3.2/javascript.html#modals
  604. * =========================================================
  605. * Copyright 2013 Twitter, Inc.
  606. *
  607. * Licensed under the Apache License, Version 2.0 (the "License");
  608. * you may not use this file except in compliance with the License.
  609. * You may obtain a copy of the License at
  610. *
  611. * http://www.apache.org/licenses/LICENSE-2.0
  612. *
  613. * Unless required by applicable law or agreed to in writing, software
  614. * distributed under the License is distributed on an "AS IS" BASIS,
  615. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  616. * See the License for the specific language governing permissions and
  617. * limitations under the License.
  618. * ========================================================= */
  619. !function ($) {
  620. "use strict"; // jshint ;_;
  621. /* MODAL CLASS DEFINITION
  622. * ====================== */
  623. var Modal = function (element, options) {
  624. this.options = options
  625. this.$element = $(element)
  626. .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
  627. this.options.remote && this.$element.find('.modal-body').load(this.options.remote)
  628. }
  629. Modal.prototype = {
  630. constructor: Modal
  631. , toggle: function () {
  632. return this[!this.isShown ? 'show' : 'hide']()
  633. }
  634. , show: function () {
  635. var that = this
  636. , e = $.Event('show')
  637. this.$element.trigger(e)
  638. if (this.isShown || e.isDefaultPrevented()) return
  639. this.isShown = true
  640. this.escape()
  641. this.backdrop(function () {
  642. var transition = $.support.transition && that.$element.hasClass('fade')
  643. if (!that.$element.parent().length) {
  644. that.$element.appendTo(document.body) //don't move modals dom position
  645. }
  646. that.$element.show()
  647. if (transition) {
  648. that.$element[0].offsetWidth // force reflow
  649. }
  650. that.$element
  651. .addClass('in')
  652. .attr('aria-hidden', false)
  653. that.enforceFocus()
  654. transition ?
  655. that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) :
  656. that.$element.focus().trigger('shown')
  657. })
  658. }
  659. , hide: function (e) {
  660. e && e.preventDefault()
  661. var that = this
  662. e = $.Event('hide')
  663. this.$element.trigger(e)
  664. if (!this.isShown || e.isDefaultPrevented()) return
  665. this.isShown = false
  666. this.escape()
  667. $(document).off('focusin.modal')
  668. this.$element
  669. .removeClass('in')
  670. .attr('aria-hidden', true)
  671. $.support.transition && this.$element.hasClass('fade') ?
  672. this.hideWithTransition() :
  673. this.hideModal()
  674. }
  675. , enforceFocus: function () {
  676. var that = this
  677. $(document).on('focusin.modal', function (e) {
  678. if (that.$element[0] !== e.target && !that.$element.has(e.target).length) {
  679. that.$element.focus()
  680. }
  681. })
  682. }
  683. , escape: function () {
  684. var that = this
  685. if (this.isShown && this.options.keyboard) {
  686. this.$element.on('keyup.dismiss.modal', function ( e ) {
  687. e.which == 27 && that.hide()
  688. })
  689. } else if (!this.isShown) {
  690. this.$element.off('keyup.dismiss.modal')
  691. }
  692. }
  693. , hideWithTransition: function () {
  694. var that = this
  695. , timeout = setTimeout(function () {
  696. that.$element.off($.support.transition.end)
  697. that.hideModal()
  698. }, 500)
  699. this.$element.one($.support.transition.end, function () {
  700. clearTimeout(timeout)
  701. that.hideModal()
  702. })
  703. }
  704. , hideModal: function () {
  705. var that = this
  706. this.$element.hide()
  707. this.backdrop(function () {
  708. that.removeBackdrop()
  709. that.$element.trigger('hidden')
  710. })
  711. }
  712. , removeBackdrop: function () {
  713. this.$backdrop && this.$backdrop.remove()
  714. this.$backdrop = null
  715. }
  716. , backdrop: function (callback) {
  717. var that = this
  718. , animate = this.$element.hasClass('fade') ? 'fade' : ''
  719. if (this.isShown && this.options.backdrop) {
  720. var doAnimate = $.support.transition && animate
  721. this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
  722. .appendTo(document.body)
  723. this.$backdrop.click(
  724. this.options.backdrop == 'static' ?
  725. $.proxy(this.$element[0].focus, this.$element[0])
  726. : $.proxy(this.hide, this)
  727. )
  728. if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
  729. this.$backdrop.addClass('in')
  730. if (!callback) return
  731. doAnimate ?
  732. this.$backdrop.one($.support.transition.end, callback) :
  733. callback()
  734. } else if (!this.isShown && this.$backdrop) {
  735. this.$backdrop.removeClass('in')
  736. $.support.transition && this.$element.hasClass('fade')?
  737. this.$backdrop.one($.support.transition.end, callback) :
  738. callback()
  739. } else if (callback) {
  740. callback()
  741. }
  742. }
  743. }
  744. /* MODAL PLUGIN DEFINITION
  745. * ======================= */
  746. var old = $.fn.modal
  747. $.fn.modal = function (option) {
  748. return this.each(function () {
  749. var $this = $(this)
  750. , data = $this.data('modal')
  751. , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
  752. if (!data) $this.data('modal', (data = new Modal(this, options)))
  753. if (typeof option == 'string') data[option]()
  754. else if (options.show) data.show()
  755. })
  756. }
  757. $.fn.modal.defaults = {
  758. backdrop: true
  759. , keyboard: true
  760. , show: true
  761. }
  762. $.fn.modal.Constructor = Modal
  763. /* MODAL NO CONFLICT
  764. * ================= */
  765. $.fn.modal.noConflict = function () {
  766. $.fn.modal = old
  767. return this
  768. }
  769. /* MODAL DATA-API
  770. * ============== */
  771. $(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) {
  772. var $this = $(this)
  773. , href = $this.attr('href')
  774. , $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
  775. , option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data())
  776. e.preventDefault()
  777. $target
  778. .modal(option)
  779. .one('hide', function () {
  780. $this.focus()
  781. })
  782. })
  783. }(window.jQuery);
  784. /* ===========================================================
  785. * bootstrap-tooltip.js v2.3.2
  786. * http://getbootstrap.com/2.3.2/javascript.html#tooltips
  787. * Inspired by the original jQuery.tipsy by Jason Frame
  788. * ===========================================================
  789. * Copyright 2013 Twitter, Inc.
  790. *
  791. * Licensed under the Apache License, Version 2.0 (the "License");
  792. * you may not use this file except in compliance with the License.
  793. * You may obtain a copy of the License at
  794. *
  795. * http://www.apache.org/licenses/LICENSE-2.0
  796. *
  797. * Unless required by applicable law or agreed to in writing, software
  798. * distributed under the License is distributed on an "AS IS" BASIS,
  799. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  800. * See the License for the specific language governing permissions and
  801. * limitations under the License.
  802. * ========================================================== */
  803. !function ($) {
  804. "use strict"; // jshint ;_;
  805. /* TOOLTIP PUBLIC CLASS DEFINITION
  806. * =============================== */
  807. var Tooltip = function (element, options) {
  808. this.init('tooltip', element, options)
  809. }
  810. Tooltip.prototype = {
  811. constructor: Tooltip
  812. , init: function (type, element, options) {
  813. var eventIn
  814. , eventOut
  815. , triggers
  816. , trigger
  817. , i
  818. this.type = type
  819. this.$element = $(element)
  820. this.options = this.getOptions(options)
  821. this.enabled = true
  822. triggers = this.options.trigger.split(' ')
  823. for (i = triggers.length; i--;) {
  824. trigger = triggers[i]
  825. if (trigger == 'click') {
  826. this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
  827. } else if (trigger != 'manual') {
  828. eventIn = trigger == 'hover' ? 'mouseenter' : 'focus'
  829. eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
  830. this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
  831. this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
  832. }
  833. }
  834. this.options.selector ?
  835. (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
  836. this.fixTitle()
  837. }
  838. , getOptions: function (options) {
  839. options = $.extend({}, $.fn[this.type].defaults, this.$element.data(), options)
  840. if (options.delay && typeof options.delay == 'number') {
  841. options.delay = {
  842. show: options.delay
  843. , hide: options.delay
  844. }
  845. }
  846. return options
  847. }
  848. , enter: function (e) {
  849. var defaults = $.fn[this.type].defaults
  850. , options = {}
  851. , self
  852. this._options && $.each(this._options, function (key, value) {
  853. if (defaults[key] != value) options[key] = value
  854. }, this)
  855. self = $(e.currentTarget)[this.type](options).data(this.type)
  856. if (!self.options.delay || !self.options.delay.show) return self.show()
  857. clearTimeout(this.timeout)
  858. self.hoverState = 'in'
  859. this.timeout = setTimeout(function() {
  860. if (self.hoverState == 'in') self.show()
  861. }, self.options.delay.show)
  862. }
  863. , leave: function (e) {
  864. var self = $(e.currentTarget)[this.type](this._options).data(this.type)
  865. if (this.timeout) clearTimeout(this.timeout)
  866. if (!self.options.delay || !self.options.delay.hide) return self.hide()
  867. self.hoverState = 'out'
  868. this.timeout = setTimeout(function() {
  869. if (self.hoverState == 'out') self.hide()
  870. }, self.options.delay.hide)
  871. }
  872. , show: function () {
  873. var $tip
  874. , pos
  875. , actualWidth
  876. , actualHeight
  877. , placement
  878. , tp
  879. , e = $.Event('show')
  880. if (this.hasContent() && this.enabled) {
  881. this.$element.trigger(e)
  882. if (e.isDefaultPrevented()) return
  883. $tip = this.tip()
  884. this.setContent()
  885. if (this.options.animation) {
  886. $tip.addClass('fade')
  887. }
  888. placement = typeof this.options.placement == 'function' ?
  889. this.options.placement.call(this, $tip[0], this.$element[0]) :
  890. this.options.placement
  891. $tip
  892. .detach()
  893. .css({ top: 0, left: 0, display: 'block' })
  894. this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
  895. pos = this.getPosition()
  896. actualWidth = $tip[0].offsetWidth
  897. actualHeight = $tip[0].offsetHeight
  898. switch (placement) {
  899. case 'bottom':
  900. tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
  901. break
  902. case 'top':
  903. tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
  904. break
  905. case 'left':
  906. tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
  907. break
  908. case 'right':
  909. tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
  910. break
  911. }
  912. this.applyPlacement(tp, placement)
  913. this.$element.trigger('shown')
  914. }
  915. }
  916. , applyPlacement: function(offset, placement){
  917. var $tip = this.tip()
  918. , width = $tip[0].offsetWidth
  919. , height = $tip[0].offsetHeight
  920. , actualWidth
  921. , actualHeight
  922. , delta
  923. , replace
  924. $tip
  925. .offset(offset)
  926. .addClass(placement)
  927. .addClass('in')
  928. actualWidth = $tip[0].offsetWidth
  929. actualHeight = $tip[0].offsetHeight
  930. if (placement == 'top' && actualHeight != height) {
  931. offset.top = offset.top + height - actualHeight
  932. replace = true
  933. }
  934. if (placement == 'bottom' || placement == 'top') {
  935. delta = 0
  936. if (offset.left < 0){
  937. delta = offset.left * -2
  938. offset.left = 0
  939. $tip.offset(offset)
  940. actualWidth = $tip[0].offsetWidth
  941. actualHeight = $tip[0].offsetHeight
  942. }
  943. this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
  944. } else {
  945. this.replaceArrow(actualHeight - height, actualHeight, 'top')
  946. }
  947. if (replace) $tip.offset(offset)
  948. }
  949. , replaceArrow: function(delta, dimension, position){
  950. this
  951. .arrow()
  952. .css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
  953. }
  954. , setContent: function () {
  955. var $tip = this.tip()
  956. , title = this.getTitle()
  957. $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
  958. $tip.removeClass('fade in top bottom left right')
  959. }
  960. , hide: function () {
  961. var that = this
  962. , $tip = this.tip()
  963. , e = $.Event('hide')
  964. this.$element.trigger(e)
  965. if (e.isDefaultPrevented()) return
  966. $tip.removeClass('in')
  967. function removeWithAnimation() {
  968. var timeout = setTimeout(function () {
  969. $tip.off($.support.transition.end).detach()
  970. }, 500)
  971. $tip.one($.support.transition.end, function () {
  972. clearTimeout(timeout)
  973. $tip.detach()
  974. })
  975. }
  976. $.support.transition && this.$tip.hasClass('fade') ?
  977. removeWithAnimation() :
  978. $tip.detach()
  979. this.$element.trigger('hidden')
  980. return this
  981. }
  982. , fixTitle: function () {
  983. var $e = this.$element
  984. if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
  985. $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
  986. }
  987. }
  988. , hasContent: function () {
  989. return this.getTitle()
  990. }
  991. , getPosition: function () {
  992. var el = this.$element[0]
  993. return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
  994. width: el.offsetWidth
  995. , height: el.offsetHeight
  996. }, this.$element.offset())
  997. }
  998. , getTitle: function () {
  999. var title
  1000. , $e = this.$element
  1001. , o = this.options
  1002. title = $e.attr('data-original-title')
  1003. || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
  1004. return title
  1005. }
  1006. , tip: function () {
  1007. return this.$tip = this.$tip || $(this.options.template)
  1008. }
  1009. , arrow: function(){
  1010. return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow")
  1011. }
  1012. , validate: function () {
  1013. if (!this.$element[0].parentNode) {
  1014. this.hide()
  1015. this.$element = null
  1016. this.options = null
  1017. }
  1018. }
  1019. , enable: function () {
  1020. this.enabled = true
  1021. }
  1022. , disable: function () {
  1023. this.enabled = false
  1024. }
  1025. , toggleEnabled: function () {
  1026. this.enabled = !this.enabled
  1027. }
  1028. , toggle: function (e) {
  1029. var self = e ? $(e.currentTarget)[this.type](this._options).data(this.type) : this
  1030. self.tip().hasClass('in') ? self.hide() : self.show()
  1031. }
  1032. , destroy: function () {
  1033. this.hide().$element.off('.' + this.type).removeData(this.type)
  1034. }
  1035. }
  1036. /* TOOLTIP PLUGIN DEFINITION
  1037. * ========================= */
  1038. var old = $.fn.tooltip
  1039. $.fn.tooltip = function ( option ) {
  1040. return this.each(function () {
  1041. var $this = $(this)
  1042. , data = $this.data('tooltip')
  1043. , options = typeof option == 'object' && option
  1044. if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
  1045. if (typeof option == 'string') data[option]()
  1046. })
  1047. }
  1048. $.fn.tooltip.Constructor = Tooltip
  1049. $.fn.tooltip.defaults = {
  1050. animation: true
  1051. , placement: 'top'
  1052. , selector: false
  1053. , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
  1054. , trigger: 'hover focus'
  1055. , title: ''
  1056. , delay: 0
  1057. , html: false
  1058. , container: false
  1059. }
  1060. /* TOOLTIP NO CONFLICT
  1061. * =================== */
  1062. $.fn.tooltip.noConflict = function () {
  1063. $.fn.tooltip = old
  1064. return this
  1065. }
  1066. }(window.jQuery);
  1067. /* ===========================================================
  1068. * bootstrap-popover.js v2.3.2
  1069. * http://getbootstrap.com/2.3.2/javascript.html#popovers
  1070. * ===========================================================
  1071. * Copyright 2013 Twitter, Inc.
  1072. *
  1073. * Licensed under the Apache License, Version 2.0 (the "License");
  1074. * you may not use this file except in compliance with the License.
  1075. * You may obtain a copy of the License at
  1076. *
  1077. * http://www.apache.org/licenses/LICENSE-2.0
  1078. *
  1079. * Unless required by applicable law or agreed to in writing, software
  1080. * distributed under the License is distributed on an "AS IS" BASIS,
  1081. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  1082. * See the License for the specific language governing permissions and
  1083. * limitations under the License.
  1084. * =========================================================== */
  1085. !function ($) {
  1086. "use strict"; // jshint ;_;
  1087. /* POPOVER PUBLIC CLASS DEFINITION
  1088. * =============================== */
  1089. var Popover = function (element, options) {
  1090. this.init('popover', element, options)
  1091. }
  1092. /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
  1093. ========================================== */
  1094. Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
  1095. constructor: Popover
  1096. , setContent: function () {
  1097. var $tip = this.tip()
  1098. , title = this.getTitle()
  1099. , content = this.getContent()
  1100. $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
  1101. $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)
  1102. $tip.removeClass('fade top bottom left right in')
  1103. }
  1104. , hasContent: function () {
  1105. return this.getTitle() || this.getContent()
  1106. }
  1107. , getContent: function () {
  1108. var content
  1109. , $e = this.$element
  1110. , o = this.options
  1111. content = (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
  1112. || $e.attr('data-content')
  1113. return content
  1114. }
  1115. , tip: function () {
  1116. if (!this.$tip) {
  1117. this.$tip = $(this.options.template)
  1118. }
  1119. return this.$tip
  1120. }
  1121. , destroy: function () {
  1122. this.hide().$element.off('.' + this.type).removeData(this.type)
  1123. }
  1124. })
  1125. /* POPOVER PLUGIN DEFINITION
  1126. * ======================= */
  1127. var old = $.fn.popover
  1128. $.fn.popover = function (option) {
  1129. return this.each(function () {
  1130. var $this = $(this)
  1131. , data = $this.data('popover')
  1132. , options = typeof option == 'object' && option
  1133. if (!data) $this.data('popover', (data = new Popover(this, options)))
  1134. if (typeof option == 'string') data[option]()
  1135. })
  1136. }
  1137. $.fn.popover.Constructor = Popover
  1138. $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
  1139. placement: 'right'
  1140. , trigger: 'click'
  1141. , content: ''
  1142. , template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
  1143. })
  1144. /* POPOVER NO CONFLICT
  1145. * =================== */
  1146. $.fn.popover.noConflict = function () {
  1147. $.fn.popover = old
  1148. return this
  1149. }
  1150. }(window.jQuery);
  1151. /* =============================================================
  1152. * bootstrap-scrollspy.js v2.3.2
  1153. * http://getbootstrap.com/2.3.2/javascript.html#scrollspy
  1154. * =============================================================
  1155. * Copyright 2013 Twitter, Inc.
  1156. *
  1157. * Licensed under the Apache License, Version 2.0 (the "License");
  1158. * you may not use this file except in compliance with the License.
  1159. * You may obtain a copy of the License at
  1160. *
  1161. * http://www.apache.org/licenses/LICENSE-2.0
  1162. *
  1163. * Unless required by applicable law or agreed to in writing, software
  1164. * distributed under the License is distributed on an "AS IS" BASIS,
  1165. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  1166. * See the License for the specific language governing permissions and
  1167. * limitations under the License.
  1168. * ============================================================== */
  1169. !function ($) {
  1170. "use strict"; // jshint ;_;
  1171. /* SCROLLSPY CLASS DEFINITION
  1172. * ========================== */
  1173. function ScrollSpy(element, options) {
  1174. var process = $.proxy(this.process, this)
  1175. , $element = $(element).is('body') ? $(window) : $(element)
  1176. , href
  1177. this.options = $.extend({}, $.fn.scrollspy.defaults, options)
  1178. this.$scrollElement = $element.on('scroll.scroll-spy.data-api', process)
  1179. this.selector = (this.options.target
  1180. || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
  1181. || '') + ' .nav li > a'
  1182. this.$body = $('body')
  1183. this.refresh()
  1184. this.process()
  1185. }
  1186. ScrollSpy.prototype = {
  1187. constructor: ScrollSpy
  1188. , refresh: function () {
  1189. var self = this
  1190. , $targets
  1191. this.offsets = $([])
  1192. this.targets = $([])
  1193. $targets = this.$body
  1194. .find(this.selector)
  1195. .map(function () {
  1196. var $el = $(this)
  1197. , href = $el.data('target') || $el.attr('href')
  1198. , $href = /^#\w/.test(href) && $(href)
  1199. return ( $href
  1200. && $href.length
  1201. && [[ $href.position().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]] ) || null
  1202. })
  1203. .sort(function (a, b) { return a[0] - b[0] })
  1204. .each(function () {
  1205. self.offsets.push(this[0])
  1206. self.targets.push(this[1])
  1207. })
  1208. }
  1209. , process: function () {
  1210. var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
  1211. , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
  1212. , maxScroll = scrollHeight - this.$scrollElement.height()
  1213. , offsets = this.offsets
  1214. , targets = this.targets
  1215. , activeTarget = this.activeTarget
  1216. , i
  1217. if (scrollTop >= maxScroll) {
  1218. return activeTarget != (i = targets.last()[0])
  1219. && this.activate ( i )
  1220. }
  1221. for (i = offsets.length; i--;) {
  1222. activeTarget != targets[i]
  1223. && scrollTop >= offsets[i]
  1224. && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
  1225. && this.activate( targets[i] )
  1226. }
  1227. }
  1228. , activate: function (target) {
  1229. var active
  1230. , selector
  1231. this.activeTarget = target
  1232. $(this.selector)
  1233. .parent('.active')
  1234. .removeClass('active')
  1235. selector = this.selector
  1236. + '[data-target="' + target + '"],'
  1237. + this.selector + '[href="' + target + '"]'
  1238. active = $(selector)
  1239. .parent('li')
  1240. .addClass('active')
  1241. if (active.parent('.dropdown-menu').length) {
  1242. active = active.closest('li.dropdown').addClass('active')
  1243. }
  1244. active.trigger('activate')
  1245. }
  1246. }
  1247. /* SCROLLSPY PLUGIN DEFINITION
  1248. * =========================== */
  1249. var old = $.fn.scrollspy
  1250. $.fn.scrollspy = function (option) {
  1251. return this.each(function () {
  1252. var $this = $(this)
  1253. , data = $this.data('scrollspy')
  1254. , options = typeof option == 'object' && option
  1255. if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options)))
  1256. if (typeof option == 'string') data[option]()
  1257. })
  1258. }
  1259. $.fn.scrollspy.Constructor = ScrollSpy
  1260. $.fn.scrollspy.defaults = {
  1261. offset: 10
  1262. }
  1263. /* SCROLLSPY NO CONFLICT
  1264. * ===================== */
  1265. $.fn.scrollspy.noConflict = function () {
  1266. $.fn.scrollspy = old
  1267. return this
  1268. }
  1269. /* SCROLLSPY DATA-API
  1270. * ================== */
  1271. $(window).on('load', function () {
  1272. $('[data-spy="scroll"]').each(function () {
  1273. var $spy = $(this)
  1274. $spy.scrollspy($spy.data())
  1275. })
  1276. })
  1277. }(window.jQuery);/* ========================================================
  1278. * bootstrap-tab.js v2.3.2
  1279. * http://getbootstrap.com/2.3.2/javascript.html#tabs
  1280. * ========================================================
  1281. * Copyright 2013 Twitter, Inc.
  1282. *
  1283. * Licensed under the Apache License, Version 2.0 (the "License");
  1284. * you may not use this file except in compliance with the License.
  1285. * You may obtain a copy of the License at
  1286. *
  1287. * http://www.apache.org/licenses/LICENSE-2.0
  1288. *
  1289. * Unless required by applicable law or agreed to in writing, software
  1290. * distributed under the License is distributed on an "AS IS" BASIS,
  1291. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  1292. * See the License for the specific language governing permissions and
  1293. * limitations under the License.
  1294. * ======================================================== */
  1295. !function ($) {
  1296. "use strict"; // jshint ;_;
  1297. /* TAB CLASS DEFINITION
  1298. * ==================== */
  1299. var Tab = function (element) {
  1300. this.element = $(element)
  1301. }
  1302. Tab.prototype = {
  1303. constructor: Tab
  1304. , show: function () {
  1305. var $this = this.element
  1306. , $ul = $this.closest('ul:not(.dropdown-menu)')
  1307. , selector = $this.attr('data-target')
  1308. , previous
  1309. , $target
  1310. , e
  1311. if (!selector) {
  1312. selector = $this.attr('href')
  1313. selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
  1314. }
  1315. if ( $this.parent('li').hasClass('active') ) return
  1316. previous = $ul.find('.active:last a')[0]
  1317. e = $.Event('show', {
  1318. relatedTarget: previous
  1319. })
  1320. $this.trigger(e)
  1321. if (e.isDefaultPrevented()) return
  1322. $target = $(selector)
  1323. this.activate($this.parent('li'), $ul)
  1324. this.activate($target, $target.parent(), function () {
  1325. $this.trigger({
  1326. type: 'shown'
  1327. , relatedTarget: previous
  1328. })
  1329. })
  1330. }
  1331. , activate: function ( element, container, callback) {
  1332. var $active = container.find('> .active')
  1333. , transition = callback
  1334. && $.support.transition
  1335. && $active.hasClass('fade')
  1336. function next() {
  1337. $active
  1338. .removeClass('active')
  1339. .find('> .dropdown-menu > .active')
  1340. .removeClass('active')
  1341. element.addClass('active')
  1342. if (transition) {
  1343. element[0].offsetWidth // reflow for transition
  1344. element.addClass('in')
  1345. } else {
  1346. element.removeClass('fade')
  1347. }
  1348. if ( element.parent('.dropdown-menu') ) {
  1349. element.closest('li.dropdown').addClass('active')
  1350. }
  1351. callback && callback()
  1352. }
  1353. transition ?
  1354. $active.one($.support.transition.end, next) :
  1355. next()
  1356. $active.removeClass('in')
  1357. }
  1358. }
  1359. /* TAB PLUGIN DEFINITION
  1360. * ===================== */
  1361. var old = $.fn.tab
  1362. $.fn.tab = function ( option ) {
  1363. return this.each(function () {
  1364. var $this = $(this)
  1365. , data = $this.data('tab')
  1366. if (!data) $this.data('tab', (data = new Tab(this)))
  1367. if (typeof option == 'string') data[option]()
  1368. })
  1369. }
  1370. $.fn.tab.Constructor = Tab
  1371. /* TAB NO CONFLICT
  1372. * =============== */
  1373. $.fn.tab.noConflict = function () {
  1374. $.fn.tab = old
  1375. return this
  1376. }
  1377. /* TAB DATA-API
  1378. * ============ */
  1379. $(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
  1380. e.preventDefault()
  1381. $(this).tab('show')
  1382. })
  1383. }(window.jQuery);/* =============================================================
  1384. * bootstrap-typeahead.js v2.3.2
  1385. * http://getbootstrap.com/2.3.2/javascript.html#typeahead
  1386. * =============================================================
  1387. * Copyright 2013 Twitter, Inc.
  1388. *
  1389. * Licensed under the Apache License, Version 2.0 (the "License");
  1390. * you may not use this file except in compliance with the License.
  1391. * You may obtain a copy of the License at
  1392. *
  1393. * http://www.apache.org/licenses/LICENSE-2.0
  1394. *
  1395. * Unless required by applicable law or agreed to in writing, software
  1396. * distributed under the License is distributed on an "AS IS" BASIS,
  1397. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  1398. * See the License for the specific language governing permissions and
  1399. * limitations under the License.
  1400. * ============================================================ */
  1401. !function($){
  1402. "use strict"; // jshint ;_;
  1403. /* TYPEAHEAD PUBLIC CLASS DEFINITION
  1404. * ================================= */
  1405. var Typeahead = function (element, options) {
  1406. this.$element = $(element)
  1407. this.options = $.extend({}, $.fn.typeahead.defaults, options)
  1408. this.matcher = this.options.matcher || this.matcher
  1409. this.sorter = this.options.sorter || this.sorter
  1410. this.highlighter = this.options.highlighter || this.highlighter
  1411. this.updater = this.options.updater || this.updater
  1412. this.source = this.options.source
  1413. this.$menu = $(this.options.menu)
  1414. this.shown = false
  1415. this.listen()
  1416. }
  1417. Typeahead.prototype = {
  1418. constructor: Typeahead
  1419. , select: function () {
  1420. var val = this.$menu.find('.active').attr('data-value')
  1421. this.$element
  1422. .val(this.updater(val))
  1423. .change()
  1424. return this.hide()
  1425. }
  1426. , updater: function (item) {
  1427. return item
  1428. }
  1429. , show: function () {
  1430. var pos = $.extend({}, this.$element.position(), {
  1431. height: this.$element[0].offsetHeight
  1432. })
  1433. this.$menu
  1434. .insertAfter(this.$element)
  1435. .css({
  1436. top: pos.top + pos.height
  1437. , left: pos.left
  1438. })
  1439. .show()
  1440. this.shown = true
  1441. return this
  1442. }
  1443. , hide: function () {
  1444. this.$menu.hide()
  1445. this.shown = false
  1446. return this
  1447. }
  1448. , lookup: function (event) {
  1449. var items
  1450. this.query = this.$element.val()
  1451. if (!this.query || this.query.length < this.options.minLength) {
  1452. return this.shown ? this.hide() : this
  1453. }
  1454. items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source
  1455. return items ? this.process(items) : this
  1456. }
  1457. , process: function (items) {
  1458. var that = this
  1459. items = $.grep(items, function (item) {
  1460. return that.matcher(item)
  1461. })
  1462. items = this.sorter(items)
  1463. if (!items.length) {
  1464. return this.shown ? this.hide() : this
  1465. }
  1466. return this.render(items.slice(0, this.options.items)).show()
  1467. }
  1468. , matcher: function (item) {
  1469. return ~item.toLowerCase().indexOf(this.query.toLowerCase())
  1470. }
  1471. , sorter: function (items) {
  1472. var beginswith = []
  1473. , caseSensitive = []
  1474. , caseInsensitive = []
  1475. , item
  1476. while (item = items.shift()) {
  1477. if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item)
  1478. else if (~item.indexOf(this.query)) caseSensitive.push(item)
  1479. else caseInsensitive.push(item)
  1480. }
  1481. return beginswith.concat(caseSensitive, caseInsensitive)
  1482. }
  1483. , highlighter: function (item) {
  1484. var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&')
  1485. return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
  1486. return '<strong>' + match + '</strong>'
  1487. })
  1488. }
  1489. , render: function (items) {
  1490. var that = this
  1491. items = $(items).map(function (i, item) {
  1492. i = $(that.options.item).attr('data-value', item)
  1493. i.find('a').html(that.highlighter(item))
  1494. return i[0]
  1495. })
  1496. items.first().addClass('active')
  1497. this.$menu.html(items)
  1498. return this
  1499. }
  1500. , next: function (event) {
  1501. var active = this.$menu.find('.active').removeClass('active')
  1502. , next = active.next()
  1503. if (!next.length) {
  1504. next = $(this.$menu.find('li')[0])
  1505. }
  1506. next.addClass('active')
  1507. }
  1508. , prev: function (event) {
  1509. var active = this.$menu.find('.active').removeClass('active')
  1510. , prev = active.prev()
  1511. if (!prev.length) {
  1512. prev = this.$menu.find('li').last()
  1513. }
  1514. prev.addClass('active')
  1515. }
  1516. , listen: function () {
  1517. this.$element
  1518. .on('focus', $.proxy(this.focus, this))
  1519. .on('blur', $.proxy(this.blur, this))
  1520. .on('keypress', $.proxy(this.keypress, this))
  1521. .on('keyup', $.proxy(this.keyup, this))
  1522. if (this.eventSupported('keydown')) {
  1523. this.$element.on('keydown', $.proxy(this.keydown, this))
  1524. }
  1525. this.$menu
  1526. .on('click', $.proxy(this.click, this))
  1527. .on('mouseenter', 'li', $.proxy(this.mouseenter, this))
  1528. .on('mouseleave', 'li', $.proxy(this.mouseleave, this))
  1529. }
  1530. , eventSupported: function(eventName) {
  1531. var isSupported = eventName in this.$element
  1532. if (!isSupported) {
  1533. this.$element.setAttribute(eventName, 'return;')
  1534. isSupported = typeof this.$element[eventName] === 'function'
  1535. }
  1536. return isSupported
  1537. }
  1538. , move: function (e) {
  1539. if (!this.shown) return
  1540. switch(e.keyCode) {
  1541. case 9: // tab
  1542. case 13: // enter
  1543. case 27: // escape
  1544. e.preventDefault()
  1545. break
  1546. case 38: // up arrow
  1547. e.preventDefault()
  1548. this.prev()
  1549. break
  1550. case 40: // down arrow
  1551. e.preventDefault()
  1552. this.next()
  1553. break
  1554. }
  1555. e.stopPropagation()
  1556. }
  1557. , keydown: function (e) {
  1558. this.suppressKeyPressRepeat = ~$.inArray(e.keyCode, [40,38,9,13,27])
  1559. this.move(e)
  1560. }
  1561. , keypress: function (e) {
  1562. if (this.suppressKeyPressRepeat) return
  1563. this.move(e)
  1564. }
  1565. , keyup: function (e) {
  1566. switch(e.keyCode) {
  1567. case 40: // down arrow
  1568. case 38: // up arrow
  1569. case 16: // shift
  1570. case 17: // ctrl
  1571. case 18: // alt
  1572. break
  1573. case 9: // tab
  1574. case 13: // enter
  1575. if (!this.shown) return
  1576. this.select()
  1577. break
  1578. case 27: // escape
  1579. if (!this.shown) return
  1580. this.hide()
  1581. break
  1582. default:
  1583. this.lookup()
  1584. }
  1585. e.stopPropagation()
  1586. e.preventDefault()
  1587. }
  1588. , focus: function (e) {
  1589. this.focused = true
  1590. }
  1591. , blur: function (e) {
  1592. this.focused = false
  1593. if (!this.mousedover && this.shown) this.hide()
  1594. }
  1595. , click: function (e) {
  1596. e.stopPropagation()
  1597. e.preventDefault()
  1598. this.select()
  1599. this.$element.focus()
  1600. }
  1601. , mouseenter: function (e) {
  1602. this.mousedover = true
  1603. this.$menu.find('.active').removeClass('active')
  1604. $(e.currentTarget).addClass('active')
  1605. }
  1606. , mouseleave: function (e) {
  1607. this.mousedover = false
  1608. if (!this.focused && this.shown) this.hide()
  1609. }
  1610. }
  1611. /* TYPEAHEAD PLUGIN DEFINITION
  1612. * =========================== */
  1613. var old = $.fn.typeahead
  1614. $.fn.typeahead = function (option) {
  1615. return this.each(function () {
  1616. var $this = $(this)
  1617. , data = $this.data('typeahead')
  1618. , options = typeof option == 'object' && option
  1619. if (!data) $this.data('typeahead', (data = new Typeahead(this, options)))
  1620. if (typeof option == 'string') data[option]()
  1621. })
  1622. }
  1623. $.fn.typeahead.defaults = {
  1624. source: []
  1625. , items: 8
  1626. , menu: '<ul class="typeahead dropdown-menu"></ul>'
  1627. , item: '<li><a href="#"></a></li>'
  1628. , minLength: 1
  1629. }
  1630. $.fn.typeahead.Constructor = Typeahead
  1631. /* TYPEAHEAD NO CONFLICT
  1632. * =================== */
  1633. $.fn.typeahead.noConflict = function () {
  1634. $.fn.typeahead = old
  1635. return this
  1636. }
  1637. /* TYPEAHEAD DATA-API
  1638. * ================== */
  1639. $(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
  1640. var $this = $(this)
  1641. if ($this.data('typeahead')) return
  1642. $this.typeahead($this.data())
  1643. })
  1644. }(window.jQuery);
  1645. /* ==========================================================
  1646. * bootstrap-affix.js v2.3.2
  1647. * http://getbootstrap.com/2.3.2/javascript.html#affix
  1648. * ==========================================================
  1649. * Copyright 2013 Twitter, Inc.
  1650. *
  1651. * Licensed under the Apache License, Version 2.0 (the "License");
  1652. * you may not use this file except in compliance with the License.
  1653. * You may obtain a copy of the License at
  1654. *
  1655. * http://www.apache.org/licenses/LICENSE-2.0
  1656. *
  1657. * Unless required by applicable law or agreed to in writing, software
  1658. * distributed under the License is distributed on an "AS IS" BASIS,
  1659. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  1660. * See the License for the specific language governing permissions and
  1661. * limitations under the License.
  1662. * ========================================================== */
  1663. !function ($) {
  1664. "use strict"; // jshint ;_;
  1665. /* AFFIX CLASS DEFINITION
  1666. * ====================== */
  1667. var Affix = function (element, options) {
  1668. this.options = $.extend({}, $.fn.affix.defaults, options)
  1669. this.$window = $(window)
  1670. .on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
  1671. .on('click.affix.data-api', $.proxy(function () { setTimeout($.proxy(this.checkPosition, this), 1) }, this))
  1672. this.$element = $(element)
  1673. this.checkPosition()
  1674. }
  1675. Affix.prototype.checkPosition = function () {
  1676. if (!this.$element.is(':visible')) return
  1677. var scrollHeight = $(document).height()
  1678. , scrollTop = this.$window.scrollTop()
  1679. , position = this.$element.offset()
  1680. , offset = this.options.offset
  1681. , offsetBottom = offset.bottom
  1682. , offsetTop = offset.top
  1683. , reset = 'affix affix-top affix-bottom'
  1684. , affix
  1685. if (typeof offset != 'object') offsetBottom = offsetTop = offset
  1686. if (typeof offsetTop == 'function') offsetTop = offset.top()
  1687. if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
  1688. affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ?
  1689. false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ?
  1690. 'bottom' : offsetTop != null && scrollTop <= offsetTop ?
  1691. 'top' : false
  1692. if (this.affixed === affix) return
  1693. this.affixed = affix
  1694. this.unpin = affix == 'bottom' ? position.top - scrollTop : null
  1695. this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : ''))
  1696. }
  1697. /* AFFIX PLUGIN DEFINITION
  1698. * ======================= */
  1699. var old = $.fn.affix
  1700. $.fn.affix = function (option) {
  1701. return this.each(function () {
  1702. var $this = $(this)
  1703. , data = $this.data('affix')
  1704. , options = typeof option == 'object' && option
  1705. if (!data) $this.data('affix', (data = new Affix(this, options)))
  1706. if (typeof option == 'string') data[option]()
  1707. })
  1708. }
  1709. $.fn.affix.Constructor = Affix
  1710. $.fn.affix.defaults = {
  1711. offset: 0
  1712. }
  1713. /* AFFIX NO CONFLICT
  1714. * ================= */
  1715. $.fn.affix.noConflict = function () {
  1716. $.fn.affix = old
  1717. return this
  1718. }
  1719. /* AFFIX DATA-API
  1720. * ============== */
  1721. $(window).on('load', function () {
  1722. $('[data-spy="affix"]').each(function () {
  1723. var $spy = $(this)
  1724. , data = $spy.data()
  1725. data.offset = data.offset || {}
  1726. data.offsetBottom && (data.offset.bottom = data.offsetBottom)
  1727. data.offsetTop && (data.offset.top = data.offsetTop)
  1728. $spy.affix(data)
  1729. })
  1730. })
  1731. }(window.jQuery);