From 32785e06cd47fc6c5c64c7e9c077769a462ae5ea Mon Sep 17 00:00:00 2001 From: yo mama Date: Thu, 12 Feb 2015 20:23:41 -0800 Subject: moving over...adding cgi --- js/username.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 js/username.js (limited to 'js/username.js') diff --git a/js/username.js b/js/username.js new file mode 100644 index 0000000..1222127 --- /dev/null +++ b/js/username.js @@ -0,0 +1,30 @@ +$(document).ready(function(){ + var name = get_name_from_cookie() + $("#username").val(name) +}); + +function get_name_from_cookie() + { + if (document.cookie) + { + var cookies = document.cookie.split(";") + for (i in cookies) + { + var cookie = cookies[i].split("=") + if (cookie[0].indexOf("imname") !== -1) + { + if (cookie[1] !== 'false' && cookie[1] !== 'undefined' && cookie[1].length) + { + return cookie[1] + } + } + } + } + return "" +}; + +function update_username(data){ + if (data.username.length > 0){ + document.cookie = "imname="+data.username+";path=/;domain=.asdf.us;max-age=1086400" + } +} -- cgit v1.2.3-70-g09d2