mirror of
				https://github.com/MichMich/MagicMirror.git
				synced 2025-10-31 10:48:10 +00:00 
			
		
		
		
	implemented roundTemperature in weather modules
This commit is contained in:
		| @@ -63,6 +63,13 @@ The following properties can be configured: | ||||
| 				<br><b>Default value:</b> <code>config.units</code> | ||||
| 			</td> | ||||
| 		</tr> | ||||
| 		<tr> | ||||
| 			<td><code>roundTemperature</code></td> | ||||
| 			<td>Round temperature value to nearest integer.<br> | ||||
| 				<br><b>Possible values:</b> <code>true</code> (round to integer) or <code>false</code> (display exact value with decimal point) | ||||
| 				<br><b>Default value:</b> <code>false</code> | ||||
| 			</td> | ||||
| 		</tr> | ||||
| 		<tr> | ||||
| 			<td><code>updateInterval</code></td> | ||||
| 			<td>How often does the content needs to be fetched? (Milliseconds)<br> | ||||
|   | ||||
| @@ -15,6 +15,7 @@ Module.register("currentweather",{ | ||||
| 		locationID: "", | ||||
| 		appid: "", | ||||
| 		units: config.units, | ||||
| 		roundTemperature: false, | ||||
| 		updateInterval: 10 * 60 * 1000, // every 10 minutes | ||||
| 		animationSpeed: 1000, | ||||
| 		timeFormat: config.timeFormat, | ||||
| @@ -149,9 +150,13 @@ Module.register("currentweather",{ | ||||
| 		weatherIcon.className = "wi weathericon " + this.weatherType; | ||||
| 		large.appendChild(weatherIcon); | ||||
|  | ||||
| 		var temp = this.temperature; | ||||
| 		if (this.config.roundTemperature) { | ||||
| 			temp = Math.round(temp); | ||||
| 		} | ||||
| 		var temperature = document.createElement("span"); | ||||
| 		temperature.className = "bright"; | ||||
| 		temperature.innerHTML = " " + this.temperature + "°"; | ||||
| 		temperature.innerHTML = " " + temp + "°"; | ||||
| 		large.appendChild(temperature); | ||||
|  | ||||
| 		wrapper.appendChild(small); | ||||
|   | ||||
| @@ -63,6 +63,13 @@ The following properties can be configured: | ||||
| 				<br><b>Default value:</b> <code>config.units</code> | ||||
| 			</td> | ||||
| 		</tr> | ||||
| 		<tr> | ||||
| 			<td><code>roundTemperature</code></td> | ||||
| 			<td>Round temperature values to nearest integer.<br> | ||||
| 				<br><b>Possible values:</b> <code>true</code> (round to integer) or <code>false</code> (display exact value with decimal point) | ||||
| 				<br><b>Default value:</b> <code>false</code> | ||||
| 			</td> | ||||
| 		</tr> | ||||
| 		<tr> | ||||
| 			<td><code>maxNumberOfDays</code></td> | ||||
| 			<td>How many days of forecast to return. Specified by config.js<br> | ||||
|   | ||||
| @@ -15,6 +15,7 @@ Module.register("weatherforecast",{ | ||||
| 		locationID: "", | ||||
| 		appid: "", | ||||
| 		units: config.units, | ||||
| 		roundTemperature: false, | ||||
| 		maxNumberOfDays: 7, | ||||
| 		updateInterval: 10 * 60 * 1000, // every 10 minutes | ||||
| 		animationSpeed: 1000, | ||||
| @@ -129,13 +130,20 @@ Module.register("weatherforecast",{ | ||||
| 			icon.className = "wi weathericon " + forecast.icon; | ||||
| 			iconCell.appendChild(icon); | ||||
|  | ||||
| 			var maxTemp = forecast.maxTemp; | ||||
| 			var minTemp = forecast.minTemp; | ||||
| 			if (this.config.roundTemperature) { | ||||
| 				maxTemp = Math.round(maxTemp); | ||||
| 				minTemp = Math.round(minTemp); | ||||
| 			} | ||||
| 			 | ||||
| 			var maxTempCell = document.createElement("td"); | ||||
| 			maxTempCell.innerHTML = forecast.maxTemp; | ||||
| 			maxTempCell.innerHTML = maxTemp; | ||||
| 			maxTempCell.className = "align-right bright max-temp"; | ||||
| 			row.appendChild(maxTempCell); | ||||
|  | ||||
| 			var minTempCell = document.createElement("td"); | ||||
| 			minTempCell.innerHTML = forecast.minTemp; | ||||
| 			minTempCell.innerHTML = minTemp; | ||||
| 			minTempCell.className = "align-right min-temp"; | ||||
| 			row.appendChild(minTempCell); | ||||
|  | ||||
| @@ -289,3 +297,4 @@ Module.register("weatherforecast",{ | ||||
| 		return parseFloat(temperature).toFixed(1); | ||||
| 	} | ||||
| }); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user