Added module for giving the time to the system.

This commit is contained in:
Bram van der Veen 2015-08-13 21:32:02 +02:00
parent adb8393479
commit 6a082e4156
3 changed files with 22 additions and 4 deletions

View file

@ -13,7 +13,7 @@ html
script(type="text/javascript", src="/js/script.js")
script(type="text/javascript").
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', 'UA-46880644-1', 'werkmanrooster.nl');ga('send', 'pageview');ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
body
body(class=app.locals.time.get() > 20.5 ? 'night' : '')
div.bar
if headers.user
ul.left
@ -26,15 +26,14 @@ html
li |
li
a(href="/klassenlijst/#{headers.user.group}") Jouw Klassenlijst
ul.right
li
a(href="/logout") Logout
li |
li
a(href="http://git.werkmanrooster.nl/werkmanrooster/rooster-io.git", target="_blank") Recente ontwikkelingen
else
ul
li

17
time.js Normal file
View file

@ -0,0 +1,17 @@
//time.js
//Function for getting the time, with minutes as a fracture.
function get() {
var time = new Date();
return time.getHours() + (time.getMinutes() / 60);
}
//Function for parsing and checking if the currrent time is within the parsed string.
function within_timespan(timespan) {
}
module.exports = {
'get': get,
'within_timespan': within_timespan
}

2
web.js
View file

@ -10,6 +10,7 @@ var lookup = require('./lookup');
var schedule = require('./schedule');
var auth = require('./auth');
var redirecter = require('./redirecter');
var time = require('./time');
var app = express();
@ -21,6 +22,7 @@ app.set('views', __dirname + '/resources/jade');
//Give the app some configuration information
app.locals.linkbar = config().linkbar;
app.locals.hour_times = config().hour_times;
app.locals.time = time;
//Set up all static directories for getting resources.
app.use('/css', less(__dirname + '/resources/less'));