MagicMirror² v2.14.0 is available! For more information about this release, check out this topic.

default compliments



  • 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



  • @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



  • @ashishtank fantastic! that’s correct. Thanks


Log in to reply