diff options
| -rw-r--r-- | static/js/pichat.js | 20 |
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? :/ |
