-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add option to inject custom CSS #1193
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
Add option to inject custom CSS #1193
Conversation
source/options.html
Outdated
| <textarea name="disabledFeatures" rows="3" placeholder="For example: mark-unread hide-own-stars"></textarea> | ||
| <div class="small"> | ||
| <strong>Notice:</strong> Mostly untested; only JavaScript-based features can be disabled. | ||
| </div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem necessary. Also p>div isn't valid HTML
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having class .small for p is of no use as textarea gets an exclusive font-size of 12px, but mostly a WIP.
source/options.html
Outdated
| <label> | ||
| <input type="checkbox" name="logging"> | ||
| Enable logging | ||
| <span>Enable logging</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nor does this. If you want to add spacing you can add margin-right to input[type='checkbox']
source/options.css
Outdated
| label { | ||
| display: flex; | ||
| align-items: center; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⬆️❓
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vertical-alignment: ---px on the checkbox
|
|
||
| p { | ||
| margin: 0 0 1em; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
margin-bottom already seems to be 1em and I think margin-top looks better at 1em (default)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you know vertical margins do collapse, and margin-top of 0 makes h2 elements and p to be closer, making more content fit in view.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then we only need margin-top: 0
| </p> | ||
| <p class="small"> | ||
| <textarea name="disabledFeatures" rows="3" placeholder="For example: mark-unread hide-own-stars"></textarea> <br> | ||
| <textarea name="disabledFeatures" rows="3" placeholder="For example: mark-unread hide-own-stars"></textarea> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
|
||
| export const injectCustomCSS = async () => { | ||
| const {customCSS = ''} = await options; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if customCSS === '', return
| resize: vertical; | ||
| } | ||
| label { | ||
| vertical-align: -0.16em; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bfred-it Can you verify this value of -0.16em? Gives me 2px for 12px font size (2 / 12 ~= 0.16).
|
Can you post a screenshot so others can see without checking out? |
|
I'm reposting @ramlmn's screenshot from the issue: |
|
Thanks @hkdobrev! |
|
Thanks @ramlmn! :) |
|
I've noticed that if I write some CSS in the textarea and then reload the extension on the Extensions page, the CSS is gone. |
|
Look in the console, you should see the logging from webext-options-sync. It worked for me every time I reloaded |
|
@bfred-it I write the CSS, close options, click reload, and this is logged: Then I click the reload button again and this is logged: |
|
Oh, darn, true. It’s missing a default in background.js so the migration drops it. Edit: fixed |



Still a WIP, need to change some wording and layout.
Most important: need some opinions!
Closes #1186.