Page 5 of 9

Re: beteljuice AJAX testers wanted

Posted: Mon 29 Dec 2008 5:46 pm
by steve
dane wrote:But this is about weather stations, so who am I to argue with a weather specialist?
I'm no specialist. All my knowledge comes from the experts on the uk.sci.weather newsgroup :)

Steve

Re: beteljuice AJAX testers wanted

Posted: Mon 29 Dec 2008 11:03 pm
by gwheelo
After adding Firebug to my Firefox browser - I am showing 1 bug on http://www.wheelocknet.net/cumulus/now.htm - my Ajax page . See attached. The flagged "onload" instruction appears complete to me a novice- but perhaps it is looking for some more detail.

Anyone have a suggestion?

GW

Re: beteljuice AJAX testers wanted

Posted: Tue 30 Dec 2008 12:35 am
by beteljuice
Interesting !
You may have disovered something that was driving me insane with an even more complicated piece of code that worked in everything except FireFox.

Try changing the <body> statement to:

Code: Select all

<body onLoad="ajaxLoader('http://www.wheelocknet.net/cumulus/realtime.txt?' + new Date().getTime()); done=1;" onpageshow="if(!done){window.onLoad();}; done=0;"> 
Let me know if it works !

(I don't run FF)

Re: beteljuice AJAX testers wanted

Posted: Tue 30 Dec 2008 8:17 am
by gwheelo
No joy with new code.
see attachment.

GW

Re: beteljuice AJAX testers wanted

Posted: Fri 02 Jan 2009 12:02 pm
by beteljuice
Update:

Just to let you know, pre-release release has been delayed while I build some work arounds and 'belt and braces' stuff.

George (gwheelo) decided to test my mettle by having a page with:
  • Embedded style sheet
    in-line styles
    Two External style sheets
    Two External JavaScript calls at the end, which downloaded and ran more script (analytics / counter)
    .. and HTML comment errors (explained elswhere)
Bless Him

Once the html comment error had been discovered, the page sort of worked in FireFox using the body onLoad option.

However, it made me revisit the way that different browsers handle onLoad, and think about the different possible options for users to handle their browser cache.

onLoad has been dumped !

They all have a different idea of what it means !
Basically speaking, DHTML has to be 'rendered' by (put your browser here) before the script runs, else the inital data grab 'seems' to fail, and you have to wait until the next grab for information to appear.

'Rendering' may or may not take place before any external style sheets, etc. have downloaded.

What this means:
You have an empty element with no styles applied:
<div id="myDiv"></div> - There it is - NOT !
Until the users browser 'renders' the page it doesn't exist :roll:
Not very helpful when these are the very things that we are manipulating :cry:

In the next release there will be a looping check (with a safety timeout) to see if elements have been 'rendered' before the main script call.

This does mean that all html pages that use the script MUST have a new div id at the bottom of the page preferably immediately before the closing </body> tag.
Also, for some browsers there may be a slight inital delay before the data appears (<0.25s usually)

There will be some other tweaks, but the majority of variable names will be the same.

To be continued ............

Re: beteljuice AJAX testers wanted

Posted: Sat 03 Jan 2009 12:18 am
by gwheelo
I am going to take all that as a compliment. But there is no doubt that my complex ideas, sloppy html, and novice approach only results in passable webpages through the patient, thoughtful, and always tutorial assistance of people like, Beteljuice, Steve, Kevin, and all the other support characters on this great forum. Result, see: http://www.wheelocknet.net/cumulus/now.htm

And if anyone needs a beta tester - I have the track record now to make it break. Get past me and you have a winner!

Thanks everyone!

George Wheelock

Re: beteljuice AJAX testers wanted

Posted: Fri 09 Jan 2009 12:20 pm
by beteljuice
Hadn't thought about it but steve said elsewhere:
.. are you using the 'rename' option for ftp? Your realtime.txt file keeps disappearing briefly - this makes the data in your banner disappear. The rename option should stop this happening.
Same logic applies to anything trying to grab realtime.txt, including this AJAX routine ;)

Re: beteljuice AJAX testers wanted

Posted: Mon 19 Jan 2009 3:09 pm
by Paul C
I have a simple web page with this "ajax" on. Its just a copy of your orginal one with my name added on (sorry).

However it has proved quite useful today and can successfully report the snow falling script does work.

I would now like to edit it a little. I dont what all the temp etc in degrees F, just C will be fine and the pressure is OK in MB rather than anything else. Can you point me in the right direction for removing (safely) the bits I dont need, in otherwords all the duplicate variables to be removed ?

thanks

Re: beteljuice AJAX testers wanted

Posted: Mon 19 Jan 2009 3:30 pm
by beteljuice
I hope to shortly re-issue everything (still a few tweaks and cleaning up to do), there will be some minor changes and the snow / freeze calcs are part of that (sorry - should be more accurate :lol: )

You don't really need to worry about the javascript file, just edit the html page to suit.

Just look for the 'variable' names you don't want, and remove everything todo with that <span>

eg.

Now: <span class="ajax" id = "ajaxtemp_C"></span>&nbsp; / <span class="ajax" id = "ajaxtemp_F"></span>&nbsp;&nbsp;| Trend:<span id = "ajaxtemptrend"></span>

