Added a way to select different tabs.
This commit is contained in:
parent
a4bb6c59e4
commit
280645d548
|
@ -6,6 +6,11 @@ include search
|
|||
- var days = ['Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrijdag', 'Zaterdag', 'Zondag'];
|
||||
|
||||
div.schedule
|
||||
ul
|
||||
each type in match.json.types
|
||||
li
|
||||
span=type.letter
|
||||
a(href='?tab=' + type.tab)=type.value
|
||||
each day in match.json
|
||||
div.day
|
||||
div.hour.title
|
||||
|
|
|
@ -58,6 +58,50 @@ div.schedule {
|
|||
border: solid 1px #e1e1e1;
|
||||
font-family: Open Sans;
|
||||
|
||||
ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
text-align: right;
|
||||
background-color: #e1e1e1;
|
||||
|
||||
li {
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
color: #FFF;
|
||||
font-family: Oswald;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
-webkit-transition: 1s ease;
|
||||
|
||||
&:hover {
|
||||
-webkit-transition: 1s ease;
|
||||
width: 160px;
|
||||
}
|
||||
|
||||
&:first-child span {
|
||||
background-color: #0C5489;
|
||||
}
|
||||
|
||||
&:last-child span {
|
||||
background-color: #C41824;
|
||||
}
|
||||
|
||||
span {
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
display: inline-block;
|
||||
background-color: #96aa48;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: #000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
div.day {
|
||||
float: left;
|
||||
|
||||
|
|
15
schedule.js
15
schedule.js
|
@ -28,13 +28,20 @@ function get(url, callback) {
|
|||
|
||||
function schedule_types(page) {
|
||||
var extract = cheerio('table tr td[valign="bottom"] table tr td b, table tr td[valign="bottom"] table tr td a', page).text().split(/\s\s/);
|
||||
var tab = 0;
|
||||
var types = [];
|
||||
|
||||
for (element of extract) {
|
||||
element != '' ? types.push(element) : null;
|
||||
element != '' ? types.push({
|
||||
'letter': element.substr(0, 1),
|
||||
'value' : element.match(/.*(?:rooster)|t\/m|\d\d\s\w{3}/g).join(' ').slice(1).replace(/rooster/, ''),
|
||||
'tab': tab++
|
||||
}) : null;
|
||||
}
|
||||
|
||||
return types
|
||||
|
||||
console.log(types);
|
||||
|
||||
return types;
|
||||
}
|
||||
|
||||
//Function for converting the page into a json dataset.
|
||||
|
@ -72,6 +79,8 @@ function to_json(page) {
|
|||
}
|
||||
}
|
||||
|
||||
schedule_data.types = types;
|
||||
|
||||
return schedule_data;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue