debian-mirror-gitlab/app/assets/javascripts/merge_request_tabs.js

528 lines
17 KiB
JavaScript
Raw Normal View History

2017-08-17 22:00:37 +05:30
/* eslint-disable no-new, class-methods-use-this */
2018-05-09 12:01:36 +05:30
import $ from 'jquery';
2020-03-13 15:44:24 +05:30
import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils';
2017-08-17 22:00:37 +05:30
import Cookies from 'js-cookie';
2020-05-24 23:13:21 +05:30
import createEventHub from '~/helpers/event_hub_factory';
2018-03-17 18:26:18 +05:30
import axios from './lib/utils/axios_utils';
2020-10-24 23:57:45 +05:30
import { deprecatedCreateFlash as flash } from './flash';
2017-08-17 22:00:37 +05:30
import BlobForkSuggestion from './blob/blob_fork_suggestion';
2017-09-10 17:25:29 +05:30
import initChangesDropdown from './init_changes_dropdown';
2019-02-15 15:39:39 +05:30
import {
parseUrlPathname,
handleLocationHash,
isMetaClick,
parseBoolean,
} from './lib/utils/common_utils';
2018-11-08 19:23:39 +05:30
import { isInVueNoteablePage } from './lib/utils/dom_utils';
2018-03-17 18:26:18 +05:30
import { getLocationHash } from './lib/utils/url_utility';
import Diff from './diff';
import { localTimeAgo } from './lib/utils/datetime_utility';
import syntaxHighlight from './syntax_highlight';
import Notes from './notes';
2018-11-08 19:23:39 +05:30
import { polyfillSticky } from './lib/utils/sticky';
2020-10-24 23:57:45 +05:30
import initAddContextCommitsTriggers from './add_context_commits_modal';
2019-09-04 21:01:54 +05:30
import { __ } from './locale';
2017-08-17 22:00:37 +05:30
2016-09-29 09:46:39 +05:30
// MergeRequestTabs
//
// Handles persisting and restoring the current tab selection and lazily-loading
// content on the MergeRequests#show page.
//
// ### Example Markup
//
// <ul class="nav-links merge-request-tabs">
// <li class="notes-tab active">
2020-03-13 15:44:24 +05:30
// <a data-action="notes" data-target="#notes" data-toggle="tab" href="/foo/bar/-/merge_requests/1">
2016-09-29 09:46:39 +05:30
// Discussion
// </a>
// </li>
// <li class="commits-tab">
2020-03-13 15:44:24 +05:30
// <a data-action="commits" data-target="#commits" data-toggle="tab" href="/foo/bar/-/merge_requests/1/commits">
2016-09-29 09:46:39 +05:30
// Commits
// </a>
// </li>
// <li class="diffs-tab">
2020-03-13 15:44:24 +05:30
// <a data-action="diffs" data-target="#diffs" data-toggle="tab" href="/foo/bar/-/merge_requests/1/diffs">
2016-09-29 09:46:39 +05:30
// Diffs
// </a>
// </li>
// </ul>
//
// <div class="tab-content">
// <div class="notes tab-pane active" id="notes">
// Notes Content
// </div>
// <div class="commits tab-pane" id="commits">
// Commits Content
// </div>
// <div class="diffs tab-pane" id="diffs">
// Diffs Content
// </div>
// </div>
//
// <div class="mr-loading-status">
// <div class="loading">
// Loading Animation
// </div>
// </div>
//
2016-09-13 17:45:13 +05:30
2018-03-17 18:26:18 +05:30
// Store the `location` object, allowing for easier stubbing in tests
2018-11-08 19:23:39 +05:30
let { location } = window;
2016-09-13 17:45:13 +05:30
2018-03-17 18:26:18 +05:30
export default class MergeRequestTabs {
constructor({ action, setUrl, stubLocation } = {}) {
2018-11-08 19:23:39 +05:30
this.mergeRequestTabs = document.querySelector('.merge-request-tabs-container');
this.mergeRequestTabsAll =
this.mergeRequestTabs && this.mergeRequestTabs.querySelectorAll
? this.mergeRequestTabs.querySelectorAll('.merge-request-tabs li')
: null;
this.mergeRequestTabPanes = document.querySelector('#diff-notes-app');
this.mergeRequestTabPanesAll =
this.mergeRequestTabPanes && this.mergeRequestTabPanes.querySelectorAll
? this.mergeRequestTabPanes.querySelectorAll('.tab-pane')
: null;
2018-03-17 18:26:18 +05:30
const navbar = document.querySelector('.navbar-gitlab');
2018-05-09 12:01:36 +05:30
const peek = document.getElementById('js-peek');
2018-03-17 18:26:18 +05:30
const paddingTop = 16;
2016-11-03 12:29:30 +05:30
2018-11-08 19:23:39 +05:30
this.commitsTab = document.querySelector('.tab-content .commits.tab-pane');
this.currentTab = null;
2018-03-17 18:26:18 +05:30
this.diffsLoaded = false;
this.pipelinesLoaded = false;
this.commitsLoaded = false;
this.fixedLayoutPref = null;
2020-05-24 23:13:21 +05:30
this.eventHub = createEventHub();
2016-11-03 12:29:30 +05:30
2018-03-17 18:26:18 +05:30
this.setUrl = setUrl !== undefined ? setUrl : true;
this.setCurrentAction = this.setCurrentAction.bind(this);
this.tabShown = this.tabShown.bind(this);
2018-11-08 19:23:39 +05:30
this.clickTab = this.clickTab.bind(this);
2018-03-17 18:26:18 +05:30
this.stickyTop = navbar ? navbar.offsetHeight - paddingTop : 0;
2016-11-03 12:29:30 +05:30
2018-05-09 12:01:36 +05:30
if (peek) {
this.stickyTop += peek.offsetHeight;
}
2018-11-08 19:23:39 +05:30
if (this.mergeRequestTabs) {
this.stickyTop += this.mergeRequestTabs.offsetHeight;
2016-09-13 17:45:13 +05:30
}
2018-03-17 18:26:18 +05:30
if (stubLocation) {
location = stubLocation;
2017-08-17 22:00:37 +05:30
}
2018-03-17 18:26:18 +05:30
this.bindEvents();
2018-11-08 19:23:39 +05:30
if (
this.mergeRequestTabs &&
this.mergeRequestTabs.querySelector(`a[data-action='${action}']`) &&
this.mergeRequestTabs.querySelector(`a[data-action='${action}']`).click
2018-12-05 23:21:45 +05:30
) {
2018-11-08 19:23:39 +05:30
this.mergeRequestTabs.querySelector(`a[data-action='${action}']`).click();
2018-12-05 23:21:45 +05:30
}
2018-03-17 18:26:18 +05:30
this.initAffix();
}
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
bindEvents() {
2018-11-08 19:23:39 +05:30
$('.merge-request-tabs a[data-toggle="tabvue"]').on('click', this.clickTab);
2020-06-23 00:09:42 +05:30
window.addEventListener('popstate', event => {
if (event.state && event.state.action) {
this.tabShown(event.state.action, event.target.location);
this.currentAction = event.state.action;
this.eventHub.$emit('MergeRequestTabChange', this.getCurrentAction());
}
});
2018-03-17 18:26:18 +05:30
}
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
// Used in tests
unbindEvents() {
2018-11-08 19:23:39 +05:30
$('.merge-request-tabs a[data-toggle="tabvue"]').off('click', this.clickTab);
2018-03-17 18:26:18 +05:30
}
destroyPipelinesView() {
if (this.commitPipelinesTable) {
this.commitPipelinesTable.$destroy();
this.commitPipelinesTable = null;
document.querySelector('#commit-pipeline-table-view').innerHTML = '';
2017-08-17 22:00:37 +05:30
}
2018-03-17 18:26:18 +05:30
}
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
clickTab(e) {
2018-11-08 19:23:39 +05:30
if (e.currentTarget) {
2018-03-17 18:26:18 +05:30
e.stopImmediatePropagation();
2017-08-17 22:00:37 +05:30
e.preventDefault();
2018-11-08 19:23:39 +05:30
2019-09-04 21:01:54 +05:30
const { action } = e.currentTarget.dataset || {};
2018-11-08 19:23:39 +05:30
2019-09-04 21:01:54 +05:30
if (isMetaClick(e)) {
2018-11-08 19:23:39 +05:30
const targetLink = e.currentTarget.getAttribute('href');
window.open(targetLink, '_blank');
2019-09-04 21:01:54 +05:30
} else if (action) {
const href = e.currentTarget.getAttribute('href');
this.tabShown(action, href);
2020-06-23 00:09:42 +05:30
if (this.setUrl) {
this.setCurrentAction(action);
}
2018-11-08 19:23:39 +05:30
}
2017-08-17 22:00:37 +05:30
}
2018-03-17 18:26:18 +05:30
}
2017-08-17 22:00:37 +05:30
2018-11-08 19:23:39 +05:30
tabShown(action, href) {
if (action !== this.currentTab && this.mergeRequestTabs) {
this.currentTab = action;
if (this.mergeRequestTabPanesAll) {
this.mergeRequestTabPanesAll.forEach(el => {
const tabPane = el;
tabPane.style.display = 'none';
});
2017-08-17 22:00:37 +05:30
}
2018-11-08 19:23:39 +05:30
if (this.mergeRequestTabsAll) {
this.mergeRequestTabsAll.forEach(el => {
el.classList.remove('active');
});
2016-09-13 17:45:13 +05:30
}
2018-11-08 19:23:39 +05:30
const tabPane = this.mergeRequestTabPanes.querySelector(`#${action}`);
if (tabPane) tabPane.style.display = 'block';
const tab = this.mergeRequestTabs.querySelector(`.${action}-tab`);
if (tab) tab.classList.add('active');
if (action === 'commits') {
this.loadCommits(href);
this.expandView();
this.resetViewContainer();
this.destroyPipelinesView();
} else if (action === 'new') {
2018-03-17 18:26:18 +05:30
this.expandView();
2018-11-08 19:23:39 +05:30
this.resetViewContainer();
this.destroyPipelinesView();
} else if (this.isDiffAction(action)) {
if (!isInVueNoteablePage()) {
this.loadDiff(href);
}
2020-03-13 15:44:24 +05:30
if (bp.getBreakpointSize() !== 'xl') {
2018-11-08 19:23:39 +05:30
this.shrinkView();
}
2018-12-05 23:21:45 +05:30
this.expandViewContainer();
2018-11-08 19:23:39 +05:30
this.destroyPipelinesView();
this.commitsTab.classList.remove('active');
} else if (action === 'pipelines') {
this.resetViewContainer();
this.mountPipelinesView();
} else {
this.mergeRequestTabPanes.querySelector('#notes').style.display = 'block';
this.mergeRequestTabs.querySelector('.notes-tab').classList.add('active');
if (bp.getBreakpointSize() !== 'xs') {
this.expandView();
}
this.resetViewContainer();
this.destroyPipelinesView();
}
2020-07-28 23:09:34 +05:30
$('.detail-page-description').renderGFM();
2019-02-15 15:39:39 +05:30
} else if (action === this.currentAction) {
// ContentTop is used to handle anything at the top of the page before the main content
const mainContentContainer = document.querySelector('.content-wrapper');
const tabContentContainer = document.querySelector('.tab-content');
if (mainContentContainer && tabContentContainer) {
const mainContentTop = mainContentContainer.getBoundingClientRect().top;
const tabContentTop = tabContentContainer.getBoundingClientRect().top;
// 51px is the height of the navbar buttons, e.g. `Discussion | Commits | Changes`
const scrollDestination = tabContentTop - mainContentTop - 51;
// scrollBehavior is only available in browsers that support scrollToOptions
if ('scrollBehavior' in document.documentElement.style) {
window.scrollTo({
top: scrollDestination,
behavior: 'smooth',
});
} else {
window.scrollTo(0, scrollDestination);
}
}
2018-03-17 18:26:18 +05:30
}
2020-10-24 23:57:45 +05:30
this.eventHub.$emit('MergeRequestTabChange', action);
2018-03-17 18:26:18 +05:30
}
2016-09-13 17:45:13 +05:30
2018-03-17 18:26:18 +05:30
scrollToElement(container) {
if (location.hash) {
2018-05-09 12:01:36 +05:30
const offset = 0 - ($('.navbar-gitlab').outerHeight() + $('.js-tabs-affix').outerHeight());
2018-03-17 18:26:18 +05:30
const $el = $(`${container} ${location.hash}:not(.match)`);
if ($el.length) {
$.scrollTo($el[0], { offset });
2016-09-13 17:45:13 +05:30
}
2017-08-17 22:00:37 +05:30
}
2018-03-17 18:26:18 +05:30
}
2016-09-13 17:45:13 +05:30
2018-03-17 18:26:18 +05:30
// Replaces the current Merge Request-specific action in the URL with a new one
//
// If the action is "notes", the URL is reset to the standard
// `MergeRequests#show` route.
//
// Examples:
//
2020-03-13 15:44:24 +05:30
// location.pathname # => "/namespace/project/-/merge_requests/1"
2018-03-17 18:26:18 +05:30
// setCurrentAction('diffs')
2020-03-13 15:44:24 +05:30
// location.pathname # => "/namespace/project/-/merge_requests/1/diffs"
2018-03-17 18:26:18 +05:30
//
2020-03-13 15:44:24 +05:30
// location.pathname # => "/namespace/project/-/merge_requests/1/diffs"
2018-03-17 18:26:18 +05:30
// setCurrentAction('show')
2020-03-13 15:44:24 +05:30
// location.pathname # => "/namespace/project/-/merge_requests/1"
2018-03-17 18:26:18 +05:30
//
2020-03-13 15:44:24 +05:30
// location.pathname # => "/namespace/project/-/merge_requests/1/diffs"
2018-03-17 18:26:18 +05:30
// setCurrentAction('commits')
2020-03-13 15:44:24 +05:30
// location.pathname # => "/namespace/project/-/merge_requests/1/commits"
2018-03-17 18:26:18 +05:30
//
// Returns the new URL String
setCurrentAction(action) {
this.currentAction = action;
// Remove a trailing '/commits' '/diffs' '/pipelines'
let newState = location.pathname.replace(/\/(commits|diffs|pipelines)(\.html)?\/?$/, '');
// Append the new action if we're on a tab other than 'notes'
if (this.currentAction !== 'show' && this.currentAction !== 'new') {
newState += `/${this.currentAction}`;
2017-08-17 22:00:37 +05:30
}
2016-09-13 17:45:13 +05:30
2018-03-17 18:26:18 +05:30
// Ensure parameters and hash come along for the ride
newState += location.search + location.hash;
2017-08-17 22:00:37 +05:30
2020-06-23 00:09:42 +05:30
if (window.history.state && window.history.state.url && window.location.pathname !== newState) {
window.history.pushState(
{
url: newState,
action: this.currentAction,
},
document.title,
newState,
);
} else {
window.history.replaceState(
{
url: window.location.href,
action,
},
document.title,
window.location.href,
);
}
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
return newState;
}
2017-08-17 22:00:37 +05:30
2018-03-27 19:54:05 +05:30
getCurrentAction() {
return this.currentAction;
}
2018-03-17 18:26:18 +05:30
loadCommits(source) {
if (this.commitsLoaded) {
return;
}
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
this.toggleLoading(true);
2017-08-17 22:00:37 +05:30
2018-05-09 12:01:36 +05:30
axios
.get(`${source}.json`)
2018-03-17 18:26:18 +05:30
.then(({ data }) => {
document.querySelector('div#commits').innerHTML = data.html;
localTimeAgo($('.js-timeago', 'div#commits'));
this.commitsLoaded = true;
this.scrollToElement('#commits');
2016-09-13 17:45:13 +05:30
2018-03-17 18:26:18 +05:30
this.toggleLoading(false);
2020-10-24 23:57:45 +05:30
initAddContextCommitsTriggers();
2018-03-17 18:26:18 +05:30
})
.catch(() => {
this.toggleLoading(false);
2019-09-04 21:01:54 +05:30
flash(__('An error occurred while fetching this tab.'));
2016-09-13 17:45:13 +05:30
});
2018-03-17 18:26:18 +05:30
}
2016-09-13 17:45:13 +05:30
2018-03-17 18:26:18 +05:30
mountPipelinesView() {
const pipelineTableViewEl = document.querySelector('#commit-pipeline-table-view');
2019-12-04 20:38:33 +05:30
const { CommitPipelinesTable, mrWidgetData } = gl;
2018-03-17 18:26:18 +05:30
this.commitPipelinesTable = new CommitPipelinesTable({
propsData: {
endpoint: pipelineTableViewEl.dataset.endpoint,
helpPagePath: pipelineTableViewEl.dataset.helpPagePath,
emptyStateSvgPath: pipelineTableViewEl.dataset.emptyStateSvgPath,
errorStateSvgPath: pipelineTableViewEl.dataset.errorStateSvgPath,
autoDevopsHelpPath: pipelineTableViewEl.dataset.helpAutoDevopsPath,
2020-10-24 23:57:45 +05:30
canCreatePipelineInTargetProject: Boolean(
mrWidgetData?.can_create_pipeline_in_target_project,
),
sourceProjectFullPath: mrWidgetData?.source_project_full_path || '',
targetProjectFullPath: mrWidgetData?.target_project_full_path || '',
2019-12-04 20:38:33 +05:30
projectId: pipelineTableViewEl.dataset.projectId,
mergeRequestId: mrWidgetData ? mrWidgetData.iid : null,
2018-03-17 18:26:18 +05:30
},
}).$mount();
// $mount(el) replaces the el with the new rendered component. We need it in order to mount
// it everytime this tab is clicked - https://vuejs.org/v2/api/#vm-mount
pipelineTableViewEl.appendChild(this.commitPipelinesTable.$el);
}
2017-09-10 17:25:29 +05:30
2018-03-17 18:26:18 +05:30
loadDiff(source) {
if (this.diffsLoaded) {
document.dispatchEvent(new CustomEvent('scroll'));
return;
2017-08-17 22:00:37 +05:30
}
2018-03-17 18:26:18 +05:30
// We extract pathname for the current Changes tab anchor href
// some pages like MergeRequestsController#new has query parameters on that anchor
const urlPathname = parseUrlPathname(source);
this.toggleLoading(true);
2018-05-09 12:01:36 +05:30
axios
.get(`${urlPathname}.json${location.search}`)
2018-03-17 18:26:18 +05:30
.then(({ data }) => {
const $container = $('#diffs');
$container.html(data.html);
initChangesDropdown(this.stickyTop);
2016-11-03 12:29:30 +05:30
2018-03-17 18:26:18 +05:30
if (typeof gl.diffNotesCompileComponents !== 'undefined') {
gl.diffNotesCompileComponents();
}
localTimeAgo($('.js-timeago', 'div#diffs'));
syntaxHighlight($('#diffs .js-syntax-highlight'));
2018-12-05 23:21:45 +05:30
if (this.isDiffAction(this.currentAction)) {
2018-03-17 18:26:18 +05:30
this.expandViewContainer();
}
this.diffsLoaded = true;
new Diff();
this.scrollToElement('#diffs');
$('.diff-file').each((i, el) => {
new BlobForkSuggestion({
openButtons: $(el).find('.js-edit-blob-link-fork-toggler'),
forkButtons: $(el).find('.js-fork-suggestion-button'),
cancelButtons: $(el).find('.js-cancel-fork-suggestion-button'),
suggestionSections: $(el).find('.js-file-fork-suggestion-section'),
actionTextPieces: $(el).find('.js-file-fork-suggestion-section-action'),
2018-05-09 12:01:36 +05:30
}).init();
2018-03-17 18:26:18 +05:30
});
// Scroll any linked note into view
// Similar to `toggler_behavior` in the discussion tab
const hash = getLocationHash();
const anchor = hash && $container.find(`.note[id="${hash}"]`);
if (anchor && anchor.length > 0) {
2019-07-31 22:56:46 +05:30
const notesContent = anchor.closest('.notes-content');
2018-03-17 18:26:18 +05:30
const lineType = notesContent.hasClass('new') ? 'new' : 'old';
Notes.instance.toggleDiffNote({
target: anchor,
lineType,
forceShow: true,
2017-08-17 22:00:37 +05:30
});
2018-03-17 18:26:18 +05:30
anchor[0].scrollIntoView();
handleLocationHash();
// We have multiple elements on the page with `#note_xxx`
// (discussion and diff tabs) and `:target` only applies to the first
anchor.addClass('target');
}
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
this.toggleLoading(false);
})
.catch(() => {
this.toggleLoading(false);
2019-09-04 21:01:54 +05:30
flash(__('An error occurred while fetching this tab.'));
2016-09-13 17:45:13 +05:30
});
2018-03-17 18:26:18 +05:30
}
2016-09-13 17:45:13 +05:30
2018-03-17 18:26:18 +05:30
// Show or hide the loading spinner
//
// status - Boolean, true to show, false to hide
toggleLoading(status) {
2018-11-08 19:23:39 +05:30
$('.mr-loading-status .loading').toggleClass('hide', !status);
2018-03-17 18:26:18 +05:30
}
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
diffViewType() {
2019-03-02 22:35:43 +05:30
return $('.js-diff-view-buttons button.active').data('viewType');
2018-03-17 18:26:18 +05:30
}
2016-09-13 17:45:13 +05:30
2018-03-17 18:26:18 +05:30
isDiffAction(action) {
return action === 'diffs' || action === 'new/diffs';
}
2016-11-03 12:29:30 +05:30
2018-12-05 23:21:45 +05:30
expandViewContainer(removeLimited = true) {
2018-03-17 18:26:18 +05:30
const $wrapper = $('.content-wrapper .container-fluid').not('.breadcrumbs');
if (this.fixedLayoutPref === null) {
this.fixedLayoutPref = $wrapper.hasClass('container-limited');
2017-08-17 22:00:37 +05:30
}
2018-12-05 23:21:45 +05:30
if (this.diffViewType() === 'parallel' || removeLimited) {
$wrapper.removeClass('container-limited');
} else {
$wrapper.toggleClass('container-limited', this.fixedLayoutPref);
}
2018-03-17 18:26:18 +05:30
}
2016-09-13 17:45:13 +05:30
2018-03-17 18:26:18 +05:30
resetViewContainer() {
if (this.fixedLayoutPref !== null) {
2018-05-09 12:01:36 +05:30
$('.content-wrapper .container-fluid').toggleClass('container-limited', this.fixedLayoutPref);
2017-08-17 22:00:37 +05:30
}
2018-03-17 18:26:18 +05:30
}
2016-11-03 12:29:30 +05:30
2018-03-17 18:26:18 +05:30
shrinkView() {
const $gutterIcon = $('.js-sidebar-toggle i:visible');
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
// Wait until listeners are set
setTimeout(() => {
// Only when sidebar is expanded
if ($gutterIcon.is('.fa-angle-double-right')) {
$gutterIcon.closest('a').trigger('click', [true]);
}
}, 0);
}
2016-09-13 17:45:13 +05:30
2018-03-17 18:26:18 +05:30
// Expand the issuable sidebar unless the user explicitly collapsed it
expandView() {
2019-02-15 15:39:39 +05:30
if (parseBoolean(Cookies.get('collapsed_gutter'))) {
2018-03-17 18:26:18 +05:30
return;
2017-08-17 22:00:37 +05:30
}
2018-03-17 18:26:18 +05:30
const $gutterIcon = $('.js-sidebar-toggle i:visible');
2016-09-13 17:45:13 +05:30
2018-03-17 18:26:18 +05:30
// Wait until listeners are set
setTimeout(() => {
// Only when sidebar is collapsed
if ($gutterIcon.is('.fa-angle-double-left')) {
$gutterIcon.closest('a').trigger('click', [true]);
2016-09-13 17:45:13 +05:30
}
2018-03-17 18:26:18 +05:30
}, 0);
}
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
initAffix() {
const $tabs = $('.js-tabs-affix');
// Screen space on small screens is usually very sparse
// So we dont affix the tabs on these
if (bp.getBreakpointSize() === 'xs' || !$tabs.length) return;
/**
If the browser does not support position sticky, it returns the position as static.
If the browser does support sticky, then we allow the browser to handle it, if not
then we default back to Bootstraps affix
2018-11-08 19:23:39 +05:30
*/
2018-03-17 18:26:18 +05:30
if ($tabs.css('position') !== 'static') return;
2018-11-08 19:23:39 +05:30
polyfillSticky($tabs);
2017-08-17 22:00:37 +05:30
}
2018-03-17 18:26:18 +05:30
}