Hi,
As some people might have noticed, adding punctuation to an URL often results in getting a wrong or improper link, especially when it contains variables.
Thus,
http://www.youtube.com/watch?v is turned into
Http://www.Youtube.Com/watch?V because of the ? (not here, but if you add a variable, it will), generating an erroneous link. As those alterations caused me some snags, I concluded to add a slight modification.
Despite that I use a French version of Punctuator, I think it should work with the English one; I haven't tested it yet though.
Just after the var stuff ends, add:
code:
var exp2=new RegExp("http", "gi");
if (sMessage_.search(exp2)==-1) {
And then conclude with:
code:
}
at the very end. You should get something like:
code:
function OnEvent_ChatWndSendMessage(pChatWnd, sMessage){
sMessage_ = sMessage
sLast = sMessage_.substr(sMessage_.length-1,1)
var exp=new
RegExp("[a-zA-Z0-9éèêëàáâäóòôöíìîïçÉÈÊËÀÁÂÄÒÓÔÖÌÍÎÏÇ-]+","g");
var Mots=sMessage_.match(exp)
var exp2=new RegExp("http", "gi");
if (sMessage_.search(exp2)==-1) {
if (Mots.length == 1) {}
else if (sLast != "!" && sLast != "?" && sLast != ".")
{sMessage = sMessage_.substr(0,1).toUpperCase() + sMessage_.substr(1) + '.';}
else
{sMessage = sMessage_.substr(0,1).toUpperCase() + sMessage_.substr(1);}
sMessage_ = sMessage
for (i=0; i<sMessage.length; i++)
if (sMessage.substr(i,1) == "!" || sMessage.substr(i,1) == "?" || sMessage.substr(i,1) == ".") {
u=(i+1);
while (u<sMessage.length && sMessage_.substr(u,1)==" ") {
u++;
}
sMessage = sMessage_.substr(0,u)+sMessage_.substr(u,1).toUpperCase()+sMessage_.substr(u+1)
sMessage_ = sMessage
}
return sMessage;
}
}
Thought it was gonna be a tough nut to crack, but no.