Add per-repo counts to EGG
This commit is contained in:
@@ -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(); };
|
||||
|
||||
Reference in New Issue
Block a user