javascript for weather data

User avatar
Posts: 13379
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

javascript for weather data

Post by ChrisGreaves »

I am feeling particularly pleased with myself, but also with Marc Knoll.
I am now in my fourth year of using a bookmark

Code: Select all|2021-05-31&dlyRange=2006-07-09|2021-05-31&mlyRange=2006-08-01|2007-07-01&StationID=45047&Prov=NL&urlExtension=_e.html&searchType=stnName&optLimit=yearRange&StartYear=2020&EndYear=2021&selRowPerPage=100&Line=0&searchMethod=contains&txtStationName=bonavista&timeframe=2&Day=1&Year=2019&Month=02#
and then laboriously editing the URL in the URL box to see what is happening this month.
Thanks to Mark I now have a little javascript that (until ten minutes ago) automatically showed me this month's depressing data.
I say "ten minutes ago" because I became brave enough to add a "minus one" factor to the year calculation to see if I could bring up this-month-last-year as a comparison (see third line in the code box below).

Code: Select all

javascript:function url() {
 var date = new Date();
 var y = date.getFullYear() - 1 ; 
 var m = date.getMonth() +1; 
 if(m < 10){m = '0' + m;}
 var d = date.getDate();
 if(d < 10){d = '0' + d;}
 var date = y + "-" + m + "-" + d;

 return '' + y + '&Month=' + m + '#';

Now, what else can I program dynamically in my bookmarks ... :scratch:
Cheers, Chris
You do not have the required permissions to view the files attached to this post.
Four out of three people have trouble with Fractions