aboutsummaryrefslogtreecommitdiffstats
path: root/code/frontpage/assets/js/alert.js
diff options
context:
space:
mode:
Diffstat (limited to 'code/frontpage/assets/js/alert.js')
-rw-r--r--code/frontpage/assets/js/alert.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/code/frontpage/assets/js/alert.js b/code/frontpage/assets/js/alert.js
new file mode 100644
index 0000000..1956103
--- /dev/null
+++ b/code/frontpage/assets/js/alert.js
@@ -0,0 +1,20 @@
+var announcement = document.getElementById('announcement');
+
+if (announcement !== null) {
+
+ var id = announcement.dataset.id;
+
+ Object.keys(localStorage).forEach(function(key) {
+ if (/^global-alert-/.test(key)) {
+ if (key !== id ) {
+ localStorage.removeItem(key);
+ document.documentElement.removeAttribute('data-global-alert');
+ }
+ }
+ });
+
+ announcement.addEventListener('closed.bs.alert', () => {
+ localStorage.setItem(id, 'closed');
+ });
+
+} \ No newline at end of file