From 188f1e79227fabfd46bf0feff460516414395364 Mon Sep 17 00:00:00 2001 From: timb Date: Fri, 15 Jan 2010 18:57:43 -0800 Subject: fixed up the default value for the login form fields and moved most of the javascript into static/js --- static/home.js | 36 --- static/index.html | 17 +- static/js/home.js | 58 ++++ static/js/pichat.js | 244 +++++++++++++++++ static/js/sha1.js | 330 +++++++++++++++++++++++ static/js/underscore-min.js | 16 ++ static/js/underscore.js | 637 ++++++++++++++++++++++++++++++++++++++++++++ static/pichat.js | 244 ----------------- static/sha1.js | 330 ----------------------- template/form_login.st | 4 +- template/head.st | 5 +- 11 files changed, 1294 insertions(+), 627 deletions(-) delete mode 100755 static/home.js create mode 100755 static/js/home.js create mode 100755 static/js/pichat.js create mode 100755 static/js/sha1.js create mode 100644 static/js/underscore-min.js create mode 100644 static/js/underscore.js delete mode 100755 static/pichat.js delete mode 100755 static/sha1.js diff --git a/static/home.js b/static/home.js deleted file mode 100755 index 7ced9da..0000000 --- a/static/home.js +++ /dev/null @@ -1,36 +0,0 @@ -function ifEnter(fn) { - return function(e) { - if (e.keyCode == 13) { fn(); } - }; -} - -function initHome() { - $('#passwordInput').keyup(ifEnter(login)); - $('#loginSubmit').click(login); -} - -function login() { - $('#passwordInput, #loginSubmit').blur(); - var nick = $('#nickInput').val(); - var password = $('#passwordInput').val(); - var hash = hex_sha1(nick + '$' + password + '$dumpfm'); - - var onSuccess = function(json) { - location.href = "/chat"; - }; - - var onError = function(resp, textStatus, errorThrown) { - alert("Error logging in!"); - }; - - $.ajax({ - type: 'GET', - timeout: 5000, - url: 'login', - data: {'nick': nick, ts: '', 'hash': hash }, - cache: false, - dataType: 'json', - success: onSuccess, - error: onError - }); -}; \ No newline at end of file diff --git a/static/index.html b/static/index.html index 0ed1671..cb1852b 100755 --- a/static/index.html +++ b/static/index.html @@ -1,7 +1,8 @@ - - + + + + - - + + + -- cgit v1.2.3-70-g09d2