1 // Source: https://www.quirksmode.org/js/cookies.html
3 function setCookie(name
,value
)
6 date
.setTime(date
.getTime()+(183*24*60*60*1000)); //6 months
7 var expires
= "; expires="+date
.toGMTString();
8 document
.cookie
= name
+"="+value
+expires
+"; path=/";
11 function getCookie(name
) {
12 var nameEQ
= name
+ "=";
13 var ca
= document
.cookie
.split(';');
14 for (var i
=0;i
< ca
.length
;i
++)
17 while (c
.charAt(0)==' ')
18 c
= c
.substring(1,c
.length
);
19 if (c
.indexOf(nameEQ
) == 0)
20 return c
.substring(nameEQ
.length
,c
.length
);
25 function getRandString()
27 // Random enough (for socket and game IDs)
28 return (Date
.now().toString(36) + Math
.random().toString(36).substr(2, 7))