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.

    How to load a <script> src = " " </script> into my mirror?

    Scheduled Pinned Locked Moved Development
    35 Posts 4 Posters 27.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.
    • nbrennN Offline
      nbrenn @morozgrafix
      last edited by

      @morozgrafix This looks awesome! I will try to work with this over the next couple days and will let you know if I have any other questions! Thanks!

      morozgrafixM 1 Reply Last reply Reply Quote 0
      • morozgrafixM Offline
        morozgrafix Moderator @nbrenn
        last edited by

        @nbrenn sounds good. Good luck!

        nbrennN 1 Reply Last reply Reply Quote 0
        • nbrennN Offline
          nbrenn @morozgrafix
          last edited by

          @morozgrafix Everything is working very well so far!

          I am updating my “Sum” daily, but I would like to be able to show the previous day’s sum. Could I store the value of the sum at 11:59pm, each evening, and then display that value in addition to the current day’s sum?

          Additionally, how could I modify the line of code:

          this.sum = lines.reduce((a, b) => a + b, 0);
          

          to allow for me to sum across multiple columns? So, if my .csv has 3 columns, I’d like the sum total of them.

          morozgrafixM 1 Reply Last reply Reply Quote 0
          • cowboysdudeC Offline
            cowboysdude Module Developer
            last edited by

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • morozgrafixM Offline
              morozgrafix Moderator @nbrenn
              last edited by

              @nbrenn sorry swamped at work today. That line just takes all of the values from each line and adds them up. It will not work for multiple columns and true csv files. You would need to resort to logic that we had initially in JSfiddle. If I have time I will look into this later today.

              nbrennN 1 Reply Last reply Reply Quote 0
              • nbrennN Offline
                nbrenn @morozgrafix
                last edited by

                @morozgrafix I think I can work around this by changing the SQL query (that generates my .csv) to include just one column. Then I can implement it as a new module, placed above the current one.

                1 Reply Last reply Reply Quote 0
                • nbrennN Offline
                  nbrenn
                  last edited by

                  Does anyone know of the best documentation for adding an image/graphic into a mirror module?

                  For my example here, Mirror Datafeed and Sum Module, I am summing over the values in a column in a .csv and then outputting it.

                  I would like to show an image based on what that value is. As a crude example, if the sum is greater than 50, output a frown. If it is less than 50, show a smiling face. What’s the best documentation for putting in graphics that will work on the mirror?

                  cowboysdudeC 1 Reply Last reply Reply Quote 0
                  • cowboysdudeC Offline
                    cowboysdude Module Developer @nbrenn
                    last edited by cowboysdude

                    @nbrenn I’m sure there are many ways but here’s one … :laughing:

                    I borrowed this from strawberrys modules…

                    var awayLogo = document.createElement("span");
                                   var awayIcon = document.createElement("img");
                                   awayIcon.src = this.file("icons/" + game.awayTeam + ".png");
                                   awayLogo.appendChild(awayIcon);
                                   large.appendChild(awayLogo);
                    

                    he’s getting the name from parsing xml and the away team name is for example ‘bal’… so his png in his icon folder is named ‘bal.png’ and here he’s calling it to show… that’s one way :)

                    You can also look at morozgrafix’s MMM-Horoscope to see another … hope it helps!

                    nbrennN 1 Reply Last reply Reply Quote 1
                    • nbrennN Offline
                      nbrenn @cowboysdude
                      last edited by

                      @cowboysdude Thanks for the example!

                      Is there a specific styling that needs to be used for the images? For example, I would need the image to have the typical white/greyish hue to it.

                      cowboysdudeC 1 Reply Last reply Reply Quote 0
                      • cowboysdudeC Offline
                        cowboysdude Module Developer @nbrenn
                        last edited by

                        @nbrenn I believe you can do it with a classid…

                        var gameTemp = document.createElement("div");
                                       gameTemp.classList.add("gametemp");
                        

                        Then add it your css file:

                        .MMM-NFLweather .gametemp {
                            color: #10B1C8;
                        }
                        
                        strawberry 3.141S 1 Reply Last reply Reply Quote 1
                        • 1
                        • 2
                        • 3
                        • 4
                        • 3 / 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