metarWeather block opens fully extended

Post Reply
User avatar
hdultra103
Observer
Observer
Posts: 15
Joined: Thu Nov 16, 2017 8:01 pm
Location: Gig Harbor, Washington
Station model: Davis Vantage Pro 2 Plus
Software: Weewx
Contact:

metarWeather block opens fully extended

Post by hdultra103 » Tue Nov 21, 2017 7:40 am

I installed the metarWeather block on my home page and set the required settings. When I open my webpage the metarWeather block loads fully open which makes it very long. Is there a way to make it not load fully open? I didn't see a setting for it not to. Thanks.

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: metarWeather block opens fully extended

Post by Jachym » Tue Nov 21, 2017 10:12 am

Hi,
rule number 1 - always include link :-)
viewtopic.php?f=75&t=53

Then I can see what is happening

User avatar
hdultra103
Observer
Observer
Posts: 15
Joined: Thu Nov 16, 2017 8:01 pm
Location: Gig Harbor, Washington
Station model: Davis Vantage Pro 2 Plus
Software: Weewx
Contact:

Re: metarWeather block opens fully extended

Post by hdultra103 » Tue Nov 21, 2017 4:01 pm

Understood. Here is a link to my page. http://highridge.myweather.site/templat ... esktop.php Thanks.

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: metarWeather block opens fully extended

Post by Jachym » Tue Nov 21, 2017 4:07 pm

OK I see, the number of METAR stations is variable, in your case there is quite a lot of them. I would recommend using the Custom METAR block, where the individual metars can be loaded separately

User avatar
meteocaldas
Language Admin
Language Admin
Posts: 111
Joined: Fri Aug 25, 2017 7:56 pm
Location: Caldas da Rainha, Portugal
Station model: OS WMR-88A
Software: Cumulus
Contact:

Re: metarWeather block opens fully extended

Post by meteocaldas » Tue Nov 21, 2017 10:01 pm

hdultra103 wrote: Tue Nov 21, 2017 7:40 am I installed the metarWeather block on my home page and set the required settings. When I open my webpage the metarWeather block loads fully open which makes it very long. Is there a way to make it not load fully open? I didn't see a setting for it not to. Thanks.
Hi!
I love the fantastic MetarWeather block (thanks Jachym!) as it shows all my country metars at once and it is very easy to order and compare their values.
However, I had the same annoying problem of the auto opening of the long metar list, because it forces the viewer to close it, before taking a look at the whole page.
I think that this mandatory auto-open thing, is the reason why, so far, I have not seen any other site using this very useful block.
I solved this problem by quoting 2 lines in metarWeatherBlock.php, that are related to all countries except CA and US.
In your case, since your country is US, quote the 2 lines at the bottom of the script, related to US as shown below.
The only disadvantage of this solution is that you will need to open your state metars by clicking in continent, country and then choose the state.
I could not test this solution because my country is not US, but I hope it will solve your problem, as it solved mine.
You can also take a look at my metarWeather block to check how it is working fine, just with those 2 lines quoted.
http://www.meteocaldas.com/mtp

<?php
if($stationCountry!="us" && $stationCountry!="ca"){
?>
// Quote next 2 lines to avoid auto-open for any country other than CA or US
// $("#metarWeatherData").html('<br><br><br><span class="spinnerMetar">Loading…</span><br><br><br>');
// $("#metarWeatherData").load("homepage/blocks/metarWeather/metarLoad.php?country=<?php echo $stationCountry?>");
<?php
}
else if($stationCountry=="ca"){
?>
// Quote next 2 lines to avoid auto-open if your country is CA
// $("#metarWeatherData").html('<br><br><br><span class="spinnerMetar">Loading…</span><br><br><br>');
// $("#metarWeatherData").load("homepage/blocks/metarWeather/metarLoad.php?country=ca&province=<?php echo strtoupper($defaultProvinceCA)?>");
<?php
}
else if($stationCountry=="us"){
?>
// Quote next 2 lines to avoid auto-open if your country is US
// $("#metarWeatherData").html('<br><br><br><span class="spinnerMetar">Loading…</span><br><br><br>');
// $("#metarWeatherData").load("homepage/blocks/metarWeather/metarLoad.php?country=us&state=<?php echo strtoupper($defaultUSState)?>");
<?php
}
?>
</script>


Image
Last edited by meteocaldas on Tue Nov 21, 2017 10:59 pm, edited 9 times in total.

User avatar
hdultra103
Observer
Observer
Posts: 15
Joined: Thu Nov 16, 2017 8:01 pm
Location: Gig Harbor, Washington
Station model: Davis Vantage Pro 2 Plus
Software: Weewx
Contact:

Re: metarWeather block opens fully extended

Post by hdultra103 » Tue Nov 21, 2017 10:24 pm

Thanks for the info guys. I'll play around with both ideas.

Post Reply