bookmarks

This commit is contained in:
MDeeApp
2025-10-24 18:17:34 +02:00
parent 9d85044b7f
commit c7cb02cf2d
3 changed files with 61 additions and 0 deletions

View File

@@ -396,6 +396,20 @@ function normalizeFacebookPostUrl(rawValue) {
parsed.protocol = 'https:'; parsed.protocol = 'https:';
parsed.port = ''; parsed.port = '';
const normalizedPathBeforeTrim = parsed.pathname.replace(/\/+$/, '') || '/';
const lowerPathBeforeTrim = normalizedPathBeforeTrim.toLowerCase();
const watchId = parsed.searchParams.get('v') || parsed.searchParams.get('video_id');
if ((lowerPathBeforeTrim === '/watch' || lowerPathBeforeTrim === '/video.php') && watchId) {
parsed.pathname = `/reel/${watchId}/`;
parsed.search = '';
} else {
const reelMatch = lowerPathBeforeTrim.match(/^\/reel\/([^/]+)$/);
if (reelMatch) {
parsed.pathname = `/reel/${reelMatch[1]}/`;
parsed.search = '';
}
}
const cleanedParams = new URLSearchParams(); const cleanedParams = new URLSearchParams();
parsed.searchParams.forEach((paramValue, paramKey) => { parsed.searchParams.forEach((paramValue, paramKey) => {
const lowerKey = paramKey.toLowerCase(); const lowerKey = paramKey.toLowerCase();
@@ -424,6 +438,11 @@ function normalizeFacebookPostUrl(rawValue) {
} }
} }
const normalizedPath = parsed.pathname.replace(/\/+$/, '').toLowerCase();
if (normalizedPath.startsWith('/hashtag/') || normalizedPath.startsWith('/watch/hashtag/')) {
return null;
}
const search = cleanedParams.toString(); const search = cleanedParams.toString();
const formatted = `${parsed.origin}${parsed.pathname}${search ? `?${search}` : ''}`; const formatted = `${parsed.origin}${parsed.pathname}${search ? `?${search}` : ''}`;
return formatted.replace(/[?&]$/, ''); return formatted.replace(/[?&]$/, '');

View File

@@ -1890,6 +1890,20 @@ function normalizeFacebookPostUrl(rawValue) {
return ''; return '';
} }
const normalizedPathBeforeTrim = parsed.pathname.replace(/\/+$/, '') || '/';
const lowerPathBeforeTrim = normalizedPathBeforeTrim.toLowerCase();
const watchId = parsed.searchParams.get('v') || parsed.searchParams.get('video_id');
if ((lowerPathBeforeTrim === '/watch' || lowerPathBeforeTrim === '/video.php') && watchId) {
parsed.pathname = `/reel/${watchId}/`;
parsed.search = '';
} else {
const reelMatch = lowerPathBeforeTrim.match(/^\/reel\/([^/]+)$/);
if (reelMatch) {
parsed.pathname = `/reel/${reelMatch[1]}/`;
parsed.search = '';
}
}
const cleanedParams = new URLSearchParams(); const cleanedParams = new URLSearchParams();
parsed.searchParams.forEach((paramValue, paramKey) => { parsed.searchParams.forEach((paramValue, paramKey) => {
const lowerKey = paramKey.toLowerCase(); const lowerKey = paramKey.toLowerCase();
@@ -1921,6 +1935,11 @@ function normalizeFacebookPostUrl(rawValue) {
} }
} }
const normalizedPath = parsed.pathname.replace(/\/+$/, '').toLowerCase();
if (normalizedPath.startsWith('/hashtag/') || normalizedPath.startsWith('/watch/hashtag/')) {
return '';
}
const search = cleanedParams.toString(); const search = cleanedParams.toString();
const formatted = `${parsed.origin}${parsed.pathname}${search ? `?${search}` : ''}`; const formatted = `${parsed.origin}${parsed.pathname}${search ? `?${search}` : ''}`;
return formatted.replace(/[?&]$/, ''); return formatted.replace(/[?&]$/, '');

View File

@@ -626,6 +626,7 @@ function openBookmark(bookmark) {
window.open(url, '_blank', 'noopener'); window.open(url, '_blank', 'noopener');
} }
}); });
} }
async function markBookmarkClick(bookmarkId) { async function markBookmarkClick(bookmarkId) {
@@ -894,6 +895,7 @@ function toggleBookmarkPanel(forceVisible) {
bookmarkPanelVisible = shouldShow; bookmarkPanelVisible = shouldShow;
bookmarkPanel.hidden = !bookmarkPanelVisible; bookmarkPanel.hidden = !bookmarkPanelVisible;
bookmarkPanel.style.display = bookmarkPanelVisible ? 'flex' : 'none';
bookmarkPanel.setAttribute('aria-hidden', bookmarkPanelVisible ? 'false' : 'true'); bookmarkPanel.setAttribute('aria-hidden', bookmarkPanelVisible ? 'false' : 'true');
bookmarkPanelToggle.setAttribute('aria-expanded', bookmarkPanelVisible ? 'true' : 'false'); bookmarkPanelToggle.setAttribute('aria-expanded', bookmarkPanelVisible ? 'true' : 'false');
@@ -993,6 +995,8 @@ function initializeBookmarks() {
if (bookmarkPanel) { if (bookmarkPanel) {
bookmarkPanel.setAttribute('aria-hidden', 'true'); bookmarkPanel.setAttribute('aria-hidden', 'true');
bookmarkPanel.hidden = true;
bookmarkPanel.style.display = 'none';
} }
if (bookmarkPanelToggle) { if (bookmarkPanelToggle) {
@@ -1338,6 +1342,20 @@ function normalizeFacebookPostUrl(rawValue) {
return null; return null;
} }
const normalizedPathBeforeTrim = parsed.pathname.replace(/\/+$/, '') || '/';
const lowerPathBeforeTrim = normalizedPathBeforeTrim.toLowerCase();
const watchId = parsed.searchParams.get('v') || parsed.searchParams.get('video_id');
if ((lowerPathBeforeTrim === '/watch' || lowerPathBeforeTrim === '/video.php') && watchId) {
parsed.pathname = `/reel/${watchId}/`;
parsed.search = '';
} else {
const reelMatch = lowerPathBeforeTrim.match(/^\/reel\/([^/]+)$/);
if (reelMatch) {
parsed.pathname = `/reel/${reelMatch[1]}/`;
parsed.search = '';
}
}
const cleanedParams = new URLSearchParams(); const cleanedParams = new URLSearchParams();
parsed.searchParams.forEach((paramValue, paramKey) => { parsed.searchParams.forEach((paramValue, paramKey) => {
const lowerKey = paramKey.toLowerCase(); const lowerKey = paramKey.toLowerCase();
@@ -1349,6 +1367,11 @@ function normalizeFacebookPostUrl(rawValue) {
cleanedParams.append(paramKey, paramValue); cleanedParams.append(paramKey, paramValue);
}); });
const normalizedPath = parsed.pathname.replace(/\/+$/, '').toLowerCase();
if (normalizedPath.startsWith('/hashtag/') || normalizedPath.startsWith('/watch/hashtag/')) {
return '';
}
const search = cleanedParams.toString(); const search = cleanedParams.toString();
const formatted = `${parsed.origin}${parsed.pathname}${search ? `?${search}` : ''}`; const formatted = `${parsed.origin}${parsed.pathname}${search ? `?${search}` : ''}`;
return formatted.replace(/[?&]$/, ''); return formatted.replace(/[?&]$/, '');