MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Is it possible to have CSS for normal screens and a custom CSS for 7in screen?

    Scheduled Pinned Locked Moved Custom CSS
    32 Posts 3 Posters 9.4k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      sdetweil @Radnor
      last edited by sdetweil

      @Radnor ah well, THAT is a completely different kind of problem.

      config is loaded for each browser, just once for the node_helpers

      u can turn off modules by setting their disabled property to true
      and config.js is code, SO you could do this

      there is a variable available at config load time outerWidth (and outerHeight)

      so you could use them to programatically set disabled true and change positions

      var small_size=800   // this in front of config=  
                                         // rather than coding 800 in all the spots, only one place to change it
      

      for example

      {
         module: calendar,
         position: outerWidth == small_size ? 'upper_right':'upper_left',
         disabled: outerWidth == small_size ? false:true,
         config:{
            ...
            ...
         }
      }
      

      if u change the main.css to use view size instead of fixed pixels the screen can shrink to fit…
      (i have a view based main.css if u want to try it)
      every module may have to be modified for view size

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      1 Reply Last reply Reply Quote 0
      • R Offline
        Radnor
        last edited by

        @sdetweil I will try that little later today. Yes, I like the idea of setting a var too.

        1 Reply Last reply Reply Quote 0
        • R Offline
          Radnor
          last edited by

          @sdetweil In my config.js file I tried screen.width outerWidth with no luck. Would you mind some code from your main.css?

          Tried window.xxxxx too without luck.

          S 2 Replies Last reply Reply Quote 0
          • S Offline
            sdetweil @Radnor
            last edited by

            @Radnor exactly as my sample shows… no screen, no window

            just outerWidth (case sensitive)

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @Radnor
              last edited by sdetweil

              @Radnor to debug, npm start dev
              in the developer window, select the sources tab, select config.js on the left
              find the 1st line, click on the number on the left column, it will turn blue, now have a program stop
              hit f5 to refresh the page, it will stop at that line… you can hover over variables and it will tell u the values.
              you can explore the variable on the right, global, scroll down

              I assume u are running electron browser (its the default)
              this is firefox.
              Screenshot at 2020-04-27 13-47-36.png
              and electron (with the hover)
              Screenshot at 2020-04-27 13-50-56.png

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              S 1 Reply Last reply Reply Quote 0
              • S Offline
                sdetweil @sdetweil
                last edited by sdetweil

                @sdetweil hang on… I see the bug on loading at node_helper time…

                change it like this to capture the undefined error at startup

                var width = 0
                try {
                width=outerWidth
                }
                catch(error){
                }

                var config={ etc

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                1 Reply Last reply Reply Quote 0
                • R Offline
                  Radnor
                  last edited by

                  in the config.js it does not like outerWidth. shows errors as loading up. It DOES get the correct value though…

                  I have at the top of my config file:

                  var small_size = 800;
                  var ss = outerWidth;
                  

                  In debug mode I can see both vars getting their respective values.

                  S 1 Reply Last reply Reply Quote 0
                  • S Offline
                    sdetweil @Radnor
                    last edited by

                    @Radnor see my comments above workaround for not defined at node_module load time

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    1 Reply Last reply Reply Quote 0
                    • S Offline
                      sdetweil @Radnor
                      last edited by

                      @Radnor css and config.js are different things… no way to change the filenames of the css files…

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      1 Reply Last reply Reply Quote 0
                      • R Offline
                        Radnor
                        last edited by

                        Getting really close!

                        My config file is:

                        var small_size = 800;
                        var width = 0;
                        try {
                        	width=outerWidth
                        }
                        catch(error){
                        }
                        
                        SNIP
                        
                        		{
                        			module: "newsfeed",
                        			position: "bottom_bar",
                        disabled: width > small_size ? false:true,
                        			config: {
                        SNIP
                        

                        On phone does not show. On laptop stuck at “Loading…”

                        S 1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 3
                        • 4
                        • 2 / 4
                        • First post
                          Last post
                        Enjoying MagicMirror? Please consider a donation!
                        MagicMirror created by Michael Teeuw.
                        Forum managed by Sam, technical setup by Karsten.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy