Welcome to the Cumulus Support forum.
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024
Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 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 V3 release 3.28.6 (build 3283) - 21 March 2024
Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 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
smb_ajax 1.3
Moderator: daj
-
- Posts: 1808
- Joined: Sat 17 Dec 2011 11:55 am
- Weather Station: Davis Vantage Pro2
- Operating System: Windows 11 x64
- Location: Dorset - UK
- Contact:
smb_ajax 1.3
Hi there!
I downloaded the file from this site a long time go - brilliant script for showing live updated values on your website.
As the weather has been appalling these past few days, i've decided to do a bit of tinkering on my site.
I've set the Javascript file to show a red colour each time an updated value occurs, but I was wondering if anyone clever enough would be able to add the option of choosing a font weight to it? I wanted to give it a bold look.
Regards.
I downloaded the file from this site a long time go - brilliant script for showing live updated values on your website.
As the weather has been appalling these past few days, i've decided to do a bit of tinkering on my site.
I've set the Javascript file to show a red colour each time an updated value occurs, but I was wondering if anyone clever enough would be able to add the option of choosing a font weight to it? I wanted to give it a bold look.
Regards.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 214
- Joined: Tue 24 Nov 2015 11:30 pm
- Weather Station: Fine Offset & Davis Vantage Vue
- Operating System: Windows 10; Raspbian Buster
- Location: Switzerland
Re: smb_ajax 1.3
I don't know any javascript, but you got me interested!
A bit of Googling suggests that you need to go the part in your file that says
and add
Now I don't know if you can put it in the same line, or if you need to repeat the whole line or what, but that should be the code you need!
My source was: https://en.wikibooks.org/wiki/JavaScrip ... ent_styles
Added:
After a bit more research, I think you need to change this section to:
Also, you'll probably need to turn the BOLD off again in the "reset_ajax_color" function. So after:
add an extra line to make:
Hope this helps!
A bit of Googling suggests that you need to go the part in your file that says
Code: Select all
if(flashtime!=0) ajx.style.color=flashcolour;
Code: Select all
ajx.style.fontWeight = "bold"; //makes the text bold
My source was: https://en.wikibooks.org/wiki/JavaScrip ... ent_styles
Added:
After a bit more research, I think you need to change this section to:
Code: Select all
if(flashtime!=0) {
ajx.style.color=flashcolour;
ajx.style.fontWeight = "bold";
}
Code: Select all
element.style.color='';
Code: Select all
element.style.color='';
element.style.fontWeight = "normal";
Last edited by ExperiMentor on Sat 17 Aug 2019 10:03 pm, edited 1 time in total.
- 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: smb_ajax 1.3
Not quite that straight-forward I'm afraid ...
Yes your code will make the text bold when the element is 'flashed', but ... how do you turn it off ?
You need to go down to ..
Yes your code will make the text bold when the element is 'flashed', but ... how do you turn it off ?
You need to go down to ..
Code: Select all
function reset_ajax_color( ) {
// reset all the <span class="ajax"...> styles to have no colour override
elements = getElementsByClass("span","ajax");
numelements = elements.length;
for (var index=0;index!=numelements;index++) {
element = elements[index];
element.style.color='';
// NEW ** turn off bold at end of flash period
element.style.fontWeight='normal';
}
}
......................Imagine, what you will KNOW tomorrow !
-
- Posts: 214
- Joined: Tue 24 Nov 2015 11:30 pm
- Weather Station: Fine Offset & Davis Vantage Vue
- Operating System: Windows 10; Raspbian Buster
- Location: Switzerland
Re: smb_ajax 1.3
I realised that too and made the same edit in parallel!!Not quite that straight-forward I'm afraid ...
GMTA!!
-
- Posts: 1808
- Joined: Sat 17 Dec 2011 11:55 am
- Weather Station: Davis Vantage Pro2
- Operating System: Windows 11 x64
- Location: Dorset - UK
- Contact:
Re: smb_ajax 1.3
Sweet - Nailed it!
Thanks guys!!
Bold was a little too much in the end, so as fontweight can use a numerical value, I went down the middle and set it at 600.
Thank you so much.
Thanks guys!!
Bold was a little too much in the end, so as fontweight can use a numerical value, I went down the middle and set it at 600.
Thank you so much.
-
- Posts: 1808
- Joined: Sat 17 Dec 2011 11:55 am
- Weather Station: Davis Vantage Pro2
- Operating System: Windows 11 x64
- Location: Dorset - UK
- Contact:
Re: smb_ajax 1.3
Back again!
Can the .js file (in my first post) be adapted to read from two different xml files with the same schema?
Can the .js file (in my first post) be adapted to read from two different xml files with the same schema?
- HansR
- Posts: 5957
- Joined: Sat 20 Oct 2012 6:53 am
- Weather Station: GW1100 (WS80/WH40)
- Operating System: Raspberry OS/Bookworm
- Location: Wagenborgen (NL)
- Contact:
Re: smb_ajax 1.3
Is there a working example to get on track quick and easy and see how far I can get to use it?
Hans
https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
-
- Posts: 1808
- Joined: Sat 17 Dec 2011 11:55 am
- Weather Station: Davis Vantage Pro2
- Operating System: Windows 11 x64
- Location: Dorset - UK
- Contact:
Re: smb_ajax 1.3
I can't quite remember where I got the info from, originally. I think it may have been from this forum?!
Here's the files I use, along with a quick explanation:
I get Cumulus MX to process the cumulusxml.xml file and then upload it as realtime.xml
I put this is the <head> section
I put this in my header file (it can go in any file that you want to grab data with)
Here's my example of grabbing some of the data:
As soon as new data in the realtime.xml appears, the data will change and flash red for a small duration.
I personally process and upload the file every 4 seconds.
The reason I ask if smb_ajax.js could be used to read two xml files at the same time is, I am now using a second instance of Cumulus MX to upload my Ecowitt GW-1000 data. I wanted to get that to upload it's own xml file with it's data so it could update like my Davis data does, albeit at 30 seconds rather than 4 seconds.
I was using a small workaround; I got Cumulus MX for the GW-1000 to upload the xml file with it's own data with the same name realtime.xml, each instance of Cumulus MX would overwrite the remote files. However, it caused a few issues.
Here's the files I use, along with a quick explanation:
I get Cumulus MX to process the cumulusxml.xml file and then upload it as realtime.xml
I put this is the <head> section
Code: Select all
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script src="smb_ajax.js"></script>
Code: Select all
<script>
//<![CDATA[
initialize('./realtime.xml', 4);
// ]]>
</script>
Code: Select all
<td style="text-align: left;">Inside Temperature:</td>
<td><span class="ajax" id="intemp"></span> °C</span></td>
<td style="text-align: left;">Inside Humidity:</td>
<td><span class="ajax" id="inhum"></span> %</span></td>
I personally process and upload the file every 4 seconds.
The reason I ask if smb_ajax.js could be used to read two xml files at the same time is, I am now using a second instance of Cumulus MX to upload my Ecowitt GW-1000 data. I wanted to get that to upload it's own xml file with it's data so it could update like my Davis data does, albeit at 30 seconds rather than 4 seconds.
I was using a small workaround; I got Cumulus MX for the GW-1000 to upload the xml file with it's own data with the same name realtime.xml, each instance of Cumulus MX would overwrite the remote files. However, it caused a few issues.
You do not have the required permissions to view the files attached to this post.
- HansR
- Posts: 5957
- Joined: Sat 20 Oct 2012 6:53 am
- Weather Station: GW1100 (WS80/WH40)
- Operating System: Raspberry OS/Bookworm
- Location: Wagenborgen (NL)
- Contact:
Re: smb_ajax 1.3
Thanks, something to digest
Hans
https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
- 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: smb_ajax 1.3
I'm unsure what you are asking ?
The script can parse any correct format xml file you declare:
initialize('./realtime.xml', 4);
However; In any one 'page' the output can only be used once (last one in), so you couldn't have eg. two tables with different data sources.
If you are talking about different pages for the different data, but still using the script, then the second xml file will need to have a different filename and / or path_to/filename
The script can parse any correct format xml file you declare:
initialize('./realtime.xml', 4);
However; In any one 'page' the output can only be used once (last one in), so you couldn't have eg. two tables with different data sources.
If you are talking about different pages for the different data, but still using the script, then the second xml file will need to have a different filename and / or path_to/filename
......................Imagine, what you will KNOW tomorrow !
-
- Posts: 1808
- Joined: Sat 17 Dec 2011 11:55 am
- Weather Station: Davis Vantage Pro2
- Operating System: Windows 11 x64
- Location: Dorset - UK
- Contact:
Re: smb_ajax 1.3
That's exactly it.beteljuice wrote: ↑Sat 23 Nov 2019 10:18 pm I'm unsure what you are asking ?
The script can parse any correct format xml file you declare:
initialize('./realtime.xml', 4);
However; In any one 'page' the output can only be used once (last one in), so you couldn't have eg. two tables with different data sources.
I have two xml files I want to read and show the data on the same page. That's why I asked if it was possible to have the smb_ajax read from two xml's. The structure is the same, it just contains different data values.
realtime.xml and gw1000.xml
- 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: smb_ajax 1.3
... but the output variables are the same names !
= can't be done
= can't be done
......................Imagine, what you will KNOW tomorrow !