bootstrap.js 62 KB

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