diff --git a/prototype/src/main/resources/static/js/back.js b/prototype/src/main/resources/static/js/back.js new file mode 100644 index 0000000..9f41110 --- /dev/null +++ b/prototype/src/main/resources/static/js/back.js @@ -0,0 +1,31 @@ +document.addEventListener("DOMContentLoaded", function(event) { + let back = document.getElementsByClassName('back')[0]; + if (!back) { + return; + } + + let group = back.dataset.group || 'default'; + let name = back.dataset.name; + let insert = back.dataset.insert == "true"; + + if (name) { + window.sessionStorage.setItem('back-' + 'group', JSON.stringify({ + 'text': name, + 'location': window.location.toString() + })); + } + + let history = JSON.parse(window.sessionStorage.getItem('back-' + 'group')); + if (insert && history) { + + let a = document.createElement("a"); + a.href = "#"; + a.onclick = function() { + window.location = history.location; + }; + + a.innerText = history.text || 'Zurück'; + back.appendChild(a); + } + +}); diff --git a/prototype/src/main/resources/templates/fragments/intern.html b/prototype/src/main/resources/templates/fragments/intern.html index 529b3bc..e082898 100644 --- a/prototype/src/main/resources/templates/fragments/intern.html +++ b/prototype/src/main/resources/templates/fragments/intern.html @@ -13,7 +13,7 @@