chore: prettier.... TWO!

This commit is contained in:
wearrrrr 2024-10-10 19:35:08 -05:00
parent 3436d85888
commit 0d4ee9ee96
5 changed files with 18 additions and 18 deletions

View file

@ -171,8 +171,8 @@ export default function (client: ScramjetClient, self: typeof window) {
// since the prototype chain is fucked // since the prototype chain is fucked
const style = ctx.get() as CSSStyleDeclaration; const style = ctx.get() as CSSStyleDeclaration;
return new Proxy(style, { return new Proxy(style, {
get(t, p) { get(t, p) {
const v = Reflect.get(t, p); const v = Reflect.get(t, p);
if (typeof v === "function") { if (typeof v === "function") {
@ -190,8 +190,8 @@ return new Proxy(style, {
if (v == "" || typeof v !== "string") { if (v == "" || typeof v !== "string") {
return Reflect.set(t, p, v); return Reflect.set(t, p, v);
} }
return Reflect.set(t, p, rewriteCss(v, client.meta)); return Reflect.set(t, p, rewriteCss(v, client.meta));
}, },
}); });
}, },

View file

@ -10,8 +10,8 @@ export default function (client: ScramjetClient, self: Self) {
client.Trap("IDBDatabase.prototype.name", { client.Trap("IDBDatabase.prototype.name", {
get(ctx) { get(ctx) {
const name = ctx.get() as string; const name = ctx.get() as string;
return name.substring(name.indexOf("@") + 1); return name.substring(name.indexOf("@") + 1);
}, },
}); });
} }

View file

@ -85,15 +85,15 @@ export default function (client: ScramjetClient, self: Self) {
client.RawTrap(ctx.this, "response", { client.RawTrap(ctx.this, "response", {
get() { get() {
if (ctx.this.responseType === "arraybuffer") return bodyab.buffer; if (ctx.this.responseType === "arraybuffer") return bodyab.buffer;
return body; return body;
}, },
}); });
client.RawTrap(ctx.this, "responseXML", { client.RawTrap(ctx.this, "responseXML", {
get() { get() {
const parser = new DOMParser(); const parser = new DOMParser();
return parser.parseFromString(body, "text/xml"); return parser.parseFromString(body, "text/xml");
}, },
}); });
client.RawTrap(ctx.this, "getAllResponseHeaders", { client.RawTrap(ctx.this, "getAllResponseHeaders", {
@ -106,8 +106,8 @@ return parser.parseFromString(body, "text/xml");
return (header: string) => { return (header: string) => {
const re = new RegExp(`^${header}: (.*)$`, "m"); const re = new RegExp(`^${header}: (.*)$`, "m");
const match = re.exec(headers); const match = re.exec(headers);
return match ? match[1] : null; return match ? match[1] : null;
}; };
}, },
}); });

View file

@ -66,8 +66,8 @@ export default function (client: ScramjetClient, self: typeof globalThis) {
if (typeof v === "string" && v.includes("scramjet")) { if (typeof v === "string" && v.includes("scramjet")) {
debugger; debugger;
} }
return v; return v;
}; };
// location = "..." can't be rewritten as wrapfn(location) = ..., so instead it will actually be rewritten as // location = "..." can't be rewritten as wrapfn(location) = ..., so instead it will actually be rewritten as

View file

@ -272,14 +272,14 @@ export function rewriteSrcset(srcset: string, meta: URLMeta) {
function base64ToBytes(base64) { function base64ToBytes(base64) {
const binString = atob(base64); const binString = atob(base64);
return Uint8Array.from(binString, (m) => m.codePointAt(0)); return Uint8Array.from(binString, (m) => m.codePointAt(0));
} }
function bytesToBase64(bytes: Uint8Array) { function bytesToBase64(bytes: Uint8Array) {
const binString = Array.from(bytes, (byte) => const binString = Array.from(bytes, (byte) =>
String.fromCodePoint(byte) String.fromCodePoint(byte)
).join(""); ).join("");
return btoa(binString); return btoa(binString);
} }