Giter Site home page Giter Site logo

Comments (10)

filips123 avatar filips123 commented on July 26, 2024

I will try to create this but I need some help.

Because this detection must happen in the client side, I created new CoffeeScript file that is included in wrapper.html. It correctly detects theme and theme changes but I have some problems.

To update the theme, three things need to be updated. First is background-color of the main page and the second is theme-* class in its body. This two things works. But theme-* also have to be updated in the site in an iframe. I also tried to do this, but the problem is that I get cross-origin when I want to change the class of body in the iframe.

@HelloZeroNet How can I do this? Is there some function in ZeroFrame to inject script (that would change the body's class) into iframe page? Any other alternative?

from zerohello.

HelloZeroNet avatar HelloZeroNet commented on July 26, 2024

Probably the cleanest solution would be let the sites handle it.

Other possibility: At the load of the wrapper it checks if the system preference is different from zeronet setting. If it is, then change it and reload the page.

from zerohello.

filips123 avatar filips123 commented on July 26, 2024

Probably the cleanest solution would be let the sites handle it.

But the problem is that all sites would need to be updated to do this.

Other possibility: At the load of the wrapper it checks if the system preference is different from zeronet setting. If it is, then change it and reload the page.

How could then wrapper detect if the user wants automatic theme changes? If this option would be overwritten every time there is an update, wrapper won't be able to detect if the user wants automatic theme changes.

This may be fixed by settings another user setting (maybe called use_system_theme) that would be independent of the current theme setting. So wrapper would only check for the system preference if that setting would be true.

Some problem with this may be if the user changes its system theme when the site is already opened. If the site would then be reloaded, the user could lose all their unsaved work. If it would not be reloaded, the theme would not be updated.

But this is probably not so important problem because users probably won't change system theme when they have sites opened. And if they would, they will just have to reload site manually.

If this is OK, I can develop support for this.

from zerohello.

HelloZeroNet avatar HelloZeroNet commented on July 26, 2024

Yeah adding a new, separate use_system_theme setting to the user sounds like a good solution. I think lack of real-time theme changing is not a big problem.

from zerohello.

filips123 avatar filips123 commented on July 26, 2024

@HelloZeroNet I created PR HelloZeroNet/ZeroNet#1999.

When you merge it, please let me know which revision and version will it have, so I can implement version check and configuration in ZeroHello.

from zerohello.

HelloZeroNet avatar HelloZeroNet commented on July 26, 2024

The rev got bumped to 4085, so you can use that as a minimal version requirement

from zerohello.

filips123 avatar filips123 commented on July 26, 2024

@HelloZeroNet Thank you. And which version will it be?

from zerohello.

HelloZeroNet avatar HelloZeroNet commented on July 26, 2024

0.7.0, but the version does not matter, it's safe to use Page.site_info.rev > 4085

from zerohello.

filips123 avatar filips123 commented on July 26, 2024

I wanted version to display it to user (You need at least x.y.z to use this feature).

from zerohello.

filips123 avatar filips123 commented on July 26, 2024

@HelloZeroNet I created #119.

from zerohello.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.