I've got a html file and JS file
So I've got a syntax of svg in my html file :
<body>
<svg width="500" height="100">
<circle id="circle1" cx="20" cy="20" r="10"
style="stroke: none; fill: #ff0000;"/>
<text x="47.872" y="11.064">{home/sensors/temp/kitchen} °C</text>
<circle id="circle1" cx="20" cy="20" r="10"
style="stroke: none; fill: #ff0000;"/>
<title x="47.872" y="11.064" >{home/sensors/temp/bathroom} °C</title>
<circle id="circle1" cx="20" cy="20" r="10"
style="stroke: none; fill: #ff0000;"/>
<text x="47.872" y="11.064">{home/sensors/temp/room} °C</text>
</svg>
<script type="text/javascript" src="../scripts/link.js"></script>
</body>
</html>
Currently, I've got only this in my link.js:
let listTickets = new Map([
['0', '{home/sensors/temp/kitchen}'],
['1', '{home/sensors/temp/bathroom}'],
['2', '{home/sensors/temp/room}']
]);
let listNumber = new Map([
['0', '24'],
['1', '22'],
['2', '25']
]);
// var topicMatch = line.match(/\{[\w\/]+\}/g); // think need to use regex
So What I want in my js file, it's when we've got a syntax in html file like:
"{ + content + }
Need to replace (in my navigator and not in file) the same syntax by his value, for example, we are reading the html file :
detect first content : {home/sensors/temp/kitchen} => need to change by '24'
detect second content : {home/sensors/temp/bathroom} => need to change by '22'
detect first content : {home/sensors/temp/kitchen} => need to change by '25'
Thanks for your help