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.

    Exact matches for phrases in config.js?

    Scheduled Pinned Locked Moved Troubleshooting
    4 Posts 3 Posters 607 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.
    • TipponT Offline
      Tippon
      last edited by

      I recently updated my default calendar module to use colours and symbols for repeating events, using the customEvents option from here:

      https://docs.magicmirror.builders/modules/calendar.html#configuration-options

      but I’ve since found out that if the keyword is part of another word, the second word triggers the custom colour and symbol too. As an example, I’ve used ‘live’ for live music events, but ‘delivery’ triggers the same colour and symbol.

      Does anyone know the correct term for this so that I can try to figure it out please? I can only find answers for creating the Javascript in the first place, but I want a way to limit the term from my config.js, if that’s possible.

      Please forgive me if I'm slow to reply, I'm currently experiencing memory issues, and sometimes forget that I've asked a question >.<

      lavolp3L 1 Reply Last reply Reply Quote 0
      • lavolp3L Offline
        lavolp3 Module Developer @Tippon
        last edited by lavolp3

        @tippon The reason is that the .indexOf()function searches a string for a character pattern, not for a word.
        You could try to include spaces, have it search for 'live ' and/or ' live'

        How to troubleshoot modules
        MMM-soccer v2, MMM-AVStock

        S TipponT 2 Replies Last reply Reply Quote 0
        • S Away
          sdetweil @lavolp3
          last edited by sdetweil

          @lavolp3 indexOf searches for string patterns too… but as u note adding a space to distinguish keyword from word contents might still be required

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • TipponT Offline
            Tippon @lavolp3
            last edited by

            @lavolp3 @sdetweil Thanks for the replies, it worked perfectly! :)

            I tried a space before and after ‘live’, and both at once. I made a separate entry for ‘delivery’ too, and put it after the ‘live’ line. The ‘delivery’ line wasn’t necessary, but I tried it as an override (which didn’t work), and liked the way it looked :D

            {keyword: 'live ', symbol: 'music', color: 'Aqua'},
            {keyword: 'delivery', symbol: 'truck', color: 'GreenYellow'},
            

            Please forgive me if I'm slow to reply, I'm currently experiencing memory issues, and sometimes forget that I've asked a question >.<

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