Upgrade maplibre and fix goToPost

This commit is contained in:
2024-02-10 23:12:57 +01:00
parent cab899e544
commit 869b084d70
15 changed files with 604 additions and 499 deletions

View File

@@ -20,9 +20,10 @@
},
data() {
return {
time: '',
mouseOverHeader: false,
absTime: this.options.formatted_time,
absTimeLocal: this.options.formatted_time_local,
timeDiff: (this.options.formatted_time && this.options.formatted_time_local != this.options.formatted_time),
anchorVisible: ['message', 'media', 'post'].includes(this.options.type),
anchorTitle: this.spot.lang('copy_to_clipboard'),
anchorIcon: 'link'
@@ -40,23 +41,21 @@
return this.options.subtype || this.options.type;
},
displayedId() {
return this.options.displayed_id?(' '+this.spot.lang('counter', this.options.displayed_id)):'';
return this.options.displayed_id?(this.spot.lang('counter', this.options.displayed_id)):'';
},
hash() {
let asHash = this.spot.getHash();
return '#'+[asHash.page, asHash.items[0], this.options.type, this.options.id].join(this.spot.consts.hash_sep);
},
timeDiff() {
return (this.options.formatted_time && this.options.formatted_time_local != this.options.formatted_time);
},
modeHisto() {
return (this.$parent.project.mode==this.spot.consts.modes.histo);
return (this.project.mode==this.spot.consts.modes.histo);
},
relTime() {
return this.modeHisto?this.options.formatted_time.substr(0, 10):this.options.relative_time;
}
return this.modeHisto?(this.options.formatted_time || '').substr(0, 10):this.options.relative_time;
},
},
inject: ['spot'],
inject: ['spot', 'project', 'user'],
methods: {
copyAnchor() {
copyTextToClipboard(this.spot.consts.server+this.spot.hash());
@@ -105,9 +104,7 @@
},
mounted() {
//Auto-adjust text area height
if(this.options.type == 'poster') {
autosize(this.$refs.post);
}
if(this.options.type == 'poster') autosize(this.$refs.post);
}
}
</script>
@@ -115,11 +112,18 @@
<template>
<div :class="postClass" :id="postId">
<div class="header">
<span class="index">
<div class="index">
<spotIcon :icon="subType" :text="displayedId" />
<a v-if="anchorVisible" class="link desktop" @click="copyAnchor" ref="anchor" :href="hash" :title="anchorTitle"><spotIcon :icon="anchorIcon" /></a>
</span>
<span class="time" @mouseover="time = relTime" @mouseleave="time = timeDiff?spot.lang('your_time', absTime):absTime">{{ time }}</span>
<a v-if="anchorVisible" class="link desktop" @click="copyAnchor" ref="anchor" :href="hash" :title="anchorTitle">
<spotIcon :icon="anchorIcon" />
</a>
</div>
<div class="time" @mouseleave="mouseOverHeader = false" @mouseover="mouseOverHeader = true" :title="timeDiff?spot.lang('local_time', absTimeLocal):''">
<Transition name="fade" mode="out-in">
<span v-if="mouseOverHeader">{{ timeDiff?spot.lang('your_time', absTime):absTime }}</span>
<span v-else>{{ relTime }}</span>
</Transition>
</div>
</div>
<div class="body">
<div v-if="options.type == 'message'" class="body-box" @mouseenter="openMarkerPopup" @mouseleave="closeMarkerPopup">
@@ -151,7 +155,7 @@
</div>
<p v-else-if="options.type == 'poster'" class="message">
<textarea ref="post" name="post" :placeholder="spot.lang('post_message')" class="autoExpand" rows="1" v-model="$parent.post"></textarea>
<input type="text" name="name" :placeholder="spot.lang('post_name')" v-model="$parent.user.name" />
<input type="text" name="name" :placeholder="spot.lang('post_name')" v-model="user.name" />
<spotButton name="submit" :aria-label="spot.lang('send')" :title="spot.lang('send')" :icon="'send'" />
</p>
<div v-else-if="options.type == 'archived'">