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

Commit

Permalink
Content scripts now launch in dynamic iframes
Browse files Browse the repository at this point in the history
  • Loading branch information
vladfulgeanu committed Apr 14, 2014
1 parent 346303b commit 192f06b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions javascripts/background_scripts/reading_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,10 @@ chrome.tabs.onActivated.addListener(function(activeInfo) {
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"});
});
13 changes: 13 additions & 0 deletions javascripts/content_scripts/privly.js
Original file line number Diff line number Diff line change
Expand Up @@ -798,3 +798,16 @@ var privly = {
")(\\S){3,}$","gi")
}
};

/*
* In order to launch the content script loaded in each iframe of the page
* (especially the dynamically generated ones) it is needed to tell the
* 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')
privly.start();
});
}

0 comments on commit 192f06b

Please sign in to comment.