Permalink
Browse files

Fixing createCookie issue #664

  • Loading branch information...
mattlevine committed Dec 31, 2012
1 parent df8548c commit edb5249cd48d38ff1a6d7abe59c42c890667eca2
Showing with 26 additions and 1 deletion.
  1. +25 −0 default/js/global.js
  2. +1 −1 default/js/global.min.js
View
@@ -457,6 +457,31 @@ function submitForm(frm,action,theClass){
return false;
}
+function createCookie(name,value,days) {
+ if (days) {
+ var date = new Date();
+ date.setTime(date.getTime()+(days*24*60*60*1000));
+ var expires = "; expires="+date.toGMTString();
+ }
+ else var expires = "";
+ document.cookie = name+"="+value+expires+"; path=/";
+}
+
+function readCookie(name) {
+ var nameEQ = name + "=";
+ var ca = document.cookie.split(';');
+ 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 unescape(c.substring(nameEQ.length,c.length));
+ }
+ return "";
+}
+
+function eraseCookie(name) {
+ createCookie(name,"",-1);
+}
+
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit edb5249

Please sign in to comment.