actually prettier

This commit is contained in:
Toshit Chawda 2024-07-14 16:22:34 -07:00
parent fb53b44869
commit 56767f5b31
No known key found for this signature in database
GPG key ID: 91480ED99E2B3D9D
41 changed files with 1914 additions and 1919 deletions

View file

@ -1,32 +1,32 @@
// @ts-nocheck
import { encodeUrl, decodeUrl } from "./shared";
import { encodeUrl, decodeUrl } from "./shared"
function createLocation() {
const loc = new URL(decodeUrl(location.href));
loc.assign = (url: string) => location.assign(encodeUrl(url));
loc.reload = () => location.reload();
loc.replace = (url: string) => location.replace(encodeUrl(url));
loc.toString = () => loc.href;
const loc = new URL(decodeUrl(location.href))
loc.assign = (url: string) => location.assign(encodeUrl(url))
loc.reload = () => location.reload()
loc.replace = (url: string) => location.replace(encodeUrl(url))
loc.toString = () => loc.href
return loc;
return loc
}
export const locationProxy = new Proxy(window.location, {
get(target, prop) {
const loc = createLocation();
get(target, prop) {
const loc = createLocation()
return loc[prop];
},
return loc[prop]
},
set(obj, prop, value) {
const loc = createLocation();
set(obj, prop, value) {
const loc = createLocation()
if (prop === "href") {
location.href = encodeUrl(value);
} else {
loc[prop] = value;
}
if (prop === "href") {
location.href = encodeUrl(value)
} else {
loc[prop] = value
}
return true;
},
});
return true
},
})