Max-Github / FireFoxInvertColors

A simple addon that will invert a web page colors.
GNU General Public License v3.0
56 stars 15 forks source link

Refactor and add support for NOT inverting images #15

Closed iam-TJ closed 6 years ago

iam-TJ commented 6 years ago

New feature: option to disable inverting images

options.{js,html} have been refactored and now can be extended easily if additional options are required.

background.js has been refactored to streamline the code and provide improved handling of logic states. On extension load it now also calls toggleColors() to ensure the browser action icon and tab states are set correctly.

Closes #14.

Signed-off-by: Tj hacker@iam.tj

Max-Github commented 6 years ago

Apologies for the delayer response. I just did a quick review and everything looks good. I will take a closer look this evening and most probably merge these in and release a new version.

Max-Github commented 6 years ago

I have tested the changes with Firefox 58.0.2, and the images get inverted regardless if the option is enabled or not.

iam-TJ commented 6 years ago

I've tested with 58.0.1 (64-bit) on Linux and it works. What specific page are you using to test?

Max-Github commented 6 years ago

This is using the latest Firefox version on 64bit ubuntin 16.04:

Initiation:

Went to google.com. Inverted colors, everything was inverted as expected. Reverted back to normal colors.

Went to extension properties, and enabled "Do not invert images". Went back to google.com. Inverted colors, everything including the image got inverted.

Repeated with https://www.wikipedia.org/ with the same results.

iam-TJ commented 6 years ago

We're seeing extremely strange differences.

I'm not using web-ext though, I'm working directly with the extension unpacked in the profile directory ( ~/.mozilla/firefox//extensions/@firefoxinvertcolors/ ).

I use the options.html Enable/Disable to 'reload' the extension if I make changes to the source.

I'm attaching a screenshot showing the addon options.html, FF about dialog, and a separate window at ff58-inverted wikipedia.

Max-Github commented 6 years ago

I see, I always ran tests using web-ext, as it is also used to package the extension to be submitted to Mozilla.

I will have to see why there is such a difference. I am sure that this all can be resolved.

Max-Github commented 6 years ago

Updating web-ext seems to have resolved the issues.

I have also updated your css select to include more "images" and basic video as such: img, svg, video, canvas, [style*=".jpg"], [style*=".png"], [style*=".gif"]

iam-TJ commented 6 years ago

Thanks. I held off adding other elements because whilst testing on the bb bbc.co.uk site I encountered some strange issues - possibly related to them sometimes using a

. Hopefully your additions will capture those cases.