simplify application and remove window references
Sonarqube Scanner / Build and analyze (push) Failing after 1m27s
Sonarqube Scanner / Build and analyze (push) Failing after 1m27s
This commit is contained in:
+11
-14
@@ -9,7 +9,6 @@
|
||||
routeState: 'idle',
|
||||
activePage: null,
|
||||
routeProgressIndex: null,
|
||||
activePoiId: null,
|
||||
deviceHeading: null
|
||||
};
|
||||
|
||||
@@ -21,7 +20,7 @@
|
||||
$(document)
|
||||
.on('pointerup', selector, function (event) {
|
||||
const pointer = event.originalEvent;
|
||||
if (pointer && pointer.isPrimary === false) return;
|
||||
if (pointer?.isPrimary === false) return;
|
||||
if (pointer?.pointerType === 'mouse' && pointer.button !== 0) return;
|
||||
event.preventDefault();
|
||||
handler.call(this, event);
|
||||
@@ -38,10 +37,10 @@
|
||||
if (!target.length) throw new Error(`Unbekannte Ansicht: ${pageSelector}`);
|
||||
|
||||
const previous = state.activePage;
|
||||
$('.app-page').attr('hidden', true).removeClass('is-active');
|
||||
target.removeAttr('hidden').addClass('is-active');
|
||||
$('.app-page').attr('hidden', true);
|
||||
target.removeAttr('hidden');
|
||||
state.activePage = pageSelector;
|
||||
window.scrollTo({ top: 0, behavior: options.instant ? 'auto' : 'smooth' });
|
||||
globalThis.scrollTo({ top: 0, behavior: options.instant ? 'auto' : 'smooth' });
|
||||
|
||||
if (options.updateHistory === false) return;
|
||||
const historyState = { page: pageSelector, previous };
|
||||
@@ -52,7 +51,7 @@
|
||||
function normalizeSearch(value) {
|
||||
return String(value ?? '')
|
||||
.normalize('NFKD')
|
||||
.replace(/[\u0300-\u036f]/g, '')
|
||||
.replaceAll(/[\u0300-\u036f]/g, '')
|
||||
.toLocaleLowerCase('de');
|
||||
}
|
||||
|
||||
@@ -172,11 +171,10 @@
|
||||
}
|
||||
|
||||
function setActivePoi(poiId) {
|
||||
state.activePoiId = poiId == null ? null : Number(poiId);
|
||||
$('#poi-list [data-poi-id]').removeAttr('aria-current');
|
||||
if (state.activePoiId != null) {
|
||||
$(`#poi-list [data-poi-id="${state.activePoiId}"]`).attr('aria-current', 'step');
|
||||
}
|
||||
if (poiId == null) return;
|
||||
|
||||
$(`#poi-list [data-poi-id="${Number(poiId)}"]`).attr('aria-current', 'step');
|
||||
}
|
||||
|
||||
function endRoute({ announce = true, returnToRoutes = false } = {}) {
|
||||
@@ -451,7 +449,7 @@
|
||||
const metrics = updatePoiIndicators(position);
|
||||
if (state.routeState !== 'running') return;
|
||||
|
||||
let nearest = nearestPendingPoi(metrics);
|
||||
const nearest = nearestPendingPoi(metrics);
|
||||
updateNavigation(position);
|
||||
|
||||
$('#tracking-status').text(
|
||||
@@ -463,7 +461,6 @@
|
||||
state.triggered.add(nearest.poi.id);
|
||||
ns.Vibration.start(ns.Vibration.Patterns.ACTIVE_POI);
|
||||
showPoi(nearest.poi);
|
||||
nearest = nearestPendingPoi(metrics);
|
||||
updateNavigation(position);
|
||||
}
|
||||
}
|
||||
@@ -545,7 +542,7 @@
|
||||
endRoute({ returnToRoutes: true });
|
||||
});
|
||||
|
||||
window.addEventListener('popstate', event => {
|
||||
globalThis.addEventListener('popstate', event => {
|
||||
const page = event.state?.page || '#routes-page';
|
||||
navigate(page, { updateHistory: false, instant: true });
|
||||
});
|
||||
@@ -587,4 +584,4 @@
|
||||
hideNavigation();
|
||||
}
|
||||
};
|
||||
}(window.Wegwichtel, window.jQuery));
|
||||
}(globalThis.Wegwichtel, globalThis.jQuery));
|
||||
|
||||
Reference in New Issue
Block a user