diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-07-15 20:50:15 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-07-15 20:50:15 -0400 |
| commit | ed9aba1964c24850f41ebaba1bba8ffa8059fb84 (patch) | |
| tree | e57a553f7817eead99549c766a0e96fedcbea708 | |
| parent | b2da7b372a76651e37e9f413c56d2669d458ca45 (diff) | |
store username
| -rw-r--r-- | css/sally.css | 20 | ||||
| -rw-r--r-- | index.html | 3 | ||||
| -rw-r--r-- | js/upload.js | 2 | ||||
| -rw-r--r-- | js/user.js | 10 |
4 files changed, 30 insertions, 5 deletions
diff --git a/css/sally.css b/css/sally.css index 4c80ff8..b1c1098 100644 --- a/css/sally.css +++ b/css/sally.css @@ -161,3 +161,23 @@ textarea { font-size:12pt; width: 37vw; height: 300px; background: #333; color: margin-right: 5px; margin-bottom: 5px; } +#username_input { + background: transparent; + padding: 0; + outline: 0; + border: 1px solid transparent; + width: 76px; +} +#username_input:focus { + border: 1px solid #0f0; + color: #0f0; +} +#upload_input { + background: transparent; + padding: 0; + outline: 0; + border: 1px solid #0f0; + color: #0f0; + width: 152px; + display: none; +} @@ -60,7 +60,8 @@ <button id="import_button">import colorcode</button> <button id="import_html">import sally</button> </span> - <input type="text" id="username"> + <input id="username_input" type="text" placeholder="username"> + <input id="upload_input" type="text" placeholder="uploaded url"> <button id="export_button">export</button> <button id="save_button">save</button> <button id="upload_button">upload</button><br> diff --git a/js/upload.js b/js/upload.js index ec786d5..354cee2 100644 --- a/js/upload.js +++ b/js/upload.js @@ -1,5 +1,5 @@ var upload = (function(){ - var el = document.getElementById("upload_value") + var el = document.getElementById("upload_input") function upload(uri, filename, tag){ filename = filename || get_filename() @@ -1,7 +1,7 @@ var user = (function(){ var user = {} - var el = document.getElementById("username") + var el = document.getElementById("username_input") user.init = function(){ user.load() @@ -39,9 +39,13 @@ var user = (function(){ } return username } + var timeout user.save = function(){ - var username = user.sanitize() - if (username != user.username) user.setCookie(username); + clearTimeout(timeout) + timeout = setTimeout(function(){ + var username = user.sanitize() + if (username != user.username) user.setCookie(username); + }) } user.setCookie = function(username){ console.log("setting to " + username) |
