From 0f7b5fce63b58fc05bc8dab114668ccafb82b8ff Mon Sep 17 00:00:00 2001 From: BlueRaja Date: Mon, 4 Mar 2013 01:11:51 -0600 Subject: BUGFIX: Multiple hashes (#) in a line break url creation in chat --- pages/chat.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'pages') diff --git a/pages/chat.php b/pages/chat.php index 41b07fb..27122d8 100644 --- a/pages/chat.php +++ b/pages/chat.php @@ -147,15 +147,13 @@ function chatReplaceAndEncode(chat) { chat = chat.replace(/\*\*(\S(.*?\S)?)\*\*/gm, "$1"); chat = chat.replace(/\~\~(\S(.*?\S)?)\~\~/gm, "$1"); chat = chat.replace(/\*(\S(.*?\S)?)\*/gm, "$1"); - - //TODO: For Blue: - // I want the # in the to=$1 to turn into %23; but not anywhere else. + + //Surround all URLs with a link var URLexp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; chat = chat.replace(URLexp, "$1"); - //Here's to hoping no one puts a hash infront of a URL... - chat = chat.replace(/\#/, "%23"); - //Here's for when someone does that and goes "wth?" - //chat = chat.replace(/\#/g, "%23"); + + //Replace # in the URL with %23 + chat = chat.replace(//ig, ""); return chat; } -- cgit v1.2.3