add ability to modify the time stamp

This commit is contained in:
Bnyro 2022-08-28 16:58:56 +02:00 committed by Kavin
parent 4af8256a98
commit d360a52797
No known key found for this signature in database
GPG key ID: 49451E4482CC5BCD
2 changed files with 9 additions and 3 deletions

View file

@ -11,6 +11,10 @@
<label v-t="'actions.piped_link'" /> <label v-t="'actions.piped_link'" />
<input type="checkbox" v-model="pipedLink" /> <input type="checkbox" v-model="pipedLink" />
</div> </div>
<div class="flex justify-between mt-2">
<label v-t="'actions.time_code'" />
<input class="input w-12" type="text" v-model="timeStamp" />
</div>
<h3 class="mt-4" v-text="generatedLink" /> <h3 class="mt-4" v-text="generatedLink" />
<div class="flex justify-end mt-4"> <div class="flex justify-end mt-4">
<button class="btn" v-t="'actions.follow_link'" @click="followLink()" /> <button class="btn" v-t="'actions.follow_link'" @click="followLink()" />
@ -37,11 +41,12 @@ export default {
return { return {
withTimeCode: true, withTimeCode: true,
pipedLink: true, pipedLink: true,
timeStamp: null,
}; };
}, },
mounted() { mounted() {
window.addEventListener("keydown", this.handleKeyDown); window.addEventListener("keydown", this.handleKeyDown);
console.log(parseInt(this.currentTime)); this.timeStamp = parseInt(this.currentTime);
}, },
unmounted() { unmounted() {
window.removeEventListener("keydown", this.handleKeyDown); window.removeEventListener("keydown", this.handleKeyDown);
@ -73,7 +78,7 @@ export default {
var href = this.pipedLink var href = this.pipedLink
? window.location.origin + "/watch?v=" + this.videoId ? window.location.origin + "/watch?v=" + this.videoId
: "https://youtu.be/" + this.videoId; : "https://youtu.be/" + this.videoId;
if (this.withTimeCode) href += "?t=" + this.currentTime; if (this.withTimeCode && this.timeStamp) href += "?t=" + this.timeStamp;
return href; return href;
}, },
}, },

View file

@ -102,7 +102,8 @@
"with_timecode": "Share with time code", "with_timecode": "Share with time code",
"piped_link": "Piped link", "piped_link": "Piped link",
"follow_link": "Follow link", "follow_link": "Follow link",
"copy_link": "Copy link" "copy_link": "Copy link",
"time_code": "Time code (in seconds)"
}, },
"comment": { "comment": {
"pinned_by": "Pinned by", "pinned_by": "Pinned by",