// on clicking Previous button in browser, reset the page // needed to get another CSRF token and remove the spinning wheel window.onpageshow = function() { if (performance.getEntriesByType("navigation")[0].type == "back_forward") { location.reload(false); } } let browse_forms_button = get('browse_forms_button'); let new_link_button = get('new_link_button'); // csrf_token is retrieved from server-side template new_link_button.addEventListener('click', function() { get("csrf_token").value = csrf_token; get("new_link").submit(); hideButtonsAndSpin(); }); if (browse_forms_button != undefined) { browse_forms_button.addEventListener('click', function () { hideButtonsAndSpin(); }); } function hideButtonsAndSpin() { new_link_button.classList.add("hidden"); // hide the access forms button if it exists if (browse_forms_button != undefined) { browse_forms_button.classList.add("hidden"); } get('loading_ring').classList.remove("hidden"); } function get(elemId) { return document.getElementById(elemId); }