1
0

Add per-repo counts to EGG
All checks were successful
Build Docker and Deploy / Build Docker (push) Successful in 21s
Build Docker and Deploy / Deploy to Server (push) Successful in 16s

This commit is contained in:
2025-07-12 18:32:22 +02:00
parent 6d54e5b9ba
commit e5c9b1c2a0
10 changed files with 133 additions and 21 deletions

View File

@@ -10,6 +10,7 @@ var ExtendedGitGraph2;
masterTip.style.display = 'none';
const masterTipHeader = masterTip.getElementsByTagName('strong')[0];
const masterTipContent = masterTip.getElementsByTagName('span')[0];
const masterTipExtra = masterTip.getElementsByTagName('span')[0];
const rects = Array.from(document.getElementsByClassName("egg_rect"));
for (let rect of rects) {
rect.addEventListener("mouseenter", event => {
@@ -19,6 +20,24 @@ var ExtendedGitGraph2;
masterTip.style.display = 'block';
masterTipHeader.innerHTML = count + ' commits';
masterTipContent.innerHTML = ' on ' + date;
if (event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) {
masterTipExtra.style.display = 'grid';
const extraAttr = target.getAttributeNames().sort().filter(p => p.startsWith('data-repo-')).map(p => target.getAttribute(p));
let extraHTML = '';
for (const attr of extraAttr) {
try {
let obj = JSON.parse(attr.replace(/'/g, '"'));
extraHTML += `<span class="extra-attr">[${obj.source}] ${obj.repo_name}:</span><strong>${obj.count}</strong>\n`;
}
catch (e) {
console.error('Error parsing extra attribute:', attr, e);
}
}
masterTipExtra.innerHTML = extraHTML;
}
else {
masterTipExtra.style.display = 'none';
}
masterTip.style.left = (window.pageXOffset + target.getBoundingClientRect().left - masterTip.getBoundingClientRect().width / 2 - 3.5 + 9) + 'px';
masterTip.style.top = (window.pageYOffset + target.getBoundingClientRect().top - masterTip.getBoundingClientRect().height - 10) + 'px';
});
@@ -27,4 +46,4 @@ var ExtendedGitGraph2;
}
ExtendedGitGraph2.initHover = initHover;
})(ExtendedGitGraph2 || (ExtendedGitGraph2 = {}));
window.onload = () => { ExtendedGitGraph2.initHover(); };
window.onload = () => { ExtendedGitGraph2.initHover(); };