Skip to content
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

Merged
merged 4 commits into from
Jan 23, 2018
Merged

Issue #44 #76

merged 4 commits into from
Jan 23, 2018

Conversation

NffS
Copy link
Contributor

@NffS NffS commented Jan 19, 2018

Fixes #44

@beshur
Copy link
Member

beshur commented Jan 19, 2018

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')),
Copy link
Member

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')),
Copy link
Member

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);
Copy link
Member

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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

|| ?

Copy link
Member

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.

Copy link
Member

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,
Copy link
Member

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,
Copy link
Member

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,
Copy link
Member

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same ||

@beshur beshur changed the title Issue 44 Issue #44 Jan 23, 2018
Copy link
Member

@beshur beshur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relief

@beshur beshur merged commit 34a60f7 into master Jan 23, 2018
@beshur beshur deleted the issue-44 branch January 23, 2018 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants