diff options
author | sy-b <94835959+sy-b@users.noreply.github.com> | 2022-04-22 18:09:58 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-22 18:09:58 +0300 |
commit | b63a5c08eb18ecff2528c65262c1a07f8e6e4a8a (patch) | |
tree | 515af853e9146fcf8efe67de479303a82ca97286 | |
parent | 4025503b9c5a9d03b4d575762e3eda0b3f6ce3ec (diff) |
Update ryd.background.js
- Doesn't steal focus
- Prevents the second time popup before opt-in
-rw-r--r-- | Extensions/combined/ryd.background.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Extensions/combined/ryd.background.js b/Extensions/combined/ryd.background.js index 0870dd7..08f6afa 100644 --- a/Extensions/combined/ryd.background.js +++ b/Extensions/combined/ryd.background.js @@ -74,12 +74,16 @@ api.runtime.onMessage.addListener((request, sender, sendResponse) => { } }); -api.storage.sync.get(['showChangelog'], (details) => { - if (details.showChangelog !== false) { - api.tabs.create({url: api.runtime.getURL("/changelog/3/changelog_3.0.html")}); - api.storage.sync.set({'showChangelog': false}); - } -}); + api.storage.sync.get(['lastShowChangelogVersion'], (details) => { + if (extConfig.showUpdatePopup === true && + details.lastShowChangelogVersion !== chrome.runtime.getManifest().version + ) { + // keep it inside get to avoid race condition + api.storage.sync.set({'lastShowChangelogVersion ': chrome.runtime.getManifest().version}); + // wait until async get runs & don't steal tab focus + api.tabs.create({url: api.runtime.getURL("/changelog/3/changelog_3.0.html"), active: false}); + } + }); async function sendVote(videoId, vote) { api.storage.sync.get(null, async (storageResult) => { |