Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025

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

If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080

HTML "Title" to pop-up explanantion of fields

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

Moderator: daj

Post Reply
User avatar
mikechristelow
Posts: 165
Joined: Wed 01 Feb 2012 9:33 pm
Weather Station: Watson W8681 (solar)
Operating System: Windows XP SP3
Location: Crewe, Cheshire
Contact:

HTML "Title" to pop-up explanantion of fields

Post by mikechristelow »

I can never get the hang of when wind chill and heat index apply so have to keep looking these up. I decided to modify my Cumulus web page (the indexT.html page) to provide a little pop-up explanation of the criteria, whenever the cursor hovers over the text - see the attached picture.

You can do this using the HTML "abbr" (abbreviation) and "title" features. Edit the indexT.html file (best save a copy beforehand, just in case) and then change (for example)

<td>Windchill</td>

to

<td><abbr title="Wind chill is only defined for temperatures at or below 10 °C (50 °F) and wind speeds above 4.8 kilometres per hour (3.0 mph)">Windchill</abbr></td>

where
- the text enclosed in "" is what will appear in the pop-up (you can put whatever definition you want here of course), and
- Windchill is the text as it appears on the Cumulus web page

The next time Cumulus runs a web page update you will be able to hover the cursor over the Windchill label and the long text will pop-up automatically. Obviously you can use the same technique on any of the lables. :clap:

All I need to do now is sort out how to use an "if ... then ... else" statement so that the actual values for Windchill and Heat Index are shown only when they are applicable, and I display "N/A" or "---" when they are not. :)

Mike
You do not have the required permissions to view the files attached to this post.
http://www.christelow.co.uk
“It's snowing still," said Eeyore gloomily.
"So it is."
"And freezing."
"Is it?"
"Yes," said Eeyore. "However," he said, brightening up a little, "we haven't had an earthquake lately.”

duke

Re: HTML "Title" to pop-up explanantion of fields

Post by duke »

Nice idea, I like that. Something else to occupy my time ;)

Duke
Matt.j5b
Posts: 512
Joined: Mon 28 Nov 2011 2:13 am
Weather Station: Davis VP2/ WLL with DFARS
Operating System: RPi Raspbian (Buster)
Location: Ferny Grove, Brisbane, Australia
Contact:

Re: HTML "Title" to pop-up explanantion of fields

Post by Matt.j5b »

I was doing the same thing with the pop up labels to explain what heat index, wind chill etc are which I did yesterday, before I set up my website, hopefully today.
Regards, Matt of Brisbane, Australia
Ferny Grove Weather
Image
User avatar
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: HTML "Title" to pop-up explanantion of fields

Post by beteljuice »

I must admit I've never used it, but as far as I can tell the only difference between using title=".. in <abbr> and in <span> is the dotted underline when using <abbr>.
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
GraemeT
Posts: 312
Joined: Wed 21 Oct 2009 11:19 am
Weather Station: La Crosse WS-2355 & WS-2306
Operating System: Windoze 7, 10, 11
Location: Bayswater, Australia
Contact:

Re: HTML "Title" to pop-up explanantion of fields

Post by GraemeT »

You could use something like this:

Code: Select all

<?php
if ($temp<="10") 
		echo '<td>Windchill</td><td class="obs_data"><span class="ajax" id="wchill"></span></td>';
		else if (($temp>"27") && ($dew>"12") && ($hum>"40"))
		echo '<td>Heat Index</td><td class="obs_data"><span class="ajax" id="heatindex"></span></td>';
		else echo '<td></td><td class="obs_data"></td>';
?>
to decide whether to display windchill,heatindex, or nothing.
Cheers,
Graeme.
User avatar
mikechristelow
Posts: 165
Joined: Wed 01 Feb 2012 9:33 pm
Weather Station: Watson W8681 (solar)
Operating System: Windows XP SP3
Location: Crewe, Cheshire
Contact:

Re: HTML "Title" to pop-up explanantion of fields

Post by mikechristelow »

