Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
xpeuvr327 authored Nov 11, 2024
1 parent a7ec0ba commit 831e904
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions sh/index.html
Original file line number Diff line number Diff line change
@@ -1,17 +1 @@
< !DOCTYPE html > < html lang = "en" > < head > < meta charset = "UTF-8" > < meta name = "viewport"
content = "width=device-width, initial-scale=1.0" > < title > URL Shortener < /title></head > < body > < h1 > URL Shortener < /h1><p>Redirecting...</p > < script > function getQueryParams() {
return new URLSearchParams(window.location.search)
}
async function redirectUser() {
const params = getQueryParams(),
route = params.get('r');
if (route) {
const response = await fetch('p/redirects.json'),
data = await response.json(),
redirectEntry = data.find(entry => entry.sh === route);
if (redirectEntry) {
window.location.href = redirectEntry.url
}

}
window.onload = redirectUser; < /script></body > < /html>
<!DOCTYPE html><html lang="en"><meta charset="UTF-8"><meta content="width=device-width,initial-scale=1" name="viewport"><title>URL Shortener</title><h1>URL Shortener</h1><p>Redirecting...</p><script>function getQueryParams(){return new URLSearchParams(window.location.search);}async function redirectUser(){let params=getQueryParams(),r=params.get("r");if(r){let response=await fetch("p/redirects.json"),data=await response.json(),route=data.find(e=>e[r]);if(route)window.location.href=route[r];}}window.onload=redirectUser;</script>

0 comments on commit 831e904

Please sign in to comment.