diff --git a/modules/shared/auth/ui/home.php b/modules/shared/auth/ui/home.php index df1ea70..c6d1553 100644 --- a/modules/shared/auth/ui/home.php +++ b/modules/shared/auth/ui/home.php @@ -593,7 +593,7 @@ function render_auth_home_page(array $user, array $otcProducts = [], array $best echo " };"; echo " const buildUrl = (params) => {"; echo " const url = new URL(window.location.href);"; - echo " url.searchParams.set('bestellungen_fragment', '1');"; + echo " url.searchParams.delete('bestellungen_fragment');"; echo " Object.entries(params).forEach(([key, value]) => {"; echo " if (value === null || value === undefined || value === '') {"; echo " url.searchParams.delete(key);"; @@ -603,44 +603,15 @@ function render_auth_home_page(array $user, array $otcProducts = [], array $best echo " });"; echo " return url;"; echo " };"; - echo " const replaceFragment = (html) => {"; - echo " const doc = new DOMParser().parseFromString(html, 'text/html');"; - echo " const fragment = doc.querySelector('[data-bestellungen-content]');"; - echo " if (!fragment) {"; - echo " return false;"; - echo " }"; - echo " contentRoot.innerHTML = fragment.innerHTML;"; - echo " table = getTable();"; - echo " return !!table;"; - echo " };"; echo " const loadFragment = async (params, updateHistory = true) => {"; echo " if (searchTimer) { window.clearTimeout(searchTimer); searchTimer = null; }"; echo " const url = buildUrl(params);"; - echo " const activeRequest = ++requestToken;"; - echo " const currentTable = getTable();"; - echo " if (currentTable) { currentTable.setAttribute('aria-busy', 'true'); }"; - echo " try {"; - echo " const response = await fetch(url.toString(), { headers: { 'X-Requested-With': 'XMLHttpRequest' } });"; - echo " const html = await response.text();"; - echo " if (activeRequest !== requestToken) {"; - echo " return;"; - echo " }"; - echo " const replaced = replaceFragment(html);"; - echo " table = getTable();"; - echo " if (replaced && updateHistory) {"; - echo " const historyUrl = new URL(url.toString());"; - echo " historyUrl.searchParams.delete('bestellungen_fragment');"; - echo " window.history.replaceState({}, '', historyUrl);"; - echo " }"; - echo " bindTable();"; - echo " } finally {"; - echo " if (activeRequest === requestToken) {"; - echo " table = getTable();"; - echo " if (table) {"; - echo " table.removeAttribute('aria-busy');"; - echo " }"; - echo " }"; + echo " const targetUrl = url.toString();"; + echo " if (updateHistory) {"; + echo " window.location.assign(targetUrl);"; + echo " return;"; echo " }"; + echo " window.location.replace(targetUrl);"; echo " };"; echo " const bindTable = () => {"; echo " table = getTable();"; @@ -658,7 +629,7 @@ function render_auth_home_page(array $user, array $otcProducts = [], array $best echo " bestellungen_sort: getSortColumn(),"; echo " bestellungen_dir: getSortDirection(),"; echo " bestellungen_limit: getPageSize(),"; - echo " });"; + echo " }, false);"; echo " }, 250);"; echo " });"; echo " }"; @@ -732,7 +703,7 @@ function render_auth_home_page(array $user, array $otcProducts = [], array $best echo " bestellungen_sort: getSortColumn(),"; echo " bestellungen_dir: getSortDirection(),"; echo " bestellungen_limit: getPageSize(),"; - echo " });"; + echo " }, false);"; echo " }, 250);"; echo " });"; echo " document.addEventListener('keydown', (event) => {";