Fix direct link to post

This commit is contained in:
2026-04-17 23:45:17 +02:00
parent 3416ace4ee
commit fcbb3d9d14

View File

@@ -125,12 +125,18 @@ export default {
this.quit();
},
methods: {
init() {
async init() {
let bFirstLoad = (typeof this.currProject.codename == 'undefined');
this.initProject();
if(bFirstLoad) this.initLightbox();
this.initFeed();
this.initMap();
await Promise.all([
this.initFeed(),
this.initMap()
]);
//Direct link: Scroll to post
if(this.$parent.hash.items.length == 3) this.findPost({type: this.$parent.hash.items[1], id: this.$parent.hash.items[2]});
},
quit() {
lightbox.end();
@@ -176,9 +182,6 @@ export default {
await this.getNextFeed();
this.$refs.feedSimpleBar.scrollElement.scrollTop = 0;
//Scroll to post
if(this.$parent.hash.items.length == 3) this.findPost({type: this.$parent.hash.items[1], id: this.$parent.hash.items[2]});
//Start auto-update
if(!this.modeHisto) this.setFeedUpdateTimer(this.refreshRate);
},
@@ -223,7 +226,12 @@ export default {
attributionControl: false
});
this.map.once('load', async () => {
//Force wait for load event
await new Promise((resolve) => {
if(this.map.loaded()) resolve();
else this.map.once('load', resolve);
});
//Default Basemap
this.baseMap = this.baseMaps.filter((asBM) => asBM.default_map)[0].codename;
@@ -316,11 +324,11 @@ export default {
//Toggle only when map is ready, for the tilt effet
this.toggleFeedPanel(bOpenFeedPanel);
//Force wait for idle event
await new Promise((resolve) => {
this.map.once('idle', resolve);
});
this.map.on('idle', () => { });
//Legend
},
convertMsgToFeatures(oMsg) {
return oMsg.map(oMsg => ({
@@ -453,13 +461,14 @@ export default {
},
panToBetweenPanels(oLngLat, iZoom, fCallback) {
const iXOffset = (this.settingsPanelOpen?getOuterWidth(this.$refs.settings):0) - (this.feedPanelOpen?getOuterWidth(this.$refs.feed):0);
this.map.once('moveend', fCallback);
this.map.easeTo({
center: oLngLat,
zoom: iZoom,
offset: [iXOffset / 2, 0],
duration: 500
});
setTimeout(fCallback, 500);
},
isMarkerVisible(oLngLat){
return this.map.getBounds().contains(oLngLat);
@@ -561,7 +570,7 @@ export default {
- parseFloat(getComputedStyle(this.$refs.feedSimpleBar.$el).paddingTop)
);
aoRefs[0].executeMainAction();
this.spot.flushHash(['post', 'message']);
//this.spot.flushHash(['post', 'message']);
bFound = true;
}