1
0
Fork 0
forked from forgejo/forgejo

Render diff stats server-side (#13579)

Eliminates a flash on page load on the diff stat bars.
This commit is contained in:
silverwind 2020-11-16 00:50:06 +01:00 committed by GitHub
parent 0de546009e
commit efcba9b011
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 29 deletions

View file

@ -1134,17 +1134,6 @@ async function initRepository() {
initReactionSelector();
}
// Diff
if ($('.repository.diff').length > 0) {
$('.diff-counter').each(function () {
const $item = $(this);
const addLine = $item.find('span[data-line].add').data('line');
const delLine = $item.find('span[data-line].del').data('line');
const addPercent = parseFloat(addLine) / (parseFloat(addLine) + parseFloat(delLine)) * 100;
$item.find('.bar .add').css('width', `${addPercent}%`);
});
}
// Quick start and repository home
$('#repo-clone-ssh').on('click', function () {
$('.clone-url').text($(this).data('link'));