/** * jquery-bootstrap-scrolling-tabs * @version v2.6.1 * @link https://github.com/mikejacobson/jquery-bootstrap-scrolling-tabs * @author Mike Jacobson * @license MIT License, http://www.opensource.org/licenses/MIT */ !function(e,t){"use strict";function n(e){this.stc=e}function r(e){this.stc=e}function a(e){this.stc=e}function o(t){var o=this;o.$tabsContainer=t,o.instanceId=e.fn.scrollingTabs.nextInstanceId++,o.movableContainerLeftPos=0,o.scrollArrowsVisible=!1,o.scrollToTabEdge=!1,o.disableScrollArrowsOnFullyScrolled=!1,o.reverseScroll=!1,o.widthMultiplier=1,o.scrollMovement=new a(o),o.eventHandlers=new r(o),o.elementsHandler=new n(o)}function i(t,n,r){var a,o=n.tabs,i={paneId:n.propPaneId,title:n.propTitle,active:n.propActive,disabled:n.propDisabled,content:n.propContent},l=n.ignoreTabPanes,c=o.length&&void 0!==o[0][i.content],d=A.getNewElNavTabs(),b=A.getNewElTabContent(),f=l?null:function(){a.after(b)};if(o.length)return o.forEach(function(e,t){var r={forceActiveTab:!0,tabLiContent:n.tabsLiContent&&n.tabsLiContent[t],tabPostProcessor:n.tabsPostProcessors&&n.tabsPostProcessors[t]};A.getNewElTabLi(e,i,r).appendTo(d),!l&&c&&A.getNewElTabPane(e,i,r).appendTo(b)}),a=s(d,n,r,f),a.appendTo(t),t.data({scrtabs:{tabs:o,propNames:i,ignoreTabPanes:l,hasTabContent:c,tabsLiContent:n.tabsLiContent,tabsPostProcessors:n.tabsPostProcessors,scroller:a}}),a.find(".nav-tabs > li").each(function(t){L.storeDataOnLiEl(e(this),o,t)}),t}function s(e,t,n,r){e.find('a[data-toggle="tab"]').removeData(T.DATA_KEY_BOOTSTRAP_TAB);var a=A.getNewElScrollerElementWrappingNavTabsInstance(e.clone(!0),t),i=new o(a),s=e.data("scrtabs");return s?s.scroller=a:e.data("scrtabs",{scroller:a}),e.replaceWith(a.css("visibility","hidden")),t.tabClickHandler&&"function"==typeof t.tabClickHandler&&(a.hasTabClickHandler=!0,i.tabClickHandler=t.tabClickHandler),a.initTabs=function(){i.initTabs(t,a,n,r)},a.scrollToActiveTab=function(){i.scrollToActiveTab(t)},a.initTabs(),C(a,i),a}function l(e){var t=e.updatedTabsArray,n=e.updatedTabsLiContent||[],r=e.updatedTabsPostProcessors||[],a=e.propNames,o=e.ignoreTabPanes,i=e.options,s=e.$currTabLis,l=e.$navTabs,c=o?null:e.$currTabContentPanesContainer,d=o?null:e.$currTabContentPanes,b=!1;return t.forEach(function(e,f){var C,v=s.find('a[href="#'+e[a.paneId]+'"]'),u=f>=s.length;v.length||(b=!0,i.tabLiContent=n[f],i.tabPostProcessor=r[f],v=A.getNewElTabLi(e,a,i),L.storeDataOnLiEl(v,t,f),u?v.appendTo(l):v.insertBefore(s.eq(f)),o||void 0===e[a.content]||(C=A.getNewElTabPane(e,a,i),u?C.appendTo(c):C.insertBefore(d.eq(f))))}),b}function c(e){var t=e.tabLi,n=e.ignoreTabPanes,r=t.$li,a=t.$contentPane,o=t.origTabData,i=t.newTabData,s=e.propNames,l=!1;return o[s.title]!==i[s.title]&&(r.find('a[role="tab"]').html(o[s.title]=i[s.title]),l=!0),o[s.disabled]!==i[s.disabled]&&(i[s.disabled]?(r.addClass("disabled"),r.find('a[role="tab"]').attr("data-toggle","")):(r.removeClass("disabled"),r.find('a[role="tab"]').attr("data-toggle","tab")),o[s.disabled]=i[s.disabled],l=!0),e.options.forceActiveTab&&(r[i[s.active]?"addClass":"removeClass"]("active"),a[i[s.active]?"addClass":"removeClass"]("active"),o[s.active]=i[s.active],l=!0),n||o[s.content]===i[s.content]||(a.html(o[s.content]=i[s.content]),l=!0),l}function d(e){var t,n=e.tabLi,r=e.ignoreTabPanes,a=n.$li;return-1===n.newIdx&&(a.hasClass("active")&&(t=L.getIndexOfClosestEnabledTab(e.$currTabLis,n.currDomIdx))>-1&&(e.$currTabLis.eq(t).addClass("active"),r||e.$currTabContentPanes.eq(t).addClass("active")),a.remove(),r||n.$contentPane.remove(),!0)}function b(t){var n=t.$currTabLis,r=t.updatedTabsArray,a=t.propNames,o=t.ignoreTabPanes,i=[],s=o?null:[];return!!L.didTabOrderChange(n,r,a)&&(r.forEach(function(t){var r=t[a.paneId];i.push(n.find('a[role="tab"][href="#'+r+'"]').parent("li")),o||s.push(e("#"+r))}),t.$navTabs.append(i),o||t.$currTabContentPanesContainer.append(s),!0)}function f(t){var n=t.$currTabLis,r=t.updatedTabsArray,a=t.propNames,o=!1;return n.each(function(n){var i=e(this),s=i.data("tab"),l=L.getTabIndexByPaneId(r,a.paneId,s[a.paneId]),b=l>-1?r[l]:null;if(t.tabLi={$li:i,currDomIdx:n,newIdx:l,$contentPane:A.getElTabPaneForLi(i),origTabData:s,newTabData:b},d(t))return void(o=!0);c(t)&&(o=!0)}),o}function C(t,n){function r(t){e(t.target).append(o.off(T.EVENTS.CLICK))}function a(r){function a(){var n=e(this),r=n.parent("li"),a=r.parent(".dropdown-menu"),o=n.attr("href");r.hasClass("active")||(t.find("li.active").not(c).add(a.find("li.active")).removeClass("active"),c.add(r).addClass("active"),e(".tab-content .tab-pane.active").removeClass("active"),e(o).addClass("active"))}var i,s,l,c=e(r.target),d=c.offset(),b=t.find('li[role="presentation"].active');o=c.find(".dropdown-menu").attr("data-"+T.DATA_KEY_DDMENU_MODIFIED,!0),b[0]!==c[0]&&o.find("li.active").removeClass("active"),o.on(T.EVENTS.CLICK,'a[role="tab"]',a),e("body").append(o),i=o.width()+d.left,s=t.width()-(n.$slideRightArrow.outerWidth()+1),l=d.left,i>s&&(l-=i-s),o.css({display:"block",top:d.top+c.outerHeight()-2,left:l})}var o;t.on(T.EVENTS.DROPDOWN_MENU_SHOW,a).on(T.EVENTS.DROPDOWN_MENU_HIDE,r)}function v(e,t){var n=e.data().scrtabs,r=n.scroller,a=e.find(".scrtabs-tab-container .nav-tabs"),o=e.find(".tab-content"),i=!1,s={options:t,updatedTabsArray:n.tabs,updatedTabsLiContent:n.tabsLiContent,updatedTabsPostProcessors:n.tabsPostProcessors,propNames:n.propNames,ignoreTabPanes:n.ignoreTabPanes,$navTabs:a,$currTabLis:a.find("> li"),$currTabContentPanesContainer:o,$currTabContentPanes:o.find(".tab-pane")};return l(s)&&(i=!0),b(s)&&(i=!0),f(s)&&(i=!0),i&&r.initTabs(),i}function u(t,n){t.data("scrtabs")&&(!t.data("scrtabs").isWrapperOnly&&v(t,n)||e("body").trigger(T.EVENTS.FORCE_REFRESH))}function h(){var t=e(this),n=t.data("scrtabs");n&&n.scroller.scrollToActiveTab()}function S(){var n,r=e(this),a=r.data("scrtabs");if(a){for("self"===a.enableSwipingElement?r.removeClass(T.CSS_CLASSES.ALLOW_SCROLLBAR):"parent"===a.enableSwipingElement&&r.closest(".scrtabs-tab-container").parent().removeClass(T.CSS_CLASSES.ALLOW_SCROLLBAR),a.scroller.off(T.EVENTS.DROPDOWN_MENU_SHOW).off(T.EVENTS.DROPDOWN_MENU_HIDE),a.scroller.find("[data-"+T.DATA_KEY_DDMENU_MODIFIED+"]").css({display:"",left:"",top:""}).off(T.EVENTS.CLICK).removeAttr("data-"+T.DATA_KEY_DDMENU_MODIFIED),a.scroller.hasTabClickHandler&&r.find('a[data-toggle="tab"]').off(".scrtabs"),a.isWrapperOnly?(n=r.parents(".scrtabs-tab-container"),n.length&&n.replaceWith(r)):(a.scroller&&a.scroller.initTabs&&(a.scroller.initTabs=null),r.find(".scrtabs-tab-container").add(".tab-content").remove()),r.removeData("scrtabs");--e.fn.scrollingTabs.nextInstanceId>=0;)e(t).off(T.EVENTS.WINDOW_RESIZE+e.fn.scrollingTabs.nextInstanceId);e("body").off(T.EVENTS.FORCE_REFRESH)}}var T={CONTINUOUS_SCROLLING_TIMEOUT_INTERVAL:50,SCROLL_OFFSET_FRACTION:6,DATA_KEY_DDMENU_MODIFIED:"scrtabsddmenumodified",DATA_KEY_IS_MOUSEDOWN:"scrtabsismousedown",DATA_KEY_BOOTSTRAP_TAB:"bs.tab",CSS_CLASSES:{BOOTSTRAP4:"scrtabs-bootstrap4",RTL:"scrtabs-rtl",SCROLL_ARROW_CLICK_TARGET:"scrtabs-click-target",SCROLL_ARROW_DISABLE:"scrtabs-disable",SCROLL_ARROW_WITH_CLICK_TARGET:"scrtabs-with-click-target"},SLIDE_DIRECTION:{LEFT:1,RIGHT:2},EVENTS:{CLICK:"click.scrtabs",DROPDOWN_MENU_HIDE:"hide.bs.dropdown.scrtabs",DROPDOWN_MENU_SHOW:"show.bs.dropdown.scrtabs",FORCE_REFRESH:"forcerefresh.scrtabs",MOUSEDOWN:"mousedown.scrtabs",MOUSEUP:"mouseup.scrtabs",TABS_READY:"ready.scrtabs",TOUCH_END:"touchend.scrtabs",TOUCH_MOVE:"touchmove.scrtabs",TOUCH_START:"touchstart.scrtabs",WINDOW_RESIZE:"resize.scrtabs"}};!function(t){var n=function(e,t,n){var r;return function(){function a(){n||e.apply(o,i),r=null}var o=this,i=arguments;r?clearTimeout(r):n&&e.apply(o,i),r=setTimeout(a,t||100)}};e.fn[t]=function(e,r){var a=r||T.EVENTS.WINDOW_RESIZE;return e?this.bind(a,n(e)):this.trigger(t)}}("smartresizeScrtabs"),function(n){n.initElements=function(e){var t=this;t.setElementReferences(e),t.setEventListeners(e)},n.listenForTouchEvents=function(){var e,t,n,r=this,a=r.stc,o=a.scrollMovement,i=T.EVENTS,s=!1;a.$movableContainer.on(i.TOUCH_START,function(n){s=!0,t=a.movableContainerLeftPos,e=n.originalEvent.changedTouches[0].pageX}).on(i.TOUCH_END,function(){s=!1}).on(i.TOUCH_MOVE,function(r){if(s){var i=r.originalEvent.changedTouches[0].pageX,l=i-e;a.rtl&&(l=-l);var c;n=t+l,n>0?n=0:(c=o.getMinPos(),n li"),l.$slideLeftArrow=l.reverseScroll?r:a,l.$slideLeftArrowClickTarget=l.reverseScroll?o:i,l.$slideRightArrow=l.reverseScroll?a:r,l.$slideRightArrowClickTarget=l.reverseScroll?i:o,l.$scrollArrows=l.$slideLeftArrow.add(l.$slideRightArrow),l.$win=e(t)},n.setElementWidths=function(){var e=this,t=e.stc;t.winWidth=t.$win.width(),t.scrollArrowsCombinedWidth=t.$slideLeftArrow.outerWidth()+t.$slideRightArrow.outerWidth(),e.setFixedContainerWidth(),e.setMovableContainerWidth()},n.setEventListeners=function(t){var n=this,r=n.stc,a=r.eventHandlers,o=T.EVENTS,i=o.WINDOW_RESIZE+r.instanceId;t.enableSwiping&&n.listenForTouchEvents(),r.$slideLeftArrowClickTarget.off(".scrtabs").on(o.MOUSEDOWN,function(e){a.handleMousedownOnSlideMovContainerLeftArrow.call(a,e)}).on(o.MOUSEUP,function(e){a.handleMouseupOnSlideMovContainerLeftArrow.call(a,e)}).on(o.CLICK,function(e){a.handleClickOnSlideMovContainerLeftArrow.call(a,e)}),r.$slideRightArrowClickTarget.off(".scrtabs").on(o.MOUSEDOWN,function(e){a.handleMousedownOnSlideMovContainerRightArrow.call(a,e)}).on(o.MOUSEUP,function(e){a.handleMouseupOnSlideMovContainerRightArrow.call(a,e)}).on(o.CLICK,function(e){a.handleClickOnSlideMovContainerRightArrow.call(a,e)}),r.tabClickHandler&&r.$tabsLiCollection.find('a[data-toggle="tab"]').off(o.CLICK).on(o.CLICK,r.tabClickHandler),t.handleDelayedScrollbar&&n.listenForDelayedScrollbar(),r.$win.off(i).smartresizeScrtabs(function(e){a.handleWindowResize.call(a,e)},i),e("body").on(T.EVENTS.FORCE_REFRESH,r.elementsHandler.refreshAllElementSizes.bind(r.elementsHandler))},n.listenForDelayedScrollbar=function(){var n=document.createElement("iframe");n.id="scrtabs-scrollbar-resize-listener",n.style.cssText="height: 0; background-color: transparent; margin: 0; padding: 0; overflow: hidden; border-width: 0; position: absolute; width: 100%;",n.onload=function(){function r(){try{e(t).trigger("resize"),a=null}catch(e){}}var a;n.contentWindow.addEventListener("resize",function(){a&&clearTimeout(a),a=setTimeout(r,100)})},document.body.appendChild(n)},n.setFixedContainerWidth=function(){var e=this,t=e.stc,n=t.$tabsContainer.get(0).getBoundingClientRect();t.fixedContainerWidth=n.width||n.right-n.left,t.fixedContainerWidth=t.fixedContainerWidth*t.widthMultiplier,t.$fixedContainer.width(t.fixedContainerWidth)},n.setFixedContainerWidthForHiddenScrollArrows=function(){var e=this,t=e.stc;t.$fixedContainer.width(t.fixedContainerWidth)},n.setFixedContainerWidthForVisibleScrollArrows=function(){var e=this,t=e.stc;t.$fixedContainer.width(t.fixedContainerWidth-t.scrollArrowsCombinedWidth)},n.setMovableContainerWidth=function(){var t=this,n=t.stc,r=n.$tabsUl.find("> li");n.movableContainerWidth=0,r.length&&(r.each(function(){var t=e(this),r=0;n.isNavPills&&(r=parseInt(t.css("margin-left"),10)+parseInt(t.css("margin-right"),10)),n.movableContainerWidth+=t.outerWidth()+r}),n.movableContainerWidth+=1,n.movableContainerWidtht.fixedContainerWidth;n&&!t.scrollArrowsVisible?(t.$scrollArrows.show(),t.scrollArrowsVisible=!0):!n&&t.scrollArrowsVisible&&(t.$scrollArrows.hide(),t.scrollArrowsVisible=!1),t.scrollArrowsVisible?e.setFixedContainerWidthForVisibleScrollArrows():e.setFixedContainerWidthForHiddenScrollArrows()}}(n.prototype),function(e){e.handleClickOnSlideMovContainerLeftArrow=function(){this.stc.scrollMovement.incrementMovableContainerLeft()},e.handleClickOnSlideMovContainerRightArrow=function(){this.stc.scrollMovement.incrementMovableContainerRight()},e.handleMousedownOnSlideMovContainerLeftArrow=function(){var e=this,t=e.stc;t.$slideLeftArrowClickTarget.data(T.DATA_KEY_IS_MOUSEDOWN,!0),t.scrollMovement.continueSlideMovableContainerLeft()},e.handleMousedownOnSlideMovContainerRightArrow=function(){var e=this,t=e.stc;t.$slideRightArrowClickTarget.data(T.DATA_KEY_IS_MOUSEDOWN,!0),t.scrollMovement.continueSlideMovableContainerRight()},e.handleMouseupOnSlideMovContainerLeftArrow=function(){this.stc.$slideLeftArrowClickTarget.data(T.DATA_KEY_IS_MOUSEDOWN,!1)},e.handleMouseupOnSlideMovContainerRightArrow=function(){this.stc.$slideRightArrowClickTarget.data(T.DATA_KEY_IS_MOUSEDOWN,!1)},e.handleWindowResize=function(){var e=this,t=e.stc,n=t.$win.width();if(n===t.winWidth)return!1;t.winWidth=n,t.elementsHandler.refreshAllElementSizes()}}(r.prototype),function(t){t.continueSlideMovableContainerLeft=function(){var e=this,t=e.stc;setTimeout(function(){t.movableContainerLeftPos<=e.getMinPos()||!t.$slideLeftArrowClickTarget.data(T.DATA_KEY_IS_MOUSEDOWN)||e.incrementMovableContainerLeft()||e.continueSlideMovableContainerLeft()},T.CONTINUOUS_SCROLLING_TIMEOUT_INTERVAL)},t.continueSlideMovableContainerRight=function(){var e=this,t=e.stc;setTimeout(function(){t.movableContainerLeftPos>=0||!t.$slideRightArrowClickTarget.data(T.DATA_KEY_IS_MOUSEDOWN)||e.incrementMovableContainerRight()||e.continueSlideMovableContainerRight()},T.CONTINUOUS_SCROLLING_TIMEOUT_INTERVAL)},t.decrementMovableContainerLeftPos=function(e){var t=this,n=t.stc;n.movableContainerLeftPos-=n.fixedContainerWidth/T.SCROLL_OFFSET_FRACTION,n.movableContainerLeftPos0?n.movableContainerLeftPos=0:n.scrollToTabEdge&&t.setMovableContainerLeftPosToTabEdge(T.SLIDE_DIRECTION.RIGHT)),t.slideMovableContainerToLeftPos(),t.enableSlideLeftArrow(),0===n.movableContainerLeftPos},t.refreshScrollArrowsDisabledState=function(){var e=this,t=e.stc;if(t.disableScrollArrowsOnFullyScrolled&&t.scrollArrowsVisible){if(t.movableContainerLeftPos>=0)return e.disableSlideRightArrow(),void e.enableSlideLeftArrow();if(t.movableContainerLeftPos<=e.getMinPos())return e.disableSlideLeftArrow(),void e.enableSlideRightArrow();e.enableSlideLeftArrow(),e.enableSlideRightArrow()}},t.scrollToActiveTab=function(){var e,t,n,r,a,o,i,s,l,c=this,d=c.stc;if(d.scrollArrowsVisible&&(d.usingBootstrap4?(t=d.$tabsUl.find("li > .nav-link.active"),t.length&&(e=t.parent())):e=d.$tabsUl.find("li.active"),e&&e.length)){if(l=d.$slideRightArrow.outerWidth(),o=e.outerWidth(),n=e.offset().left-d.$fixedContainer.offset().left,r=n+o,a=d.fixedContainerWidth-l,d.rtl){if(d.$slideLeftArrow.outerWidth(),n<0)return d.movableContainerLeftPos+=n,c.slideMovableContainerToLeftPos(),!0;if(r>a)return d.movableContainerLeftPos+=r-a+2*l,c.slideMovableContainerToLeftPos(),!0}else{if(r>a)return i=r-a+l,s=d.fixedContainerWidth/2,i+=s-o/2,d.movableContainerLeftPos-=i,c.slideMovableContainerToLeftPos(),!0;if(d.$slideLeftArrow.outerWidth(),n<0)return s=d.fixedContainerWidth/2,d.movableContainerLeftPos+=-n+s-o/2,c.slideMovableContainerToLeftPos(),!0}return!1}},t.setMovableContainerLeftPosToTabEdge=function(t){var n=this,r=n.stc,a=-r.movableContainerLeftPos,o=0;r.$tabsLiCollection.each(function(){var n=e(this).width();if((o+=n)>a)return r.movableContainerLeftPos=t===T.SLIDE_DIRECTION.RIGHT?-(o-n):-o,!1})},t.slideMovableContainerToLeftPos=function(){var e,t=this,n=t.stc,r=t.getMinPos();n.movableContainerLeftPos>0?n.movableContainerLeftPos=0:n.movableContainerLeftPos')}function r(t,n){var r=e('
'),a=n.leftArrowContent||'
',o=e(a),i=n.rightArrowContent||'
',s=e(i),l=e('
'),c=e('
');return n.disableScrollArrowsOnFullyScrolled&&o.add(s).addClass(T.CSS_CLASSES.SCROLL_ARROW_DISABLE),r.append(o,l.append(c.append(t)),s)}function a(t,n){return e('').attr("href","#"+t[n.paneId]).html(t[n.title])}function o(){return e('
')}function i(t,n,r){var o=r.tabLiContent||'
  • ',i=e(o),s=a(t,n).appendTo(i);return t[n.disabled]?(i.addClass("disabled"),s.attr("data-toggle","")):r.forceActiveTab&&t[n.active]&&i.addClass("active"),r.tabPostProcessor&&r.tabPostProcessor(i,s),i}function s(t,n,r){var a=e('
    ').attr("id",t[n.paneId]).html(t[n.content]);return r.forceActiveTab&&t[n.active]&&a.addClass("active"),a}return{getElTabPaneForLi:t,getNewElNavTabs:n,getNewElScrollerElementWrappingNavTabsInstance:r,getNewElTabAnchor:a,getNewElTabContent:o,getNewElTabLi:i,getNewElTabPane:s}}(),L=function(){function t(t,n,a){var o=!1;return t.each(function(t){var i=r(n,a.paneId,e(this).data("tab")[a.paneId]);if(i>-1&&i!==t)return o=!0,!1}),o}function n(e,t){for(var n=e.length-1,r=-1,a=0,o=0;-1===r&&o>=0;)((o=t+ ++a)<=n&&!e.eq(o).hasClass("disabled")||(o=t-a)>=0&&!e.eq(o).hasClass("disabled"))&&(r=o);return r}function r(e,t,n){var r=-1;return e.some(function(e,a){if(e[t]===n)return r=a,!0}),r}function a(t,n,r){t.data({tab:e.extend({},n[r]),index:r})}return{didTabOrderChange:t,getIndexOfClosestEnabledTab:n,getTabIndexByPaneId:r,storeDataOnLiEl:a}}(),E={destroy:function(){return this.each(S)},init:function(t){var n=this,r=n.length-1,a=e.extend({},e.fn.scrollingTabs.defaults,t||{});return a.tabs?n.each(function(t){i(e(this),a,t