Add option to inject custom CSS#1193
Add option to inject custom CSS#1193fregante merged 11 commits intorefined-github:masterfrom ramlmn:add-custom-css-option
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.
This doesn't seem necessary. Also p>div isn't valid HTML
There was a problem hiding this comment.
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.
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.
vertical-alignment: ---px on the checkbox
|
|
||
| p { | ||
| margin: 0 0 1em; | ||
| } |
There was a problem hiding this comment.
margin-bottom already seems to be 1em and I think margin-top looks better at 1em (default)
There was a problem hiding this comment.
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.
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> |
|
|
||
| export const injectCustomCSS = async () => { | ||
| const {customCSS = ''} = await options; | ||
|
|
| resize: vertical; | ||
| } | ||
| label { | ||
| vertical-align: -0.16em; |
There was a problem hiding this comment.
@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.