mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-08-14 23:57:27 +00:00
Change toggle to markAsWatched only.
This commit is contained in:
parent
1d1d9d583e
commit
df4cbbdf18
1 changed files with 9 additions and 15 deletions
|
@ -75,7 +75,7 @@
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
v-if="isFeed && this.getPreferenceBoolean('hideWatched', false)"
|
v-if="isFeed && this.getPreferenceBoolean('hideWatched', false)"
|
||||||
@click="toggleWatched(video.url.substr(-11))"
|
@click="markAsWatched(video.url.substr(-11))"
|
||||||
ref="watchButton"
|
ref="watchButton"
|
||||||
>
|
>
|
||||||
<font-awesome-icon icon="eye" :title="$t('actions.mark_as_watched')" />
|
<font-awesome-icon icon="eye" :title="$t('actions.mark_as_watched')" />
|
||||||
|
@ -194,8 +194,7 @@ export default {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
toggleWatched(videoId) {
|
markAsWatched(videoId) {
|
||||||
// Copied from WatchVideo.vue
|
|
||||||
if (window.db) {
|
if (window.db) {
|
||||||
var tx = window.db.transaction("watch_history", "readwrite");
|
var tx = window.db.transaction("watch_history", "readwrite");
|
||||||
var store = tx.objectStore("watch_history");
|
var store = tx.objectStore("watch_history");
|
||||||
|
@ -204,12 +203,9 @@ export default {
|
||||||
request.onsuccess = function (event) {
|
request.onsuccess = function (event) {
|
||||||
var video = event.target.result;
|
var video = event.target.result;
|
||||||
if (video) {
|
if (video) {
|
||||||
if (!instance.video.watched) {
|
video.watchedAt = Date.now();
|
||||||
video.watchedAt = Date.now();
|
|
||||||
} else {
|
|
||||||
// #todo: remove
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
|
// Should match WatchVideo.vue
|
||||||
video = {
|
video = {
|
||||||
videoId: videoId,
|
videoId: videoId,
|
||||||
title: instance.video.title,
|
title: instance.video.title,
|
||||||
|
@ -220,14 +216,12 @@ export default {
|
||||||
watchedAt: Date.now(),
|
watchedAt: Date.now(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
// Set time to end for shouldShowVideo
|
||||||
// Save to db
|
video.currentTime = instance.video.duration;
|
||||||
|
// Save
|
||||||
store.put(video);
|
store.put(video);
|
||||||
|
// Disappear
|
||||||
// Disappear?
|
instance.shouldShowVideo();
|
||||||
if (instance.getPreferenceBoolean("hideWatched", false)) {
|
|
||||||
instance.shouldShowVideo();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue