Use our exposed versions
This commit is contained in:
parent
e56455fbaf
commit
22785a9860
2 changed files with 48 additions and 53 deletions
|
|
@ -1,39 +1,40 @@
|
|||
(function () {
|
||||
if (window.__AVIA_DESKTOP_PATCH__) return;
|
||||
window.__AVIA_DESKTOP_PATCH__ = true;
|
||||
if (window.__AVIA_DESKTOP_PATCH__) return;
|
||||
window.__AVIA_DESKTOP_PATCH__ = true;
|
||||
|
||||
const AVIA_VERSION = "1.6.0";
|
||||
function patchButton() {
|
||||
document
|
||||
.querySelectorAll("a.pos_relative.gap_16px.p_13px")
|
||||
.forEach((el) => {
|
||||
if (el.dataset.aviaPatched) return;
|
||||
|
||||
function patchButton() {
|
||||
document
|
||||
.querySelectorAll("a.pos_relative.gap_16px.p_13px")
|
||||
.forEach(el => {
|
||||
if (el.dataset.aviaPatched) return;
|
||||
const textContainer = el.querySelector(
|
||||
"div.d_flex.flex-g_1.flex-d_column",
|
||||
);
|
||||
if (!textContainer) return;
|
||||
|
||||
const textContainer = el.querySelector("div.d_flex.flex-g_1.flex-d_column");
|
||||
if (!textContainer) return;
|
||||
const nameDiv = textContainer.querySelector("div");
|
||||
const versionSpan = textContainer.querySelector("span.lh_1rem");
|
||||
|
||||
const nameDiv = textContainer.querySelector("div");
|
||||
const versionSpan = textContainer.querySelector("span.lh_1rem");
|
||||
if (!nameDiv || !versionSpan) return;
|
||||
if (!nameDiv.textContent.includes("Stoat for Desktop")) return;
|
||||
|
||||
if (!nameDiv || !versionSpan) return;
|
||||
if (!nameDiv.textContent.includes("Stoat for Desktop")) return;
|
||||
if (!versionSpan.textContent.includes("Version:")) return;
|
||||
|
||||
const match = versionSpan.textContent.match(/Version:\s*([0-9.]+)/);
|
||||
if (!match) return;
|
||||
const stoatVersion = match[1];
|
||||
const aviaVersion = window.native.versions.aviaClient();
|
||||
const stoatVersion = window.native.versions.desktop();
|
||||
|
||||
el.dataset.aviaPatched = "true";
|
||||
el.dataset.aviaPatched = "true";
|
||||
|
||||
nameDiv.textContent = "Avia Client Desktop";
|
||||
versionSpan.textContent = `Version ${AVIA_VERSION} (Based on Stoat ${stoatVersion})`;
|
||||
nameDiv.textContent = "Avia Client Desktop";
|
||||
versionSpan.textContent = `Version ${aviaVersion} (Based on Stoat ${stoatVersion})`;
|
||||
|
||||
textContainer.style.whiteSpace = "normal";
|
||||
textContainer.style.overflow = "visible";
|
||||
});
|
||||
}
|
||||
textContainer.style.whiteSpace = "normal";
|
||||
textContainer.style.overflow = "visible";
|
||||
});
|
||||
}
|
||||
|
||||
const observer = new MutationObserver(patchButton);
|
||||
observer.observe(document.body, { childList: true, subtree: true });
|
||||
patchButton();
|
||||
})();
|
||||
const observer = new MutationObserver(patchButton);
|
||||
observer.observe(document.body, { childList: true, subtree: true });
|
||||
patchButton();
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -1,40 +1,34 @@
|
|||
(function () {
|
||||
if (window.__AVIA_VERSION_PATCH__) return;
|
||||
window.__AVIA_VERSION_PATCH__ = true;
|
||||
|
||||
if (window.__AVIA_VERSION_PATCH__) return;
|
||||
window.__AVIA_VERSION_PATCH__ = true;
|
||||
function patchVersion() {
|
||||
document
|
||||
.querySelectorAll("span.lh_1rem.fs_0\\.75rem.ls_0\\.03125rem.fw_500")
|
||||
.forEach((el) => {
|
||||
if (el.dataset.aviaPatched) return;
|
||||
|
||||
function patchVersion() {
|
||||
if (!el.textContent.trim().startsWith("Stoat for Desktop")) return;
|
||||
|
||||
document
|
||||
.querySelectorAll("span.lh_1rem.fs_0\\.75rem.ls_0\\.03125rem.fw_500")
|
||||
.forEach(el => {
|
||||
const stoatVersion = window.native.versions.desktop();
|
||||
|
||||
if (el.dataset.aviaPatched) return;
|
||||
el.dataset.aviaPatched = "true";
|
||||
|
||||
const match = el.textContent.match(/Stoat for Desktop\s+([0-9.]+)/);
|
||||
|
||||
if (!match) return;
|
||||
|
||||
const stoatVersion = match[1];
|
||||
|
||||
el.dataset.aviaPatched = "true";
|
||||
|
||||
el.innerHTML = `
|
||||
el.innerHTML = `
|
||||
Avia Client Desktop<br>
|
||||
<span style="font-size:10px;opacity:0.7;">
|
||||
Based on Stoat ${stoatVersion}
|
||||
</span>
|
||||
`;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const observer = new MutationObserver(patchVersion);
|
||||
const observer = new MutationObserver(patchVersion);
|
||||
|
||||
observer.observe(document.body, {
|
||||
childList: true,
|
||||
subtree: true
|
||||
});
|
||||
|
||||
patchVersion();
|
||||
observer.observe(document.body, {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
});
|
||||
|
||||
patchVersion();
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue