From 704efb06cd424de7411f198bc4c6ce6b99a9dcbe Mon Sep 17 00:00:00 2001 From: sostler Date: Fri, 18 Dec 2009 21:56:51 -0500 Subject: Checkin before leaving --- static/home.js | 2 +- static/index.html | 354 +++++++++++++++++++++++++++--------------------------- static/pichat.js | 10 +- 3 files changed, 184 insertions(+), 182 deletions(-) (limited to 'static') diff --git a/static/home.js b/static/home.js index 5857368..8416703 100755 --- a/static/home.js +++ b/static/home.js @@ -15,7 +15,7 @@ function login() { var hash = hex_sha1(nick + '$' + password + '$dumpfm'); var onSuccess = function(json) { - location.href = "u/" + nick; + location.href = "/chat"; }; var onError = function(resp, textStatus, errorThrown) { diff --git a/static/index.html b/static/index.html index fb5224e..0ccb121 100644 --- a/static/index.html +++ b/static/index.html @@ -1,196 +1,193 @@ - + + - + - - - - - - -
-
- -
+ --> + + + + +
+
+


- -
-

+
+

+
-
-
-


+


 

@@ -210,18 +207,19 @@ body {

 

 

- + - - + +
- \ No newline at end of file + + diff --git a/static/pichat.js b/static/pichat.js index 826bcba..d489bba 100755 --- a/static/pichat.js +++ b/static/pichat.js @@ -15,7 +15,8 @@ function escapeHtml(txt) { } function buildUserDiv(user) { - return '
' + escapeHtml(user) + '
'; + var nick = escapeHtml(user); + return '
' + nick + '
'; } // http://stackoverflow.com/questions/37684/replace-url-with-html-links-javascript @@ -29,6 +30,7 @@ var URLRegex = /((http\:\/\/|https\:\/\/|ftp\:\/\/)|(www\.))+(\w+:{0,1}\w*@)?(\S var PicRegex = /\.(jpg|jpeg|png|gif|bmp)$/i; function buildMsgContent(content) { + content = $.trim(content); var match = URLRegex.exec(content) if (match && PicRegex.test(match[0])) { return '' @@ -39,7 +41,8 @@ function buildMsgContent(content) { } function buildMessageDiv(msg) { - return '
' + escapeHtml(msg.nick) + ': ' + var nick = escapeHtml(msg.nick); + return '
' + nick + ': ' + buildMsgContent(msg.content) + '
'; } @@ -150,6 +153,7 @@ function initProfile() { }); var onSubmit = function(original_element, edit, old) { + edit = $.trim(edit); if (edit == old) { return old }; // MAJOR TODO: Prevent entering script tags if (original_element == 'avatar' && edit.indexOf("<") != -1) { @@ -161,7 +165,7 @@ function initProfile() { url: "/update-profile", data: { 'attr': original_element, 'val': edit } }); - if (original_element == 'avatar') { + if (original_element == 'avatar') { var s = ''; $('#avatarPic').replaceWith(s); } -- cgit v1.2.3-70-g09d2