mirror of
https://github.com/stevenjoezhang/live2d-widget.git
synced 2024-11-22 12:39:59 +08:00
Drop jQuery
This commit is contained in:
parent
3d99f6e9ed
commit
fcb6a6faf5
@ -19,7 +19,10 @@ function loadWidget(waifuPath, apiPath) {
|
|||||||
<span class="fa fa-lg fa-times"></span>
|
<span class="fa fa-lg fa-times"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>`);
|
</div>`);
|
||||||
$("#waifu").show().css({ bottom: 0 });
|
// https://stackoverflow.com/questions/24148403/trigger-css-transition-on-appended-element
|
||||||
|
setTimeout(() => {
|
||||||
|
document.getElementById("waifu").style.bottom = 0;
|
||||||
|
}, 0);
|
||||||
|
|
||||||
function registerEventListener() {
|
function registerEventListener() {
|
||||||
document.querySelector("#waifu-tool .fa-comment").addEventListener("click", showHitokoto);
|
document.querySelector("#waifu-tool .fa-comment").addEventListener("click", showHitokoto);
|
||||||
@ -46,9 +49,9 @@ function loadWidget(waifuPath, apiPath) {
|
|||||||
document.querySelector("#waifu-tool .fa-times").addEventListener("click", () => {
|
document.querySelector("#waifu-tool .fa-times").addEventListener("click", () => {
|
||||||
localStorage.setItem("waifu-display", Date.now());
|
localStorage.setItem("waifu-display", Date.now());
|
||||||
showMessage("愿你有一天能与重要的人重逢。", 2000, 11);
|
showMessage("愿你有一天能与重要的人重逢。", 2000, 11);
|
||||||
$("#waifu").css({ bottom: -500 });
|
document.getElementById("waifu").style.bottom = "-500px";
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
$("#waifu").hide();
|
document.getElementById("waifu").style.display = "none";
|
||||||
document.getElementById("waifu-toggle").classList.add("waifu-toggle-active");
|
document.getElementById("waifu-toggle").classList.add("waifu-toggle-active");
|
||||||
}, 3000);
|
}, 3000);
|
||||||
});
|
});
|
||||||
@ -96,13 +99,9 @@ function loadWidget(waifuPath, apiPath) {
|
|||||||
var userAction = false,
|
var userAction = false,
|
||||||
userActionTimer = null,
|
userActionTimer = null,
|
||||||
messageTimer = null,
|
messageTimer = null,
|
||||||
messageArray = ["好久不见,日子过得好快呢……", "大坏蛋!你都多久没理人家了呀,嘤嘤嘤~", "嗨~快来逗我玩吧!", "拿小拳拳锤你胸口!"];
|
messageArray = ["好久不见,日子过得好快呢……", "大坏蛋!你都多久没理人家了呀,嘤嘤嘤~", "嗨~快来逗我玩吧!", "拿小拳拳锤你胸口!", "记得把小家加入 Adblock 白名单哦!"];
|
||||||
if ($(".fa-share-alt").is(":hidden")) messageArray.push("记得把小家加入 Adblock 白名单哦!");
|
window.addEventListener("mousemove", () => userAction = true);
|
||||||
$(document).mousemove(() => {
|
window.addEventListener("keydown", () => userAction = true);
|
||||||
userAction = true;
|
|
||||||
}).keydown(() => {
|
|
||||||
userAction = true;
|
|
||||||
});
|
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
if (userAction) {
|
if (userAction) {
|
||||||
userAction = false;
|
userAction = false;
|
||||||
@ -234,7 +233,10 @@ function initWidget(waifuPath = "/waifu-tips.json", apiPath = "") {
|
|||||||
toggle.removeAttribute("first-time");
|
toggle.removeAttribute("first-time");
|
||||||
} else {
|
} else {
|
||||||
localStorage.removeItem("waifu-display");
|
localStorage.removeItem("waifu-display");
|
||||||
$("#waifu").show().css({ bottom: 0 });
|
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) {
|
if (localStorage.getItem("waifu-display") && Date.now() - localStorage.getItem("waifu-display") <= 86400000) {
|
||||||
|
Loading…
Reference in New Issue
Block a user