console.log("enabling login"); 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=/; domain=aimath.org"; */ document.cookie = name + "=" + value + expires + "; path=/; " + "SameSite=None; Secure"; console.log("created cookie " + name); } 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; } function eraseCookie(name) { createCookie(name,"",-1); } /* next two also in edit.js. Need to clean up */ Storage.prototype.setObject = function(key, value) { // this.setItem(key, JSON.stringify(value)); this.setItem(key, JSON.stringify(value, function(key, val) { // console.log("key", key, "value", value, "val", val); return val.toFixed ? Number(val.toFixed(3)) : val; })); } Storage.prototype.getObject = function(key) { var value = this.getItem(key); return value && JSON.parse(value); } function hash_of_string(str) { str = str.toString(); var the_len = str.length; the_len = Math.min(12,the_len); var the_hash = 123456; var hash_lis = [510149, 120151, 230157, 411063, 320167, 631973, 410179, 321081, 231091, 111093, 121097, 230199]; for (var j=0; j < the_len; ++ j) { var this_char = str.charCodeAt(j); this_char = parseInt(this_char); var this_add = this_char * hash_lis[j]; the_hash += this_add; the_hash = the_hash % 1000000; } return the_hash.toString() } function login_form(mode="login") { var the_form = ""; /* the_form += '