From d3e7b5708deffbed864c916de22663f48333c58b Mon Sep 17 00:00:00 2001 From: yo mama Date: Tue, 22 Sep 2015 00:51:40 -0700 Subject: finishing server --- share/frontend/impattern/js/username.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 share/frontend/impattern/js/username.js (limited to 'share/frontend/impattern/js/username.js') diff --git a/share/frontend/impattern/js/username.js b/share/frontend/impattern/js/username.js new file mode 100644 index 0000000..eb89ed0 --- /dev/null +++ b/share/frontend/impattern/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(username){ + if (username.length > 0){ + document.cookie = "imname="+username+";path=/;domain=.asdf.us;max-age=1086400" + } +} -- cgit v1.2.3-70-g09d2