This commit is contained in:
2022-05-01 14:04:07 +08:00
parent 42c71b44c6
commit b794f77721
7 changed files with 44 additions and 39 deletions

View File

@ -1,10 +1,15 @@
const __APP_VERSION__ = "__APP_VERSION";
const __APP_BUILD_TIME__ = __APP_BUILD_TIME;
const APP_VERSION = __APP_VERSION__;
const APP_BUILD_TIME = __APP_BUILD_TIME__;
import "./styles.css";
import Typed from "typed.js";
import Tippy from 'tippy.js';
import 'tippy.js/dist/tippy.css';
import 'tippy.js/animations/scale.css';
window.addEventListener("load", (_ev) => {
new Typed(document.querySelector("description") ?? "description", {
stringsElement: "#description-list",
@ -18,15 +23,18 @@ window.addEventListener("load", (_ev) => {
});
document.querySelectorAll("[alt]").forEach((Elem) => {
const tooltip = document.createElement("tooltiptext");
tooltip.innerText = Elem.getAttribute("alt") ?? "";
Elem.appendChild(tooltip);
Tippy(Elem, {
content: Elem.getAttribute("alt") ?? "",
})
});
// @ts-expect-error
document.querySelector(
"#footer > div"
).innerHTML += `<a href="https://git.186526.xyz/186526/home-app"><img alt="Update Commit" src="https://blog.186526.xyz/shields.io/badge/commit-${__APP_VERSION__}-blue" /></a> <img alt="Latest Update" src="https://blog.186526.xyz/shields.io/date/${__APP_BUILD_TIME__}?color=sucessful&label=latest%20update" />`;
).innerHTML += `<a href="https://git.186526.xyz/186526/home-app"><img alt="Update Commit" src="https://blog.186526.xyz/shields.io/badge/commit-${APP_VERSION}-blue" /></a> <img alt="Latest Update" src="https://blog.186526.xyz/shields.io/date/${APP_BUILD_TIME}?color=sucessful&label=latest%20update" />`;
// @ts-expect-error
document.querySelector("#footer").innerHTML = document.querySelector("#footer")?.innerHTML.replaceAll("unknown",__APP_BUILD_MACHINE__);
if ("serviceWorker" in navigator) {
navigator.serviceWorker

View File

@ -141,29 +141,6 @@ background {
}
}
tooltiptext {
display: none;
visibility: hidden;
font-family: "Google Sans", Roboto, Noto Sans SC, sans-serif;
width: 120px;
background-color: #555;
color: #fff;
text-align: center;
padding: 5px 0;
border-radius: 6px;
opacity: 0;
transition: opacity 0.6s;
position: absolute;
z-index: 1;
}
:hover > tooltiptext {
display: block;
visibility: visible;
opacity: 1;
}
.toast {
background: var(--mask-color);
border-radius: 8px;

5
src/vite-env.d.ts vendored
View File

@ -1,3 +1,4 @@
/// <reference types="vite/client" />
declare const __APP_VERSION: string;
declare const __APP_BUILD_TIME: string;
declare const __APP_VERSION__: string;
declare const __APP_BUILD_TIME__: string;
declare const __APP_BUILD_MACHINE__: string;