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.

    Attribution Tag for Default Compliments Model

    Scheduled Pinned Locked Moved Development
    8 Posts 2 Posters 988 Views 2 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.
    • R Offline
      raspberrypi9
      last edited by

      Sorry, the title should say “Default Compliments Module”

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

        @raspberrypi9

        a google search like this
        ‘how to add an author attribution to a web element in html’
        give a bunch of info on how to do the citation

        and you might luck out w the existing code not detecting your structure vs the string it uses today

        so in getdom() it gets all the ‘strings’ that might apply
        and then randomly picks one from that list

        now you could test if that thing is an object or string, and if object add the html elements needed first your citation

        in this latest release we added the ability to reload the remote compliments file on done timed cycle

        so your authors could update it

        a great way to learn what to do is make a small html file and load that via a browser til you get the display like you want, and take that knowledge for the small change you want to make

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        R 1 Reply Last reply Reply Quote 0
        • R Offline
          raspberrypi9 @sdetweil
          last edited by

          @sdetweil Thanks so much for replying to my post. Just want to confirm that I understand the approach…

          So what you are saying is that I should make an .html file and google what html tags to put in it so that I can load it with File…Open in my browser and once it displays correctly, I can take those tags and google how to write javascript code in the getDom function in MagicMirror/modules/default/compliments that will implement those same html tags. Is the correct? Thanks.

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

            @raspberrypi9 yes.

            you may be able to see how to create html elements in the existing code, but knowing what you want to have will be the most important thing

            as you have little experience w this, the html file will be a clean way to gain some of that knowledge.

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            R 1 Reply Last reply Reply Quote 0
            • R Offline
              raspberrypi9 @sdetweil
              last edited by

              @sdetweil I think I know what I want to do for the visual/presentation aspect. I’m going to just print the attribution name in smaller font at the end of the compliment.

              I’d like to change the config schema from:

              compliments: {
              anytime: [ “compliment 1”,
              “compliment 2”]
              }

              to

              compliments: {
              anytime: [ {“compliment from Bob”, “Bob”},
              {“compliment from Lucy”, “Lucy”}]
              }

              but when I just make that change in the config file, it tells me that I have syntax errors. How can I change things so that my new scheme for compliments will be accepted and I can access both the compliment and name field in the compliments.js file where I assume I can modify how it is rendered?

              Thanks so much for your help.

              S 2 Replies Last reply Reply Quote 0
              • S Offline
                sdetweil @raspberrypi9
                last edited by

                @raspberrypi9 js objects {} must contain

                name: value

                pairs
                for example

                {text:"........",author:"mom"}
                

                Sam

                How to add modules

                learning how to use browser developers window for css changes

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

                  @raspberrypi9 did you figure this out?

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

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