fradrive/templates/standalone/alerts.julius

26 lines
676 B
Plaintext

(function() {
'use strict';
window.utils = window.utils || {};
window.utils.alert = function(alertEl) {
var closeEl = document.createElement('DIV');
closeEl.classList.add('alert__close');
// TODO: fix this. How to request translation in *.julius .files?
closeEl.innerText = "_{MsgCloseAlert}";
closeEl.addEventListener('click', function(event) {
alertEl.classList.add('alert--invisible');
});
alertEl.appendChild(closeEl);
}
})();
document.addEventListener('DOMContentLoaded', function() {
// setup alerts
Array.from(document.querySelectorAll('.alert')).forEach(function(alertEl) {
window.utils.alert(alertEl);
});
});