debian-mirror-gitlab/app/assets/javascripts/blob/utils.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
583 B
JavaScript
Raw Normal View History

2023-01-13 00:05:48 +05:30
import { getBaseURL } from '~/lib/utils/url_utility';
2020-04-08 14:13:33 +05:30
2023-01-13 00:05:48 +05:30
const blameLinesPerPage = document.querySelector('.js-per-page')?.dataset?.blamePerPage;
2020-11-24 15:15:51 +05:30
2023-01-13 00:05:48 +05:30
export const getPageParamValue = (lineNum, blamePerPage = blameLinesPerPage) => {
if (!blamePerPage) return '';
const page = Math.ceil(parseInt(lineNum, 10) / parseInt(blamePerPage, 10));
return page <= 1 ? '' : page;
};
export const getPageSearchString = (path, page) => {
if (!page) return '';
const url = new URL(path, getBaseURL());
url.searchParams.set('page', page);
return url.search;
};
2020-04-08 14:13:33 +05:30
export default () => ({});