diff options
Diffstat (limited to 'webchat/public/functions.js')
-rw-r--r-- | webchat/public/functions.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/webchat/public/functions.js b/webchat/public/functions.js index 318d0865..781fafce 100644 --- a/webchat/public/functions.js +++ b/webchat/public/functions.js @@ -1,3 +1,11 @@ +function inputParser (str) { + var match = /^\/([a-z]+)(?:\s+(.*\S))?\s*$/.exec(str) + if (match) { + return { method: match[1], params: match[2] } + } else { + return { method: 'msg', params: str } + } +} function replaceURLWithHTMLLinks (text) { var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; |