A ChatGPT based emulation of the therapist Doctor Kernel from the book "A digital Affair" by Neora Shem Shaul
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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