Skip to content

Commit

Permalink
i
Browse files Browse the repository at this point in the history
  • Loading branch information
i1li committed Nov 23, 2024
1 parent fdbb09c commit c4d545f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/js/github-pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
// the single page app to route accordingly.

// Updated to modern syntax in 2024 for https://github.com/i1li/i
if (window.SPA404Redirect) {
const decoded = window.SPA404Redirect.search.slice(1).split('&').map(s => s.replace(/~and~/g, '&')).join('?');
const newUrl = window.SPA404Redirect.origin + window.SPA404Redirect.pathname.slice(0, -1) + decoded + window.SPA404Redirect.hash;
window.history.replaceState(null, null, newUrl);
delete window.SPA404Redirect;
}
(() => {
if (window.SPA404Redirect) {
const decoded = window.SPA404Redirect.search.slice(1).split('&').map(s => s.replace(/~and~/g, '&')).join('?');
const newUrl = window.SPA404Redirect.origin + window.SPA404Redirect.pathname.slice(0, -1) + decoded + window.SPA404Redirect.hash;
window.history.replaceState(null, null, newUrl);
delete window.SPA404Redirect;
}
})();

0 comments on commit c4d545f

Please sign in to comment.