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.

    default compliments

    Scheduled Pinned Locked Moved Troubleshooting
    3 Posts 2 Posters 397 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.
    • M Offline
      MrDondoT
      last edited by

      hey guys, is there any way to insert HTML tags in a remote JSON file for copliments default module?
      ie:
      < font color=‘red’ >hello sweety< font >

      thanks

      1 Reply Last reply Reply Quote 0
      • A Offline
        ashishtank Module Developer
        last edited by

        @MrDondoT said in default compliments:

        < font color=‘red’ >hello sweety< font >

        It is possible but you need to change the current module code as well, right now it is creating text node but to support html text code needs to be changed as below

        for (var part of parts) {
        			// create a text element for each part
        			//compliment.appendChild(document.createTextNode(part)); //Comment this line
        			compliment.innerHTML += part;  //Add this line
        			// add a break `
        			compliment.appendChild(document.createElement("BR"));
        		}
        

        Result should be as below if your compliments are like below

        evening: ["Wow, you look hot!", "You look nice!", "Hi, <i>sexy!</i>","< font color='red'>hello sweety< /font>"],
        

        77f53b06-9495-47b1-98a7-a4939e08be30-image.png

        b0215eac-63f0-43ed-ab2d-7775b1f4de16-image.png

        –
        Ashish

        M 1 Reply Last reply Reply Quote 1
        • M Offline
          MrDondoT @ashishtank
          last edited by

          @ashishtank fantastic! that’s correct. Thanks

          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