summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortim b <timb@camcompu.home>2010-06-14 22:02:41 -0700
committertim b <timb@camcompu.home>2010-06-14 22:02:41 -0700
commit02b4185b2e77dc5cbb367514bf58c8bd72d64ee6 (patch)
treeaba8362244e62956e714c14da0831853dc321740
parent91ec3a6721b0b05830a043eb5ee1e47fc53ff001 (diff)
annoying caps
-rw-r--r--static/js/pichat.js20
1 files changed, 19 insertions, 1 deletions
diff --git a/static/js/pichat.js b/static/js/pichat.js
index c19ff6b..8245582 100644
--- a/static/js/pichat.js
+++ b/static/js/pichat.js
@@ -68,7 +68,25 @@ function getImagesAsArray(text) {
function linkify(text) {
LastMsgContainsImage = false
- return text.replace(URLRegex, linkReplace);
+ text = annoyingCaps(text)
+ text = text.replace(URLRegex, linkReplace);
+ return text
+}
+
+function annoyingCaps(text){
+ var chunks = text.split(" ")
+ console.log(chunks)
+ 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? :/