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