mirror of
https://github.com/Buriburizaem0n/live2d.git
synced 2026-02-04 19:40:01 +00:00
fixed bug
This commit is contained in:
@@ -267,6 +267,33 @@ function loadWidget() {
|
|||||||
model.y = parentHeight - model.height;
|
model.y = parentHeight - model.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function initWidget() {
|
||||||
|
document.body.insertAdjacentHTML("beforeend", `<div id="waifu-toggle">
|
||||||
|
<span>猫 咪</span>
|
||||||
|
</div>`);
|
||||||
|
let toggle = document.getElementById("waifu-toggle");
|
||||||
|
toggle.addEventListener("click", () => {
|
||||||
|
toggle.classList.remove("waifu-toggle-active");
|
||||||
|
if (toggle.getAttribute("first-time")) {
|
||||||
|
loadWidget();
|
||||||
|
toggle.removeAttribute("first-time");
|
||||||
|
} else {
|
||||||
|
localStorage.removeItem("waifu-display");
|
||||||
|
document.getElementById("waifu").style.display = "";
|
||||||
|
setTimeout(() => {
|
||||||
|
document.getElementById("waifu").style.bottom = 0;
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (localStorage.getItem("waifu-display") && Date.now() - localStorage.getItem("waifu-display") <= 86400000) {
|
||||||
|
toggle.setAttribute("first-time", true);
|
||||||
|
setTimeout(() => {
|
||||||
|
toggle.classList.add("waifu-toggle-active");
|
||||||
|
}, 0);
|
||||||
|
} else {
|
||||||
|
loadWidget();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('\n' + ' %c Live2D with Music Player' + ' %c https://github.com/crowya/live2d ' + '\n', 'color: #fadfa3; background: #030307; padding:5px 0;', 'background: #fadfa3; padding:5px 0;');
|
console.log('\n' + ' %c Live2D with Music Player' + ' %c https://github.com/crowya/live2d ' + '\n', 'color: #fadfa3; background: #030307; padding:5px 0;', 'background: #fadfa3; padding:5px 0;');
|
||||||
|
|||||||
Reference in New Issue
Block a user