-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #44 #76
Conversation
Looks fine, testing locally for a couple of days. |
background.js
Outdated
@@ -158,26 +158,33 @@ chrome.storage.onChanged.addListener(function(changes, namespace) { | |||
|
|||
chrome.browserAction.onClicked.addListener(function(e) { | |||
var lastPlayingTabId = parseInt(DataStorage.get('lastPlayingTabId')), | |||
lastPlayingFrameId = parseInt(DataStorage.get('lastPlayingFrameId')), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lastPlayingFrameId = parseInt(DataStorage.get('lastPlayingFrameId')) | 0
background.js
Outdated
lastPausedTabId = parseInt(DataStorage.get('lastPausedTabId')), | ||
lastPausedFrameId = parseInt(DataStorage.get('lastPausedFrameId')), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lastPausedFrameId = parseInt(DataStorage.get('lastPausedFrameId')) | 0
this way we don't need check it then
background.js
Outdated
@@ -191,23 +198,26 @@ chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { | |||
break; | |||
|
|||
case 'started': | |||
if(lastPlayingTabId && sender.tab.id != lastPlayingTabId) { | |||
chrome.tabs.sendMessage(lastPlayingTabId, {action: 'pause'}); | |||
var isFrameIdChanged = (lastPlayingTabId && lastPlayingFrameId && sender.frameId != lastPlayingFrameId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can have here lastPlayingFrameId equal to 0
background.js
Outdated
@@ -158,24 +158,20 @@ chrome.storage.onChanged.addListener(function(changes, namespace) { | |||
|
|||
chrome.browserAction.onClicked.addListener(function(e) { | |||
var lastPlayingTabId = parseInt(DataStorage.get('lastPlayingTabId')), | |||
lastPlayingFrameId = parseInt(DataStorage.get('lastPlayingFrameId')), | |||
lastPlayingFrameId = parseInt(DataStorage.get('lastPlayingFrameId')) | 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|| ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My fault, I mentioned bitwise operator in comments. But in this case, it should probably work as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guys, let's keep it simple.
OR is not the same as bitwise OR.
background.js
Outdated
lastPausedTabId = parseInt(DataStorage.get('lastPausedTabId')), | ||
lastPausedFrameId = parseInt(DataStorage.get('lastPausedFrameId')), | ||
lastPausedFrameId = parseInt(DataStorage.get('lastPausedFrameId')) | 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same ||
background.js
Outdated
@@ -184,7 +180,7 @@ chrome.browserAction.onClicked.addListener(function(e) { | |||
|
|||
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { | |||
var lastPlayingTabId = parseInt(DataStorage.get('lastPlayingTabId')), | |||
lastPlayingFrameId = parseInt(DataStorage.get('lastPlayingFrameId')), | |||
lastPlayingFrameId = parseInt(DataStorage.get('lastPlayingFrameId')) | 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same ||
background.js
Outdated
@@ -236,10 +230,8 @@ chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { | |||
chrome.commands.onCommand.addListener(function(command) { | |||
var lastPlayingTabId = parseInt(DataStorage.get('lastPlayingTabId')), | |||
lastPausedTabId = parseInt(DataStorage.get('lastPausedTabId')), | |||
lastPausedFrameId = parseInt(DataStorage.get('lastPausedFrameId')), | |||
lastPausedFrameId = parseInt(DataStorage.get('lastPausedFrameId')) | 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same ||
background.js
Outdated
lastPausedFrameId = parseInt(DataStorage.get('lastPausedFrameId')); | ||
if(!lastPausedFrameId) | ||
lastPausedFrameId = 0; | ||
lastPausedFrameId = parseInt(DataStorage.get('lastPausedFrameId')) | 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relief
Fixes #44