• 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 20.6k 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 16, 2018, 9:57 PM

    @sdetweil

     start: function () {
            Log.info("Starting module: " + this.name);
    
            // Set locale.
            moment.locale(config.language);
    
            this.newsItems = [];
            this.loaded = false;
            this.activeItem = 0;
            this.scrollPosition = 0;
    
            this.registerFeeds();
    
    		"use strict";
    
            this.isShowingDescription = this.config.showDescription;
        },
    

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

    S 1 Reply Last reply Oct 16, 2018, 10:03 PM Reply Quote 0
    • J Offline
      justjim1220 Module Developer @sdetweil
      last edited by Oct 16, 2018, 9:59 PM

      @sdetweil

      this is the default MM newsfeed, I am trying to modify it to show different things.

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

      1 Reply Last reply Reply Quote 0
      • J Offline
        justjim1220 Module Developer @sdetweil
        last edited by Oct 16, 2018, 10:03 PM

        @sdetweil

        My last modification was this…

        https://forum.magicmirror.builders/assets/uploads/files/1539306174825-screenshot-140.png

        https://forum.magicmirror.builders/assets/uploads/files/1539306174825-screenshot-141.png

        https://forum.magicmirror.builders/assets/uploads/files/1539306174825-screenshot-142.png

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

        1 Reply Last reply Reply Quote 0
        • S Online
          sdetweil @justjim1220
          last edited by Oct 16, 2018, 10:03 PM

          @justjim1220 the problem is that the newsItems array is set from the rest api to pull the entries from the source. THAT data does NOT contain the icon you want to use.

          your feed DEFINITION does , but not the feed response data…

          so, can u tell from an item which ‘feeds’ entry caused this entry to be in the data? (ie, tell its source)… and can you search the feeds to locate the feed definition from any data in the item?

          once u can do that, then u can use the feed entry icon

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          J 2 Replies Last reply Oct 16, 2018, 10:05 PM Reply Quote 0
          • J Offline
            justjim1220 Module Developer @sdetweil
            last edited by Oct 16, 2018, 10:05 PM

            @sdetweil

            Not quite sure I am following you correctly…
            Do you mean to pull the icon from the feeds source? the website?

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

            1 Reply Last reply Reply Quote 0
            • J Offline
              justjim1220 Module Developer @sdetweil
              last edited by Oct 16, 2018, 10:09 PM

              @sdetweil

              ok, so how would I be able to use the corresponding icons/images for the active feed showing if there isn’t any icon data in the rest API?

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

              S 1 Reply Last reply Oct 16, 2018, 10:15 PM Reply Quote 0
              • S Online
                sdetweil @justjim1220
                last edited by Oct 16, 2018, 10:15 PM

                @justjim1220 you have to match up the feed definition (feeds array) with the element in the source response (newsItems array) somehow

                the source does not send the icon back

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                J 2 Replies Last reply Oct 16, 2018, 10:17 PM Reply Quote 0
                • J Offline
                  justjim1220 Module Developer @sdetweil
                  last edited by Oct 16, 2018, 10:17 PM

                  @sdetweil

                  that’s because I don’t think the source has an icon to pull from it.

                  So, is there a way to put the icons in an image folder in the newsfeed directory and pull from there for each corresponding newsfeed?

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

                  1 Reply Last reply Reply Quote 0
                  • J Offline
                    justjim1220 Module Developer @sdetweil
                    last edited by Oct 16, 2018, 10:20 PM

                    @sdetweil

                    this is how I was able to modify the code to show a single icon and to get it to scroll across the screen

                    https://forum.magicmirror.builders/assets/uploads/files/1539381868184-screenshot-146.png

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

                    1 Reply Last reply Reply Quote 0
                    • S Online
                      sdetweil
                      last edited by Oct 17, 2018, 12:53 AM

                      right… you hard coded it…

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      J 1 Reply Last reply Oct 17, 2018, 2:19 AM Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 4
                      • 5
                      • 6
                      • 4 / 6
                      4 / 6
                      • First post
                        9/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