- Improved the code in util.js to not throw errors if halfmoon is removed in the future

This commit is contained in:
Dennis Rönn 2020-09-15 21:19:38 +02:00
parent edd306be1b
commit 54993f1b07

View file

@ -1,9 +1,11 @@
halfmoon.showModal = id => {
const t = document.getElementById(id)
t && t.classList.add("show")
}
halfmoon.hideModal = id => {
const t = document.getElementById(id)
t && t.classList.remove("show")
if ((typeof halfmoon === "object" || typeof halfmoon === 'function') && (halfmoon !== null)) {
halfmoon.showModal = id => {
const t = document.getElementById(id)
t && t.classList.add("show")
}
halfmoon.hideModal = id => {
const t = document.getElementById(id)
t && t.classList.remove("show")
}
}