Skip to content

Commit d488197

Browse files
committed
i
1 parent 9f99362 commit d488197

7 files changed

Lines changed: 10 additions & 11 deletions

File tree

dist/404.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
const newSearch = l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '';
3535
l.pathname = newPath;
3636
l.search = newSearch;
37-
window.SPA404Redirect = l;
3837
window.location.replace(l.href);
3938
}
4039
})();

dist/bundle-1d603.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

dist/bundle-d4905.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/404.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
const newSearch = l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '';
3535
l.pathname = newPath;
3636
l.search = newSearch;
37-
window.SPA404Redirect = l;
3837
window.location.replace(l.href);
3938
}
4039
})();

src/js/github-pages.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
// the single page app to route accordingly.
1212

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

0 commit comments

Comments
 (0)