12-24-2009, 12:09 PM
(This post was last modified: 12-28-2009, 03:36 AM by davidelliott-.)
Hello, This is someone elses script but i want to edit it for my personal use. Anyway here is the code;
What i want to change it instead of it replace the text that i send e.g 'Google(test)'
I want it to send 'Google (test)' then the link.
Thanks for help
Code:
function FilterString( str )
{
var googleMatches = null;
//While a match is found to the regular expression
while( (googleMatches = str.match( "Google\\(.*?\\)" )) != null )
{
//Get string
var googleString = googleMatches[0];
Debug.Trace( googleString )
//Get the search text
var searchText = googleString.substring(7, googleString.length-1);
//Replace all spaces with +'s
searchText = searchText.replace(' ', '+');
//Make it into it's final form
searchText = "http://lmgtfy.com/?q=" + searchText;
//Replace
str = str.replace( googleString, searchText );
}
//Return
return str;
}
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
return FilterString( Message );
}
What i want to change it instead of it replace the text that i send e.g 'Google(test)'
I want it to send 'Google (test)' then the link.
Thanks for help