android-messages-desktop icon indicating copy to clipboard operation
android-messages-desktop copied to clipboard

CSS Injection

Open Tyler-JS opened this issue 3 years ago • 6 comments

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 avatar Oct 20 '22 21:10 Tyler-JS

That should be a feature we could add. Not sure how it should be implemented. Any thoughts would be appreciated.

Thanks Kyle

On Thu Oct 20, 2022, 09:34 PM GMT, Tyler-JS @.***> wrote:

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 — Reply to this email directly, view it on GitHub https://github.com/OrangeDrangon/android-messages-desktop/issues/402, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGB2A7LGZINB543DK7RCN3TWEG3G5ANCNFSM6AAAAAARKR7ZZE. You are receiving this because you are subscribed to this thread.Message ID: @.***>

OrangeDrangon avatar Oct 20 '22 21:10 OrangeDrangon

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

Tyler-JS avatar Oct 21 '22 00:10 Tyler-JS

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.

OrangeDrangon avatar Oct 21 '22 01:10 OrangeDrangon

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.

Tyler-JS avatar Oct 21 '22 01:10 Tyler-JS

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 :).

OrangeDrangon avatar Oct 21 '22 01:10 OrangeDrangon

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!

Tyler-JS avatar Oct 21 '22 03:10 Tyler-JS