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

    Topics

    • oscarbO

      How to keep secrets out of config.js (server only)

      Watching Ignoring Scheduled Pinned Locked Moved Tutorials
      11
      0 Votes
      11 Posts
      4k Views
      J
      @BKeyport Here’s a more detailed explanation for you and anyone who is curious. The if (typeof module !== "undefined") {} line checks if there is a global variable named module. If there is, then we must be using a module system and we have to export config using module.exports = config;. If not, then we must be in the browser and config will already be available to any other modules. In the browser, there is no concept of separate modules (a.k.a. files); script files are loaded in and simply concatenated one after the other. So if you load config.js and then another-file.js, the config variable (var config = { ... } ) will be available as a global variable in another-file.js. The module and require variables are not defined. In more modern code with a module system, you have to export anything you want to use elsewhere, and import it in modules where you need it. Node.js uses module.exports = ... to export and ... = require("module-to-import") to import.
    • oscarbO

      Show date below time and date info on several lines

      Watching Ignoring Scheduled Pinned Locked Moved Showcase
      1
      1
      2 Votes
      1 Posts
      2k Views
      oscarbO
      Hi! Just thought I would share how I put the date below the time for the default Clock module using only CSS - no need to modify or create your own clock module! [image: 1564610343245-screenshot-2019-07-31-at-23.56.53.png] custom.css /* CLOCK */ #module_2_clock > div > div { display: flex; flex-direction: column; } /* Date */ #module_2_clock > div > div > div.date { order: 2; } /* Time */ #module_2_clock > div > div > div.time { order: 1; font-family: Roboto, sans-serif; font-weight: 300; font-size: 80px; line-height: 75px; letter-spacing: -3px; color: #fff; } Also, to show the week on a separate line and make it a little bit smaller, use HTML tags within brackets when setting the date format, like this: config.js { module: "clock", position: "top_right", config: { displaySeconds: false, dateFormat: "dddd D MMMM[< br/ >< small >vecka] W[< /small >]", } }, NOTE: Since the forum is sanitising HTML, remove all the spaces from the tags above in < small >, < /small > and < br/ > to make it work. Hope this can inspire and help someone! :)
    • 1 / 1