summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-07-15 20:50:15 -0400
committerJules Laplace <jules@okfoc.us>2015-07-15 20:50:15 -0400
commited9aba1964c24850f41ebaba1bba8ffa8059fb84 (patch)
treee57a553f7817eead99549c766a0e96fedcbea708
parentb2da7b372a76651e37e9f413c56d2669d458ca45 (diff)
store username
-rw-r--r--css/sally.css20
-rw-r--r--index.html3
-rw-r--r--js/upload.js2
-rw-r--r--js/user.js10
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;
+}
diff --git a/index.html b/index.html
index 7f584e2..ba351a3 100644
--- a/index.html
+++ b/index.html
@@ -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()
diff --git a/js/user.js b/js/user.js
index b26e591..c8f60d9 100644
--- a/js/user.js
+++ b/js/user.js
@@ -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)