• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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.

Hide a module by default

Scheduled Pinned Locked Moved Development
4 Posts 2 Posters 1.1k Views 2 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.
  • B Offline
    Burnallover
    last edited by May 29, 2020, 7:43 PM

    Hi all,

    I try to modify an existing module to put the fonctionnality for hidden it by default when the mirror start

    explanation : i have the MMM-WiFiPassword configured on the first page, and i want it to not show when the Mirror started, and after that i can ask my assistant to show the wifi for a period.

    I know i can hide it manually with RemoteControl, but i really want it to be Hidden at the start of the mirror.

    have you an idea to help me ?

    Thanks in advance!

    S 1 Reply Last reply May 29, 2020, 7:50 PM Reply Quote 0
    • S Offline
      sdetweil @Burnallover
      last edited by May 29, 2020, 7:50 PM

      @Burnallover in whatever function in the modulename.js

      this.hide()
      

      will hide the module
      and then check in the getDom() and only return an empty div (return the wrapper with nothing in it)

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      B 1 Reply Last reply May 29, 2020, 8:00 PM Reply Quote 0
      • B Offline
        Burnallover @sdetweil
        last edited by May 29, 2020, 8:00 PM

        @sdetweil thank for your response ! :)

        I already tried to put something like that on function :

        if (this.config.hide) {
        		this.hide()
        	}
        

        but i need some help for the getDom() part, i’m sorry i’m not a developper, can you give me an example of what it should be? sorry for my english, i’m french…

        S 1 Reply Last reply May 29, 2020, 8:07 PM Reply Quote 0
        • S Offline
          sdetweil @Burnallover
          last edited by sdetweil May 30, 2020, 11:53 AM May 29, 2020, 8:07 PM

          @Burnallover getDom() needs to return something, but u don’t want your content displayed. so

          hidden: false, 
          
          
          suspend: function(){
              this.hidden=true
          },
          
          restore: function(){
               this.hidden=false
          },
          
          notificationReceived: function(notification, payload, source){
             // this comes before the first call to getDom()
             if(notification === "ALL_MODULES_STARTED")
                this.hidden=true;
          }.
          
          getDom: function (){
          var wrapper=document.createElement('div')
          if(this.hidden==false){ 
               //create normal content
          }
          return wrapper;
          },

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 1
          • 1 / 1
          1 / 1
          • First post
            1/4
            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