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

    Posts

    Recent Best Controversial
    • What is the startup order in a Module with node_helper.js?

      What is the exact startup order of a module?
      What is processed first and how can I learn/understand the process?

      posted in Development
      E
      E3V3A
    • What is the difference between require() and getScripts()?

      I’ve been trying to implement the jquery dependent package (Tabulator) on my mirror. What it does is, convert JSON data into a nice dynamic HTML table.

      In the working HTML version, I just the script tag, to include everything, but in a Node MMM, we can either use require("blablah") in the node_helper.js file, or use getScripts("blablah.js") in the MMM-MyModule.js file.

      1. What is the difference?
      2. When to use what?

      Right now I’m using the 2nd option, and it loads, but the table is never shown… I’m thinking I’m missing something.

      posted in Development
      E
      E3V3A
    • RE: I got sucked up into a magic mirror! (and need some help)

      @raywo Great! Thanks! I just answered…

      What’s next? Well, the table never get shown, so fixing that is next.
      Once all this demo works, it’s time to put it all into a module that is actually doing something.

      posted in Development
      E
      E3V3A
    • RE: Adding jQuery

      @ninjabreadman Oh man, Excellent! I wish I’d had seen that a week ago…

      Anyway, I’ve solved it since, but got another issue with getting the Tabulator code to actually do something. No errors shown, unfortunately.

      PS. Is there a way to close a thread or mark it as solved??

      posted in Requests
      E
      E3V3A
    • RE: MMM-Tabulator: How to port HTML JS imports to node JS imports? [solved]

      @ninjabreadman Thank you very much for trying to help. But I’m pretty sure I tried that as well…at some point, giving me a “double” path. (Perhaps a browser cache issue?).

      Anyway, this is resolved, and I have a new problem of a completely different sort in this thread.

      posted in Troubleshooting
      E
      E3V3A
    • RE: I got sucked up into a magic mirror! (and need some help)

      @raywo Hi Thank you fo r taking your time to look at this. I have now updated the code.
      It runs and I created a new loadTabulate function, that is supposed to do exactly the same as in the demo.html file…it returns, but nothing is displayed. I don’t know how to debug this, since there are no errors.

      Perhaps, I just doing this Tabulator inclusion all wrong. I have no idea how to proceed at this point.

      posted in Development
      E
      E3V3A
    • RE: I got sucked up into a magic mirror! (and need some help)

      @raywo

      Your MMM look very nice and the code is indeed very clean, although quite different from what I’ve seen so far. However, I’m looking at this as an exercise, since it’s my first Module.

      So yes, using jquery + add-ons are definitely overkill, but has not yet been done before AFAICT. As you can see, in the demo.html, it makes doing fantastic tables using JSON a super breeze (obviously at the cost of external code and processing bloat). So since I hate making DOM from JS, I rather prefer using tools available, even if it means all this extra work and hair-pulling.

      I’ll soon update the repo code in the signature, once I get the table up.

      posted in Development
      E
      E3V3A
    • RE: I got sucked up into a magic mirror! (and need some help)

      I’ve solved one of the problems with the blocked due to MIME type mismatch error above, in this thread. Please look at that answer to import your external jquery related scripts.

      posted in Development
      E
      E3V3A
    • RE: MMM-Tabulator: How to port HTML JS imports to node JS imports? [solved]

      @raywo Hi! Yeah, that worked! Thank you! I was going really crazy here…

      Anything other than what’s shown below, results in an error as mentioned above.
      Apparently the only types of paths that work, are the following (including the out-commented ones):

              getScripts: function() {
      //              return ["moment.js"];
                      return [
                              this.file('node_modules/jquery/dist/jquery.min.js'),
                              this.file('node_modules/jquery-ui-dist/jquery-ui.min.js'),
                              this.file('node_modules/jquery.tabulator/dist/js/tabulator.js')
      //                      'modules/MMM-Tabulator/node_modules/jquery/dist/jquery.min.js',
      //                      'modules/MMM-Tabulator/node_modules/jquery-ui-dist/jquery-ui.min.js',
      //                      'modules/MMM-Tabulator/node_modules/jquery.tabulator/dist/js/tabulator.js'
                      ]
              },
      
              getStyles: function() {
                      return [
                              this.file('node_modules/jquery-ui-dist/jquery-ui.css'),
                              this.file('node_modules/jquery.tabulator/dist/css/tabulator.css'),
                              "MMM-Tabulator.css"
                      ];
              },
      
      

      That took considerable trial-and-error, as this is not at all apparent from the documentation. At least not how I interpret it. (I was clearly under the incredibly naive impression that MM would search the file tree in node_modules directory and elsewhere, looking for the file names specified.)

      posted in Troubleshooting
      E
      E3V3A
    • RE: Adding jQuery

      @strawberry-3-141

      It seem that getscripts doesn’t work anymore, at least not as I expected. This seem to be because even though MM finds the script, we get hit by the security error:

      The resource from “http://192.168.1.2:8080/node_modules/jquery-ui-dist/jquery-ui.css” was blocked due to MIME type mismatch (X-Content-Type-Options: nosniff).
      

      Any idea how to get past this?

      posted in Requests
      E
      E3V3A
    • 1
    • 2
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 19 / 22