Ishmaeel / CrackbookRevival

Chrome extension for discouraging the use of attention-sucking websites
Other
33 stars 12 forks source link

add firefox support #9

Closed allenbenz closed 3 years ago

allenbenz commented 4 years ago

Firefox was pretty close to already working, had to change a couple api calls to non-depreciated versions and check different properties for the generate from history function.

Near as I can tell everything works, from a maintenance perspective I think it wouldn't be very hard to maintain this as firefox's api is almost identical to chrome's.

eerolinna commented 4 years ago

Hey, I also implemented similar changes (minus the history, didn't get that one working). I had one additional change to address opening links in a new tab.

The issue was that opening a junk link in new tab caused the "wait X seconds" to never get closed. This seems to still occur with your fork (I tested with web-ext run).

Steps to reproduce using hackernews as example

  1. Add news.ycombinator.com as junk domain
  2. Open news.ycombinator.com, works fine
  3. Open a comment link in new tab. The "wait X seconds" won't disappear.

However if the firefox preference When you open a link in a new tab, switch to it immediately (in about:preferences) is enabled this doesn't occur.

The way I got this working was by changing https://github.com/Ishmaeel/CrackbookRevival/blob/c10851177681d39b0b7ddd81e6c119720bd41d4b/background.js#L272 to

chrome.tabs.sendMessage(tabId, dimmerAction);

and adding

chrome.runtime.onMessage.addListener(invoke_dimmer)

to dimmer.js