修复页脚样式一徽标显示错误问题

This commit is contained in:
1152958806@qq.com 2023-08-05 19:04:28 +08:00 committed by 困困鱼
parent 353e55d640
commit 92aabcbd55
2 changed files with 18 additions and 17 deletions

View File

@ -38,16 +38,29 @@
t = Math.trunc(234e8 + (now - grt) / 1e3 * 17)
n = (t / 1496e5).toFixed(6)
}
// 更新网页中显示的网站运行时间
function updateHtml() {
const footer = document.getElementById("footer");
if (!footer) return
let currentTimeHtml = `本站居然运行了 ${dnum} 天<span id='runtime'> ${hnum} 小时 ${mnum} 分 ${snum} 秒 </span><i class='haofont hao-icon-heartbeat' style='color:red'></i> <br> 旅行者 1 号当前距离地球 ${t} 千米,约为 ${n} 个天文单位 🚀`;
if (document.getElementById("runtimeTextTip")) {
document.getElementById("runtimeTextTip").innerHTML = currentTimeHtml;
let currentTimeHtml = "";
let img = "";
let description = "";
if (nowHour < 18 && nowHour >= 9) {
// 如果是上班时间
img = "[(${theme.config.footer.footerContent.style_one.work_img})]";
description = "[(${theme.config.footer.footerContent.style_one.work_description})]";
} else {
// 如果是下班时间
img = "[(${theme.config.footer.footerContent.style_one.offduty_img})]";
description = "[(${theme.config.footer.footerContent.style_one.offduty_description})]";
}
if (document.getElementById("workboard")) {
currentTimeHtml = `<img class="workSituationImg boardsign" src="${img}" alt="${description}" title="${description}">
<div id="runtimeTextTip"> 本站居然运行了 ${dnum} 天<span id='runtime'> ${hnum} 小时 ${mnum} 分 ${snum} 秒 </span><i class='haofont hao-icon-heartbeat' style='color:red'></i> <br> 旅行者 1 号当前距离地球 ${t} 千米,约为 ${n} 个天文单位 🚀 </div>`
document.getElementById("workboard").innerHTML = currentTimeHtml;
}
}
setInterval(() => {
updateTime();
updateHtml();

View File

@ -103,19 +103,7 @@
<div class="copyright" th:if="${#strings.isEmpty(theme.config.basics.siteStartTime)}">
©[[${#dates.format(new java.util.Date(), 'yyyy')}]] By [[${site.title}]]
</div>
<div th:if="${theme.config.footer.footerContent.style_one.runtime_enable}" id="workboard">
<th:block th:with="nowHour = ${#dates.hour(#dates.createNow())}">
<img th:if="${nowHour < 18 && nowHour >= 9}" class="workSituationImg boardsign"
th:src="${theme.config.footer.footerContent.style_one.work_img}"
th:alt="${theme.config.footer.footerContent.style_one.work_description}"
th:title="${theme.config.footer.footerContent.style_one.work_description}" />
<img th:unless="${nowHour < 18 && nowHour >= 9}" class="workSituationImg boardsign"
th:src="${theme.config.footer.footerContent.style_one.offduty_img}"
th:alt="${theme.config.footer.footerContent.style_one.offduty_description}"
th:title="${theme.config.footer.footerContent.style_one.offduty_description}" />
<div id="runtimeTextTip"></div>
</th:block>
</div>
<div th:if="${theme.config.footer.footerContent.style_one.runtime_enable}" id="workboard"></div>
<p id="ghbdages"
th:with="bdageitem = ${theme.config.footer.footerContent.style_one.bdageitem}">
<a class="github-badge" th:each="data : ${bdageitem}" target="_blank"