Merge branch 'main' into dev
This commit is contained in:
commit
4bcbd24d99
6 changed files with 699 additions and 699 deletions
|
|
@ -1,8 +1,8 @@
|
||||||
(function(){
|
(function(){
|
||||||
if(window.__AVIA_CATEGORY_SETTINGS__) return;
|
if(window.__AVIA_CATEGORY_SETTINGS__) return;
|
||||||
window.__AVIA_CATEGORY_SETTINGS__ = true;
|
window.__AVIA_CATEGORY_SETTINGS__ = true;
|
||||||
|
|
||||||
function inject(){
|
function inject(){
|
||||||
|
|
||||||
if(document.getElementById('avia-cloned-settings')) return;
|
if(document.getElementById('avia-cloned-settings')) return;
|
||||||
|
|
||||||
|
|
@ -23,12 +23,12 @@ function inject(){
|
||||||
if(list) list.innerHTML = "";
|
if(list) list.innerHTML = "";
|
||||||
|
|
||||||
container.parentNode.insertBefore(clone, container.nextSibling);
|
container.parentNode.insertBefore(clone, container.nextSibling);
|
||||||
}
|
}
|
||||||
|
|
||||||
new MutationObserver(() => {
|
new MutationObserver(() => {
|
||||||
inject();
|
inject();
|
||||||
}).observe(document.body, { childList: true, subtree: true });
|
}).observe(document.body, { childList: true, subtree: true });
|
||||||
|
|
||||||
inject();
|
inject();
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
@ -1,20 +1,20 @@
|
||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
if (window.__AVIA_FAVORITES_LOADED__) return;
|
if (window.__AVIA_FAVORITES_LOADED__) return;
|
||||||
window.__AVIA_FAVORITES_LOADED__ = true;
|
window.__AVIA_FAVORITES_LOADED__ = true;
|
||||||
|
|
||||||
const STORAGE_KEY = "avia_favorites";
|
const STORAGE_KEY = "avia_favorites";
|
||||||
|
|
||||||
const getFavorites = () => JSON.parse(localStorage.getItem(STORAGE_KEY) || "[]");
|
const getFavorites = () => JSON.parse(localStorage.getItem(STORAGE_KEY) || "[]");
|
||||||
const setFavorites = (data) => localStorage.setItem(STORAGE_KEY, JSON.stringify(data));
|
const setFavorites = (data) => localStorage.setItem(STORAGE_KEY, JSON.stringify(data));
|
||||||
|
|
||||||
function extractYouTubeID(url) {
|
function extractYouTubeID(url) {
|
||||||
const reg = /(?:youtube\.com\/(?:watch\?v=|shorts\/)|youtu\.be\/)([^&?/]+)/;
|
const reg = /(?:youtube\.com\/(?:watch\?v=|shorts\/)|youtu\.be\/)([^&?/]+)/;
|
||||||
const match = url.match(reg);
|
const match = url.match(reg);
|
||||||
return match ? match[1] : null;
|
return match ? match[1] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleFavoritesPanel() {
|
function toggleFavoritesPanel() {
|
||||||
|
|
||||||
let panel = document.getElementById("avia-favorites-panel");
|
let panel = document.getElementById("avia-favorites-panel");
|
||||||
if (panel) {
|
if (panel) {
|
||||||
|
|
@ -319,9 +319,9 @@ function toggleFavoritesPanel() {
|
||||||
};
|
};
|
||||||
|
|
||||||
render();
|
render();
|
||||||
}
|
}
|
||||||
|
|
||||||
function injectButton() {
|
function injectButton() {
|
||||||
|
|
||||||
if (document.getElementById("avia-favorites-btn")) return;
|
if (document.getElementById("avia-favorites-btn")) return;
|
||||||
|
|
||||||
|
|
@ -339,11 +339,11 @@ function injectButton() {
|
||||||
clone.querySelector("button").onclick = toggleFavoritesPanel;
|
clone.querySelector("button").onclick = toggleFavoritesPanel;
|
||||||
|
|
||||||
wrapper.parentElement.insertBefore(clone, wrapper.nextSibling);
|
wrapper.parentElement.insertBefore(clone, wrapper.nextSibling);
|
||||||
}
|
}
|
||||||
|
|
||||||
new MutationObserver(injectButton)
|
new MutationObserver(injectButton)
|
||||||
.observe(document.body, { childList: true, subtree: true });
|
.observe(document.body, { childList: true, subtree: true });
|
||||||
|
|
||||||
injectButton();
|
injectButton();
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
if (window.__AVIA_VERSION_PATCH__) return;
|
if (window.__AVIA_VERSION_PATCH__) return;
|
||||||
window.__AVIA_VERSION_PATCH__ = true;
|
window.__AVIA_VERSION_PATCH__ = true;
|
||||||
|
|
||||||
function patchVersion() {
|
function patchVersion() {
|
||||||
|
|
||||||
document
|
document
|
||||||
.querySelectorAll("span.lh_1rem.fs_0\\.75rem.ls_0\\.03125rem.fw_500")
|
.querySelectorAll("span.lh_1rem.fs_0\\.75rem.ls_0\\.03125rem.fw_500")
|
||||||
|
|
@ -20,22 +20,21 @@ function patchVersion() {
|
||||||
el.dataset.aviaPatched = "true";
|
el.dataset.aviaPatched = "true";
|
||||||
|
|
||||||
el.innerHTML = `
|
el.innerHTML = `
|
||||||
Avia Client Desktop<br>
|
Avia Client Desktop<br>
|
||||||
<span style="font-size:10px;opacity:0.7;">
|
<span style="font-size:10px;opacity:0.7;">
|
||||||
Based on Stoat ${stoatVersion}
|
Based on Stoat ${stoatVersion}
|
||||||
</span>
|
</span>
|
||||||
`;
|
`;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
const observer = new MutationObserver(patchVersion);
|
||||||
|
|
||||||
const observer = new MutationObserver(patchVersion);
|
observer.observe(document.body, {
|
||||||
|
|
||||||
observer.observe(document.body, {
|
|
||||||
childList: true,
|
childList: true,
|
||||||
subtree: true
|
subtree: true
|
||||||
});
|
});
|
||||||
|
|
||||||
patchVersion();
|
patchVersion();
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
|
|
@ -243,15 +243,15 @@
|
||||||
const appearanceBtn = Array.from(document.querySelectorAll('a')).find(a => a.textContent.trim() === 'Appearance');
|
const appearanceBtn = Array.from(document.querySelectorAll('a')).find(a => a.textContent.trim() === 'Appearance');
|
||||||
if (!appearanceBtn) return;
|
if (!appearanceBtn) return;
|
||||||
|
|
||||||
const aviaHeader = [...document.querySelectorAll('span')]
|
const aviaHeader = [...document.querySelectorAll('span')]
|
||||||
.find(s => s.textContent.trim() === "AVIA CLIENT SETTINGS");
|
.find(s => s.textContent.trim() === "AVIA CLIENT SETTINGS");
|
||||||
if (!aviaHeader) return;
|
if (!aviaHeader) return;
|
||||||
|
|
||||||
const aviaContainer = aviaHeader.closest('.d_flex.flex-d_column');
|
const aviaContainer = aviaHeader.closest('.d_flex.flex-d_column');
|
||||||
if (!aviaContainer) return;
|
if (!aviaContainer) return;
|
||||||
|
|
||||||
const targetParent = aviaContainer.querySelector('.d_flex.flex-d_column.gap_var\\(--gap-s\\)');
|
const targetParent = aviaContainer.querySelector('.d_flex.flex-d_column.gap_var\\(--gap-s\\)');
|
||||||
if (!targetParent) return;
|
if (!targetParent) return;
|
||||||
|
|
||||||
if (!document.getElementById('stoat-fake-linktree')) {
|
if (!document.getElementById('stoat-fake-linktree')) {
|
||||||
const linktreeBtn = appearanceBtn.cloneNode(true);
|
const linktreeBtn = appearanceBtn.cloneNode(true);
|
||||||
|
|
@ -305,7 +305,8 @@ if (!targetParent) return;
|
||||||
document.getElementById('stoat-fake-loadfont') ||
|
document.getElementById('stoat-fake-loadfont') ||
|
||||||
document.getElementById('stoat-fake-stoatserver') ||
|
document.getElementById('stoat-fake-stoatserver') ||
|
||||||
document.getElementById('stoat-fake-linktree');
|
document.getElementById('stoat-fake-linktree');
|
||||||
targetParent.appendChild(quickCssBtn); }
|
targetParent.appendChild(quickCssBtn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyQuickCSS(css) {
|
function applyQuickCSS(css) {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
if (window.__AVIA_THEMES_LOADED__) return;
|
if (window.__AVIA_THEMES_LOADED__) return;
|
||||||
window.__AVIA_THEMES_LOADED__ = true;
|
window.__AVIA_THEMES_LOADED__ = true;
|
||||||
|
|
||||||
const STORAGE_KEY = "avia_themes";
|
const STORAGE_KEY = "avia_themes";
|
||||||
let editingTheme = null;
|
let editingTheme = null;
|
||||||
|
|
||||||
const TEMPLATE = `/*
|
const TEMPLATE = `/*
|
||||||
@name Whatever name here
|
@name Whatever name here
|
||||||
@author Whatever Author Here
|
@author Whatever Author Here
|
||||||
@version 1.0
|
@version 1.0
|
||||||
|
|
@ -15,19 +15,19 @@ const TEMPLATE = `/*
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const getThemes = () => JSON.parse(localStorage.getItem(STORAGE_KEY) || "[]");
|
const getThemes = () => JSON.parse(localStorage.getItem(STORAGE_KEY) || "[]");
|
||||||
const setThemes = (data) => localStorage.setItem(STORAGE_KEY, JSON.stringify(data));
|
const setThemes = (data) => localStorage.setItem(STORAGE_KEY, JSON.stringify(data));
|
||||||
|
|
||||||
function parseMeta(css){
|
function parseMeta(css){
|
||||||
const name = css.match(/@name\s+(.+)/)?.[1] || "Unknown Theme";
|
const name = css.match(/@name\s+(.+)/)?.[1] || "Unknown Theme";
|
||||||
const author = css.match(/@author\s+(.+)/)?.[1] || "Unknown";
|
const author = css.match(/@author\s+(.+)/)?.[1] || "Unknown";
|
||||||
const version = css.match(/@version\s+(.+)/)?.[1] || "1.0";
|
const version = css.match(/@version\s+(.+)/)?.[1] || "1.0";
|
||||||
const rawDescription = css.match(/@description\s+(.+)/)?.[1] || "No Description Available";
|
const rawDescription = css.match(/@description\s+(.+)/)?.[1] || "No Description Available";
|
||||||
const description = rawDescription.trim() === "*/" ? "No Description Available" : rawDescription;
|
const description = rawDescription.trim() === "*/" ? "No Description Available" : rawDescription;
|
||||||
return {name,author,version,description};
|
return {name,author,version,description};
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyThemes(){
|
function applyThemes(){
|
||||||
document.querySelectorAll(".avia-theme-style").forEach(e=>e.remove());
|
document.querySelectorAll(".avia-theme-style").forEach(e=>e.remove());
|
||||||
const themes = getThemes();
|
const themes = getThemes();
|
||||||
themes.forEach(theme=>{
|
themes.forEach(theme=>{
|
||||||
|
|
@ -37,9 +37,9 @@ function applyThemes(){
|
||||||
style.textContent=theme.css;
|
style.textContent=theme.css;
|
||||||
document.head.appendChild(style);
|
document.head.appendChild(style);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function styleBtn(btn, bg) {
|
function styleBtn(btn, bg) {
|
||||||
Object.assign(btn.style, {
|
Object.assign(btn.style, {
|
||||||
padding: "5px 12px",
|
padding: "5px 12px",
|
||||||
borderRadius: "8px",
|
borderRadius: "8px",
|
||||||
|
|
@ -53,9 +53,9 @@ function styleBtn(btn, bg) {
|
||||||
});
|
});
|
||||||
btn.onmouseenter = () => btn.style.opacity = "0.75";
|
btn.onmouseenter = () => btn.style.opacity = "0.75";
|
||||||
btn.onmouseleave = () => btn.style.opacity = "1";
|
btn.onmouseleave = () => btn.style.opacity = "1";
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeDraggable(panel, handle){
|
function makeDraggable(panel, handle){
|
||||||
let dragging=false,offsetX,offsetY;
|
let dragging=false,offsetX,offsetY;
|
||||||
handle.addEventListener("mousedown",e=>{
|
handle.addEventListener("mousedown",e=>{
|
||||||
dragging=true;
|
dragging=true;
|
||||||
|
|
@ -71,9 +71,9 @@ function makeDraggable(panel, handle){
|
||||||
panel.style.right="auto";
|
panel.style.right="auto";
|
||||||
panel.style.bottom="auto";
|
panel.style.bottom="auto";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function openThemeEditor(theme){
|
function openThemeEditor(theme){
|
||||||
editingTheme = theme;
|
editingTheme = theme;
|
||||||
let panel = document.getElementById('avia-theme-editor');
|
let panel = document.getElementById('avia-theme-editor');
|
||||||
if(panel){
|
if(panel){
|
||||||
|
|
@ -152,9 +152,9 @@ function openThemeEditor(theme){
|
||||||
panel.appendChild(close);
|
panel.appendChild(close);
|
||||||
panel.appendChild(textarea);
|
panel.appendChild(textarea);
|
||||||
document.body.appendChild(panel);
|
document.body.appendChild(panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleThemesPanel(){
|
function toggleThemesPanel(){
|
||||||
let panel=document.getElementById("avia-themes-panel");
|
let panel=document.getElementById("avia-themes-panel");
|
||||||
if(panel){
|
if(panel){
|
||||||
panel.style.display = panel.style.display==="none"?"flex":"none";
|
panel.style.display = panel.style.display==="none"?"flex":"none";
|
||||||
|
|
@ -359,9 +359,9 @@ function toggleThemesPanel(){
|
||||||
};
|
};
|
||||||
|
|
||||||
render();
|
render();
|
||||||
}
|
}
|
||||||
|
|
||||||
function injectButton(){
|
function injectButton(){
|
||||||
if(document.getElementById("avia-themes-btn")) return;
|
if(document.getElementById("avia-themes-btn")) return;
|
||||||
const appearanceBtn=[...document.querySelectorAll("a")].find(a=>a.textContent.trim()==="Appearance");
|
const appearanceBtn=[...document.querySelectorAll("a")].find(a=>a.textContent.trim()==="Appearance");
|
||||||
const quickCSS=document.getElementById("stoat-fake-quickcss");
|
const quickCSS=document.getElementById("stoat-fake-quickcss");
|
||||||
|
|
@ -372,10 +372,10 @@ function injectButton(){
|
||||||
if(text) text.textContent="(Avia) Themes";
|
if(text) text.textContent="(Avia) Themes";
|
||||||
clone.onclick=toggleThemesPanel;
|
clone.onclick=toggleThemesPanel;
|
||||||
quickCSS.parentElement.insertBefore(clone, quickCSS.nextSibling);
|
quickCSS.parentElement.insertBefore(clone, quickCSS.nextSibling);
|
||||||
}
|
}
|
||||||
|
|
||||||
new MutationObserver(injectButton).observe(document.body,{childList:true,subtree:true});
|
new MutationObserver(injectButton).observe(document.body,{childList:true,subtree:true});
|
||||||
injectButton();
|
injectButton();
|
||||||
applyThemes();
|
applyThemes();
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue