diff --git a/css/main.css b/css/main.css index 72f99811..68a35931 100644 --- a/css/main.css +++ b/css/main.css @@ -6,7 +6,8 @@ body, html { height: 100%; - font-family: "HelveticaNeue-UltraLight"; + font-family: "HelveticaNeue-Light"; + letter-spacing: -3px; color: #fff; font-size: 75px; -webkit-font-smoothing: antialiased; @@ -35,7 +36,7 @@ body, html { position: absolute; top: 50%; height: 200px; - margin-top: -100px; + /* margin-top: -100px; */ line-height: 100px; } @@ -56,23 +57,25 @@ body, html { .xsmall { font-size: 25px; - font-family: "HelveticaNeue-Light"; + letter-spacing: 0px; + font-family: "HelveticaNeue-Medium"; } .small { font-size: 35px; + letter-spacing: -1.5px; font-family: "HelveticaNeue-Light"; } .xdimmed { - color: #fff; + color: #666; } .dimmed { - color: #fff; + color: #999; } .icon @@ -80,10 +83,10 @@ body, html { position: relative; top :-10px; display: inline-block; - font-size: 35px; + font-size: 50px; padding-right: 5px; font-weight: 100; - margin-right: 10px; + margin-right: 0px; } .forecast-table { diff --git a/js/main.js b/js/main.js index 0935fc9c..5215f1b4 100644 --- a/js/main.js +++ b/js/main.js @@ -19,11 +19,23 @@ jQuery.fn.outerHTML = function(s) { : jQuery("

").append(this.eq(0).clone()).html(); }; -function roundTemp(temp) +function roundVal(temp) { return Math.round(temp * 10) / 10; } +function kmh2beaufort(kmh) +{ + var speeds = [1, 5, 11, 19, 28, 38, 49, 61, 74, 88, 102, 117, 1000]; + for (var beaufort in speeds) { + var speed = speeds[beaufort]; + if (speed > kmh) { + return beaufort; + } + } + return 12; +} + jQuery(document).ready(function($) { var news = []; @@ -80,8 +92,16 @@ jQuery(document).ready(function($) { (function updateCompliment() { - var compliments = ['Hey, handsome!','Hi, sexy!','Hello, beauty!', 'You look sexy!', 'Wow, you look hot!']; - //var compliments = ['Testing ...', 'Please wait ...']; + var compliments = [ + 'Hey, handsome!', + 'Hi, sexy!', + 'Hello, beauty!', + 'You look sexy!', + 'Wow, you look hot!', + 'Looking good today!', + 'You look nice!', + 'Enjoy your day!' + ]; while (compliment == lastCompliment) { compliment = Math.floor(Math.random()*compliments.length); @@ -92,7 +112,7 @@ jQuery(document).ready(function($) { setTimeout(function() { updateCompliment(); - }, 20000); + }, 30000); })(); (function updateCurrentWeather() @@ -120,9 +140,14 @@ jQuery(document).ready(function($) { $.getJSON('http://api.openweathermap.org/data/2.5/weather', weatherParams, function(json, textStatus) { - var temp = roundTemp(json.main.temp); - var temp_min = roundTemp(json.main.temp_min); - var temp_max = roundTemp(json.main.temp_max); + + var temp = roundVal(json.main.temp); + var temp_min = roundVal(json.main.temp_min); + var temp_max = roundVal(json.main.temp_max); + + var wind = roundVal(json.wind.speed); + + console.log(wind); var iconClass = iconTable[json.weather[0].icon]; var icon = $('').addClass('icon').addClass('dimmed').addClass(iconClass); @@ -131,13 +156,14 @@ jQuery(document).ready(function($) { // var forecast = 'Min: '+temp_min+'°, Max: '+temp_max+'°'; // $('.forecast').updateWithText(forecast, 1000); - + var now = new Date(); var sunrise = new Date(json.sys.sunrise*1000).toTimeString().substring(0,5); var sunset = new Date(json.sys.sunset*1000).toTimeString().substring(0,5); - var sunString = ' ' + sunrise+' ' + sunset; + var windString = ' ' + kmh2beaufort(wind) ; + var sunString = (json.sys.sunrise*1000 > now && json.sys.sunset*1000 > now) ? ' ' + sunrise : ' ' + sunset; - $('.sun').updateWithText(sunString, 1000); + $('.sun').updateWithText(windString+' '+sunString, 1000); }); setTimeout(function() { @@ -178,8 +204,8 @@ jQuery(document).ready(function($) { var row = $(''); row.append($('').addClass('day').html(dayAbbr[dt.getDay()])); - row.append($('').addClass('temp-max').html(roundTemp(forecast.temp_max))); - row.append($('').addClass('temp-min').html(roundTemp(forecast.temp_min))); + row.append($('').addClass('temp-max').html(roundVal(forecast.temp_max))); + row.append($('').addClass('temp-min').html(roundVal(forecast.temp_min))); forecastTable.append(row); }