Skip to content

Commit

Permalink
Adding front-end
Browse files Browse the repository at this point in the history
  • Loading branch information
alaycock committed Jun 15, 2015
1 parent e1d86c7 commit 8da3913
Show file tree
Hide file tree
Showing 14 changed files with 474 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .settings/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place your settings in this file to overwrite default and user settings.
{
}
68 changes: 68 additions & 0 deletions public/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
body {
font-family: 'Roboto', sans-serif;
background-color: #000;
color: #FFF;
}

.top {
position: absolute;
top: 0px;
}

.bottom {
position: absolute;
bottom: 0px;
}

.hidden {
display: none;
}

/* Datetime */
#datetime {
margin-right: 10px;
margin-top: 10px;
right: 0px;
}

#time {
font-size: 100pt;
float:left;
line-height:80%;
}

#period {
font-size: 50pt;
line-height:80%;
}

#dateContainer {
float:left;
width: 100px;
}

#date {
line-height:90%;
font-size: 12pt;
}

#year {
line-height:90%;
font-size: 30pt;
}

/* Weather */
#weather {
left: 0px;
}

#today i {
font-size: 100px;
}


/* News */
#news {
margin-left: auto;
margin-right: auto;
}
46 changes: 46 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<html>
<head>
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="libs/jquery.simpleWeather.min.js"></script>
<script src="js/data.js"></script>
<script src="js/config.js"></script>
<script src="js/main.js"></script>
<link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css' />
<link href='libs/weather-icons.min.css' rel='stylesheet' type='text/css' />
<link href='css/style.css' rel='stylesheet' type='text/css' />
</head>
<body>
<div id="datetime" class="top">
<div id="time"></div>
<div id="dateContainer">
<div id="period"></div>
<div id="date"></div>
<div id="year"></div>
</div>

</div>
<div id="weather" class="top">
<div id="today">
<i></i>
<div class="now"></div>
<div class="high"></div>
<div class="low"></div>
</div>
<div id="forecast"></div>
<div id="forecastItem" class="hidden">
<i></i>
<div class="high"></div>
<div class="low"></div>
<div class="date"></div>
</div>
</div>
<div id="news" class="bottom">
News <i class="wi wi-day-lightning"></i>
</div>
</body>
</html>





5 changes: 5 additions & 0 deletions public/js/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var weatherConfig = {
location: "Calgary, AB",
woeid: "8775",
unit: "c",
};
65 changes: 65 additions & 0 deletions public/js/data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
var month = [
"January",
"February",
"March",
"April",
"May",
"September",
"July",
"August",
"September",
"October",
"November",
"December"];

var codeIcon = [
"wi-tornado", // 0 tornado
"wi-hurricane", // 1 tropical storm
"wi-hurricane", // 2 hurricane
"wi-lightning", // 3 severe thunderstorms
"wi-thunderstorm", // 4 thunderstorms
"wi-rain-mix", // 5 mixed rain and snow
"wi-rain-mix", // 6 mixed rain and sleet
"wi-rain-mix", // 7 mixed snow and sleet
"wi-sprinkle", // 8 freezing drizzle
"wi-sprinkle", // 9 drizzle
"wi-rain", // 10 freezing rain
"wi-showers", // 11 showers
"wi-showers", // 12 showers
"wi-snow", // 13 snow flurries
"wi-snow", // 14 light snow showers
"wi-snow-wind", // 15 blowing snow
"wi-snow", // 16 snow
"wi-hail", // 17 hail
"wi-sleet", // 18 sleet
"wi-dust", // 19 dust
"wi-fog",// 20 foggy
"wi-day-haze", // 21 haze
"wi-smoke", // 22 smoky
"wi-cloudy-windy", // 23 blustery
"wi-cloudy-gusts", // 24 windy
"wi-snowflake-cold", // 25 cold
"wi-cloudy", // 26 cloudy
"wi-night-cloudy", // 27 mostly cloudy (night)
"wi-day-cloudy", // 28 mostly cloudy (day)
"night-partly-cloudy", // 29 partly cloudy (night)
"wi-day-sunny-overcast", // 30 partly cloudy (day)
"wi-night-clear", // 31 clear (night)
"wi-day-sunny", // 32 sunny
"night-partly-cloudy", // 33 fair (night)
"wi-day-sunny-overcast",// 34 fair (day)
"wi-hail", // 35 mixed rain and hail
"wi-hot", // 36 hot
"wi-thunderstorm", // 37 isolated thunderstorms
"wi-thunderstorm", // 38 scattered thunderstorms
"wi-thunderstorm", // 39 scattered thunderstorms
"wi-showers", // 40 scattered showers
"wi-snow-wind", // 41 heavy snow
"wi-snow", // 42 scattered snow showers
"wi-snow-wind", // 43 heavy snow
"wi-day-sunny-overcast", // 44 partly cloudy
"wi-storm-showers", // 45 thundershowers
"wi-snow", // 46 snow showers
"wi-storm-showers", // 47 isolated thundershowers
];
codeIcon[3200] = "wi-alien"; // 3200 not available
45 changes: 45 additions & 0 deletions public/js/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
function updateTime() {
var n = new Date();


var hh = n.getHours();
var mm = n.getMinutes();
var period = "AM";

if(hh >= 12) {
hh = hh-12;
period = "PM";
}

if(mm < 10)
mm = "0" + mm;

$("#time").text(hh + ":" + mm);
$("#period").text(period);
$("#date").text(month[n.getMonth()] + " " + n.getDate());
$("#year").text(n.getFullYear());
}

function updateWeather() {
// Simple Weather JS:
// http://simpleweatherjs.com/
// Yahoo weather codes:
// https://developer.yahoo.com/weather/documentation.html#codes
// Weather icons:
// http://erikflowers.github.io/weather-icons/

weatherConfig.success = successfulWeather;
$.simpleWeather(weatherConfig);
}

function successfulWeather(res) {
$("#today i").addClass("wi " + codeIcon[res.code]);
console.log(res);
}

// Constructor
$(document).ready(function() {
setInterval(updateTime, 1000);
updateTime();
updateWeather();
});
Binary file added public/libs/font/WeatherIcons-Regular.otf
Binary file not shown.
Binary file added public/libs/font/weathericons-regular-webfont.eot
Binary file not shown.
Loading

0 comments on commit 8da3913

Please sign in to comment.