For C only would become:

Now: <span class="ajax" id = "ajaxtemp_C"></span>&nbsp;&nbsp;| Trend:<span id = "ajaxtemptrend"></span>

Have fun playing - that's what it's all about :mrgreen:

Re: beteljuice AJAX testers wanted

Posted: Tue 20 Jan 2009 8:52 am
by Paul C
Thanks,
Sorted most of that out, what about pressure though you have it in Hpa, would prefer just mb ?

Re: beteljuice AJAX testers wanted

Posted: Tue 20 Jan 2009 12:04 pm
by beteljuice
Bless .......

In the javascript, language section, look for;

Code: Select all

var langBaroRising = 'Risen %s hPa since last data'; /* used for 'change' arrow alt/title 
var langBaroFalling = 'Fallen %s hPa since last data';
Change hPa for mb

In the javascript, pressure section, look for the following lines:

Code: Select all


// hPa relative

Rset_ajax_obs("ajaxbaro_rel_hPa", pressure_rel_hPa.toFixed(1), " hPa");

// pressure Min / Max
Rset_ajax_obs("ajaxbaro_rel_hPa_Min", pressure_rel_hPa_Min.toFixed(1), " hPa");
Rset_ajax_obs("ajaxbaro_rel_hPa_Max", pressure_rel_hPa_Max.toFixed(1), " hPa");	


//   Barometric Trend (3 hour) - NB. cumulus gives an hourly average of last 3 hrs
Rset_ajax_obs("ajaxbarotrend_hPa_rate",pressure_rel_hPa_Trend_rate, " hPa");
Change any " hPa" for " mb"

You will have to do it all over again with the next build, but it will get you used to looking for 'patterns' in the code, and hopefully make you less afraid of such things.

Until you break it :lol:

Re: beteljuice AJAX testers wanted

Posted: Tue 20 Jan 2009 2:14 pm
by Paul C
I have a habit of breaking stuff !

When is your new version out ? I think I will stop fiddling until you have the new version as I was thinking of encorporating it into a new website I am planning on creating, I dont want to do all over it again.

"bless" :twisted:

Re: beteljuice AJAX testers wanted

Posted: Wed 28 Jan 2009 12:23 pm
by beteljuice
CODING ERROR !

I am STILL cleaning up / belts 'n' braces / new 'extras' etc. etc.

But the beteljuice has made a logical boo boo, that could affect the way your homebrew pages work.

The Zambretti JavaScript MUST be embedded in EVERY html page that calls the AJAX script, wether it is used or not :oops:

Code: Select all

<html>
.......
<head>

.......

<!-- zambretti forecast - also used by beteljuices 'weather map', as required -->
    <script type="text/javascript" src="zambretti/betel_cast.js"></script>

<!-- MAIN SCRIPT - getting nowhere without this -->
 <script type="text/javascript" src="betel_cumulus_ajax.js"></script>
</head>
<body>
..............
This will be fixed in the 'release' - honest !

Re: beteljuice AJAX testers wanted

Posted: Sun 15 Feb 2009 2:32 am
by beteljuice
Pre-Release Release :?

OK guys, here is the neatened up version.

http://www.beteljuice.com/cumulus/betel_cumulus.zip

Fot those that have gone before:

Major change - ALL html pages calling the script MUST have:

Code: Select all

<div id="ajaxEND" style="display; none:"></div>
just before the closing </body> tag
You can put these in your existing pages without ill-effect !

thermometerstr used in extras as a mouse-over (but could be an advisory ;) ) is now split into two;
thermometerstr_C
thermometerstr_F

bug-fix: no need to include zambtretti/betel_cast.js if not required.

added: ajax_gizmo.js
added: betel_more.html
added: basic.html

general, lots of code neatening, tweaks, belts and braces stuff.
Even more user language defined arrays (although you still may have to search for mouse-overs and extras)
The missing EXTRAS/baro_needle .... graphics are now there !
a few extra graphics.
including stuff/change_blank.gif to assist initial html page formating where you have a 'change since last' arrow.

A huge README.txt which has nearly everything you need to know in it !

Because of this, and any tweaks you may have made, I recommend you unzip / upload to a totally new directory, and copy any of your own html files accross, or just make new name copies as long as they reference the new 'ajax' directory.

No changes have been made to the /zambretti directory, so if you have changed the text / language you can just copy your existing stuff over the top.

betel_cumulus_ajax.js - Script with all the extras (extras are MPH)
KPHbetel_cumulus_ajax.js - Script with all the extras (extras are km/h)
KTSbetel_cumulus_ajax.js - Script with all the extras (extras are kts)
MPSbetel_cumulus_ajax.js - Script with all the extras (extras are m/s)
no_frills_betel_ajax.js - Script with NO extras
betel_cumulus_biggest_ajax.js - modified to run 'biggest' graphic ;)

See it working at http://www.beteljuice.com/cumulus/betel_index.html

Re: beteljuice AJAX testers wanted

Posted: Mon 16 Feb 2009 6:57 pm
by simsons
Hmm, i cant make it running.
I wrote good patch to directory and realtime.txt but always im getting something: