diff --git a/index.html b/index.html
index 5c7a14b..a2e97ae 100644
--- a/index.html
+++ b/index.html
@@ -324,15 +324,31 @@ function filter_load() {
function get_cookie(name) {
var nameEQ = name+"=";
var ca = document.cookie.split(";");
+ var cookies = Array();
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==" ") c = c.substring(1,c.length);
- if (c.indexOf(nameEQ) == 0) { return c.substring(nameEQ.length,c.length); }
+ if (c.indexOf(nameEQ) == 0) { cookies.push(c.substring(nameEQ.length,c.length)); }
+ }
+ return filter_cookies(cookies,name)
+}
+function filter_cookies(cookies,name) {
+ // return only cookies that have the pathname
+ for(var i=0;i < cookies.length;i++) {
+ var c = cookies[i];
+ var split = c.split("&");
+ if (split.length == 2) {
+ if (split[1] == window.location.pathname) {
+ return split[0];
+ }
+ }
}
return null
}
function set_cookie(name,value) {
- document.cookie = name + "=" + value.toString() + "; path=" + window.location.pathname + ";";
+ // Save cookies for 2 hours
+ document.cookie = name + "=" + value.toString() + "&" + window.location.pathname +
+ ";path=" + window.location.pathname + ";max-age="+ (60*60*2).toString() + ";";
}
document.onkeyup=keyboard_entry;
document.onkeydown=keyboard_control;