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-CalendarExt2

    Scheduled Pinned Locked Moved Utilities
    486 Posts 83 Posters 834.0k Views 83 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.
    • S Offline
      scuppasteve @Guest
      last edited by

      @Sean That worked perfectly . How would you go about making the slot event background not be a black gradient? I just want the whole thing to be transparent.

      C 1 Reply Last reply Reply Quote 0
      • C Offline
        cskenney
        last edited by cskenney

        @Sean Similar to the Transform method used to identify a keyword in a title and change the icon (birthday is the example) is there a way to do the same thing (identify a key word) and change the color and background-color for that specific item?

        My example would be if the word “Softball” is found in the title of a calendar entry it would transform the icon to a softball icon (already have this figured out). I also want to change the background-color and possibly the (font) color.

        ? 1 Reply Last reply Reply Quote 0
        • J Offline
          jani.karna @Guest
          last edited by jani.karna

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • BKeyportB Offline
            BKeyport Module Developer @sdetweil
            last edited by

            @sdetweil - It gets worse.

            65:  transform: (event) => {  
            66:	if (event.title.search("Recycle") > -1) {
            67:	event.icon = "mdi:recycle"
            68: 	},
            69: 	return event
            70: },
            
            Checking file...  /home/pi/MagicMirror/config/config.js
            Line 65 col 46 'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').
            Line 67 col 63 Missing semicolon.
            Line 68 col 34 Expected an identifier and instead saw ','.
            Line 68 col 34 Expected an assignment or function call and instead saw an expression.
            Line 68 col 35 Missing semicolon.
            Line 69 col 45 Missing semicolon.
            
            0|mm     | WARNING! Could not validate config file. Starting with default configuration. Please correct syntax errors at or above this line: /home/pi/MagicMirror/config/config.js:68
            0|mm     |                                                              },
            0|mm     |                                                               ^
            0|mm     | SyntaxError: Unexpected token ,
            0|mm     |     at new Script (vm.js:74:7)
            0|mm     |     at createScript (vm.js:246:10)
            0|mm     |     at Object.runInThisContext (vm.js:298:10)
            0|mm     |     at Module._compile (internal/modules/cjs/loader.js:678:28)
            0|mm     |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:722:10)
            0|mm     |     at Module.load (internal/modules/cjs/loader.js:620:32)
            0|mm     |     at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
            0|mm     |     at Function.Module._load (internal/modules/cjs/loader.js:551:3)
            0|mm     |     at Module.require (internal/modules/cjs/loader.js:658:17)
            0|mm     |     at require (internal/modules/cjs/helpers.js:20:18)
            

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

            S 1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @BKeyport
              last edited by

              @BKeyport said in MMM-CalendarExt2:

              Please correct syntax errors at or above this line: /home/pi/MagicMirror/config/config.js:68
              68: }, < ------- remove THAT trailing comma

              Line 65 col 46 ‘arrow function syntax (=>)’ is only available in ES6 (use ‘esversion: 6’).

              need node V6, which we should be LONG past.
              do a node -v

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              C 1 Reply Last reply Reply Quote 0
              • C Offline
                cskenney @sdetweil
                last edited by cskenney

                @sdetweil @BKeyport I had the same issue with the arrow function. I did node -v and my system is v10.15.2. I was able to work around the issue by using the older notation like shown below.

                FYI - I just revised your code so you can copy and try it.

                65:  transform: function(event)  {  
                66:	if (event.title.search("Recycle") > -1) {
                67:	event.icon = "mdi:recycle";
                68: 	}
                69: 	return event;
                70: },
                

                EDIT - line 68 revised to fix an error

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

                  @cskenney Your code almost got it. - had to remove the comma on line 68 there, but it now checks out…

                  Just don’t seem to do anything yet. Tweaking some more.

                  Actually, it’s doing exactly what it’s designed to do. It shows the icon for the event. I didn’t expect it to leave the title in place too. That’ll do perfect.

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

                  C 1 Reply Last reply Reply Quote 0
                  • C Offline
                    cskenney @BKeyport
                    last edited by

                    @BKeyport said in MMM-CalendarExt2:

                    @cskenney Your code almost got it. - had to remove the comma on line 68 there, but it now checks out…

                    I’m glad it worked for you. I edited the code above to remove the comma in case someone else tries to use it. I originally missed it when I edited your code.

                    1 Reply Last reply Reply Quote 0
                    • ? Offline
                      A Former User @cskenney
                      last edited by A Former User

                      @cskenney said in MMM-CalendarExt2:

                      I also want to change the background-color and possibly the (font) color.

                      Sorry for the late reply. At weekends, I rarely am in front of computer.
                      You can define class in your CSS. then assign it into your transfrom code.

                      transform: (event) => {  
                        if (event.title.search("Recycle") > -1) {
                          event.icon = "mdi:recycle"
                          event.className = "CLASS_RECYCLE" // in your css/custom.css, define color and bgcolor for this class
                        }
                        return event
                      },
                      
                      
                      C 1 Reply Last reply Reply Quote 1
                      • C Offline
                        cskenney @Guest
                        last edited by

                        @Sean said in MMM-CalendarExt2:

                        @cskenney said in MMM-CalendarExt2:

                        I also want to change the background-color and possibly the (font) color.

                        Sorry for the late reply. At weekends, I rarely am in front of computer.
                        You can define class in your CSS. then assign it into your transfrom code.

                        transform: (event) => {  
                          if (event.title.search("Recycle") > -1) {
                            event.icon = "mdi:recycle"
                            event.className = "CLASS_RECYCLE" // in your css/custom.css, define color and bgcolor for this class
                          },
                          return event
                        },
                        
                        

                        I figured that out about an hour ago and was coming back to the forums to revise my post. Thanks for confirming what I did works!

                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 14
                        • 15
                        • 16
                        • 17
                        • 18
                        • 48
                        • 49
                        • 16 / 49
                        • 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