Und dieser Scheiß-Skript, den ich gemacht habe, um die ursprünglichen Pfade zu ersetzen
<script>
document.addEventListener('DOMContentLoaded', function() {
const updateLinks = () => {
document.querySelectorAll('a[href*="/l/latest"]').forEach(link => {
link.href = 'https://segredin.com/';
});
document.querySelectorAll('a[href*="/l/hot"]').forEach(link => {
link.href = 'https://segredin.com/hot';
});
document.querySelectorAll('a[href*="/latest"]').forEach(link => {
link.href = 'https://segredin.com/';
});
};
const ocultarElementos = () => {
// Fügen Sie hier Code ein, um Elemente auszublenden, falls erforderlich
};
const applyStylesToPosts = () => {
// Fügen Sie hier Ihre Logik zum Stylen von Beiträgen ein
// Beispiel: document.querySelectorAll('.post').forEach(post => { ... });
};
const replaceTextNodes = (node) => {
node.childNodes.forEach(child => {
if (child.nodeType === Node.TEXT_NODE) {
child.textContent = child.textContent
.replace(/-E-/gi, ' & ')
.replace(/-/g, ' ');
} else {
replaceTextNodes(child);
}
});
};
const processTags = () => {
document.querySelectorAll('.discourse-tag.box').forEach(tag => {
replaceTextNodes(tag);
});
document.querySelectorAll('#sidebar-section-content-tags .sidebar-section-link-content-text').forEach(tag => {
replaceTextNodes(tag);
});
};
const TITLES = {
"home": "Segredin - Anonymes Dampf ablassen und Geschichten",
"hot": "Segredin - Beliebte Themen"
};
const HOMEPAGE_URLS = [
"https://segredin.com/",
"https://segredin.com"
];
const HOT_PAGE_URLS = [
"https://segredin.com/hot",
"https://segredin.com/hot/"
];
const getCurrentPageType = () => {
const currentUrl = window.location.href;
// Prüft, ob es sich um die /hot Seite handelt
if (HOT_PAGE_URLS.some(url =>
currentUrl === url ||
currentUrl.startsWith(url.replace(/\\/$/, '') + '?') ||
currentUrl === url.replace(/\\/$/, '')
)) {
return "hot";
}
// Prüft, ob es sich um die Startseite handelt
if (HOMEPAGE_URLS.some(url =>
currentUrl === url ||
currentUrl.startsWith(url.replace(/\\/$/, '') + '?') ||
currentUrl === url.replace(/\\/$/, '')
)) {
return "home";
}
return null;
};
const getDesiredTitle = () => {
const pageType = getCurrentPageType();
return pageType ? TITLES[pageType] : null;
};
const enforceTitle = () => {
const desiredTitle = getDesiredTitle();
if (!desiredTitle) return;
if (document.title !== desiredTitle) {
document.title = desiredTitle;
}
};
const startTitleObserver = () => {
const titleObserver = new MutationObserver(enforceTitle);
const titleElement = document.querySelector('title');
if (titleElement) {
titleObserver.observe(titleElement, {
childList: true,
subtree: true,
characterData: true
});
}
return titleObserver;
};
const monitorUrlChanges = (titleObserver) => {
let lastUrl = window.location.href;
setInterval(() => {
if (window.location.href !== lastUrl) {
lastUrl = window.location.href;
const pageType = getCurrentPageType();
if (pageType) {
enforceTitle();
titleObserver.disconnect();
startTitleObserver();
} else {
titleObserver.disconnect();
}
}
}, 300);
};
const mainObserver = new MutationObserver(() => {
applyStylesToPosts();
updateLinks();
ocultarElementos();
processTags();
enforceTitle();
});
// Erste Ausführung
applyStylesToPosts();
updateLinks();
ocultarElementos();
processTags();
const titleObserver = startTitleObserver();
monitorUrlChanges(titleObserver);
mainObserver.observe(document.body, {
childList: true,
subtree: true
});
document.addEventListener('page:changed', () => {
processTags();
enforceTitle();
});
});
</script>
Ich werde diesen Code erweitern, aber im Moment funktioniert er