Hi All,
Noticed this after i updated to the new Alternative ajaxWDwx.js script.
In my ajaxgizmo.php i have this:
<span class="ajaxcontent8" style="display: none">UV-index:
<span class="ajax" id="gizmouv"><?php echo $VPuv; ?></span>
<span style="color: #ffffff">
<span class="ajax" id="gizmouvword"><?php echo gizmo_get_UVrange($VPuv); ?></span>
</span>
</span>
When i look at the source of the index i see this:
<span class="ajaxcontent8" style="display: none">UV-index:
<span class="ajax" id="gizmouv">3.0</span>
<span style="color: #ffffff">
<span class="ajax" id="gizmouvword"><span style="border: solid 1px;background-color: #FBEE09;"> Medium </span></span>
</span>
</span>
But on the page itself everything else is working correctly except the uv part where i end up seeing it like this:
UV-index: 2 0 Low
where the 0 is in the box itself, where looking at other sites it is as this:
<span class="ajaxcontent8" style="display: none">UV-index:
<span class="ajax" id="gizmouv">0.0</span>
<span style="color: #ffffff">
<span class="ajax" id="gizmouvword">None</span>
</span>
</span>
and shows on there page as this:
UV-index: 0.0 Low
Looking over everything i can’t figure out where it is grabbing the extra spaces to put the 0 into the color box with the word for the UV.
Thanks!
I looked at it a bit too and was not able to see where the background was getting set to zero. I was hoping that the author was going to come back and do some updates. Maybe Ken has an idea?
It is weird tho, I checked other websites and seen no issues on the few i was at. But on my internal network where i have mine it comes up like that for some reason. I went into every file that loads that area in and can’t seen where it is getting that 0 moved over there.
I believe you are describing the symptom I wrote about here…http://discourse.weather-watch.com/p/357407.
I never appended my results to that thread, I guess I should.
I was able to confirm the problem was in the “function ajax_getUVrange…” starting at line 1159 of Rainers bws-script-ajaxWDwx-v911 (911b). I didn’t have the skills (php) to debug that function so I replaced it with some code of Ken’s I found in another thread.
So I replaced
function ajax_getUVrange ( uv ) { // code simplified by FourOhFour on wxforum.net
var uvword = "None";
var uvclr1 = UVColor[Math.min(11,Math.round(uv))];
switch (true) {
case (uv < 0): uvword = langUVWords[6]; uvclr2 = 'none'; break; // UV sensor is not sending
case (uv = 0): uvword = langUVWords[0]; uvclr2 = 'none'; break; // None
case (uv < 3): uvword = langUVWords[1]; uvclr2 = '#4EB400'; break; // Low
case (uv < 6): uvword = langUVWords[2]; uvclr2 = '#F7E400'; break; // Medium
case (uv < 8): uvword = langUVWords[3]; uvclr2 = '#F85900'; break; // High
case (uv <11): uvword = langUVWords[4]; uvclr2 = '#D8001D'; break; // Very High
case (uv >18): uvword = langUVWords[6]; uvclr2 = 'none'; break; // UV sensor is not sending
default : uvword = langUVWords[5]; uvclr2 = '#998CFF'; // Extreme
}
return ('<span style="border: 1px solid gray; text-transform: uppercase; font-weight: bold; padding-bottom: 1px; background-color: '+ uvclr1 +';"> '+Math.round(uv) +' '+ uvword +' </span>');
}; // end ajax_getUVrange function
with code…
function ajax_getUVrange ( uv ) { // code simplified by FourOhFour on wxforum.net
var uvword = "Unspec.";
if (uv <= 0) {
uvword = langUVWords[0];
} else if (uv < 3) {
uvword = "<span style=\"border: solid 1px; color: black; background-color: #4EB400;\"> "+langUVWords[1]+" </span>";
} else if (uv < 6) {
uvword = "<span style=\"border: solid 1px; color: black; background-color: #F7E400;\"> "+langUVWords[2]+" </span>";
} else if (uv < 8) {
uvword = "<span style=\"border: solid 1px; color: black; background-color: #F85900;\"> "+langUVWords[3]+" </span>";
} else if (uv < 11) {
uvword = "<span style=\"border: solid 1px; color: #FFFFFF; background-color: #D8001D;\"> "+langUVWords[4]+" </span>";
} else {
uvword = "<span style=\"border: solid 1px; color: #FFFF00; background-color: #998CFF;\"> "+langUVWords[5]+" </span>";
}
return uvword;
} // end ajax_getUVrange function
I then packed the file into a new ajaxWDwx-packed.js.
Thanks for the heads up on that, That fixed it with just changing it in the ajaxwdwx.