message box close button now works and returns 0 as it should
This commit is contained in:
parent
870f0d2f8f
commit
08abb019bd
5
main.lua
5
main.lua
|
@ -76,6 +76,7 @@ infatuated.msgbox = {
|
||||||
root = document:getElementById("infatuated-msgbox"),
|
root = document:getElementById("infatuated-msgbox"),
|
||||||
title = document:getElementById("infatuated-msgbox-title"),
|
title = document:getElementById("infatuated-msgbox-title"),
|
||||||
text = document:getElementById("infatuated-msgbox-text"),
|
text = document:getElementById("infatuated-msgbox-text"),
|
||||||
|
close = document:getElementById("infatuated-msgbox-close"),
|
||||||
buttons = document:getElementById("infatuated-msgbox-buttons")
|
buttons = document:getElementById("infatuated-msgbox-buttons")
|
||||||
}
|
}
|
||||||
function infatuated.msgbox:show(title, text, buttons, callback)
|
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
|
for k, v in pairs(document:querySelectorAll("#infatuated-msgbox-buttons button")) do
|
||||||
v:remove()
|
v:remove()
|
||||||
end
|
end
|
||||||
|
function self.close.onclick()
|
||||||
|
self:hide()
|
||||||
|
callback(0)
|
||||||
|
end
|
||||||
for i=1, #buttons do
|
for i=1, #buttons do
|
||||||
local btn = document:createElement("button")
|
local btn = document:createElement("button")
|
||||||
btn.textContent = buttons[i]
|
btn.textContent = buttons[i]
|
||||||
|
|
Loading…
Reference in New Issue