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

how to pull new element added to an array?

Scheduled Pinned Locked Moved Solved Troubleshooting
57 Posts 4 Posters 19.9k Views 4 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.
  • J Offline
    justjim1220 Module Developer @sdetweil
    last edited by Oct 18, 2018, 12:22 AM

    @sdetweil

    ok, so do I need to add it like this:

    parser.on("image", function(image){})
    			var title = image.title;
    			var image = image.image || image.logo || image.img || image.svg || this.feed_var_in_function.icon || "";
    			var url = image.url || image.link || "";
    

    Or, like this:

    parser.on("image", function(image){})
    			var title = image.title;
    			var image = item.image || item.logo || item.img || item.svg || this.feed_var_in_function.icon || "";
    			var url = image.url || image.link || "";
    

    "Life's Too Short To Dance With Ugly People"
    Jim Hallock - 1995

    1 Reply Last reply Reply Quote 0
    • C Offline
      cowboysdude Module Developer
      last edited by Oct 18, 2018, 1:36 AM

      Why are making this so hard?

      J 1 Reply Last reply Oct 18, 2018, 1:37 AM Reply Quote 0
      • J Offline
        justjim1220 Module Developer @cowboysdude
        last edited by Oct 18, 2018, 1:37 AM

        @cowboysdude

        GOD, I WISH I KNEW!!!

        "Life's Too Short To Dance With Ugly People"
        Jim Hallock - 1995

        1 Reply Last reply Reply Quote 0
        • J Offline
          justjim1220 Module Developer
          last edited by justjim1220 Oct 18, 2018, 2:00 AM Oct 18, 2018, 1:59 AM

          @sdetweil, @cowboysdude, @Sean

          I created a repository, hopefully it will make it easier for you to help.

          https://github.com/justjim1220/MMM-NewsFeedTicker

          ALL help is MUCH APPRECIATED!!!

          I gotta learn this stuff one way or another!

          :smiling_face_with_sunglasses:

          "Life's Too Short To Dance With Ugly People"
          Jim Hallock - 1995

          S 1 Reply Last reply Oct 18, 2018, 3:20 PM Reply Quote 0
          • S Away
            sdetweil @justjim1220
            last edited by Oct 18, 2018, 3:20 PM

            @justjim1220 I am trying to test my changes, but the module getDom() method is never called…

            changed the module name in module.js to match the file name and config module name.

            loads with no errors, shows loading the module js and registering the module…

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            J 1 Reply Last reply Oct 18, 2018, 11:38 PM Reply Quote 0
            • J Offline
              justjim1220 Module Developer @sdetweil
              last edited by Oct 18, 2018, 11:38 PM

              @sdetweil

              What is the possibility of using and array of sorts?

              place the logos in a pics folder, call them according to the newsItem[activeItem].title, Ive seen some examples, and tried it a few different ways, but not sure if I am missing something as I can’t get it to work.

              recent example tried:
              feeds…

                          {
                              title: "New York Times: ",
                              url: "http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml"
                          },
                          {
                              title: "Wall St. Journal: ",
                              url: "http://www.wsj.com/xml/rss/3_7085.xml"
                          },
                          {
                              title: "USA Today: ",
                              url: "http://rssfeeds.usatoday.com/UsatodaycomNation-TopStories"
                          },
                          {
                              title: "BBC World News: ",
                              url: "http://feeds.bbci.co.uk/news/world/rss.xml#"
                          }
              

              Array…

              iconArray: {
                          "USAToday": "USA Today: ",
                          "NewYorkTimes": "New York Times: ",
                          "WallStJournal": "Wall St. Journal: ",
                          "BBCWorldNews": "BBC World News: "
                      }
              

              Added this to start function…

               this.logo = {};
              

              sample code…

              var logo = this.logo;
              
                          if (this.config.showDescription) {
                              var description = document.createElement("div");
                              //description.setAttribute("style", "padding-top: 25px");
                              description.className = "bright xlarge bold" + (!this.config.wrapDescription ? " no-wrap" : "");
                              var txtDesc = this.newsItems[this.activeItem].description;
                              description.innerHTML = "<img class = image src=./modules/default/newsfeed/pics/" + logo.icon + ".png height=150px valign=middle>" + "<marquee scrollamount=20 scrolldelay=0 left=500px>" + "<font color=yellow>" + moment(new Date(this.newsItems[this.activeItem].pubdate)).fromNow() + "&nbsp; : &nbsp;" + "</font>" + this.newsItems[this.activeItem].title + "&nbsp; || &nbsp;" + txtDesc + "</marquee>";
                              wrapper.appendChild(description);
              			}
              

              Any chance this could work easier if I had it coded correctly?

              Seems Like I should be declaring the

              newsItem[activeItem].title
              

              to equal the icon/logo in some fashion…

              "Life's Too Short To Dance With Ugly People"
              Jim Hallock - 1995

              S 1 Reply Last reply Oct 18, 2018, 11:53 PM Reply Quote 0
              • S Away
                sdetweil @justjim1220
                last edited by Oct 18, 2018, 11:53 PM

                @justjim1220 no, not really…

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                J 1 Reply Last reply Oct 18, 2018, 11:54 PM Reply Quote 0
                • J Offline
                  justjim1220 Module Developer @sdetweil
                  last edited by Oct 18, 2018, 11:54 PM

                  @sdetweil

                  ok, just a thought, seen it with a few other modules. Thanks!

                  "Life's Too Short To Dance With Ugly People"
                  Jim Hallock - 1995

                  1 Reply Last reply Reply Quote 0
                  • S Away
                    sdetweil
                    last edited by sdetweil Oct 18, 2018, 11:59 PM Oct 18, 2018, 11:57 PM

                    @justjim1220 any idea why the newsticker doesn’t work at all?

                    u don’t have a package.json, so the install instructions for npm install is not needed…

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    J 2 Replies Last reply Oct 19, 2018, 12:00 AM Reply Quote 0
                    • J Offline
                      justjim1220 Module Developer @sdetweil
                      last edited by Oct 19, 2018, 12:00 AM

                      @sdetweil

                      No, no idea, one of the reasons I uploaded it as a repository, to let you and whoever else wants to gander at it and see what the issues are or could be.

                      Not sure when you downloaded it, but I made some minor changes to it a few hours ago. just some syntax errors and such.

                      Nonetheless, still can’t get it to work.

                      "Life's Too Short To Dance With Ugly People"
                      Jim Hallock - 1995

                      S 1 Reply Last reply Oct 19, 2018, 12:11 AM Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 4
                      • 5
                      • 6
                      • 2 / 6
                      2 / 6
                      • First post
                        29/57
                        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