Add persistent page modification effect - initial version. Will need more revs as we learn more in spec. #6

Merged
merged 4 commits into from Dec 6, 2017

Conversation

Projects
None yet
2 participants
Collaborator

biancadanforth commented Dec 5, 2017

Loads a content script into every tab to search for a list of words in all "p" and "div" elements, if a word is found, it is styled in a unique way (ex: background color, flipped upside down...).

Remaining wiring: connect it to the bootstrapped addon to get and set the word list per session. Currently it resets an arbitrary word list in background.js each time a content script loads.

biancadanforth added some commits Dec 5, 2017

WIP - Add libraries, initial content script works
Copying vendor files into /webextension
Add styles to each content page
Still needs recursive text replace
Add word substitution per @gregglind's code snippet; cleanup code
Snippet here: https://codepen.io/anon/pen/JOVZNj

Note: scaleY CSS property does not work on span elements unless they are display: inline-block.

Note: Currently the wordList (list of words to substitute) is refreshed each time a content script fetches it from background.js. We need to add some logic to refresh the list on each session; this could be taken care of in the "getWordList" method. I'm not sure how to set it per session from the webExtension.

@biancadanforth biancadanforth changed the title from WIP - Add libraries, initial content script works to Add persistent page modification effect Dec 6, 2017

I think this is ready, and I am going to land it, and do any more clean up if needful. Holler if I should not do that!

"manifest_version": 2,
+ "permissions": [
+ "<all_urls>",
@gregglind

gregglind Dec 6, 2017

Member

is this really a permission?

@biancadanforth

biancadanforth Dec 6, 2017

Collaborator

Without this, I get Error: Missing host permission for the tab for both the test-page.html (file:// resource) and a normal webpage (http(s)://). Based on the debugger, the content script loads just fine, but the background script doesn't inject the CSS into the page without it. Looking at MDN these are called "Host Permissions"; though it's not explicitly cited on the list of reasons why you would want to use a host permission.

@gregglind gregglind changed the title from Add persistent page modification effect to Add persistent page modification effect - initial version. Will need more revs as we learn more in spec. Dec 6, 2017

@gregglind gregglind merged commit 6649185 into mozilla:master Dec 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment