add some javascript
This commit is contained in:
parent
5440edcdfe
commit
1ebaef48e8
3 changed files with 71 additions and 9 deletions
|
@ -1 +1,61 @@
|
||||||
# fuenfknoepfe.js - teh ultimate fife buttons website
|
// fuenfknoepfe.js - teh ultimate fife buttons website
|
||||||
|
|
||||||
|
function click_handler(ziel) {
|
||||||
|
var chkBox = document.getElementById('rememberBox');
|
||||||
|
if (chkBox.checked == true) {
|
||||||
|
setzeKeks(ziel);
|
||||||
|
} else {
|
||||||
|
entferneKeks();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
console.log("Do redirect here: " + keks);
|
||||||
|
// Simulate an HTTP redirect:
|
||||||
|
// window.location.replace("http://www.w3schools.com");
|
||||||
|
} 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");
|
||||||
|
}
|
||||||
|
|
13
index.html
13
index.html
|
@ -6,37 +6,38 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>c-base matrix app selector 3000</title>
|
<title>c-base matrix app selector 3000</title>
|
||||||
<link rel="stylesheet" href="w3.css">
|
<link rel="stylesheet" href="w3.css">
|
||||||
|
<script src="fuenfknoepfe.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body onload="allewegefuehrennachKeks();">
|
||||||
<div class="w3-display-container w3-green" style="height:100vh;">
|
<div class="w3-display-container w3-green" style="height:100vh;">
|
||||||
<div class="w3-display-middle">
|
<div class="w3-display-middle">
|
||||||
<div class="w3-container w3-center">
|
<div class="w3-container w3-center">
|
||||||
<div class="w3-row">
|
<div class="w3-row">
|
||||||
<div class="w3-col">
|
<div class="w3-col">
|
||||||
<a href="/app" class="w3-btn w3-black w3-round-large w3-margin-top w3-block">Element - c-base version</a>
|
<a href="/app" class="w3-btn w3-black w3-round-large w3-margin-top w3-block" onclick="return click_handler(this);">Element - c-base version</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="w3-row">
|
<div class="w3-row">
|
||||||
<div class="w3-col">
|
<div class="w3-col">
|
||||||
|
|
||||||
<a href="/devel" class="w3-btn w3-black w3-round-large w3-margin-top w3-block">Element - c-base version (development)</a>
|
<a href="/devel" class="w3-btn w3-black w3-round-large w3-margin-top w3-block" onclick="return click_handler(this);">Element - c-base version (development)</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="w3-row">
|
<div class="w3-row">
|
||||||
<div class="w3-col">
|
<div class="w3-col">
|
||||||
<a href="/app-p2p" class="w3-btn w3-black w3-round-large w3-margin-top w3-block">Element P2P - c-base version</a>
|
<a href="/app-p2p" class="w3-btn w3-black w3-round-large w3-margin-top w3-block" onclick="return click_handler(this);">Element P2P - c-base version</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="w3-row">
|
<div class="w3-row">
|
||||||
<div class="w3-col">
|
<div class="w3-col">
|
||||||
<a href="/devel-p2p" class="w3-btn w3-black w3-round-large w3-margin-top w3-block">Element P2P - c-base version (development)</a>
|
<a href="/devel-p2p" class="w3-btn w3-black w3-round-large w3-margin-top w3-block" onclick="return click_handler(this);">Element P2P - c-base version (development)</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="w3-row">
|
<div class="w3-row">
|
||||||
<div class="w3-col">
|
<div class="w3-col">
|
||||||
<label class="w3-btn w3-black w3-round-large w3-margin-top">
|
<label class="w3-btn w3-black w3-round-large w3-margin-top">
|
||||||
<input type="checkbox" name="zutat" value="salami">
|
<input type="checkbox" name="zutat" value="salami" id="rememberBox">
|
||||||
Erinnere dich.
|
Erinnere dich.
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -4,8 +4,9 @@
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Reset</title>
|
<title>Reset</title>
|
||||||
|
<script src="fuenfknoepfe.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body onload="machkeksweg();">
|
||||||
|
<p>This page requires javascript to do something useful.</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in a new issue