bootstrap.js 78 KB

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