Skip to content

Instantly share code, notes, and snippets.

@syranez
Created October 8, 2011 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save syranez/1272521 to your computer and use it in GitHub Desktop.
Save syranez/1272521 to your computer and use it in GitHub Desktop.
the-kenny braucht Hauptmensa sonst weint er.
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";
}
};
})();
@syranez
Copy link
Author

syranez commented Oct 8, 2011

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment