This commit is contained in:
eshanized
2024-12-25 10:47:04 +05:30
parent 76d84dbfde
commit dee91853d7

View File

@@ -54,25 +54,29 @@
<script type="text/javascript">
(function(l) {
if (l.search && l.search.startsWith('/')) {
// Extract and clean up the query string
const decoded = l.search
.slice(1) // Remove the leading "/"
.split('&') // Split the query string by "&"
.filter(Boolean) // Remove empty strings caused by consecutive "&"
.map(s => s.replace(/~and~/g, '&')) // Replace "~and~" with "&"
.join('&'); // Join back with "&"
// Extract the search string and remove the leading slash
const originalQuery = l.search.slice(1);
// Reconstruct the URL and replace the history entry
window.history.replaceState(
null,
'', // Keep the title unchanged
`${l.pathname.slice(0, -1)}${decoded ? `?${decoded}` : ''}${l.hash}` // Build the new URL
);
// Split by '&' and process each part
const decodedParts = originalQuery
.split('&')
.filter(Boolean) // Remove empty parts
.map(part => part.replace(/~and~/g, '&')); // Replace "~and~" with "&"
// Join the parts back into a valid query string
const decodedQuery = decodedParts.join('&');
// Avoid applying the replacement if the query string is unchanged
const newUrl = `${l.pathname.slice(0, -1)}${decodedQuery ? `?${decodedQuery}` : ''}${l.hash}`;
if (newUrl !== l.href) {
window.history.replaceState(null, '', newUrl);
}
}
})(window.location);
</script>
<script type="module" crossorigin src="/assets/index-BvOIUj_o.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-InsxKvgR.css">
</head>