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 25.5k 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.
    • S Offline
      sdetweil @justjim1220
      last edited by

      @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

      justjim1220J 1 Reply Last reply Reply Quote 0
      • justjim1220J Offline
        justjim1220 Module Developer @sdetweil
        last edited by

        @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 Reply Quote 0
        • S Offline
          sdetweil @justjim1220
          last edited by

          @justjim1220 no, not really…

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          justjim1220J 1 Reply Last reply Reply Quote 0
          • justjim1220J Offline
            justjim1220 Module Developer @sdetweil
            last edited by

            @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 Offline
              sdetweil
              last edited by sdetweil

              @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

              justjim1220J 2 Replies Last reply Reply Quote 0
              • justjim1220J Offline
                justjim1220 Module Developer @sdetweil
                last edited by

                @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 Reply Quote 0
                • S Offline
                  sdetweil @justjim1220
                  last edited by

                  @justjim1220 yeh, I just want to get default behavior working… I have added my code, it should work, just want to test…

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  1 Reply Last reply Reply Quote 0
                  • justjim1220J Offline
                    justjim1220 Module Developer @sdetweil
                    last edited by justjim1220

                    @sdetweil

                    kind of an example of what I am looking to accomplish…
                    0_1539907805560_Screenshot (151).png
                    0_1539907813148_Screenshot (152).png
                    0_1539907823584_Screenshot (153).png
                    0_1539907833085_Screenshot (154).png

                    Only, instead of the title on the left side, I am wanting to show the logo associated with the newsfeed.

                    Like this:
                    0_1539912191383_Screenshot (155).png

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

                    S 1 Reply Last reply Reply Quote 0
                    • S Offline
                      sdetweil @justjim1220
                      last edited by

                      @justjim1220 understood…

                      i just can’t get the module to do ANYTHING…

                      it loads, and registers, and that is it… no functions are called…

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      justjim1220J 1 Reply Last reply Reply Quote 0
                      • justjim1220J Offline
                        justjim1220 Module Developer @sdetweil
                        last edited by

                        @sdetweil

                        I’m not understanding it myself, I’ll keep plugging away at it.

                        Feel free to collaborate on it any time you feel like it.

                        Thanks for all your help thus far! :winking_face:

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

                        S 1 Reply Last reply Reply Quote 0
                        • S Offline
                          sdetweil @justjim1220
                          last edited by

                          @justjim1220 I added all the defined functions and none are called…

                          Sam

                          How to add modules

                          learning how to use browser developers window for css changes

                          justjim1220J 1 Reply Last reply Reply Quote 0
                          • justjim1220J Offline
                            justjim1220 Module Developer @sdetweil
                            last edited by

                            @sdetweil
                            What I meant was that I added you as a collaborator

                            Maybe this way you can show what you did and I could look at it as well

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

                            ? 1 Reply Last reply Reply Quote 0
                            • ? Offline
                              A Former User @justjim1220
                              last edited by

                              @justjim1220 @sdetweil
                              First, in line 18 of MMM-NewsFeedTicker.js

                              Module.register("MMM-NewsFeedTicker", {
                              
                              S 1 Reply Last reply Reply Quote 0
                              • ? Offline
                                A Former User
                                last edited by A Former User

                                I don’t know what @justjim1220 expect(So, I don’t request PR), but anyway, it’s executable now.
                                https://github.com/eouia/MMM-NewsFeedTicker
                                https://github.com/justjim1220/MMM-NewsFeedTicker/commit/64f5aae290682725ce2b8a1a64dd2771dfbd83c3

                                0_1539934768820_sample1.png

                                Just executable. I think there might be many things to improve or fix.

                                justjim1220J 1 Reply Last reply Reply Quote 0
                                • ? Offline
                                  A Former User
                                  last edited by A Former User

                                  I think this is similar with what you really want to get.
                                  https://www.dropbox.com/s/9u4bjaimhlrnzfj/MMM-NewsFeedTickerX.zip?dl=0

                                  0_1539954680780_aaa.png

                                  At first, I tried with your repository, but it seems so many things to modify. So I worked with original newsfeed. I wish you good luck.

                                  S justjim1220J 2 Replies Last reply Reply Quote 0
                                  • S Offline
                                    sdetweil @Guest
                                    last edited by sdetweil

                                    @justjim1220 thanks. Woke in the middle of the night thinking that needed to match module name…

                                    Haven’t tried it yet!

                                    Sam

                                    How to add modules

                                    learning how to use browser developers window for css changes

                                    justjim1220J 1 Reply Last reply Reply Quote 0
                                    • S Offline
                                      sdetweil
                                      last edited by sdetweil

                                      i have posted my almost working code to your github project in a new branch.

                                      the image url is extracted, saved and added to each rss feed response item.
                                      that url is used in the image.src attribute for the getDom function…

                                      BUT… the url is the FULL url, and I think the web engine under MM only allows src= from LOCAL files…

                                      when u look at the debug data items, the web server base is

                                      http://0.0.0.0:configured_port

                                      meaning adding a full url on to the end of that will fail…

                                      i posted info in an issue on github on what it might take to solve that…

                                      |edit: I see that Sean has used a different ui widget (Ticker) that seems to solve this problem

                                      Sam

                                      How to add modules

                                      learning how to use browser developers window for css changes

                                      1 Reply Last reply Reply Quote 0
                                      • S Offline
                                        sdetweil @Guest
                                        last edited by

                                        @sean nicely done…

                                        Sam

                                        How to add modules

                                        learning how to use browser developers window for css changes

                                        1 Reply Last reply Reply Quote 0
                                        • justjim1220J Offline
                                          justjim1220 Module Developer @sdetweil
                                          last edited by

                                          @sdetweil

                                          LOL, I woke up early this morning thinking I could get something like this to work…

                                          0_1539979737672_Screenshot (399).png

                                          But, of course, I probably had something wrong somewhere, because it didn’t!!!

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

                                          1 Reply Last reply Reply Quote 0
                                          • justjim1220J Offline
                                            justjim1220 Module Developer @Guest
                                            last edited by

                                            @sean

                                            Not sure why, but this didn’t work for me, I will try it again in a little while, probably something I’m doing wrong!

                                            Thank You!!!

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

                                            1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 3
                                            • 2 / 3
                                            • 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