• 5day/3hour forcast script

    From Mortifis@ALLEYCAT to echicken on Wednesday, August 21, 2019 12:13:14
    owm.xjs script for 5 day / 3 hour forcast:

    Tell me what you think, please

    <?xjs
    (function () {
    try {
    load('geoip.js');
    var geoip = get_geoip( http_request.header['x-forwarded-for'] || http_request.remote_ip);
    require('openweathermap.js', 'OpenWeatherMap');
    var owm = new OpenWeatherMap();
    var wq = { units: 'metric', mode: 'json' };

    var ts = Math.round((new Date()).getTime() / 1000);

    if (geoip.latitude && geoip.longitude) {
    wq.lat = geoip.latitude;
    wq.lon = geoip.longitude;
    } else
    if (geoip.cityName) {
    wq.q = geoip.cityName;
    }

    var city = geoip.cityName + ', ' + geoip.countryName; // For Display Only

    var fc = owm.call_api('forecast', wq);

    writeln('<center>OpenWeatherMap 5 Day/3 Hour Forecast for ' + city + '</center><hr><br>');

    fc.list.forEach(function (e) {
    if(e.dt >= ts-9900) { // Doesn't list weather 15 minutes prior to next 3 hour block
    writeln(system.timestr(e.dt) + ': <br>');
    writeln('<img src=http://openweathermap.org/img/wn/'+e.weather[0].icon+'@2x.png height=50 width=50>');
    writeln(e.main.temp_max+'&#176;C, ' );
    writeln(e.weather[0].main + ', ' + e.weather[0].description);
    writeln(e.clouds.all + '% clouds');
    writeln();
    print("<br><br><br>");
    }
    });
    }
    catch (err) {
    writeln('ERROR: ' + err + '<br><br>');
    }
    }) ();



    My doctor said I have the body of a 25 year old ... and the mind of a 10 :-/

    ---
    ■ Synchronet ■ AlleyCat! BBS - http://alleycat.synchro.net:81
  • From echicken@ECBBS to Mortifis on Wednesday, August 21, 2019 11:55:40
    Re: 5day/3hour forcast script
    By: Mortifis to echicken on Wed Aug 21 2019 12:13:14

    owm.xjs script for 5 day / 3 hour forcast:

    Tell me what you think, please

    Looks okay on the surface. Does it work properly? That's what matters. :)

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com
    ■ Synchronet ■ electronic chicken bbs - bbs.electronicchicken.com
  • From Nightfox@DIGDIST to echicken on Wednesday, August 21, 2019 09:51:43
    Re: 5day/3hour forcast script
    By: echicken to Mortifis on Wed Aug 21 2019 11:55 am

    owm.xjs script for 5 day / 3 hour forcast:

    Tell me what you think, please

    Looks okay on the surface. Does it work properly? That's what matters. :)

    The Microsoft Surface (Pro)? It's a great system to run a BBS on.

    Nightfox

    ---
    ■ Synchronet ■ Digital Distortion: digitaldistortionbbs.com
  • From echicken@ECBBS to Nightfox on Wednesday, August 21, 2019 13:36:38
    Re: 5day/3hour forcast script
    By: Nightfox to echicken on Wed Aug 21 2019 09:51:43

    Looks okay on the surface. Does it work properly? That's what matters. :)

    The Microsoft Surface (Pro)? It's a great system to run a BBS on.

    Beats the heck out of that old Microsoft Underside Pro, that's for sure.

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com
    ■ Synchronet ■ electronic chicken bbs - bbs.electronicchicken.com
  • From Mortifis@ALLEYCAT to echicken on Wednesday, August 21, 2019 14:56:50
    owm.xjs script for 5 day / 3 hour forcast:

    Tell me what you think, please

    Looks okay on the surface. Does it work properly? That's what matters. :)

    LOL on the Surface Pro comments :-)

    It could use some prettying up, maybe break out the days better, but overall it's functional. Can be laughed at, I mean, seen at:

    http://alleycat.synchro.net:81/owm.xjs

    Thanks EC


    My doctor said I have the body of a 25 year old ... and the mind of a 10 :-/

    ---
    ■ Synchronet ■ AlleyCat! BBS - http://alleycat.synchro.net:81
  • From Gamgee@PALANT to Nightfox on Wednesday, August 21, 2019 21:47:00
    Nightfox wrote to echicken <=-

    Looks okay on the surface. Does it work properly? That's what matters. :)

    The Microsoft Surface (Pro)? It's a great system to run a BBS
    on.

    Hahahahaha! I see what you did there... ;-)



    ... The Word-of-the-Day is "Legs". Spread the word.
    --- MultiMail/Linux v0.52
    ■ Synchronet ■ Palantir BBS * palantirbbs.ddns.net * Pensacola, FL