diff options
Diffstat (limited to 'js/username.js')
| -rw-r--r-- | js/username.js | 30 |
1 files changed, 30 insertions, 0 deletions
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" + } +} |
