mirror of
https://github.com/chenasraf/fp-max-extension.git
synced 2026-05-17 17:48:07 +00:00
feat: forget last played time when <10 seconds left
This commit is contained in:
3
.markdownlint.json
Normal file
3
.markdownlint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"MD024": false
|
||||
}
|
||||
@@ -1,5 +1,11 @@
|
||||
# CHANGELOG
|
||||
|
||||
## v0.2.3
|
||||
|
||||
### Features
|
||||
|
||||
- Reset last played for videos when there are <10 seconds left to watch
|
||||
|
||||
## v0.2.2
|
||||
|
||||
### Features
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "fp-max-extension",
|
||||
"private": true,
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"repository": "https://github.com/chenasraf/fp-max-extension",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -66,6 +66,10 @@ function lastPlayedUpdateCallback(vid: HTMLVideoElement, vidId: string): () => v
|
||||
const key = `lastPlayed-${vidId}`
|
||||
chrome.storage.sync.get([key], (result) => {
|
||||
if (Math.floor(result[key]) === Math.floor(vid.currentTime)) return
|
||||
if (vid.currentTime >= vid.duration - 10) {
|
||||
chrome.storage.sync.remove([key])
|
||||
return
|
||||
}
|
||||
chrome.storage.sync.set({
|
||||
[`lastPlayed-${vidId}`]: vid.currentTime,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user