Merge pull request #53 from dreamerblue/master

Fix detail reset outline style and svgtip
This commit is contained in:
MeiK
2020-12-21 09:53:11 +08:00
committed by GitHub
2 changed files with 13 additions and 9 deletions

View File

@@ -111,6 +111,10 @@ body {
user-select: none;
}
.details-reset>summary {
outline: none;
}
@media (max-width: 768px) {
.Header {
padding-left: 24px!important;

View File

@@ -247,12 +247,12 @@ style="display: none;">Sat</text>
document.querySelector('#graph-svg').innerHTML = html;
}
let svgElem;
let svgElem = document.createElement('div');
svgElem.style.cssText = 'pointer-events: none; display: none;';
svgElem.classList.add(...["svg-tip", "svg-tip-one-line"]);
document.body.appendChild(svgElem);
function svgTip(elem, count, dateStr) {
svgElem = document.createElement('div');
svgElem.style.cssText = 'pointer-events: none; display: none;';
svgElem.classList.add(...["svg-tip", "svg-tip-one-line"]);
const rect = getCoords(elem);
const date = new Date(dateStr);
const dateFmt = `${months[date.getMonth()]} ${date.getDate()}, ${date.getFullYear()}`;
@@ -261,14 +261,14 @@ function svgTip(elem, count, dateStr) {
} else {
svgElem.innerHTML = `<strong>No posts</strong> on ${dateFmt}`;
}
svgElem.style.top = `${rect.top - 50}px`;
svgElem.style.left = `${rect.left - 78}px`;
svgElem.style.display = 'block';
document.body.appendChild(svgElem);
const tipRect = svgElem.getBoundingClientRect();
svgElem.style.top = `${rect.top - 50}px`;
svgElem.style.left = `${rect.left - tipRect.width / 2 + rect.width / 2}px`;
}
function hideTip() {
svgElem.remove();
svgElem.style.display = 'none';
}
function getCoords(elem) {
@@ -286,7 +286,7 @@ function getCoords(elem) {
var top = box.top + scrollTop - clientTop;
var left = box.left + scrollLeft - clientLeft;
return { top: Math.round(top), left: Math.round(left) };
return { top, left, width: box.width, height: box.height };
}
function relativeTime(dateStr) {