unsoluble / smalltime

A small FoundryVTT module for displaying and controlling the current time of day.
MIT License
25 stars 16 forks source link

[Feature Request] Allow better CSS targeting of time if date is shown. #110

Closed mouse0270 closed 2 years ago

mouse0270 commented 2 years ago

So starting off this I want to state this request is a little dumb. But it has its merits and since you position the date using absolute, it doesn't break anything.

Could you change how you target the date being show to using a class on the div#smalltime-app element. This also would let better element targeting via css when considering if the date is being shown or not.

The reason I am asking for this, is because if the #dateDisplay is above the #displayContainer you can then target the styling of the contents in the #displayContainer if the date is or isn't being displayed using CSS. For example

#smalltime-app.show-date #timeContainer {
    transform: translateY(-10px);
}

Yes this is for a specific use case with taskbar again... But it also doesn't break any of your code and it means that taskbar or other modules don't have to link into your logic with JavaScript possibly breaking things, its just allows for better CSS detection and modification.

For now I am going to just use JavaScript to determine if the date is being show or not, but thought I'd ask as it would make me feel better using CSS. I do fully understand if you decide that making either of these changes aren't worth your time, but it also doesn't hurt to ask.

Thank you for your time and awesome module.

mouse0270 commented 2 years ago

To be honest, adding the toggle to the div#smalltime-app might be the better solution.

Changing lines 1620 to $('#smalltime-app').addClass('show-date'); And line 1628 to $('#smalltime-app').removeClass('active');

and then updating the css at 432 to #smalltime-app.show-date #dateDisplay

Lasting updating line 458 to $('#smalltime-app').addClass('show-date');

I should just make a pull request showing this, shouldn't I?

unsoluble commented 2 years ago

Yeah a tested PR would let me get around to looking into this sooner than otherwise. :)

mouse0270 commented 2 years ago

I'll do it later tonight then. Thanks for at least consider it!

mouse0270 commented 2 years ago

Pull request made