Welcome to the Cumulus Support forum.
Latest Cumulus MX V4 release 4.0.1 (build 4023) - 16 May 2024
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024
Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)
Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki
Latest Cumulus MX V4 release 4.0.1 (build 4023) - 16 May 2024
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024
Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)
Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki
Auto-refresh Website Index Page Without Using Meta Refresh
Moderator: daj
-
- Posts: 642
- Joined: Mon 25 Jan 2010 1:55 pm
- Weather Station: Watson W-8681
- Operating System: Raspian
- Location: Brighton, UK
- Contact:
Re: Auto-refresh Website Index Page Without Using Meta Refre
Ooops, Sorry Dan, there was an error in that code I quoted. I've upated my post.
- beteljuice
- Posts: 3292
- Joined: Tue 09 Dec 2008 1:37 pm
- Weather Station: None !
- Operating System: W10 - Threadripper 16core, etc
- Location: Dudley, West Midlands, UK
Re: Auto-refresh Website Index Page Without Using Meta Refre
In a similar fashion, all your other JS created Hi / Lo, weather / wind icon decision coding needs to moved / modded into the ajax 'loop'
Welcome to the world of bespoke coding - to paraphrase Oscar Wilde "The pure and simple page is rarely pure and never simple" !
But you do feel so good when a little graphic changes or some text suddenly appears
Welcome to the world of bespoke coding - to paraphrase Oscar Wilde "The pure and simple page is rarely pure and never simple" !
But you do feel so good when a little graphic changes or some text suddenly appears
......................Imagine, what you will KNOW tomorrow !
-
- Posts: 363
- Joined: Wed 03 Mar 2010 10:20 am
- Weather Station: Vantage Pro2 w/ daytime FARS
- Operating System: Windows 10
- Location: Brisbane, Australia
- Contact:
Re: Auto-refresh Website Index Page Without Using Meta Refre
Thanks Paul / Daj,
I can see some more lost hours in front of the screen coming up for me.
I can see some more lost hours in front of the screen coming up for me.
Dan
http://www.brisbaneliveweather.com
A man with a thermometer always knows the temperature. A man with two thermometers, not so sure.
http://www.brisbaneliveweather.com
A man with a thermometer always knows the temperature. A man with two thermometers, not so sure.
-
- Posts: 363
- Joined: Wed 03 Mar 2010 10:20 am
- Weather Station: Vantage Pro2 w/ daytime FARS
- Operating System: Windows 10
- Location: Brisbane, Australia
- Contact:
Re: Auto-refresh Website Index Page Without Using Meta Refre
Thanks again Paul & Daj.
The script works well and easy enough to get up and running. Paul, thanks for the tip about the trend arrows. I was able to use that info to get all my other bits to update as well. Its a bit clunky in Chrome (okay in IE and FF) when fetching the wind direction graphic etc, but I can live with that.
The script works well and easy enough to get up and running. Paul, thanks for the tip about the trend arrows. I was able to use that info to get all my other bits to update as well. Its a bit clunky in Chrome (okay in IE and FF) when fetching the wind direction graphic etc, but I can live with that.
Dan
http://www.brisbaneliveweather.com
A man with a thermometer always knows the temperature. A man with two thermometers, not so sure.
http://www.brisbaneliveweather.com
A man with a thermometer always knows the temperature. A man with two thermometers, not so sure.
-
- Posts: 363
- Joined: Wed 03 Mar 2010 10:20 am
- Weather Station: Vantage Pro2 w/ daytime FARS
- Operating System: Windows 10
- Location: Brisbane, Australia
- Contact:
Re: Auto-refresh Website Index Page Without Using Meta Refre
Hi Guys,
I need some help with some conversions & calculations and the <span> tags.
Previously, I was running some js to convert and display wind speed km/h to knots (for fishing buddies) easily enough. The old script was:
<script type="text/javascript">
var speed = "<#wlatest>";
var speedknots = Math.abs(speed*0.54*10)/10;
document.write(speedknots.toFixed(1));
</script> kts
I have been able to get the do a similar thing using the realtimereader.js by using:
var spknots = rawdata[6];
$("#speedknots").html(Math.abs(spknots*0.54*10)/10);
and the span tag is <span id="speedknots"></span>
However, this will give 1.6 km/h as 0.8640000000000001 knots.
How am I able to display with 1 decimal point, ie, as 0.8 knots. Am I close or way off the mark here?
I have tried several variants but it usually breaks the javascript.
Thanks in advance.
I need some help with some conversions & calculations and the <span> tags.
Previously, I was running some js to convert and display wind speed km/h to knots (for fishing buddies) easily enough. The old script was:
<script type="text/javascript">
var speed = "<#wlatest>";
var speedknots = Math.abs(speed*0.54*10)/10;
document.write(speedknots.toFixed(1));
</script> kts
I have been able to get the do a similar thing using the realtimereader.js by using:
var spknots = rawdata[6];
$("#speedknots").html(Math.abs(spknots*0.54*10)/10);
and the span tag is <span id="speedknots"></span>
However, this will give 1.6 km/h as 0.8640000000000001 knots.
How am I able to display with 1 decimal point, ie, as 0.8 knots. Am I close or way off the mark here?
I have tried several variants but it usually breaks the javascript.
Thanks in advance.
Dan
http://www.brisbaneliveweather.com
A man with a thermometer always knows the temperature. A man with two thermometers, not so sure.
http://www.brisbaneliveweather.com
A man with a thermometer always knows the temperature. A man with two thermometers, not so sure.
-
- Posts: 642
- Joined: Mon 25 Jan 2010 1:55 pm
- Weather Station: Watson W-8681
- Operating System: Raspian
- Location: Brighton, UK
- Contact:
Re: Auto-refresh Website Index Page Without Using Meta Refre
Dan,captzero wrote:Hi Guys,
I need some help with some conversions & calculations and the <span> tags.
Previously, I was running some js to convert and display wind speed km/h to knots (for fishing buddies) easily enough. The old script was:
<script type="text/javascript">
var speed = "<#wlatest>";
var speedknots = Math.abs(speed*0.54*10)/10;
document.write(speedknots.toFixed(1));
</script> kts
I have been able to get the do a similar thing using the realtimereader.js by using:
var spknots = rawdata[6];
$("#speedknots").html(Math.abs(spknots*0.54*10)/10);
and the span tag is <span id="speedknots"></span>
However, this will give 1.6 km/h as 0.8640000000000001 knots.
How am I able to display with 1 decimal point, ie, as 0.8 knots. Am I close or way off the mark here?
I have tried several variants but it usually breaks the javascript.
Thanks in advance.
Based on the script you quoted above that worked, try this in the realtimereader.js
Code: Select all
var spknots = rawdata[6];
var speedknots = Math.abs(spknots*0.54*10)/10;
var speedknots = speedknots.toFixed(1);
$("#speedknots").html(speedknots);
The <span id="speedknots"></span> stays the same in your HTML.
-
- Posts: 363
- Joined: Wed 03 Mar 2010 10:20 am
- Weather Station: Vantage Pro2 w/ daytime FARS
- Operating System: Windows 10
- Location: Brisbane, Australia
- Contact:
Re: Auto-refresh Website Index Page Without Using Meta Refre
Works like a dream. Thanks Paul.Synewave wrote:Untested, but logically should work
I knew I had to add .toFixed(1) somewhere.
And, thanks for the quick reply too.
Dan
http://www.brisbaneliveweather.com
A man with a thermometer always knows the temperature. A man with two thermometers, not so sure.
http://www.brisbaneliveweather.com
A man with a thermometer always knows the temperature. A man with two thermometers, not so sure.
- mcrossley
- Posts: 12904
- Joined: Thu 07 Jan 2010 9:44 pm
- Weather Station: Davis VP2/WLL
- Operating System: Bullseye Lite rPi
- Location: Wilmslow, Cheshire, UK
- Contact:
Re: Auto-refresh Website Index Page Without Using Meta Refre
Why Math.abs() are you expecting it to go negative?
Math.round(spknots*0.54*10)/10
Math.round(spknots*0.54*10)/10
- mcrossley
- Posts: 12904
- Joined: Thu 07 Jan 2010 9:44 pm
- Weather Station: Davis VP2/WLL
- Operating System: Bullseye Lite rPi
- Location: Wilmslow, Cheshire, UK
- Contact:
Re: Auto-refresh Website Index Page Without Using Meta Refre
Second thoughts, as you are using .toFixed() - required for those pesky n.0 values - then all you need is:
var speedknots = rawdata[6]*0.54;
speedknots = speedknots.toFixed(1);
$("#speedknots").html(speedknots);
var speedknots = rawdata[6]*0.54;
speedknots = speedknots.toFixed(1);
$("#speedknots").html(speedknots);
- beteljuice
- Posts: 3292
- Joined: Tue 09 Dec 2008 1:37 pm
- Weather Station: None !
- Operating System: W10 - Threadripper 16core, etc
- Location: Dudley, West Midlands, UK
Re: Auto-refresh Website Index Page Without Using Meta Refre
Or as a one-liner
$("#speedknots").html((rawdata[6]*054).toFixed(1));
but not so easy on the mind or the eye
$("#speedknots").html((rawdata[6]*054).toFixed(1));
but not so easy on the mind or the eye
......................Imagine, what you will KNOW tomorrow !
- Andy
- Posts: 44
- Joined: Tue 07 Sep 2010 12:39 pm
- Weather Station: Davis Vantage Vue
- Operating System: Windows 10 64bit
- Location: Hawkenbury, Tunbridge Wells, Kent
- Contact:
Re: Auto-refresh Website Index Page Without Using Meta Refre
Paul,Synewave wrote:It seems many want their index page to automatically refresh without having to press F5. Any many don't want to get into the realms of changing their site to use the PHP methods available in the forum.
Here is a simple way to achieve this using Javascript that will refresh the weather data on your index page automatically every 15 seconds. It works by reading the data from your realtime.txt file (providing you already have Cumulus set to upload that).
Thanks - I had been after an auto update process.
Last edited by daj on Fri 18 Mar 2011 7:37 pm, edited 1 time in total.
Reason: fixed 'quoting' issue
Reason: fixed 'quoting' issue
-
- Posts: 47
- Joined: Tue 18 Jan 2011 9:36 pm
- Weather Station: Davis Vantage Vue
- Operating System: Window 7.0
- Location: Canada
Re: Auto-refresh Website Index Page Without Using Meta Refre
Hello everybody,
Hope someone can help me.
Installed Paul's autorefresh and did some modification but then sometime after the update I am getting garbage as shown on the attached picture. Then a manual refresh or if you wait for the next refresh, it will display OK.
Any idea what could be the problem?
if you want to see the page here is the link
http://pages.videotron.com/meteo/yvan
thanks for your help
Yvan
Hope someone can help me.
Installed Paul's autorefresh and did some modification but then sometime after the update I am getting garbage as shown on the attached picture. Then a manual refresh or if you wait for the next refresh, it will display OK.
Any idea what could be the problem?
if you want to see the page here is the link
http://pages.videotron.com/meteo/yvan
thanks for your help
Yvan
You do not have the required permissions to view the files attached to this post.
- mcrossley
- Posts: 12904
- Joined: Thu 07 Jan 2010 9:44 pm
- Weather Station: Davis VP2/WLL
- Operating System: Bullseye Lite rPi
- Location: Wilmslow, Cheshire, UK
- Contact:
Re: Auto-refresh Website Index Page Without Using Meta Refre
It looks like the fetch of the data actually got a Error 404 page rather than the data. I put some code in my autorefresh to check the contents of the returned data before trying to use in.
-
- Posts: 132
- Joined: Thu 26 Jun 2008 5:51 am
- Weather Station: Davis VP2 + Solar
- Operating System: A20 TV box + CumulusMX
- Location: Slov.Konjice, Slovenia
- Contact:
Re: Auto-refresh Website Index Page Without Using Meta Refre
Good script
What about some flashcolor for changed data?
What about some flashcolor for changed data?
- mcrossley
- Posts: 12904
- Joined: Thu 07 Jan 2010 9:44 pm
- Weather Station: Davis VP2/WLL
- Operating System: Bullseye Lite rPi
- Location: Wilmslow, Cheshire, UK
- Contact:
Re: Auto-refresh Website Index Page Without Using Meta Refre
I have done that on my 'now' page. You need to store all the values, then on the next refresh compare new with old. If different set a 'newValue' style to change the colour. Then at the end of the update routine overwrite the 'old' values with the new and set a 'setTimout()' to call another function after say 10 seconds the clears the new value styles.TgT wrote:Good script
What about some flashcolor for changed data?
--sent from my phone