diff --git a/static/js/alerts.js b/static/js/alerts.js new file mode 100644 index 0000000..bb6f417 --- /dev/null +++ b/static/js/alerts.js @@ -0,0 +1,20 @@ +function _findAlertDom(caller) { + let selectedDOM = caller; + do { + if (selectedDOM.classList.contains("alert-section")){ + return selectedDOM; + } + selectedDOM = selectedDOM.parentElement; + } while (selectedDOM != null); + throw Error("Missing alert-section class for self/parent(s)"); +} + +function alertAbove(caller, t, s) { + let dom = _findAlertDom(caller); + dom.outerHTML = `