public
Last active

the-kenny braucht Hauptmensa sonst weint er.

  • Download Gist
gistfile1.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
var kenny = (function() {
 
/**
* uri
*
* has to be enhanced with this \d\d\d\d-\d\d\d\d.htm
* @param string
*/
var host = "http://studentenwerk.essen-duisburg.de/speiseplaene/kl_";
 
var date = null;
 
var showNextWeek = true;
 
function getDay () {
 
if (date === null) {
date = new Date();
}
 
var day = date.getDate();
if (day < 10) {
return "0" + day;
}
 
return day;
};
 
function getMonth () {
 
if (date === null) {
console.log("month is leer");
date = new Date();
}
 
var month = date.getMonth();
month += 1;
if (month < 10) {
return "0" + month;
}
 
return month;
}
 
return {
getUri: function () {
 
date = new Date();
var day = date.getDay();
 
if (showNextWeek) {
if (day === 0) {
date = new Date(date.getTime() + 86400000);
} else if (day === 6) {
date = new Date(date.getTime() + (86400000)*2);
}
}
 
return host + getDay() + getMonth() + "-" + getDay() + getMonth() + ".htm";
}
};
})();

Use it with
document.location = kenny.getUri();
as bookmarklet.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.