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 6.1k 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
      last edited by

      @MMRIZE (tagged as author)

      I have 4 transforms attempting to work at the same time, the last one “busy” doesn’t work - can someone explain why?

      				eventTransformer: (ev) => {
      					if (ev.title.search("🏠") > -1) {
      						ev.title = ev.title.replace("🏠 Personal Commitment","Private (Brendan)");
      						ev.color = 'yellow';
      					}
      					if (ev.title.search("✈ Flight") > -1) {
      						ev.title = ev.title.replace("✈ Flight","Private (Brendan)");
      						ev.color = 'yellow';
      					}
      					if (ev.title.search("🚌️") > -1) {
      						ev.title = ev.title.replace("🚌️ Transit","Private (Brendan)");
      						ev.color = 'yellow';
      					}
      					if (ev.title.search("busy️") > -1) {
      						ev.title = ev.title.replace("busy","Private (Mom)");
      						ev.color = 'yellow';
      					}
      					return ev
      				},
      

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

      S M 2 Replies Last reply Reply Quote 0
      • S Do not disturb
        sdetweil @BKeyport
        last edited by

        @BKeyport is it lower case busy?

        Sam

        How to add modules

        learning how to use browser developers window for css changes

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

          @BKeyport
          Font seems weird. (“y” of “busy”)
          461eadf2-20c5-43ab-9125-bfc95934d396-image.jpeg

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

            @MMRIZE good catch, that’s what it was… Cut and paste solved it. I really hate that my calendar merger application uses weird junk like that.

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

            1 Reply Last reply Reply Quote 0
            • S Do not disturb
              sdetweil @MMRIZE
              last edited by

              @MMRIZE interesting, it doesn’t appear like that for me

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              BKeyportB 1 Reply Last reply Reply Quote 0
              • 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

                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                          With your input, this post could be even better 💗

                          Register Login
                          • 1 / 1
                          • 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