bootstrap.js 63 KB

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