Cheers Graeme. I assume (please excuse my naieivty) that this implies the use of PHP which I'm not using (as far as I know). I was hoping to be able to do this with javascript and html only.
http://www.christelow.co.uk
“It's snowing still," said Eeyore gloomily.
"So it is."
"And freezing."
"Is it?"
"Yes," said Eeyore. "However," he said, brightening up a little, "we haven't had an earthquake lately.”

User avatar
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: HTML "Title" to pop-up explanantion of fields

Post by beteljuice »

To replace a line in the table with Heat Index / Windchill / (nothing) assuming you are using <#webtags> , temperature / dew in deg C and JavaScript:
(and using GraemeT logic)

Code: Select all

<tr class="td_temperature_data">
   <script language="JavaScript" type="text/javascript">
   document.write((<#RCtemp> >= 10 ? "<td>Windchill</td><td><#wchill>&nbsp;<#tempunit></td>" : (<#RCtemp> > 27 && <#RCdew> > 12 && <#RChum> > 40 ? "<td>Heat Index</td><td><#heatindex>&nbsp;<#tempunit></td>" : "<td>&nbsp;</td><td>&nbsp;</td>")));
    </script>
    <noscript><td>&nbsp;</td><td>&nbsp;</td></noscript>
    <td>Right-hand column description</td>
    <td>Right-hand column data (and unit)</td>
</tr>
It's been awhile since I used double ternary notation, but I think that's right :?
The use of <#RCxxxx> makes it 'transportable' for those who use , as a decimal seperator.

But as you are going to have to rearrange your <table> contents, why not get rid of Heat Index and Windchill and just put Apparent Temp underneath Temp ?
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
MickinMoulden
Posts: 499
Joined: Mon 20 Dec 2010 12:12 pm
Weather Station: WS-1081 with rain gauge mod
Operating System: Windows 7 & 1.9.3 b1059
Location: Palmerston, NT, Australia
Contact:

Re: HTML "Title" to pop-up explanantion of fields

Post by MickinMoulden »

I've been using these for months. Got 19 on just the home page. Quite handy. I don't use the <abrr> thingy, just the title=. I use it for explanations, more information, or for comparing records. In my monthly records, it will display yearly records when you hover over. In my yearly, it displays All-Time records. It makes it much easier to make comparisons for Facebook updates. Then everyone thinks I'm really clever....or a number nerd. mmmmm. Good idea with the HI and WC. I think we got a wind chill once?
Michael, Palmerston, NT Australia www.Palmerston-WeatherImageNo image? I'm offline!
ImageImage
User avatar
GraemeT
Posts: 312
Joined: Wed 21 Oct 2009 11:19 am
Weather Station: La Crosse WS-2355 & WS-2306
Operating System: Windoze 7, 10, 11
Location: Bayswater, Australia
Contact:

Re: HTML "Title" to pop-up explanantion of fields

Post by GraemeT »

Mike,
I struggle with javascript (some would say say I struggle with php as well), but I think Beteljuice has it nailed.

If using ajax to update the data live, you might also find that the use of <#RCxxxx> is necessary to avoid anchor definition errors, as the <span> tag doesn't like to use an anchor more than once on a page. I've found it is possible to define additional "pseudo" tags within cumulus.xml to overcome this.
For example, if you want to use a tag twice on the page, once in the header and again in the page body, the following will achieve the result without an error:

Code: Select all

<item name="currentwdir">
	<value><#currentwdir></value>
	<unit></unit>
	<image></image>
	<class>dynamic</class>
	<description>Current (latest) wind bearing as read from the console as a compass point</description>
</item>
<item name="currentwdir2">
	<value><#currentwdir></value>
	<unit></unit>
	<image></image>
	<class>dynamic</class>
	<description>Copy of currentwdir</description>
</item>
Be aware though, the cumulus.xml file tends to grow quickly if you add too many items, and the bigger it is, the longer it takes to load at the client end at each update.
Cheers,
Graeme.
Post Reply