MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. wltn
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    W
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 3
    • Groups 0

    wltn

    @wltn

    0
    Reputation
    236
    Profile views
    3
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    wltn Unfollow Follow

    Latest posts made by wltn

    • RE: MMM-iframe problem plz help me

      @sean Thank you!!

      To put a website in the mirror, we put the code below in the module folder and
      we put the code ‘config.js’ in the ‘MMM-iframe’ in it.
      Mirror view will appear normally, but the web site specified in ‘MM-iframe’ will not appear.

      The picture below shows the ‘npm start and stop’ log.
      (아래 사진은 ‘npm start and stop’ 로그입니다.)

      0_1538621935749_npmn.PNG

      posted in Troubleshooting
      W
      wltn
    • MMM-iframe problem plz help me

      I’d like to launch the web using myframe, but there’s no response.
      Please help me.This is the code I wrote.

      ~/MagicMirror/modules/default/MMM-iFrame/MMM-iFrame .js

      /* global Module */
      
      /* Magic Mirror
       * Module: iFrame
       *
       * By Ben Williams http://desertblade.com
       * MIT Licensed.
       */
      
      Module.register("MMM-iFrame",{
                      // Default module config.
                      defaults: {
                                      height:"100px",
                                      width:"100%",
                                      updateInterval: 0.5 * 60 * 1000,
                                      url: "http://www.naver.com",
                                      scrolling: "no"
                      },
      
              start: function () {
                      self = this;
                      var count = 0;
                      if (this.config.url.length > 0 ) {
                            setInterval( function () {
                               self.updateDom(1000);
                               console.log('update' + count++)
                               }, this.config.updateInterval);
                      }
              },
        getRandomInt: function (min, max) {
          return Math.floor(Math.random() * (max - min)) + min;
        },
      resume: function() {
         console.log("Resuming");
         return this.getDom();
      },
      
              // Override dom generator.
              getDom: function() {
                      var iframe = document.createElement("IFRAME");
                      iframe.style = "border:0"
                      iframe.width = this.config.width;
                      iframe.height = this.config.height;
                      iframe.scrolling = this.config.scrolling;
                      var url_index = 0;
               //       console.log("currentURL:" + this.currentURL);
                      var repeat = true;
                      while(repeat) {
                          url_index = this.getRandomInt(0,this.config.url.length);
                          futureURL = this.config.url[url_index];
                          console.log("URL_length:" + this.config.url.length + " " + "URL_index:" + url_index + " " + "url:" + futureURL);
                 //         if( futureURL == currentURL) {
                              iframe.src = futureURL;
                   //           currentURL = futureURL;
                              repeat = false;
                     //     }
                      }
                      return iframe;
                    }
      });
      

      ~/MagicMirror/config/config.js

                              }
                      },
      
      {
                              module: "newsfeed",
                              position: "bottom_bar",
                              config: {
                                      feeds: [
                                              {
                                                      title: "New York Times",
                                                      url: "http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml"
                                              }
                                      ],
                                      showSourceTitle: true,
                                      showPublishDate: true
                              }
                      },
              {
                      module: "MMM-iFrame",
                      position: "middle_center",      // This can be any of the regions.
                      config: {
                              // See 'Configuration options' for more information.
                                      url: "http://www.naver.com",  // as many URLs you want or you can just ["ENTER IN URL"] if single URL.
                                      updateInterval: 0.5 * 60 * 1000, // rotate URLs every 30 seconds
                                      width: "100%", // Optional. Default: 100%
                                      height: "100px" //Optional. Default: 100px
                              }
      
              },
              ]
      
      };
      
      /*************** DO NOT EDIT THE LINE BELOW ***************/
      if (typeof module !== "undefined") {module.exports = config;}
      
      posted in Troubleshooting
      W
      wltn