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

Use activeTab permission #57

Open
justincy opened this issue Mar 5, 2015 · 2 comments
Open

Use activeTab permission #57

justincy opened this issue Mar 5, 2015 · 2 comments

Comments

@justincy
Copy link
Member

justincy commented Mar 5, 2015

Whenever a new widget/scraper is added we have to update the extension's permissions. When an existing user downloads the update with the permission change it will disable the extension and show a warning in the settings window (which is hard to find unless you notice the button turned orange are curious enough to figure out why).

This is one of two big reasons why I haven't added support for more sites (the other is testing; hard to keep up with changes to websites).

We can probably avoid this issue by using the activeTab permission. It will require a small refactor:

  • Be a browserAction instead of a pageAction (show the button at all times in the toolbar; handle case where the icon is clicked on a page with no recognizable data; probably just show the blank fields).
  • Instead of the person data being loaded by default when the user navigates to a page, we will have to wait to process the data when the user clicks on the icon. This will require us to show a loading icon in the popup until the data is loaded.
@justincy
Copy link
Member Author

justincy commented Mar 5, 2015

I was wrong about being required to turn it into a browserAction but I might do that anyways. Having the button in the toolbar is less confusing to users (where'd the button go!?!?!) and fits better with my long term vision.

@justincy
Copy link
Member Author

justincy commented Mar 5, 2015

In the background script we will have code that listens for a click on the toolbar icon and then injects code into the current page:

chrome.browserAction.onClicked.addListener(function(tab) {
  chrome.tabs.executeScript(null, {
    file: 'content-script.js'
  });
});

content-script.js would be a thin wrapper around genscrape to gather the data (if it exists) and send it to the background page.

genscrape().on('data', function(data){
  chrome.extension.sendRequest({
    type: 'person_info',
    data: data
  });
});

This would significantly simplify manifest.json too by getting rid of the entire content_scripts section (the logic for that would be moved into genscrape).

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

No branches or pull requests

1 participant