Use our exposed versions
This commit is contained in:
parent
e56455fbaf
commit
22785a9860
2 changed files with 48 additions and 53 deletions
|
|
@ -2,15 +2,15 @@
|
|||
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 => {
|
||||
.forEach((el) => {
|
||||
if (el.dataset.aviaPatched) return;
|
||||
|
||||
const textContainer = el.querySelector("div.d_flex.flex-g_1.flex-d_column");
|
||||
const textContainer = el.querySelector(
|
||||
"div.d_flex.flex-g_1.flex-d_column",
|
||||
);
|
||||
if (!textContainer) return;
|
||||
|
||||
const nameDiv = textContainer.querySelector("div");
|
||||
|
|
@ -19,14 +19,15 @@
|
|||
if (!nameDiv || !versionSpan) return;
|
||||
if (!nameDiv.textContent.includes("Stoat for Desktop")) return;
|
||||
|
||||
const match = versionSpan.textContent.match(/Version:\s*([0-9.]+)/);
|
||||
if (!match) return;
|
||||
const stoatVersion = match[1];
|
||||
if (!versionSpan.textContent.includes("Version:")) return;
|
||||
|
||||
const aviaVersion = window.native.versions.aviaClient();
|
||||
const stoatVersion = window.native.versions.desktop();
|
||||
|
||||
el.dataset.aviaPatched = "true";
|
||||
|
||||
nameDiv.textContent = "Avia Client Desktop";
|
||||
versionSpan.textContent = `Version ${AVIA_VERSION} (Based on Stoat ${stoatVersion})`;
|
||||
versionSpan.textContent = `Version ${aviaVersion} (Based on Stoat ${stoatVersion})`;
|
||||
|
||||
textContainer.style.whiteSpace = "normal";
|
||||
textContainer.style.overflow = "visible";
|
||||
|
|
|
|||
|
|
@ -1,21 +1,16 @@
|
|||
(function () {
|
||||
|
||||
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 => {
|
||||
|
||||
.forEach((el) => {
|
||||
if (el.dataset.aviaPatched) return;
|
||||
|
||||
const match = el.textContent.match(/Stoat for Desktop\s+([0-9.]+)/);
|
||||
if (!el.textContent.trim().startsWith("Stoat for Desktop")) return;
|
||||
|
||||
if (!match) return;
|
||||
|
||||
const stoatVersion = match[1];
|
||||
const stoatVersion = window.native.versions.desktop();
|
||||
|
||||
el.dataset.aviaPatched = "true";
|
||||
|
||||
|
|
@ -32,9 +27,8 @@ Avia Client Desktop<br>
|
|||
|
||||
observer.observe(document.body, {
|
||||
childList: true,
|
||||
subtree: true
|
||||
subtree: true,
|
||||
});
|
||||
|
||||
patchVersion();
|
||||
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue