|
|
@@ -684,6 +684,51 @@ function showNews(text) { |
|
|
body.removeChild(div); |
|
|
body.removeChild(div); |
|
|
}, 10000); |
|
|
}, 10000); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function doPopupMicro() { |
|
|
|
|
|
const lifetime = 10000; |
|
|
|
|
|
|
|
|
|
|
|
const div = document.createElement("div"); |
|
|
|
|
|
|
|
|
|
|
|
const left = Math.round(Math.random() * 50 + 25) + "%"; |
|
|
|
|
|
const top = Math.round(Math.random() * 50 + 25) + "%"; |
|
|
|
|
|
|
|
|
|
|
|
div.classList.add("popup-micro"); |
|
|
|
|
|
|
|
|
|
|
|
div.style.setProperty("--lifetime", lifetime/1000 + "s"); |
|
|
|
|
|
div.style.setProperty("--leftpos", left); |
|
|
|
|
|
div.style.setProperty("--toppos", top); |
|
|
|
|
|
const icon = document.createElement("div"); |
|
|
|
|
|
|
|
|
|
|
|
icon.classList.add("fas"); |
|
|
|
|
|
icon.classList.add("fa-drumstick-bite"); |
|
|
|
|
|
|
|
|
|
|
|
div.appendChild(icon); |
|
|
|
|
|
|
|
|
|
|
|
const body = document.querySelector("body"); |
|
|
|
|
|
|
|
|
|
|
|
body.appendChild(div); |
|
|
|
|
|
|
|
|
|
|
|
const remove = setTimeout(() => { |
|
|
|
|
|
body.removeChild(div); |
|
|
|
|
|
}, lifetime); |
|
|
|
|
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
doPopupMicro(); |
|
|
|
|
|
}, 20000); |
|
|
|
|
|
|
|
|
|
|
|
div.addEventListener("click", e => { |
|
|
|
|
|
clickPopup("GULP!", "gulp", [e.clientX, e.clientY]); |
|
|
|
|
|
clickPopup("+1000 food", "food", [e.clientX, e.clientY]); |
|
|
|
|
|
resources.food += 1000; |
|
|
|
|
|
clearTimeout(remove); |
|
|
|
|
|
body.removeChild(div); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function fillTooltip(type, field, content) { |
|
|
function fillTooltip(type, field, content) { |
|
|
let item = document.querySelector("#" + type + "-tooltip-" + field); |
|
|
let item = document.querySelector("#" + type + "-tooltip-" + field); |
|
|
if (typeof(content) === "string") { |
|
|
if (typeof(content) === "string") { |
|
|
@@ -784,6 +829,7 @@ window.onload = function() { |
|
|
lastTime = performance.now(); |
|
|
lastTime = performance.now(); |
|
|
|
|
|
|
|
|
doNews(); |
|
|
doNews(); |
|
|
|
|
|
doPopupMicro(); |
|
|
|
|
|
|
|
|
setTimeout(updateDisplay, 1000/updateRate); |
|
|
setTimeout(updateDisplay, 1000/updateRate); |
|
|
|
|
|
|
|
|
|