Only 1 problem though, this code needs to go into the AjaxWDwx.js too, because when the AJAX script kicks in the temperature color reverts back to black.
This is the code in that file which needs to be changed:
Bashy, that’s probably because the AJAX didn’t update properly. I’m currently testing the code,
so sometimes the code isn’t working and the red font stays because the AJAX doesn’t update
when it’s not working.
What you want is doable, but it will require a bit of code change to prevent interference and reset by the ‘green flash’ mechanism.
The existing functions in ajaxWDwx.js as
function reset_ajax_color( usecolor ) {
// reset all the <span class="ajax"...> styles to have no color override
var elements = get_ajax_tags();
var numelements = elements.length;
for (var index=0;index!=numelements;index++) {
var element = elements[index];
element.style.color=usecolor;
}
}
function set_ajax_obs( name, value ) {
// store away the current value in both the doc and the span as lastobs="value"
// change color if value != lastobs
var element = document.getElementById(name);
if (! element ) { return; } // V1.04 -- don't set if missing the <span id=name> tag
var lastobs = element.getAttribute("lastobs");
element.setAttribute("lastobs",value);
if (value != unescape(lastobs)) {
element.style.color=flashcolor;
if ( doTooltip ) { element.setAttribute("title",'AJAX tag '+name); }
element.innerHTML = value; // moved inside to fix flashing issue (Jim at jcweather.us)
}
}
could be amended to add a new function
function set_ajax_obsNF( name, value ) {
// store away the current value in both the doc and the span as lastobs="value"
// change color if value != lastobs
// no color change
var element = document.getElementById(name);
if (! element ) { return; } // V1.04 -- don't set if missing the <span id=name> tag
var lastobs = element.getAttribute("lastobs");
element.setAttribute("lastobs",value);
if (value != unescape(lastobs)) {
// element.style.color=flashcolor;
if ( doTooltip ) { element.setAttribute("title",'AJAX tag '+name); }
element.innerHTML = value; // moved inside to fix flashing issue (Jim at jcweather.us)
}
}
It was something like that I’d imagine needed to be done, but the problem was figuring out how to accomplish that.
Thanks you so much Ken, and I wish you a happy birthday!
Well, the clouds are coming closer in a few hours and the forecasts says some snow in the night and tomorrow. It will be the first real snow at my altitude, the peaks around here are already white.
+8C for overnight low is higher than many of the overnight lows we had here in July. :lol: