message box close button now works and returns 0 as it should

This commit is contained in:
banepwn 2020-04-04 03:38:07 -04:00
parent 870f0d2f8f
commit 08abb019bd
2 changed files with 6 additions and 0 deletions

View File

@ -76,6 +76,7 @@ infatuated.msgbox = {
root = document:getElementById("infatuated-msgbox"),
title = document:getElementById("infatuated-msgbox-title"),
text = document:getElementById("infatuated-msgbox-text"),
close = document:getElementById("infatuated-msgbox-close"),
buttons = document:getElementById("infatuated-msgbox-buttons")
}
function infatuated.msgbox:show(title, text, buttons, callback)
@ -84,6 +85,10 @@ function infatuated.msgbox:show(title, text, buttons, callback)
for k, v in pairs(document:querySelectorAll("#infatuated-msgbox-buttons button")) do
v:remove()
end
function self.close.onclick()
self:hide()
callback(0)
end
for i=1, #buttons do
local btn = document:createElement("button")
btn.textContent = buttons[i]

View File

@ -75,6 +75,7 @@ body {
background: #333;
color: #eee;
border: 1px solid #777;
border-radius: 0.25em;
font-family: monospace;
text-align: center;
}