Fix #329, version bump

This commit is contained in:
simon987 2023-02-23 21:21:54 -05:00
parent 8b9b067c06
commit 707bac86b3
2 changed files with 24 additions and 10 deletions

View File

@ -63,6 +63,11 @@ export default {
}, },
computed: { computed: {
tnSrc() { tnSrc() {
return this.getThumbnailSrc(this.currentThumbnailNum);
},
},
methods: {
getThumbnailSrc(thumbnailNum) {
const doc = this.doc; const doc = this.doc;
const props = doc._props; const props = doc._props;
if (props.isGif && this.hover) { if (props.isGif && this.hover) {
@ -70,10 +75,8 @@ export default {
} }
return (this.currentThumbnailNum === 0) return (this.currentThumbnailNum === 0)
? `t/${doc._source.index}/${doc._id}` ? `t/${doc._source.index}/${doc._id}`
: `t/${doc._source.index}/${doc._id}${String(this.currentThumbnailNum).padStart(4, "0")}`; : `t/${doc._source.index}/${doc._id}${String(thumbnailNum).padStart(4, "0")}`;
}, },
},
methods: {
humanTime: humanTime, humanTime: humanTime,
onThumbnailClick() { onThumbnailClick() {
this.$emit("onThumbnailClick"); this.$emit("onThumbnailClick");
@ -86,9 +89,14 @@ export default {
}, },
onTnEnter() { onTnEnter() {
this.hover = true; this.hover = true;
const start = Date.now()
if (this.doc._props.hasVidPreview) { if (this.doc._props.hasVidPreview) {
this.currentThumbnailNum += 1; let img = new Image();
this.scheduleNextTnNum(); img.src = this.getThumbnailSrc(this.currentThumbnailNum + 1);
img.onload = () => {
this.currentThumbnailNum += 1;
this.scheduleNextTnNum(Date.now() - start);
}
} }
}, },
onTnLeave() { onTnLeave() {
@ -99,17 +107,23 @@ export default {
this.timeoutId = null; this.timeoutId = null;
} }
}, },
scheduleNextTnNum() { scheduleNextTnNum(offset = 0) {
const INTERVAL = this.$store.state.optVidPreviewInterval ?? 700; const INTERVAL = (this.$store.state.optVidPreviewInterval ?? 700) - offset;
this.timeoutId = window.setTimeout(() => { this.timeoutId = window.setTimeout(() => {
const start = Date.now();
if (!this.hover) { if (!this.hover) {
return; return;
} }
this.scheduleNextTnNum();
if (this.currentThumbnailNum === this.doc._props.tnNum - 1) { if (this.currentThumbnailNum === this.doc._props.tnNum - 1) {
this.currentThumbnailNum = 0; this.currentThumbnailNum = 0;
this.scheduleNextTnNum();
} else { } else {
this.currentThumbnailNum += 1; let img = new Image();
img.src = this.getThumbnailSrc(this.currentThumbnailNum + 1);
img.onload = () => {
this.currentThumbnailNum += 1;
this.scheduleNextTnNum(Date.now() - start);
}
} }
}, INTERVAL); }, INTERVAL);
}, },

View File

@ -49,7 +49,7 @@
#include <ctype.h> #include <ctype.h>
#include "git_hash.h" #include "git_hash.h"
#define VERSION "2.14.1" #define VERSION "2.14.2"
static const char *const Version = VERSION; static const char *const Version = VERSION;
#ifndef SIST_PLATFORM #ifndef SIST_PLATFORM