diff options
| author | yo mama <pepper@scannerjammer.com> | 2015-09-22 00:51:40 -0700 |
|---|---|---|
| committer | yo mama <pepper@scannerjammer.com> | 2015-09-22 00:51:40 -0700 |
| commit | d3e7b5708deffbed864c916de22663f48333c58b (patch) | |
| tree | ef76784a7827baff88c03670bf22832a3f146b17 /share/frontend/impattern/js/username.js | |
| parent | 86c79f4372d7b2e7640a26473c7a4d331cdf7d16 (diff) | |
finishing server
Diffstat (limited to 'share/frontend/impattern/js/username.js')
| -rw-r--r-- | share/frontend/impattern/js/username.js | 30 |
1 files changed, 30 insertions, 0 deletions
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" + } +} |
