fix for firefox 52
This commit is contained in:
parent
8f34654929
commit
d8ec3ce019
@ -7,12 +7,15 @@ async function isPushRegistered() {
|
|||||||
checkServiceWorkerSupport();
|
checkServiceWorkerSupport();
|
||||||
try {
|
try {
|
||||||
const registrations = await navigator.serviceWorker.getRegistrations();
|
const registrations = await navigator.serviceWorker.getRegistrations();
|
||||||
if (!registrations?.length) return false;
|
if (!registrations || registrations.length === 0) return false;
|
||||||
|
|
||||||
return await Promise.any(
|
for (let reg of registrations) {
|
||||||
registrations.map(async (reg) => !!(await reg.pushManager.getSubscription()))
|
const subscription = await reg.pushManager.getSubscription();
|
||||||
).catch(() => false);
|
if (subscription) return true;
|
||||||
} catch {
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
} catch (error) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,10 @@ window.RTCPeerConnection = function (...args) {
|
|||||||
const lines = offer.sdp.split("\n");
|
const lines = offer.sdp.split("\n");
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
if (line.includes("a=fingerprint")) {
|
if (line.includes("a=fingerprint")) {
|
||||||
fingerprint = line.split("a=fingerprint:")[1]?.trim() ?? null;
|
const fingerprintMatch = line.split("a=fingerprint:")[1];
|
||||||
|
if (fingerprintMatch) {
|
||||||
|
fingerprint = fingerprintMatch.trim();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,7 @@ function loadConfig() {
|
|||||||
...DEFAULT_CONFIG,
|
...DEFAULT_CONFIG,
|
||||||
...JSON.parse(localStorage_.getItem(CONFIG_KEY) || "{}")
|
...JSON.parse(localStorage_.getItem(CONFIG_KEY) || "{}")
|
||||||
};
|
};
|
||||||
} catch {
|
} catch(error) {
|
||||||
return { ...DEFAULT_CONFIG };
|
return { ...DEFAULT_CONFIG };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,14 +32,26 @@
|
|||||||
if (document.querySelector("[data-join-date]")) return;
|
if (document.querySelector("[data-join-date]")) return;
|
||||||
|
|
||||||
const nitroBadge = document.querySelector(CSS_CLASSES.nitroBadge);
|
const nitroBadge = document.querySelector(CSS_CLASSES.nitroBadge);
|
||||||
const date = nitroBadge?.getAttribute("aria-label")?.replace("Subscriber since ", "");
|
if (!nitroBadge) return;
|
||||||
if (!date) return;
|
|
||||||
|
const date = nitroBadge.getAttribute("aria-label");
|
||||||
|
if (date) {
|
||||||
|
const formattedDate = date.replace("Subscriber since ", "");
|
||||||
|
if (!formattedDate) return;
|
||||||
|
}
|
||||||
|
|
||||||
const isCompact = !!document.querySelector("h3.bodyTitle-2Az3VQ");
|
const isCompact = !!document.querySelector("h3.bodyTitle-2Az3VQ");
|
||||||
const anchor = [...document.querySelectorAll("h3")].find(h =>
|
const h3Elements = document.querySelectorAll("h3");
|
||||||
(h.className.includes("bodyTitle") && h.textContent.includes("Role")) ||
|
|
||||||
h.textContent.trim() === "Note"
|
let anchor = null;
|
||||||
);
|
for (let i = 0; i < h3Elements.length; i++) {
|
||||||
|
const h = h3Elements[i];
|
||||||
|
if ((h.className.indexOf("bodyTitle") > -1 && h.textContent.indexOf("Role") > -1) ||
|
||||||
|
h.textContent.trim() === "Note") {
|
||||||
|
anchor = h;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!anchor) return;
|
if (!anchor) return;
|
||||||
|
|
||||||
const infoText = document.createElement("div");
|
const infoText = document.createElement("div");
|
||||||
@ -50,7 +62,7 @@
|
|||||||
|
|
||||||
const dateText = document.createElement("div");
|
const dateText = document.createElement("div");
|
||||||
dateText.className = isCompact ? CSS_CLASSES.userInfoBody : CSS_CLASSES.userInfoText;
|
dateText.className = isCompact ? CSS_CLASSES.userInfoBody : CSS_CLASSES.userInfoText;
|
||||||
dateText.textContent = date;
|
dateText.textContent = formattedDate;
|
||||||
dateText.dataset.joinDate = "value";
|
dateText.dataset.joinDate = "value";
|
||||||
|
|
||||||
if (isCompact) {
|
if (isCompact) {
|
||||||
@ -64,7 +76,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
infoText.style.marginTop = isNewSection ? "0px" : "10px";
|
infoText.style.marginTop = isNewSection ? "0px" : "10px";
|
||||||
infoSection.append(infoText, dateText);
|
infoSection.appendChild(infoText);
|
||||||
|
infoSection.appendChild(dateText);
|
||||||
} else {
|
} else {
|
||||||
anchor.parentNode.insertBefore(infoText, anchor);
|
anchor.parentNode.insertBefore(infoText, anchor);
|
||||||
anchor.parentNode.insertBefore(dateText, anchor);
|
anchor.parentNode.insertBefore(dateText, anchor);
|
||||||
|
|||||||
Reference in New Issue
Block a user