abyss internal link shortening, removal of # for ids and external preview
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
const ytOembedCache = new Map(); // videoId -> meta object
|
||||
const ytOembedPending = new Map(); // videoId -> Promise
|
||||
|
||||
|
||||
const fetchSidebarYoutubeTitles = async (container) => {
|
||||
const links = container.querySelectorAll('.sidebar-video-link[data-yt-id]');
|
||||
if (links.length === 0) return;
|
||||
@@ -290,6 +291,14 @@
|
||||
}
|
||||
);
|
||||
|
||||
// Abyss label replacement
|
||||
md = md.replace(
|
||||
/<a\s[^>]*href="(?:https?:\/\/[^\/]+)?\/abyss(?:#|\/)(\d+)"[^>]*>([\s\S]*?)<\/a>/gi,
|
||||
(match, abyssId) => {
|
||||
return `<a href="/abyss/${abyssId}" class="sidebar-abyss-link" data-abyss-id="${abyssId}"><i class="fa-solid fa-dice-d6"></i> /abyss/${abyssId}</a>`;
|
||||
}
|
||||
);
|
||||
|
||||
// Build regex for allowed media hosters (video/audio)
|
||||
const escapedSiteHost = window.location.host.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
const mediaHosts = [escapedSiteHost];
|
||||
|
||||
Reference in New Issue
Block a user