• 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.

This might be a daft question, but...

Scheduled Pinned Locked Moved Development
27 Posts 6 Posters 17.1k Views 5 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
    strawberry 3.141 Project Sponsor Module Developer @Mitchfarino
    last edited by Sep 8, 2016, 10:49 PM

    @Mitchfarino

    url: "", //Insert your url here
    result: false,
    
    defaults: {
        updateInterval: 30 * 60 * 1000 //Every 30 mins
    },
    
    start: function(){
        this.getData();
        setInterval(()=>{
            this.getData();
        }, this.config.updateInterval);
    },
    
    getDom: function() {
        var wrapper = document.createElement("div");
        if(this.result){
            var table = document.createElement("table");
            for (var i = 0; i < this.result.length; i++) {
                var row = document.createElement("tr");
                var name = document.createElement("td");
                name.innerHTML = this.result[i].name;
                row.appendChild(name);
                table.appendChild(row);
            }
            wrapper.appendChild(table);
        } else {
            wrapper.innerHTML = "No data to show!";
        }
        return wrapper;
    },
    
    getData: function(){
        $.getJSON(this.url, (data) => {
            this.result = data;
            this.updateDom();
        });
    }
    

    Please create a github issue if you need help, so I can keep track

    M 1 Reply Last reply Sep 8, 2016, 11:14 PM Reply Quote 1
    • M Offline
      Mitchfarino Module Developer @strawberry 3.141
      last edited by Sep 8, 2016, 11:14 PM

      @strawberry-3.141 Thanks for this, I’ll see if I can get it working

      M 1 Reply Last reply Sep 11, 2016, 9:03 PM Reply Quote 0
      • M Offline
        Mitchfarino Module Developer @Mitchfarino
        last edited by Sep 11, 2016, 9:03 PM

        @strawberry-3-141 once I’ve got some code, how do I test it on my mirror?

        Just copy the folder to the modules folder and add it to the config, or is there something else I need to do?

        Thanks

        P 1 Reply Last reply Sep 11, 2016, 9:17 PM Reply Quote 0
        • P Offline
          paviro Admin @Mitchfarino
          last edited by Sep 11, 2016, 9:17 PM

          @Mitchfarino no that’s it :)

          We're all stories in the end. Just make it a good one, eh?

          – The Doctor

          M 1 Reply Last reply Sep 11, 2016, 9:20 PM Reply Quote 1
          • M Offline
            Mitchfarino Module Developer @paviro
            last edited by Sep 11, 2016, 9:20 PM

            @paviro Awesome, thank you!

            I’m stumbling my way through, hopefully I’ll have something working soon :)

            P 1 Reply Last reply Sep 11, 2016, 9:21 PM Reply Quote 0
            • P Offline
              paviro Admin @Mitchfarino
              last edited by Sep 11, 2016, 9:21 PM

              @Mitchfarino good luck! :)

              We're all stories in the end. Just make it a good one, eh?

              – The Doctor

              M 1 Reply Last reply Sep 11, 2016, 9:23 PM Reply Quote 0
              • M Offline
                Mitchfarino Module Developer @paviro
                last edited by Sep 11, 2016, 9:23 PM

                @paviro Just one more question…

                Why would I need to run npm install for some modules?

                1 Reply Last reply Reply Quote 0
                • S Offline
                  strawberry 3.141 Project Sponsor Module Developer
                  last edited by Sep 11, 2016, 9:37 PM

                  to install the dependencies listed in the package.json file

                  Please create a github issue if you need help, so I can keep track

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    Mitchfarino Module Developer
                    last edited by Sep 12, 2016, 9:56 PM

                    Hi All,

                    I’m struggling a bit here, does anyone fancy doing a bit of hand holding to point me in the right direction?

                    JS is completely knew to me, but I’m not sure where to start.

                    Thanks in advance - I’m happy to do it through chats on this forum, or using hangouts or something similar.

                    S 1 Reply Last reply Sep 13, 2016, 6:52 AM Reply Quote 0
                    • S Offline
                      strawberry 3.141 Project Sponsor Module Developer @Mitchfarino
                      last edited by Sep 13, 2016, 6:52 AM

                      @Mitchfarino feel free to contact me via personal message

                      Please create a github issue if you need help, so I can keep track

                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 3 / 3
                      3 / 3
                      • First post
                        22/27
                        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