reworked site
This commit is contained in:
62
web/app.js
62
web/app.js
@@ -1,27 +1,12 @@
|
||||
const API_URL = 'https://fb.srv.medeba-media.de/api';
|
||||
|
||||
let initialViewParam = null;
|
||||
|
||||
// Normalize incoming routing parameters without leaving the index view
|
||||
(function normalizeViewRouting() {
|
||||
try {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const view = params.get('view');
|
||||
if (!view) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (view === 'dashboard') {
|
||||
initialViewParam = view;
|
||||
params.delete('view');
|
||||
const remaining = params.toString();
|
||||
const newUrl = `${window.location.pathname}${remaining ? `?${remaining}` : ''}${window.location.hash}`;
|
||||
window.history.replaceState({}, document.title, newUrl);
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('Konnte view-Parameter nicht verarbeiten:', error);
|
||||
}
|
||||
})();
|
||||
try {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
initialViewParam = params.get('view');
|
||||
} catch (error) {
|
||||
console.warn('Konnte view-Parameter nicht auslesen:', error);
|
||||
}
|
||||
|
||||
let focusPostIdParam = null;
|
||||
let focusPostUrlParam = null;
|
||||
@@ -145,9 +130,6 @@ function scheduleUpdatesReconnect() {
|
||||
}
|
||||
|
||||
function startUpdatesStream() {
|
||||
if (isBookmarksPage) {
|
||||
return;
|
||||
}
|
||||
if (typeof EventSource === 'undefined') {
|
||||
console.warn('EventSource wird von diesem Browser nicht unterstützt. Fallback auf Polling.');
|
||||
return;
|
||||
@@ -253,7 +235,6 @@ const bookmarkSearchInput = document.getElementById('bookmarkSearchInput');
|
||||
const bookmarkSortSelect = document.getElementById('bookmarkSortSelect');
|
||||
const bookmarkSortDirectionToggle = document.getElementById('bookmarkSortDirectionToggle');
|
||||
const profileSelectElement = document.getElementById('profileSelect');
|
||||
const isBookmarksPage = document.body.classList.contains('bookmarks-page');
|
||||
|
||||
const REFRESH_SETTINGS_KEY = 'trackerRefreshSettings';
|
||||
const SORT_SETTINGS_KEY = 'trackerSortSettings';
|
||||
@@ -2414,10 +2395,6 @@ function applyAutoRefreshSettings() {
|
||||
: '';
|
||||
}
|
||||
|
||||
if (isBookmarksPage) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!autoRefreshSettings.enabled) {
|
||||
return;
|
||||
}
|
||||
@@ -2730,10 +2707,8 @@ function applyProfileNumber(profileNumber, { fromBackend = false } = {}) {
|
||||
pushProfileState(currentProfile);
|
||||
}
|
||||
|
||||
if (!isBookmarksPage) {
|
||||
resetVisibleCount();
|
||||
renderPosts();
|
||||
}
|
||||
resetVisibleCount();
|
||||
renderPosts();
|
||||
}
|
||||
|
||||
// Load profile from localStorage
|
||||
@@ -2809,9 +2784,6 @@ if (autoRefreshToggle) {
|
||||
autoRefreshSettings.enabled = !!autoRefreshToggle.checked;
|
||||
saveAutoRefreshSettings();
|
||||
applyAutoRefreshSettings();
|
||||
if (isBookmarksPage) {
|
||||
return;
|
||||
}
|
||||
if (autoRefreshSettings.enabled && updatesStreamHealthy) {
|
||||
console.info('Live-Updates sind aktiv; automatisches Refresh bleibt pausiert.');
|
||||
}
|
||||
@@ -4119,9 +4091,7 @@ function checkAutoCheck() {
|
||||
} catch (error) {
|
||||
console.warn('Konnte check-Parameter nicht entfernen:', error);
|
||||
}
|
||||
if (!isBookmarksPage) {
|
||||
fetchPosts({ showLoader: false });
|
||||
}
|
||||
fetchPosts({ showLoader: false });
|
||||
}).catch(console.error);
|
||||
}
|
||||
}
|
||||
@@ -4190,12 +4160,10 @@ loadAutoRefreshSettings();
|
||||
initializeFocusParams();
|
||||
initializeTabFromUrl();
|
||||
loadSortMode();
|
||||
if (!isBookmarksPage) {
|
||||
resetManualPostForm();
|
||||
loadProfile();
|
||||
startProfilePolling();
|
||||
fetchPosts();
|
||||
checkAutoCheck();
|
||||
startUpdatesStream();
|
||||
}
|
||||
resetManualPostForm();
|
||||
loadProfile();
|
||||
startProfilePolling();
|
||||
fetchPosts();
|
||||
checkAutoCheck();
|
||||
startUpdatesStream();
|
||||
applyAutoRefreshSettings();
|
||||
|
||||
Reference in New Issue
Block a user