cloudy cloudy

Author Topic: ajaxgizmo.php but can't figure it out?  (Read 1653 times)

0 Members and 1 Guest are viewing this topic.

abaldish

  • Guest
ajaxgizmo.php but can't figure it out?
« on: July 25, 2010, 07:26:16 PM »
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>&nbsp;
         <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>&nbsp;
         <span style="color: #ffffff">
            <span class="ajax" id="gizmouvword"><span style="border: solid 1px;background-color: #FBEE09;">&nbsp;Medium&nbsp;</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>&nbsp;
         <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!


Offline Burnsville Weather Live

  • Scott
  • Posts: 1,292
  • Formally Webster Weather LIVE
  • Burnsville, MN, USA
    • Burnsville Weather LIVE
Re: ajaxgizmo.php but can't figure it out?
« Reply #1 on: July 25, 2010, 09:14:59 PM »
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?

Scott

www.BurnsvilleWeatherLIVE.com (Formally Webster Weather Live)

Windows XP Pro(SP3), 4G Ram, QuickCam Pro 9000, Davis Vantage Pro II w/Solar/UV & Heated Rain Catcher, WXSim, 1-Wire: Lightning, Leaf, soil moist/tmp.

abaldish

  • Guest
Re: ajaxgizmo.php but can't figure it out?
« Reply #2 on: July 25, 2010, 09:24:24 PM »
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 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?



Offline Dennis48755

  • Posts: 102
  • Sand Point, Michigan
    • Sand Point Michigan Weather
Re: ajaxgizmo.php but can't figure it out?
« Reply #3 on: July 25, 2010, 09:29:46 PM »
I believe you are describing the symptom I wrote about here...http://www.weather-watch.com/smf/index.php/topic,45661.msg371338.html#msg371338.

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
Code: [Select]
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 +';">&nbsp;'+Math.round(uv) +'&nbsp;'+ uvword +'&nbsp;</span>');
}; // end ajax_getUVrange function

with code...
Code: [Select]
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;\">&nbsp;"+langUVWords[1]+"&nbsp;</span>";
   } else if (uv < 6) {
       uvword = "<span style=\"border: solid 1px; color: black; background-color: #F7E400;\">&nbsp;"+langUVWords[2]+"&nbsp;</span>";
   } else if (uv < 8) {
       uvword =  "<span style=\"border: solid 1px; color: black; background-color: #F85900;\">&nbsp;"+langUVWords[3]+"&nbsp;</span>";
   } else if (uv < 11) {
       uvword =  "<span style=\"border: solid 1px; color: #FFFFFF; background-color: #D8001D;\">&nbsp;"+langUVWords[4]+"&nbsp;</span>";
   } else {
       uvword =  "<span style=\"border: solid 1px; color: #FFFF00; background-color: #998CFF;\">&nbsp;"+langUVWords[5]+"&nbsp;</span>";
   }
   return uvword;
} // end ajax_getUVrange function

I then packed the file into a new ajaxWDwx-packed.js.
« Last Edit: July 25, 2010, 09:36:52 PM by Dennis48755 »

abaldish

  • Guest
Re: ajaxgizmo.php but can't figure it out?
« Reply #4 on: July 26, 2010, 08:40:01 PM »
Thanks for the heads up on that, That fixed it with just changing it in the ajaxwdwx.