1
0
Fork 0

Webinterface: Wetterrater zu aktuell.html hinzugefügt

This commit is contained in:
Lukas Winkler 2014-05-31 15:41:13 +02:00
parent c4c7cedd94
commit eadd413b6f
2 changed files with 128 additions and 24 deletions

View file

@ -88,6 +88,7 @@ var addToHomeConfig = {
<!--Ende Navigationsleiste-->
<h1>Aktuell</h1>
<!--<iframe width="1" scrolling="no" height="1" frameborder="0" src="control.php?aktion=running" seamless="seamless">ifames werden nicht unterstützt</iframe>-->
<img src="" alt="Wettericon" id="wettericon" width="300px" style="float:right;z-index: -1;" />
<div class="wert">
<div class="label">Datum/Uhrzeit:</div>
<div><span class="zahl" id="uhrzeit" style="font-weight:bold;">0</span></div>
@ -203,6 +204,7 @@ function laden() { //neueste Daten nachladen und Balken bar() ausführen
}
bar_width();
bar_color();
wettericon();
}
function bar_width() {
browserbreite=document.body.offsetWidth;
@ -219,6 +221,116 @@ function bar_color() {
$("#" + ids_w[index] ).css("backgroundColor", rgb);
}
}
function wettericon() {
boden=werte[3];
temp_luft=werte[5];
feuchte=werte[6];
aussen=werte[7];
druck=werte[8];
var monate=[0.6,0.8,4.9,9.3,14.6,17.6,19.5,18.9,14.3,8.9,3.7,0.7]; // http://www.zamg.ac.at/fix/klima/oe71-00/klima2000/klimadaten_oesterreich_1971_frame1.htm
jetzt=new Date();
dieses_monat=monate[jetzt.getMonth()];
nächstes_monat=monate[jetzt.getMonth()+1];
mitteltemp=dieses_monat + (jetzt.getDate()/30)*(nächstes_monat-dieses_monat);
stunden=jetzt.getMinutes()/60 + jetzt.getHours();
temp_schätzung = -5 * Math.cos(stunden * 2 * Math.PI / 24) + mitteltemp;
console.log(temp_schätzung);
if (jetzt.getHours >= 18 || jetzt.getHours <= 7) {
tag="1";
} else {
tag="0";
}
bewölkungsgrad=(aussen-temp_schätzung);
bewölkungsgrad+=(druck-980)/10;
if (bewölkungsgrad >= 7) {
bewölkung=0; //sonnig
} else if (bewölkungsgrad <=-7) {
bewölkung=2; //stark bewölkt
} else {
bewölkung=1; //leicht bewölkt
}
console.log("Bewölkung: " + bewölkungsgrad);
if (feuchte < 85) {
ns=0; // kein Niederschlag
} else if (aussen <= -5) {
ns=2; // Schnee
if (bewölkung==0) {
bewölkung=1;
}
} else if (aussen <= 0) {
ns=4; //Schnee-Regen
} else if ((jetzt.getMonth()== 6 || jetzt.getMonth()== 7) && (aussen-temp_schätzung) > 0) {
ns=1; //Gewitter
bewölkung=2;
} else {
ns=3; //Regen
if (bewölkung==0) {
bewölkung=1;
}
}
console.log("NS: " + ns);
// Zusammenfügen
tag+="";
bewölkung+="";
ns+="";
ges = tag + ns + bewölkung;
console.log(ges);
// Zuordnung zu den Dateien
switch(ges) {
case "012":
case "112":
file="Gewitter.svg";
break;
case "100":
file="Mond.svg";
break;
case "042":
case "041":
case "142":
case "141":
file="schwacher_Schnee.svg";
break;
case "000":
file="Sonne.svg";
break;
case "001":
file="Sonne_mit_Wolke.svg";
break;
case "101":
file="Wolke_mit Mond.svg";
break;
case "002":
case "102":
file="Stark_bewölkt.svg";
break;
case "022":
case "021":
case "122":
case "121":
file="starker_Schnee.svg";
break;
case "001":
case "002":
case "101":
case "102":
file="Wolke_einzeln.svg";
break;
case "032":
case "132":
file="starker_Regen.svg";
break;
case "031":
case "131":
file="leichter_Regen.svg";
break;
}
file="images/wetter/" + file;
console.log(file);
$("#wettericon").attr("src",file );
}
laden();
window.setInterval(function(){

View file

@ -149,18 +149,18 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="32"
inkscape:cx="19.457595"
inkscape:cy="11.48243"
inkscape:zoom="16"
inkscape:cx="7.539004"
inkscape:cy="18.53485"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
showguides="true"
inkscape:guide-bbox="true"
inkscape:window-width="1920"
inkscape:window-height="1014"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-height="1018"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
@ -195,7 +195,7 @@
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1.00000012px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
d="m 9.3125001,1040.8622 -5,5"
d="m 7.6250001,1040.8622 -5,5"
id="path2995"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
@ -203,27 +203,19 @@
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path3800"
d="m 15.3125,1040.8622 -5,5"
d="m 13.625,1040.8622 -5,5"
style="fill:none;stroke:#000000;stroke-width:1.00000012px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" />
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
d="m 18.84375,1042.3421 1.054211,-0.9439 0,0 m -0.998139,-0.057 0.949842,1.0471"
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
id="path3874" />
id="path3012"
d="m 18.78125,1040.8622 -5,5"
style="fill:none;stroke:#000000;stroke-width:1.00000012px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" />
<path
style="fill:none;stroke:#000000;stroke-width:1.00000012px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
d="m 24.78125,1040.8622 -5,5"
id="path3015"
inkscape:connector-curvature="0"
d="m 22.84375,1042.1251 1.316048,-0.5214 0,0 m -0.918664,-0.3969 0.520569,1.315"
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
id="path3878" />
<path
id="path3899"
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
d="m 15.84375,1044.7599 1.401638,0.1959 0,0 m -0.611929,-0.7915 -0.172745,1.4033"
inkscape:connector-curvature="0" />
<path
id="path3903"
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
d="m 20.629426,1044.1629 -0.171778,1.4041 0,0 m 0.789396,-0.6139 -1.403294,-0.171"
inkscape:connector-curvature="0" />
sodipodi:nodetypes="cc" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB