fix: ⚗️ ensure splash is removed upon load

https://codeberg.org/calckey/calckey/pulls/10285#issuecomment-951231
This commit is contained in:
ThatOneCalculator 2023-06-24 11:43:37 -07:00
parent dd140db13f
commit ac768ece13
No known key found for this signature in database
GPG key ID: 8703CACD01000000

View file

@ -12,8 +12,9 @@ import "@phosphor-icons/web/fill";
//#region account indexedDB migration //#region account indexedDB migration
import { set } from "@/scripts/idb-proxy"; import { set } from "@/scripts/idb-proxy";
if (localStorage.getItem("accounts") != null) { const accounts = localStorage.getItem("accounts")
set("accounts", JSON.parse(localStorage.getItem("accounts"))); if (accounts) {
set("accounts", JSON.parse(accounts));
localStorage.removeItem("accounts"); localStorage.removeItem("accounts");
} }
//#endregion //#endregion
@ -50,6 +51,18 @@ import { reactionPicker } from "@/scripts/reaction-picker";
import { getUrlWithoutLoginId } from "@/scripts/login-id"; import { getUrlWithoutLoginId } from "@/scripts/login-id";
import { getAccountFromId } from "@/scripts/get-account-from-id"; import { getAccountFromId } from "@/scripts/get-account-from-id";
function checkForSplash() {
const splash = document.getElementById("splash");
// 念のためnullチェック(HTMLが古い場合があるため(そのうち消す))
if (splash) {
splash.style.opacity = "0";
splash.style.pointerEvents = "none";
splash.addEventListener("transitionend", () => {
splash.remove();
});
}
}
(async () => { (async () => {
console.info(`Calckey v${version}`); console.info(`Calckey v${version}`);
@ -105,7 +118,7 @@ import { getAccountFromId } from "@/scripts/get-account-from-id";
//#region Set lang attr //#region Set lang attr
const html = document.documentElement; const html = document.documentElement;
html.setAttribute("lang", lang); html.setAttribute("lang", lang || "en-US");
//#endregion //#endregion
//#region loginId //#region loginId
@ -198,12 +211,7 @@ import { getAccountFromId } from "@/scripts/get-account-from-id";
directives(app); directives(app);
components(app); components(app);
const splash = document.getElementById("splash"); checkForSplash();
// 念のためnullチェック(HTMLが古い場合があるため(そのうち消す))
if (splash)
splash.addEventListener("transitionend", () => {
splash.remove();
});
// https://github.com/misskey-dev/misskey/pull/8575#issuecomment-1114239210 // https://github.com/misskey-dev/misskey/pull/8575#issuecomment-1114239210
// なぜかinit.tsの内容が2回実行されることがあるため、mountするdivを1つに制限する // なぜかinit.tsの内容が2回実行されることがあるため、mountするdivを1つに制限する
@ -231,10 +239,7 @@ import { getAccountFromId } from "@/scripts/get-account-from-id";
reactionPicker.init(); reactionPicker.init();
if (splash) { checkForSplash();
splash.style.opacity = "0";
splash.style.pointerEvents = "none";
}
// クライアントが更新されたか? // クライアントが更新されたか?
const lastVersion = localStorage.getItem("lastVersion"); const lastVersion = localStorage.getItem("lastVersion");