Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
Remove onUpdate event + small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
vladfulgeanu committed Apr 14, 2014
1 parent 192f06b commit 2d40a6e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
11 changes: 3 additions & 8 deletions javascripts/background_scripts/reading_process.js
Expand Up @@ -170,15 +170,10 @@ chrome.tabs.onActivated.addListener(function(activeInfo) {
chrome.tabs.get(activeInfo.tabId, tabChange);
});

// When a tab's application changes, we have to message the proper operation
// mode to the content script
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
tabChange(tab);
});

// Respond to every request to start the content script.
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
if (request.greeting == "start_me")
sendResponse({farewell: "start"});
if (request.ask === "shouldStartPrivly?")
if(badgeText !== "off")
sendResponse({tell: "yes"});
});
7 changes: 4 additions & 3 deletions javascripts/content_scripts/privly.js
Expand Up @@ -805,9 +805,10 @@ var privly = {
* background script (reading_process.js) via a message the current operating
* mode. If it receives confirmation, then privly.start() is called.
*/
if (!privly.started) {
chrome.runtime.sendMessage({greeting: "start_me"}, function(response) {
if(response.farewell == 'start')
if (chrome !== undefined && chrome.extension !== undefined &&
chrome.extension.sendMessage !== undefined && !privly.started) {
chrome.runtime.sendMessage({ask: "shouldStartPrivly?"}, function(response) {
if(response.tell === "yes")
privly.start();
});
}

0 comments on commit 2d40a6e

Please sign in to comment.