MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. broberg
    3. Posts
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    Offline
    • Profile
    • Following 1
    • Followers 5
    • Topics 12
    • Posts 792
    • Groups 3

    Posts

    Recent Best Controversial
    • RE: Making text etc clickable

      Changes to the scheduleUpdateInterval

      	scheduleUpdateInterval: function() {
      		var self = this;
      
      		self.updateDom(self.config.animationSpeed);
      
      		// setInterval placed within a variable so you can clear it
      		this.interval = setInterval(function() {
      			self.activeItem++;
      			self.updateDom(self.config.animationSpeed);
      		}, this.config.updateInterval);
      	},
      
      

      And some functions to start and stop the interval

      	intpause: function(){
      		clearInterval(this.interval);
      
      	},
      
      	intresume: function(){
      		this.scheduleUpdateInterval();
      	},
      
      
      posted in Development
      brobergB
      broberg
    • RE: Making text etc clickable

      so after strawberry-pi explained the last snippet of code I got it to work,
      Big thanks for the patience!

      These are the changes I’ve made so far, please consider that the code is probably not optimal, at all.

       			var title = document.createElement("div");
      			title.className = "bright medium regular fed";
      			title.innerHTML = this.newsItems[this.activeItem].title;
      			title.addEventListener("click", () => showdesc(this)); //Show description on click
      			wrapper.appendChild(title);
      			
      
      			//below is the function to show description and hide title
      			function showdesc(thisdesc) {
      				
      				thisdesc.intpause();	//pause the interval			
      				title.style.display="none";
      				description = document.createElement("div");
      				description.className = "medium light infoCenter";
      				description.innerHTML = thisdesc.newsItems[thisdesc.activeItem].description;
      				description.addEventListener("click", () => hidedesc(thisdesc));  //Hide description on click 
      				wrapper.appendChild(description);
      			};
      
      			//and to close the description and return to title
      			function hidedesc(thisdesc) {
      				thisdesc.intresume();	//resume the interval
      				description.style.display="none";
      				title.style.display="block";
      				
      			};
      posted in Development
      brobergB
      broberg
    • RE: Making text etc clickable

      @strawberry-3.141

      using that code snippet in the pause function just adds a new item with the updateInterval time,

      So I can change the interval on the next loaded news item, but not the current :(

      posted in Development
      brobergB
      broberg
    • RE: Making text etc clickable

      @strawberry-3.141

      No go on that either, this.interval is undefined it says.
      I have to research this some more, it’s giving me a headache.

      Could it have something to do with the fact that the interval is set in the scheduleUpdateInterval function and it can’t be reached from another function outside that?

      this.scheduleUpdateInterval(); works, I think. (I get more updates on top of each other if I click several times)

      posted in Development
      brobergB
      broberg
    • RE: Making text etc clickable

      @strawberry-3.141 Sorry to bother you with the poking stick, but, I’m having no luck in getting it to work.

      this is the code that updates the newsfeed item

      	scheduleUpdateInterval: function() {
      		var self = this;
      
      		self.updateDom(self.config.animationSpeed);
      
      		setInterval(function() {
      			self.activeItem++;
      			self.updateDom(self.config.animationSpeed);
      		}, this.config.updateInterval);
      	},
      

      This also loads the first feed item when the page loads for the first time.

      how should I implement this in another function to pause/reset the scheduleUpdateInterval function?

      posted in Development
      brobergB
      broberg
    • RE: Module Regions - Tutorial Requested

      @valid8r they expand, adapting to the content of the


      They only need positioning and orientation.

      all

      without size constrains will adapt to it’s content and the
      or body it’s placed in.
      You can certainly add width and height constrains to the regions if you feel like it.

      The thing with

      is you can basically place them anywhere you want to, make them any size, make them lay over or under other
      and so on and so on.

      posted in Development
      brobergB
      broberg
    • RE: Module Regions - Tutorial Requested

      They have no defined size per say,

      add
      outline: #fff solid;
      to all .regions, that will give you a sense of how they look.

      posted in Development
      brobergB
      broberg
    • RE: How to add custom birthdays to the calendar module

      What calendar source are you using? Google Calendar (android), iCloud calendar or other?

      posted in Troubleshooting
      brobergB
      broberg
    • RE: Calendar - Syntax for additional config options?

      @vogelboy you have spelled the maximumEntries wrong in the config file.

      ‘3’ is the correct one, but “3” should also work.

      posted in Troubleshooting
      brobergB
      broberg
    • 1 / 1