|
|
@ -4,6 +4,7 @@ function removeModal() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function doModal(data, postcallback) { |
|
|
|
function doModal(data, postcallback) { |
|
|
|
|
|
|
|
try { |
|
|
|
const modalHtml = modal({ modal: data }); |
|
|
|
const modalHtml = modal({ modal: data }); |
|
|
|
let checkInterval; |
|
|
|
let checkInterval; |
|
|
|
document.body.insertAdjacentHTML('afterbegin', modalHtml); |
|
|
|
document.body.insertAdjacentHTML('afterbegin', modalHtml); |
|
|
@ -16,13 +17,15 @@ function doModal(data, postcallback) { |
|
|
|
clearInterval(checkInterval); |
|
|
|
clearInterval(checkInterval); |
|
|
|
}; |
|
|
|
}; |
|
|
|
const modalframe = document.getElementById('modalframe'); |
|
|
|
const modalframe = document.getElementById('modalframe'); |
|
|
|
modalframe.onload = () => { |
|
|
|
if (modalframe) { |
|
|
|
|
|
|
|
//if theres a modal frame and user has default theme, style it
|
|
|
|
if (localStorage.getItem('theme') === 'default') { |
|
|
|
if (localStorage.getItem('theme') === 'default') { |
|
|
|
|
|
|
|
modalframe.onload = () => { |
|
|
|
const currentTheme = document.head.querySelector('#theme').href; |
|
|
|
const currentTheme = document.head.querySelector('#theme').href; |
|
|
|
modalframe.contentDocument.styleSheets[1].ownerNode.href = currentTheme; |
|
|
|
modalframe.contentDocument.styleSheets[1].ownerNode.href = currentTheme; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (modalframe && postcallback) { |
|
|
|
if (postcallback) { |
|
|
|
checkInterval = setInterval(() => { |
|
|
|
checkInterval = setInterval(() => { |
|
|
|
if (modalframe && modalframe.contentDocument.title == 'Success') { |
|
|
|
if (modalframe && modalframe.contentDocument.title == 'Success') { |
|
|
|
clearInterval(checkInterval); |
|
|
|
clearInterval(checkInterval); |
|
|
@ -31,6 +34,10 @@ function doModal(data, postcallback) { |
|
|
|
} |
|
|
|
} |
|
|
|
}, 100); |
|
|
|
}, 100); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch(e) { |
|
|
|
|
|
|
|
console.error(e) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const checkTypes = ['checkbox', 'radio']; |
|
|
|
const checkTypes = ['checkbox', 'radio']; |
|
|
|