summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Ostler <scottbot9000@gmail.com>2010-06-15 13:16:43 -0400
committerScott Ostler <scottbot9000@gmail.com>2010-06-15 13:16:43 -0400
commit82e5ca69e8d8fbc2434148e13f6cc11ee600a293 (patch)
tree78b5827c1102a2639d92bbc65aa4d17dc25b208c
parent61c37d913acdea6348adc0386a757f91ddcd15e4 (diff)
parent97351343f3ee23a7449a0c4db9f580f2f03e9e38 (diff)
Merge branch 'master' of ssh://dump.fm/pichat/repo
-rw-r--r--static/js/pichat.js21
1 files changed, 19 insertions, 2 deletions
diff --git a/static/js/pichat.js b/static/js/pichat.js
index c19ff6b..62cf52e 100644
--- a/static/js/pichat.js
+++ b/static/js/pichat.js
@@ -47,7 +47,8 @@ function isCSSPropertySupported(prop){ return prop in document.body.style }
function escapeHtml(txt) {
if (!txt) { return ""; }
- else { return $("<span>").text(txt).html(); }
+// txt = annoyingCaps(txt)
+ return $("<span>").text(txt).html()
}
URLRegex = /((\b(http\:\/\/|https\:\/\/|ftp\:\/\/)|(www\.))+(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi;
@@ -68,7 +69,23 @@ function getImagesAsArray(text) {
function linkify(text) {
LastMsgContainsImage = false
- return text.replace(URLRegex, linkReplace);
+ text = text.replace(URLRegex, linkReplace);
+ return text
+}
+
+function annoyingCaps(text){
+ var chunks = text.split(" ")
+ for(var i=0; i<chunks.length; i++){
+ var chunk = chunks[i]
+ if (!chunk.length || chunk.substr(0,4) == 'http') continue;
+ var letters=chunk.split("")
+ for(var j = 0; j<letters.length; j++){
+ if (j % 2) letters[j] = letters[j].toUpperCase()
+ else letters[j] = letters[j].toLowerCase()
+ }
+ chunks[i] = letters.join("")
+ }
+ return chunks.join(" ")
}
// durty hack to use a global to check this... but otherwise i'd have to rewrite the String.replace function? :/