Commits

Luke Plant committed 0f93d2f

Whitespace changes

Comments (0)

Files changed (1)

lukeplant_me_uk/bibleverses/web/js/bibleverses.js

 var verselist = new Array();
 
 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 c.substring(nameEQ.length,c.length);
-        }
-        return null;
+    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 c.substring(nameEQ.length,c.length);
+    }
+    return null;
 }
 
 
 function setCookie(name, value, days) {
     if (days) {
-        var date = new Date();
-        date.setTime(date.getTime()+(days*24*60*60*1000));
-        var expires = "; expires="+date.toGMTString();
+	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=" + rootUrl ;
 	    replaceChildNodes(fail, "An error occurred: " + json.error);
 	}
 	showElement(fail);
-    }	
+    }
 }
 
 function loginResult(req) {
 	hideElement($('loginresultfail'));
 	hideElement($('loginbuttonsdiv'));
 	showElement($('loginclosediv'));
-	doLoggedInSetup($('id_login_email').value, 
+	doLoggedInSetup($('id_login_email').value,
 			makePasswordHash($('id_login_email').value,
 					 $('id_login_password').value));
     } else {
 	    replaceChildNodes(fail, "An error occurred: " + json.error);
 	}
 	showElement(fail);
-    }	
+    }
 }
 
 
 }
 
 function onRegister2(ev) {
-    var d = doPostRequest( "register", 
+    var d = doPostRequest( "register",
 	{'email': $('id_reg_email').value,
 	'password': makePasswordHash($('id_reg_email').value,
 				     $('id_reg_password').value)
 }
 
 function onLogin2(ev) {
-    var d = doPostRequest( "login", 
+    var d = doPostRequest( "login",
 	{'email': $('id_login_email').value,
 	'password': makePasswordHash($('id_login_email').value,
 				     $('id_login_password').value)
 function addUserBar2(email) {
     replaceChildNodes($('username'), email);
     hideElement($('userbar1'));
-    showUserBar($('userbar2'));    
+    showUserBar($('userbar2'));
 }
 
 function updateControls() {
     json = evalJSONRequest(req);
     if (json.success) {
 	indicateFinishedVerse(json.verse);
-    }     
+    }
     // TODO - error handling in case json.success != true
 
 }
     if (cb.checked) {
 	addVerse(ref);
 	verselist.push(ref);
-    } else { 
+    } else {
 	removeVerse(ref);
     }
 }
     var json = evalJSONRequest(req);
     logDebug(req.responseText);
     if (json.success) {
-	verselist = json.verselist;	
+	verselist = json.verselist;
 	indicateFinishedVerses();
     } else {
 	// login details wrong.