OrangeDrangon / android-messages-desktop

Android Messages as a Cross-platform Desktop App
Other
312 stars 27 forks source link

CSS Injection #402

Open Tyler-JS opened 1 year ago

Tyler-JS commented 1 year ago

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

OrangeDrangon commented 1 year ago

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: @.***>

Tyler-JS commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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!