make sure filter cookie is for this page only!
This commit is contained in:
20
index.html
20
index.html
@@ -324,15 +324,31 @@ function filter_load() {
|
|||||||
function get_cookie(name) {
|
function get_cookie(name) {
|
||||||
var nameEQ = name+"=";
|
var nameEQ = name+"=";
|
||||||
var ca = document.cookie.split(";");
|
var ca = document.cookie.split(";");
|
||||||
|
var cookies = Array();
|
||||||
for(var i=0;i < ca.length;i++) {
|
for(var i=0;i < ca.length;i++) {
|
||||||
var c = ca[i];
|
var c = ca[i];
|
||||||
while (c.charAt(0)==" ") c = c.substring(1,c.length);
|
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
|
return null
|
||||||
}
|
}
|
||||||
function set_cookie(name,value) {
|
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.onkeyup=keyboard_entry;
|
||||||
document.onkeydown=keyboard_control;
|
document.onkeydown=keyboard_control;
|
||||||
|
|||||||
Reference in New Issue
Block a user