fuenfknoepfe/fuenfknoepfe.js

70 lines
1.7 KiB
JavaScript
Raw Permalink Normal View History

2020-07-19 22:32:34 +00:00
// fuenfknoepfe.js - teh ultimate fife buttons website
function click_handler(ziel) {
var chkBox = document.getElementById('rememberBox');
if (chkBox.checked == true) {
setzeKeks(ziel);
} else {
entferneKeks();
}
2020-09-13 19:40:43 +00:00
geheNachKeks(ziel);
2020-07-19 22:32:34 +00:00
return false;
}
2020-09-13 19:40:43 +00:00
function geheNachKeks(ziel) {
var echtesZiel = "https://im.c-base.org" + keks;
console.log("gegeNach: " + echtesZiel)
window.location.replace(echtesZiel);
}
2020-07-19 22:32:34 +00:00
function setzeKeks(ziel) {
console.log("setzen");
wirklichsetzeKeks(ziel, 30);
}
function entferneKeks() {
console.log("entfernen");
wirklichsetzeKeks("", -1);
}
function wirklichsetzeKeks(ziel, dauer) {
var d = new Date();
d.setTime(d.getTime() + (dauer * 24 * 60 * 60 * 1000));
var expires = "expires=" + d.toUTCString();
document.cookie = "ziel=" + ziel + ";" + expires + ";path=/";
}
function allewegefuehrennachKeks() {
var keks = getCookie("ziel");
if (keks != "") {
setzeKeks(keks);
2020-09-13 19:40:43 +00:00
geheNachKeks(keks)
// console.log("Do redirect here: " + keks);
2020-07-19 22:32:34 +00:00
// Simulate an HTTP redirect:
2020-09-13 19:40:43 +00:00
//window.location.replace("https://im.c-base.org" + keks);
2020-07-19 22:32:34 +00:00
} else {
console.log("Ohne Keks keine Äktschn.");
}
}
function getCookie(keksname) {
var name = keksname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
function machkeksweg() {
entferneKeks();
window.location.replace("index.html");
}