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

    roma-cezar

    @roma-cezar

    0
    Reputation
    471
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    roma-cezar Unfollow Follow

    Latest posts made by roma-cezar

    • Custom module bases helloworld

      Hi everyone! Now i started to use magicMirror and want to build my simple custom module to indncate somrthing (traffic load at now).
      I wrote a scrypt

      var text1 = "";
      var text2 = "";
      var text3 = "";
      var htmlpage = 'https://www.yandex.ru';
      
      var request = require('request');
      var DomParser = require('dom-parser');
      var parser = new DomParser();
      var dom;
      setInterval(function() {
      request(htmlpage, function(error, response, body) {
      dom = parser.parseFromString(body);
      text1 = dom.getElementsByClassName('traffic i-bem')[0].innerHTML;
      
      dom = parser.parseFromString(text1);
      text2 = dom.getElementsByTagName('H1')[0].innerHTML;
      dom = parser.parseFromString(text2);
      text3 = dom.getElementsByClassName('link link_black_yes')[0].textContent });
      }, 1000);
      

      request and dom-parser eas intalled.
      Then i get text data string and i want to set it into the Hello world module next.

      I added my scrypt code into the module code here:

      getDom: function() {
         var wrapper = document.createElement("div");
         wrapper.innerHTML = this.config.text;
         return wrapper;
      }
      

      But it doesnt work (request and parser modules). Otherwise, just counting number works well(((.

      Could not you help me, what i have to do to get my scrypt working inside helloworld module?

      posted in Development
      R
      roma-cezar