178f3cfe2e129dcfa730b23740069d68aa602017
3 // Source: https://www.quirksmode.org/js/cookies.html
4 setCookie: function(name
, value
)
7 date
.setTime(date
.getTime()+(183*24*60*60*1000)); //6 months
8 var expires
= "; expires="+date
.toGMTString();
9 document
.cookie
= name
+"="+value
+expires
+"; path=/";
12 getCookie: function(name
, defaut
) {
13 var nameEQ
= name
+ "=";
14 var ca
= document
.cookie
.split(';');
15 for (var i
=0;i
< ca
.length
;i
++)
18 while (c
.charAt(0)==' ')
19 c
= c
.substring(1,c
.length
);
20 if (c
.indexOf(nameEQ
) == 0)
21 return c
.substring(nameEQ
.length
,c
.length
);
23 return defaut
; //cookie not found
26 // Random (enough) string for socket and game IDs
27 getRandString: function()
29 return (Date
.now().toString(36) + Math
.random().toString(36).substr(2, 7))
33 // Shortcut for an often used click (on a modal)
34 doClick: function(elemId
)
36 document
.getElementById(elemId
).click(); //or ".checked = true"
39 translate: function(msg
)
41 return translations
[msg
];