Welcome to the new home of the Cumulus Support forum.

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3044 7 December 2018. See the Wiki for download

beteljuice AJAX testers wanted

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

User avatar
beteljuice
Posts: 2516
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: beteljuice AJAX testers wanted

Post by beteljuice » Sat 09 May 2009 3:22 pm

IE8 - Argggh !

Just installed IE8 :roll:

Have discovered that I need to do some tweaks to make the ajax 'flash' colour change to work.

All I have to do now is work out all my different 'working' versions, rezip all the correct files again

... and then repost here when I've done it.

... might be a while :|
Image
......................Imagine, what you will KNOW tomorrow !

User avatar
beteljuice
Posts: 2516
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: beteljuice AJAX testers wanted

Post by beteljuice » Sat 09 May 2009 6:32 pm

IE8 Tweaks

For those who are happy editing the Javascript files, here is a 'replacement section'.

Code: Select all

// --- you don't need to customize the stuff below, the actions are controlled by the 
//  settings above.  

var ie4=document.all;
var browser = navigator.appName;
var ie8 = false;	// this and below NEW for IE8
if (ie4 && /MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
 var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
 if (ieversion>=8) {
   ie4=false;
   ie8=true;
 }
}
var counterSecs = 0;  // for MCHALLIS counter script from weather-watch.com (adapted by K. True)
var updates = 0;		// update counter for limit by maxupdates
var lastajaxtimeformat = 'unknown'; //used to reset the counter when a real update is done
var doTooltip = 0;   // set to 1 to have ajaxed variable names appear as tooltips (except for graphics)


// utility functions to navigate the HTML tags in the page (tweaked for IE8)

function get_ajax_tags ( ) {
// search all the span tags and return the list with class="ajax" in it
//
  if (ie4 && browser != "Opera" && ! ie8) {
    var elem = document.body.getElementsByTagName('span');
	var lookfor = 'className';
  } else {
    var elem = document.getElementsByTagName('span');
	var lookfor = 'class';
  }
     var arr = new Array();
	 var iarr = 0;
     for(var i = 0; i < elem.length; i++) {
          var att = elem[i].getAttribute(lookfor);
          if(att == 'ajax') {
               arr[iarr] = elem[i];
               iarr++;
          }
     }

     return arr;
}	// END function get_ajax_tags


function check_ajax_class(elem) {	// tweaked for IE8
// check element id for class="ajax" in it

  if (ie4 && browser != "Opera" && ! ie8) {
	var lookfor = 'className';
  } else {
	var lookfor = 'class';
  }

  var class_check = "";
  var att = elem.getAttribute(lookfor);
  if(att == 'ajax') {
       class_check = 1;
   }
   return class_check;
}
// --- END function check_ajax_class()


Image
......................Imagine, what you will KNOW tomorrow !

6719jason
Posts: 517
Joined: Wed 08 Apr 2009 12:38 pm
Weather Station: Was a La-Crosse WS2300 Serial
Operating System: None
Location: Weeley, Essex, UK

Re: beteljuice AJAX testers wanted

Post by 6719jason » Thu 18 Jun 2009 6:20 pm

Good Evening Beteljuice,

What Fantastic work you have done on the Ajax Pages, I have just installed them onto my site.

You can view Ajax at http://weeleyweatherstation.info/ajax/betel_index.html

Thanks Again.

All working well here.

Jason

n9mfk
Posts: 845
Joined: Sun 10 May 2009 8:52 pm
Weather Station: davis vp2 Serial datalogger
Operating System: Windows 7 64-bit
Location: Springfield, IL

Re: beteljuice AJAX testers wanted

Post by n9mfk » Tue 23 Jun 2009 2:04 am

Hi Beteljuice, has anyone come whit any thing for people that use noscript
so that they get weather data eve if scripting is off?
Beau

User avatar
beteljuice
Posts: 2516
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: beteljuice AJAX testers wanted

Post by beteljuice » Tue 23 Jun 2009 3:56 am

Basic data you could put in Cumulus Template style

eg. Temp. <span id="ajaxtemp_C"><#temp></span>
and for 'calculated' values put N/A in between <span> tags.

There is no reason why you can't have a cumulus template which is also 'ajaxed' ;)

But a far more robust way would be to duplicate the ajax script in eg. php, so that you could pre-populate all the calculated values (eg. cloud base height, feelslike values, graphic placements, etc.) before it gets to the viewers browser. Although, of course, if JavaScript is NOT enabled there won't be any auto-updating.

Nowadays it's usually paranoid work place PCs that have it disabled, and frown upon non-intranet use anyway !
Image
......................Imagine, what you will KNOW tomorrow !

n9mfk
Posts: 845
Joined: Sun 10 May 2009 8:52 pm
Weather Station: davis vp2 Serial datalogger
Operating System: Windows 7 64-bit
Location: Springfield, IL

Re: beteljuice AJAX testers wanted

Post by n9mfk » Tue 23 Jun 2009 8:16 pm

Hi Beteljuice, Thanks one thing how is figured
ajaxfeelslike_F thanks

User avatar
beteljuice
Posts: 2516
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: beteljuice AJAX testers wanted

Post by beteljuice » Tue 23 Jun 2009 10:03 pm

Not really proper to this topic, but it might be the section of code that goes:

Code: Select all

