Comments (11)
@rugk
Now that I think of it, I believe you're right that some logging should be enabled by default.
A message like "extension_name has enabled dark mode on this page" is a very valuable information to have as a web developer.
from website-dark-mode-switcher.
Why?
in the website you mean?
from website-dark-mode-switcher.
On any site I visit, for every page loaded, your add-on is writing to the browser console.
While this can be useful for debugging, the production version of your add-on should not expose this behavior.
from website-dark-mode-switcher.
Yep, that's a good point. I guess I could try to integrate my Logger module, which I can use to expose a "debug mode" setting in add-on settings. (used e.g. in the Offline QR Code Generator add-on).
Or I may just remove the debugging console logs… (at least the one not triggered by the website)
Would you be fine to still receive logs if the add-on actually does something on the site, such as injecting CSS to get everything black? (because that may be good to know for devs, so they know when this add-on e.g. breaks it)
from website-dark-mode-switcher.
Sorry for the late reply...
The "debug mode" (or "dev mode" ?) setting approach seems the best one to me.
It would be really nice to hide all console logs by default and still being able to enable them at will in add-on settings :)
from website-dark-mode-switcher.
I was just about to file the same issue :). Please don't print anything into console unless user enables some debugging.
I mean, imagine if every add-on you have installed would print something about what it's doing into the console... it's already pretty bad now when every web-page spams console with all kinds of stuff.
I'm trying to develop my content scripts on some "clean" pages, but add-ons can print even there.
Thank you in advance :)
from website-dark-mode-switcher.
Okay, that said, I think I am not going the "using a debug mode setting" way, because it's easier to implement just a reduction of the console messages.
E.g. if the add-on changes the style of your website, as a web-dev you may want to know that, because that influences how your website is displayed. And you may be confused, otherwise. (Also if the JS .matchMedia
is faked. This can lead to bugs in your website, so it's good if you know where to report these. That's also why the URL is included in these console messages.)
from website-dark-mode-switcher.
For notifying user that your add-on did something, you can use badges.
Regarding debugging - you can still collect your logs in memory on each tab and when user click some "show logs" button, it can print them in the text area. Let's face it, how many of users will check the browser console to see why their page looks different :).
Please think about other fellow developers with their own problems that needs to dig into their own logs...
This is what my console now looks like on spotify when I play song:
13:57:48.575 updated fakedColorStatus via background script injection to Symbol(prefers-color-scheme: dark) 662efc2b-5d2e-47ae-a469-a4b02c0c1847:4:29
13:57:48.567 Content Security Policy: Ignoring ‘x-frame-options’ because of ‘frame-ancestors’ directive.
13:57:48.595 set fakedColorStatus via content script to: Symbol(prefers-color-scheme: dark) common.js:16:13
13:57:48.596 Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). 11 6DEjYFkNZh67HP7R9PSZvv:1:1
13:57:48.764 updated fakedColorStatus via background script injection to Symbol(prefers-color-scheme: dark) 662efc2b-5d2e-47ae-a469-a4b02c0c1847:4:29
13:57:48.758 Content Security Policy: Ignoring ‘x-frame-options’ because of ‘frame-ancestors’ directive.
13:57:48.791 set fakedColorStatus via content script to: Symbol(prefers-color-scheme: dark) common.js:16:13
13:57:48.792 Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). 11 6DEjYFkNZh67HP7R9PSZvv:1:1
13:57:49.163 updated fakedColorStatus via background script injection to Symbol(prefers-color-scheme: dark) 662efc2b-5d2e-47ae-a469-a4b02c0c1847:4:29
13:57:49.154 Content Security Policy: Ignoring ‘x-frame-options’ because of ‘frame-ancestors’ directive.
13:57:49.187 set fakedColorStatus via content script to: Symbol(prefers-color-scheme: dark) common.js:16:13
13:57:49.187 Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). 11 6DEjYFkNZh67HP7R9PSZvv:1:1
13:57:55.016 updated fakedColorStatus via background script injection to Symbol(prefers-color-scheme: dark) 662efc2b-5d2e-47ae-a469-a4b02c0c1847:4:29
13:57:55.009 Content Security Policy: Ignoring ‘x-frame-options’ because of ‘frame-ancestors’ directive.
13:57:55.031 set fakedColorStatus via content script to: Symbol(prefers-color-scheme: dark) common.js:16:13
13:57:55.031 Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). 11 6DEjYFkNZh67HP7R9PSZvv:1:1
13:58:09.472 updated fakedColorStatus via background script injection to Symbol(prefers-color-scheme: dark) 662efc2b-5d2e-47ae-a469-a4b02c0c1847:4:29
13:58:09.464 Content Security Policy: Ignoring ‘x-frame-options’ because of ‘frame-ancestors’ directive.
13:58:09.486 set fakedColorStatus via content script to: Symbol(prefers-color-scheme: dark) common.js:16:13
13:58:09.487 Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). 11 6DEjYFkNZh67HP7R9PSZvv:1:1
13:58:31.180 updated fakedColorStatus via background script injection to Symbol(prefers-color-scheme: dark) 662efc2b-5d2e-47ae-a469-a4b02c0c1847:4:29
13:58:31.168 Content Security Policy: Ignoring ‘x-frame-options’ because of ‘frame-ancestors’ directive.
13:58:31.198 set fakedColorStatus via content script to: Symbol(prefers-color-scheme: dark) common.js:16:13
13:58:31.200 Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). 11 6DEjYFkNZh67HP7R9PSZvv:1:1
13:59:02.121 updated fakedColorStatus via background script injection to Symbol(prefers-color-scheme: dark) 662efc2b-5d2e-47ae-a469-a4b02c0c1847:4:29
13:59:02.106 Content Security Policy: Ignoring ‘x-frame-options’ because of ‘frame-ancestors’ directive.
13:59:02.138 set fakedColorStatus via content script to: Symbol(prefers-color-scheme: dark) common.js:16:13
13:59:02.138 Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). 11 6DEjYFkNZh67HP7R9PSZvv:1:1
13:59:32.535 updated fakedColorStatus via background script injection to Symbol(prefers-color-scheme: dark) 662efc2b-5d2e-47ae-a469-a4b02c0c1847:4:29
13:59:32.528 Content Security Policy: Ignoring ‘x-frame-options’ because of ‘frame-ancestors’ directive.
13:59:32.551 set fakedColorStatus via content script to: Symbol(prefers-color-scheme: dark) common.js:16:13
13:59:32.552 Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). 11 6DEjYFkNZh67HP7R9PSZvv:1:1
14:00:14.903 updated fakedColorStatus via background script injection to Symbol(prefers-color-scheme: dark) 662efc2b-5d2e-47ae-a469-a4b02c0c1847:4:29
14:00:14.897 Content Security Policy: Ignoring ‘x-frame-options’ because of ‘frame-ancestors’ directive.
14:00:14.916 set fakedColorStatus via content script to: Symbol(prefers-color-scheme: dark) common.js:16:13
14:00:14.917 Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). 11 6DEjYFkNZh67HP7R9PSZvv:1:1
14:01:06.309 updated fakedColorStatus via background script injection to Symbol(prefers-color-scheme: dark) 662efc2b-5d2e-47ae-a469-a4b02c0c1847:4:29
14:01:06.298 Content Security Policy: Ignoring ‘x-frame-options’ because of ‘frame-ancestors’ directive.
14:01:06.321 set fakedColorStatus via content script to: Symbol(prefers-color-scheme: dark) common.js:16:13
14:01:06.322 Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). 11 6DEjYFkNZh67HP7R9PSZvv:1:1
14:01:47.665 updated fakedColorStatus via background script injection to Symbol(prefers-color-scheme: dark) 662efc2b-5d2e-47ae-a469-a4b02c0c1847:4:29
14:01:47.655 Content Security Policy: Ignoring ‘x-frame-options’ because of ‘frame-ancestors’ directive.
14:01:47.680 set fakedColorStatus via content script to: Symbol(prefers-color-scheme: dark) common.js:16:13
14:01:47.680 Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). 11 6DEjYFkNZh67HP7R9PSZvv:1:1
14:03:06.851 updated fakedColorStatus via background script injection to Symbol(prefers-color-scheme: dark) 662efc2b-5d2e-47ae-a469-a4b02c0c1847:4:29
14:03:06.841 Content Security Policy: Ignoring ‘x-frame-options’ because of ‘frame-ancestors’ directive.
14:03:06.872 set fakedColorStatus via content script to: Symbol(prefers-color-scheme: dark) common.js:16:13
14:03:06.873 Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). 11 6DEjYFkNZh67HP7R9PSZvv:1:1
from website-dark-mode-switcher.
I don't want to notify users, but web-devs. (and they look into the console)
Uhm, that spotify example looks indeed excessive…
from website-dark-mode-switcher.
Okay, on sites where it does not do anything, it also does not log anything now…
It only logs some details, if it either injects CSS:
…or if it fakes the result of a JS checkMedia
:
from website-dark-mode-switcher.
Nice!
And thanks for your fast reaction!
from website-dark-mode-switcher.
Related Issues (20)
- Doesn't work with stylesheets imported with @import HOT 2
- Simplify dramatically now that mediaText is read-write HOT 4
- Automatic theme change not working in Open Fixture Library HOT 2
- Corss-origin stylesheets without crossorigin="anonymous" attribute not supported (e.g. Hardware.info) HOT 6
- Inconsistent Application on New Tabs HOT 12
- Support forcing light mode HOT 2
- Project is not needed anymore - What are the next steps? HOT 5
- https://ar.al/ Vimeo Embed Inverted HOT 2
- Bootstrap 5 Dark Mode has incorrect gradient/fades applied HOT 1
- implement optional syncing! HOT 1
- Adjust permissions doc
- Implement context menu for quickly switching to other styles
- Implement "clever"/context-based/"simple" button mode HOT 1
- Updated translations for 'da': Danish (dansk) HOT 1
- force dark theme through resistFingerprinting HOT 3
- Missing renaming
- Solution for Dark Mode Website Switcher not working with arkenfox's user.js HOT 2
- Show a warning in case privacy.resistFingerprinting is enabled
- Cannot download from Firefox Addon Store HOT 1
- Support setting light/dark mode on a per site/URL basis. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from website-dark-mode-switcher.