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.

    MMM-CX3A - Transform not working?

    Scheduled Pinned Locked Moved Solved Troubleshooting
    11 Posts 3 Posters 5.8k Views 3 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.
    • BKeyportB Offline
      BKeyport Module Developer @sdetweil
      last edited by

      @sdetweil it looks normal for me, too - however, a cut and paste into both fields from the original text does fix it, so, whatever.

      The "E" in "Javascript" stands for "Easy"

      M 1 Reply Last reply Reply Quote 0
      • M Offline
        MMRIZE @BKeyport
        last edited by

        @BKeyport
        Anyway, how about this code for those who need many transforming like you?

        eventTransformer: (event) => {
          const replaceMap = {
            'original': 'Replaced',
            'text': 'string',
            'foo': 'bar',
            'baz': 'qux',
          }
        
          Object.keys(replaceMap).forEach((key) => {
            const regex = new RegExp(key, 'gi')
            event.title = event.title.replace(regex, (token) => {
              event.color = 'red'
              return replaceMap[ key ]
            })
          })
          return event
        }
        

        5ae3c465-a5cb-4e50-8b16-35bb01462c24-image.png

        BKeyportB 1 Reply Last reply Reply Quote 0
        • BKeyportB Offline
          BKeyport Module Developer @MMRIZE
          last edited by

          @MMRIZE That looks interesting… Most of my transforming is yanking out the emoji, though - because electron does partial display at best, and I so hate the boxed X showing up everywhere.

          The "E" in "Javascript" stands for "Easy"

          M 1 Reply Last reply Reply Quote 0
          • M Offline
            MMRIZE @BKeyport
            last edited by

            @BKeyport
            You may need to install emoji fonts
            Or you can parse out non-ASCII characters with regular expressions.

            BKeyportB 1 Reply Last reply Reply Quote 0
            • BKeyportB Offline
              BKeyport Module Developer @MMRIZE
              last edited by

              @MMRIZE Interesting. How would one install the Emoji fonts? I’d rather have the prettyness than all text.

              The "E" in "Javascript" stands for "Easy"

              M 1 Reply Last reply Reply Quote 0
              • M Offline
                MMRIZE @BKeyport
                last edited by

                @BKeyport
                https://raspberrypi.stackexchange.com/questions/104181/colored-emojis-in-chromium

                1 Reply Last reply Reply Quote 0
                • 1
                • 2
                • 1 / 2
                • First post
                  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