Made a lot of changes:
Better SEO Added eastereggs Styled eastereggs Imported easteregg database Made some script.js improvements Added opensearch
This commit is contained in:
parent
fa6af3756b
commit
205411350e
68
eastereggs.json
Normal file
68
eastereggs.json
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"easter" : "eekhoorn",
|
||||||
|
"name" : "Femke Heeling",
|
||||||
|
"type" : "student"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"easter" : "chocoladebeer",
|
||||||
|
"name" : "Jerom Maat",
|
||||||
|
"text" : "Beer, malleman, \"420 blaze it\", geliefde en Albert Heijn medewerker",
|
||||||
|
"type" : "RIP"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"easter" : "nietzsche",
|
||||||
|
"name" : "hTig",
|
||||||
|
"real_name" : "Harm Tiggelaar",
|
||||||
|
"text" : "Docent, groot filosoof en voorbeeld in haarstijl",
|
||||||
|
"type" : "RIP"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"easter" : "kaas",
|
||||||
|
"name" : "Steven Smits",
|
||||||
|
"text" : "Mellow als kaas, gitarist en levensfilosoof",
|
||||||
|
"type" : "RIP"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"easter" : "stoeptegel",
|
||||||
|
"name" : "Femke Hoornstra",
|
||||||
|
"text" : "Klein, schattig en schrijfster",
|
||||||
|
"type" : "RIP"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"easter" : "die jongen met het coole haar",
|
||||||
|
"name" : "Jules Stenneker",
|
||||||
|
"type" : "student"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"easter" : "god",
|
||||||
|
"name" : "David Francois",
|
||||||
|
"type" : "student"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"easter" : "wobbes",
|
||||||
|
"name" : "Natascha Wobbes",
|
||||||
|
"type" : "RIP"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"easter" : "huis tuin en keuken neger",
|
||||||
|
"name" : "Fimme Neeleman",
|
||||||
|
"text" : "Goeie huisman, vriend, gamer, geliefde en malleman",
|
||||||
|
"type" : "RIP"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"easter" : "hahanna",
|
||||||
|
"name" : "Hanna van Rheenen",
|
||||||
|
"type" : "student"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"easter" : "lala",
|
||||||
|
"name" : 21297,
|
||||||
|
"type" : "easter"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"easter" : "aardappel",
|
||||||
|
"name" : "Sjors Mulder",
|
||||||
|
"type" : "student"
|
||||||
|
}
|
||||||
|
]
|
23
lookup.js
23
lookup.js
|
@ -1,6 +1,7 @@
|
||||||
//lookup.js
|
//lookup.js
|
||||||
var http = require('http');
|
var http = require('http');
|
||||||
var config = require('./configuration');
|
var config = require('./configuration');
|
||||||
|
var fs = require('fs');
|
||||||
|
|
||||||
var database = require('mongoskin').db('mongodb://' + config().database);
|
var database = require('mongoskin').db('mongodb://' + config().database);
|
||||||
var school_id = config().school_id;
|
var school_id = config().school_id;
|
||||||
|
@ -8,7 +9,11 @@ var school_id = config().school_id;
|
||||||
//Function for looking through the database and finding entries related to the searchterm.
|
//Function for looking through the database and finding entries related to the searchterm.
|
||||||
function lookup(req, res, next, search) {
|
function lookup(req, res, next, search) {
|
||||||
var index = database.collection('index');
|
var index = database.collection('index');
|
||||||
|
easter(search) ? req.easter = easter(search) : null;
|
||||||
|
easter(search) ? search = easter(search).name : null; //Check if there are any eastereggs matching the search query.
|
||||||
search = new RegExp(search, 'i'); //Make regular exeption for ignoring the case (Bram vs BRAM) should return the same.
|
search = new RegExp(search, 'i'); //Make regular exeption for ignoring the case (Bram vs BRAM) should return the same.
|
||||||
|
|
||||||
|
|
||||||
index.find({$or : [{id : search}, {name : search}, {first_name : search}, {last_name : search}]}).toArray(function (err, database_entry) {
|
index.find({$or : [{id : search}, {name : search}, {first_name : search}, {last_name : search}]}).toArray(function (err, database_entry) {
|
||||||
if (err) console.warn(err);
|
if (err) console.warn(err);
|
||||||
|
|
||||||
|
@ -22,6 +27,7 @@ function lookup(req, res, next, search) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
res.send('Multiple hits were found in the database.');
|
res.send('Multiple hits were found in the database.');
|
||||||
|
console.log(database_entry);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -53,4 +59,21 @@ function make_url(req, database_entry) {
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Function for checking the given search query for eatereggs.
|
||||||
|
//TODO: add a way to supply a template file for eastereggs.
|
||||||
|
function easter(search) {
|
||||||
|
var list = JSON.parse(fs.readFileSync(__dirname + '/eastereggs.json'));
|
||||||
|
|
||||||
|
for (entry of list) {
|
||||||
|
if (entry.easter == search.toLowerCase()) return entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = lookup;
|
module.exports = lookup;
|
||||||
|
|
||||||
|
//Testing function, if test is passed in the command line will execute a test.
|
||||||
|
if (process.argv[2] == "test") {
|
||||||
|
console.log(easter('aardappel'));
|
||||||
|
}
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
html
|
html
|
||||||
head
|
head(profile="http://a9.com/-/spec/opensearch/1.1/")
|
||||||
title Werkmanrooster
|
title Werkmanrooster
|
||||||
|
meta(name='viewport', content='width=device-width, user-scalable=no')
|
||||||
|
meta(name="Description", content="De beste roostersite voor de leerlingen van Werkman Stadslyceum!")
|
||||||
|
|
||||||
|
link(rel="search" type="application/opensearchdescription+xml" href="/resources/opensearch.xml" title="Rooster zoeken")
|
||||||
link(rel="stylesheet", href="/css/skeleton.css", type="text/css")
|
link(rel="stylesheet", href="/css/skeleton.css", type="text/css")
|
||||||
link(rel="stylesheet", href="/css/style.css", type="text/css")
|
link(rel="stylesheet", href="/css/style.css", type="text/css")
|
||||||
meta(name='viewport', content='width=device-width, user-scalable=no')
|
|
||||||
|
|
||||||
script(type="text/javascript", src="http://code.jquery.com/jquery-1.11.3.min.js")
|
script(type="text/javascript", src="http://code.jquery.com/jquery-1.11.3.min.js")
|
||||||
script(type="text/javascript", src="/js/script.js")
|
script(type="text/javascript", src="/js/script.js")
|
||||||
script(type="text/javascript").
|
script(type="text/javascript").
|
||||||
|
|
|
@ -3,21 +3,22 @@
|
||||||
include header
|
include header
|
||||||
include search
|
include search
|
||||||
|
|
||||||
- var days = ['Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrijdag', 'Zaterdag', 'Zondag'];
|
if !easter || easter.type != "RIP"
|
||||||
div#wrapper
|
- var days = ['Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrijdag', 'Zaterdag', 'Zondag'];
|
||||||
div.schedule
|
#wrapper
|
||||||
|
.schedule
|
||||||
ul
|
ul
|
||||||
each type in match.json.types
|
each type in match.json.types
|
||||||
li
|
li
|
||||||
span=type.letter
|
span=type.letter
|
||||||
a(href='?tab=' + type.tab)=type.value
|
a(href='?tab=' + type.tab)=type.value
|
||||||
each day in match.json
|
each day in match.json
|
||||||
div.day
|
.day
|
||||||
div.hour.title
|
.hour.title
|
||||||
span= days[match.json.indexOf(day)]
|
span= days[match.json.indexOf(day)]
|
||||||
each hour in day
|
each hour in day
|
||||||
if hour.teacher != 'vrij'
|
if hour.teacher != 'vrij'
|
||||||
div.hour(class=hour.changed == 'true' ? 'changed' : '')
|
.hour(class=hour.changed == 'true' ? 'changed' : '')
|
||||||
each subhour in hour.teacher
|
each subhour in hour.teacher
|
||||||
span.teacher(class='sub_' + hour.teacher.length)
|
span.teacher(class='sub_' + hour.teacher.length)
|
||||||
a(href=hour.teacher[hour.teacher.indexOf(subhour)])= hour.teacher[hour.teacher.indexOf(subhour)]
|
a(href=hour.teacher[hour.teacher.indexOf(subhour)])= hour.teacher[hour.teacher.indexOf(subhour)]
|
||||||
|
@ -29,7 +30,12 @@ div#wrapper
|
||||||
span.time= times[match.json[0].indexOf(hour)]
|
span.time= times[match.json[0].indexOf(hour)]
|
||||||
|
|
||||||
else
|
else
|
||||||
div.hour.changed
|
.hour.changed
|
||||||
span.free Vrij
|
span.free Vrij
|
||||||
|
else
|
||||||
|
.schedule.rip
|
||||||
|
h1 R.I.P
|
||||||
|
p="Hier ligt " + (easter.real_name || easter.name)
|
||||||
|
p=easter.text
|
||||||
|
p Voor altijd in ons hart
|
||||||
include links
|
include links
|
||||||
|
|
|
@ -13,7 +13,7 @@ $(document).ready(function () {
|
||||||
|
|
||||||
|
|
||||||
function go() {
|
function go() {
|
||||||
var searchterm = $('.search').val().trim();
|
var searchterm = $('.search').val().trim().replace(/\'s Rooster/gi, '');
|
||||||
if (!!searchterm) {
|
if (!!searchterm) {
|
||||||
document.location.pathname = '/rooster/' + searchterm;
|
document.location.pathname = '/rooster/' + searchterm;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
//mobile.less
|
//mobile.less
|
||||||
/* Larger than mobile */
|
|
||||||
|
|
||||||
/* Larger than phablet */
|
|
||||||
@media (max-width: 550px) {}
|
|
||||||
|
|
||||||
/* Larger than tablet */
|
|
||||||
@media (max-width: 755px) {
|
@media (max-width: 755px) {
|
||||||
#title {
|
#title {
|
||||||
font-size: 40px !important;
|
font-size: 40px !important;
|
||||||
|
|
||||||
|
span {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
input, button {
|
input, button {
|
||||||
|
|
|
@ -58,6 +58,11 @@ div.schedule {
|
||||||
border: solid 1px #e1e1e1;
|
border: solid 1px #e1e1e1;
|
||||||
font-family: Open Sans;
|
font-family: Open Sans;
|
||||||
|
|
||||||
|
&.rip {
|
||||||
|
text-align: center;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
20
resources/other/opensearch.xml
Normal file
20
resources/other/opensearch.xml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
|
||||||
|
<ShortName>rooster</ShortName>
|
||||||
|
<LongName>rooster zoeken</LongName>
|
||||||
|
<Description>De beste roostersite voor leerlingen van Werkman Stadslyceum</Description>
|
||||||
|
<InputEncoding>UTF-8</InputEncoding>
|
||||||
|
<OutputEncoding>UTF-8</OutputEncoding>
|
||||||
|
<AdultContent>false</AdultContent>
|
||||||
|
<Language>nl-NL</Language>
|
||||||
|
<Developer>Bram van der Veen</Developer>
|
||||||
|
<Contact>werkmanrooster@gmail.com</Contact>
|
||||||
|
<Description>De beste roostersite voor leerlingen van Werkman Stadslyceum</Description>
|
||||||
|
<Tags>werkman rooster werkmanrooster leerlingen groningen stadslyceum bram van der veen</Tags>
|
||||||
|
<Attribution>Werkmanrooster zoeken op, http://werkmanrooster.nl/</Attribution>
|
||||||
|
<SyndicationRight>open</SyndicationRight>
|
||||||
|
<!-- <Query role="example" searchTerms="Apple"/>
|
||||||
|
<Image height="16" width="16" type="image/vnd.microsoft.icon">http://werkmanrooster.nl/resources/fav.ico</Image>
|
||||||
|
<Image height="64" width="64" type="image/png">http://werkmanrooster.nl/resources/fav.png</Image>
|
||||||
|
<Url type="text/html" template="http://werkmanrooster.nl/rooster/{searchTerms}"/> -->
|
||||||
|
</OpenSearchDescription>
|
1
web.js
1
web.js
|
@ -12,6 +12,7 @@ app.disable('view cache');
|
||||||
app.set('views', __dirname + '/resources/jade');
|
app.set('views', __dirname + '/resources/jade');
|
||||||
app.use('/css', less(__dirname + '/resources/less'));
|
app.use('/css', less(__dirname + '/resources/less'));
|
||||||
app.use('/js', express.static(__dirname + '/resources/js'));
|
app.use('/js', express.static(__dirname + '/resources/js'));
|
||||||
|
app.use('/other', express.static(__dirname + '/resources/other'));
|
||||||
|
|
||||||
app.get('/', function (req, res) {
|
app.get('/', function (req, res) {
|
||||||
req.links = config().links;
|
req.links = config().links;
|
||||||
|
|
Loading…
Reference in a new issue