// ------ FeelsLike ------------------------------------------------------------------------------
		  if (temp_C <= 16.0 ) {		 // note.. using temps in C and converting for F
		 		feelslike_C = windchill_C; //use WindChill
			} else if (temp_C >=27.0 && humidity >= 40) {
		 		feelslike_C = heatidx_C;   // use HeatIndex
			} else {
				feelslike_C = temp_C
			}
	    Rset_ajax_obs("ajaxfeelslike_C", feelslike_C.toFixed(1), "&deg;C");
			feelslike_F = ((feelslike_C * 1.8) +32).toFixed(1);
 	    Rset_ajax_obs("ajaxfeelslike_F", feelslike_F, "&deg;F");

// used for thermometer 'mouseover'
			thermometerstr_C = langThermoCurrently +  temp_C.toFixed(1) + "\&deg;C, Feels like " + feelslike_C + "\&deg;C"; 
			thermometerstr_F = langThermoCurrently +  temp_F.toFixed(1) + "\&deg;F, Feels like " + feelslike_F + "\&deg;F"; 
// END feels like

However, most if not all wx kit make the Heat Index = temperature when not applicable, rather than giving it a 'null' value.

So the logic could be simplified to:

feelslike = Heat Index // default value
if Windchill is LESS THAN temp then feelslike is equal to Windchill.

We can say this, because by the same illogic logic, windchill is 'tied' to temp when not applicable :?

Hope that lightens your darkness Beau.
Image
......................Imagine, what you will KNOW tomorrow !

n9mfk
Posts: 845
Joined: Sun 10 May 2009 8:52 pm
Weather Station: davis vp2 Serial datalogger
Operating System: Windows 7 64-bit
Location: Springfield, IL

Re: beteljuice AJAX testers wanted

Post by n9mfk » Wed 24 Jun 2009 2:41 pm

Hi Beteljuice,
i have found this needs changed
from

Code: Select all

<div id="ajaxEND" style="display; none:"></div>
to

Code: Select all

<div id="ajaxEND" style="display: none;"></div>
that way the css will vaildate
beau

User avatar
beteljuice
Posts: 2516
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: beteljuice AJAX testers wanted

Post by beteljuice » Wed 24 Jun 2009 6:25 pm

Ooops - now I've got to check all my zips, and ongoing updates and .....

Hmm .. something strange has happened !

CSS validation - which worked (honest) now says a basic font face doesn't exist - don't you just love 'standards'

... to be investigated ... :shock:

Thanks for the feed-back :?
Image
......................Imagine, what you will KNOW tomorrow !

n9mfk
Posts: 845
Joined: Sun 10 May 2009 8:52 pm
Weather Station: davis vp2 Serial datalogger
Operating System: Windows 7 64-bit
Location: Springfield, IL

Re: beteljuice AJAX testers wanted

Post by n9mfk » Wed 24 Jun 2009 8:28 pm

were the best place to watch for updates
thanks

User avatar
beteljuice
Posts: 2516
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: beteljuice AJAX testers wanted

Post by beteljuice » Wed 24 Jun 2009 11:50 pm

Here - when I get round to it and stop playing :oops: , too many irons in the fire I'm afraid :roll:

eg. very much work in prog - project to create a 'content' builder front-end, many, many problems to resolve. may never see the light of day :lol:
Last edited by beteljuice on Sun 18 Nov 2018 5:10 am, edited 2 times in total.
Image
......................Imagine, what you will KNOW tomorrow !

n9mfk
Posts: 845
Joined: Sun 10 May 2009 8:52 pm
Weather Station: davis vp2 Serial datalogger
Operating System: Windows 7 64-bit
Location: Springfield, IL

Re: beteljuice AJAX testers wanted

Post by n9mfk » Mon 29 Jun 2009 5:53 pm

Hi Beteljuice,
i have a test page http://www.n9mfk.com/testpage.php
the ajax for yje temp update does not seem to update
im using fire fox any ideas ?

User avatar
beteljuice
Posts: 2516
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: beteljuice AJAX testers wanted

Post by beteljuice » Tue 30 Jun 2009 12:02 am

.. the ajax for yje temp ..
:?:
As far as I can see all your temperatures seem to be updating. (I assume you are using Cumulus for HeatIndex and php to generate 'feelslike', as you are not using ajaxheatidx_F and ajaxfeelslike_F)

BTW, you need to do the IE 8 'fix' mentioned earlier so that the green 'flash' works correctly.
Image
......................Imagine, what you will KNOW tomorrow !

n9mfk
Posts: 845
Joined: Sun 10 May 2009 8:52 pm
Weather Station: davis vp2 Serial datalogger
Operating System: Windows 7 64-bit
Location: Springfield, IL

Re: beteljuice AJAX testers wanted

Post by n9mfk » Tue 30 Jun 2009 1:28 am

Hi Beteljuice,
If i look at the page some times when the windchill turns green the temperature does not
i did some php for feels like
any ideas

User avatar
beteljuice
Posts: 2516
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: beteljuice AJAX testers wanted

Post by beteljuice » Tue 30 Jun 2009 2:10 am

n9mfk wrote:Hi Beteljuice,
If i look at the page some times when the windchill turns green the temperature does not
.....
any ideas
Simple ! - the windchill has changed, but the temperature hasn't ;)
The betejuice_ajax only processes data that has CHANGED.
Image
......................Imagine, what you will KNOW tomorrow !

Post Reply