Restores redirect script temporarily

This commit is contained in:
Helen Chong 2024-06-01 08:07:28 +08:00
parent 560a277ad9
commit 15e9a04106
2 changed files with 13 additions and 0 deletions

View File

@ -33,6 +33,7 @@
{% endblock %} {% endblock %}
{# JavaScript #} {# JavaScript #}
<script src="/assets/js/redirect.js"></script>
<script src="/assets/js/details-utils.js" defer></script> <script src="/assets/js/details-utils.js" defer></script>
<title> <title>

12
src/assets/js/redirect.js Normal file
View File

@ -0,0 +1,12 @@
const currentUrl = window.location.href;
const oldDomain = 'leilukin.neocities.org';
const newDomain = 'leilukin.com';
const redirectUrl = (oldStr, newStr) => {
if (currentUrl.includes(oldStr)) {
const newUrl = currentUrl.replace(oldStr, newStr);
location.replace(newUrl);
}
}
redirectUrl(oldDomain, newDomain);