Read the statement by Michael Teeuw here.
assign a symbol to a module
-
Hi @dominic
The simplest approach would be to add a “br” element between the temperature and humidity.
However, I would consider putting them in an unordered list and take advantage of the inbuilt layout controls within FontAwesome. E.g.
getDom: function() { var wrapper = document.createElement("div"); if(this.dataFile){ var humidityRegExp = /Humidity = (.*?) %/ig; var humidity = humidityRegExp.exec(this.dataFile)[1]; var temperatureRegExp = /Temperature = (.*?) *C/ig; var temperature = temperatureRegExp.exec(this.dataFile)[1]; var list = document.createElement("ul"); list.classList.add("fa-ul"); // add temperature var temperature_item = document.createElement("li"); var temperature_symbol = document.createElement("i"); temperature_symbol.classList.add("fa", "fa-li", "fa-home"); temperature_item.appendChild(temperature_symbol); temperature_item.appendChild(document.createTextNode(" " + temperature + "°C")); list.appendChild(temperature_item); // add humidity var humidity_item = document.createElement("li"); var humidity_symbol = document.createElement("i"); humidity_symbol.classList.add("fa", "fa-li", "fa-tint"); humidity_item.appendChild(humidity_symbol); humidity_item.appendChild(document.createTextNode(" " + humidity + "%")); list.appendChild(humidity_item); wrapper.appendChild(list); } else { wrapper.innerHTML = "No data"; } return wrapper; },
-
Hi ianperrin, thank you :)
Do you knwo, how can i erase the “*” befor the “°C” ?
-
@ianperrin you are wizard :) big thank you, now it works excellent
@dominic try delete " * " from var temperatureRegExp = /Temperature = (.*?) *C/ig;
try it:var temperatureRegExp = /Temperature = (.*?) C/ig;
-
@Plati do you know how regular expression works?makes no sense to remove the asterisks symbol, you need the asterisk because it is in the string otherwise you dont detect the value!
problem is that the asterisk has a special function in the regular expression context so you need to escape it like this
var temperatureRegExp = /Temperature = (.*?) \*C/ig;
-
@Plati i have tried it. But than there will no data displayed.
@strawberry-3.141 Tahnks for your help, you are great.