Window.goToTop = function() { Window.scrollTo(0, 0); }; Window.fragment = { get: function() { if (!window.location.hash) { return null; } const n = window.location.hash.indexOf("?"); if (n < 0) { return window.location.hash.substring(1); } else { return window.location.hash.substring(1, n); } }, getQuery: function() { if (!window.location.hash) { return null; } let hashQueryString = window.location.hash; const n = hashQueryString.indexOf("?"); if (n < 0) { return null; } hashQueryString = hasQueryString.substring(n + 1); const params = new URLSearchParams(hashQueryString); const result = {} for(const [key, value] of params.entries()) { result[key] = value; } return result; }, clear: function() { location.hash = ""; history.replaceState("", "", location.pathname); } };