Skip to content
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

CSS Injection #402

Open
Tyler-JS opened this issue Oct 20, 2022 · 6 comments
Open

CSS Injection #402

Tyler-JS opened this issue Oct 20, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@Tyler-JS
Copy link

Maybe somebody can let me know if there's already a way to do this, but the ability to inject my own CSS file would be very nice to have

@Tyler-JS Tyler-JS added the enhancement New feature or request label Oct 20, 2022
@OrangeDrangon
Copy link
Owner

OrangeDrangon commented Oct 20, 2022 via email

@Tyler-JS
Copy link
Author

Tyler-JS commented Oct 21, 2022

So I have next to zero idea what I'm doing but I just gave it a crack and kind of got something working. You can't include a stylesheet thats a local file, but I've got something working with the following:

window.addEventListener("load",function() { var head = document.getElementsByTagName('head')[0]; var inject = document.createElement('style'); inject.innerHTML = "body { background: red }"; head.appendChild(inject); });
I guess you could just read in a stylesheet there and inject it all in to a style tag.

Maybe this weekend I'll see if I can bring it a little further, but again I have no idea what I'm doing (only done a bit of JS stuff years ago and never touched electron until now), but I'm sure you can do better than I.

Cheers

@OrangeDrangon
Copy link
Owner

OrangeDrangon commented Oct 21, 2022

yeah the actual code to do it should be exactly as you put it. I mostly meant what is the ui for communicating to the user how to do this? I am leaning towards a pasteable text box.

@Tyler-JS
Copy link
Author

Ahh, gotcha. Well I had fun figuring it out anyway, lol!

And yeah, pasteable textbox is probably best. I think thats how BetterDiscord does it as well.

@OrangeDrangon
Copy link
Owner

Sorry I did not mean to come off rude. Thanks for the good idea I will put this on this list for when I have some motivation to give it a go. I am also open to prs if you want to try and figure out how to get it working :).

@Tyler-JS
Copy link
Author

No need to apologize, no offense taken 🙂

I may wind up giving it a go myself, could be fun. Either way thanks for you work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants