Files
discord-decomp/_bundle/Module1859.js
T
2026-11-01 12:12:55 +02:00

83 lines
2.2 KiB
JavaScript

// Metro module 1859 (f1860).
let c1566_0 = /input/i;
let c1566_1 = /textarea/i;
let c1566_2 = new Set(["text", "password", "number", "date", "datetime-local", "time", "week", "month", "email", "search", "tel", "url"]);
export function isElement(a0, a1) {
if (a0 == null) {
return false;
}
const r2 = a0 == null ? void 0 : a0.ownerDocument?.defaultView;
if (r2 == null) {
return false;
}
let r4 = a1?.name;
if (r4 == null) {
r4 = "Element";
}
const r9 = r2[r4];
return r9 != null && a0 instanceof r9;
}
export function cssValueToNumber(a0) {
const r5 = parseInt(a0, 10);
return isNaN(r5) ? 0 : r5;
}
export function isInputLikeElement(a0) {
if (a0 == null) {
return false;
}
if (a0.getAttribute("contenteditable") === "true") {
return true;
}
if (c1566_1.test(a0.tagName)) {
return true;
}
if (c1566_0.test(a0.tagName)) {
let r17 = a0.getAttribute("type");
if (r17 == null) {
r17 = "text";
}
if (c1566_2.has(r17)) {
return true;
}
}
return false;
}
export function removeNode(a0) {
if (a0.parentNode != null) {
a0.parentNode.removeChild(a0);
}
}
export function eventOwnerDocument({ target }) {
return target == null ? null : "ownerDocument" in target ? target.ownerDocument : "document" in target ? target.document : null;
}
export function clickedOnVisibleImage(a0, a1, { width, height: height2 }, { top, left, width: width2, height }) {
const r18 = Math.min(width2 / width, height / height2, 1);
const r19 = width * r18;
const r20 = height2 * r18;
const r23 = (height - r20) / 2 + left;
const r26 = (width2 - r19) / 2 + top;
return a1 >= r23 && a1 <= r23 + r20 && a0 >= r26 && a0 <= r26 + r19;
}
export function getParentElementByClassName({ parentElement }, a1) {
while (parentElement != null) {
const r6 = parentElement.classList.contains(a1);
const r7 = parentElement;
if (r6) {
return r7;
}
parentElement = r7.parentElement;
}
return null;
}
export function getParentElementByAttribute({ parentElement }, a1) {
while (parentElement != null) {
const attribute = parentElement.getAttribute(a1);
const r6 = parentElement;
if (attribute != null) {
return r6;
}
parentElement = r6.parentElement;
}
return null;
}