Prakash Ranganthan
unread,Dec 18, 2012, 4:58:32 AM12/18/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to greasemon...@googlegroups.com
The following is my greasemonkey script I have text "ABC-2105" in my text file in a line and in the website I have "ABC-210" it is actually matching both text and getting the text value I dont know what went wrong. Any help is much appreciated. Thanks in advance
function trimAll(sString)
{
while (sString.substring(0,1) == ' ')
{
sString = sString.substring(1, sString.length);
}
while (sString.substring(sString.length-1, sString.length) == ' ')
{
sString = sString.substring(0,sString.length-1);
}
return sString;
}
GM_xmlhttpRequest({
method: 'GET',
url: 'http://*******/newscript/Test.txt',
ignoreCache: true,
headers:
{
'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
'Accept':'text/plain',
},
onload: function(responseDetails)
{
var atcid = new Array();
atcid = responseDetails.responseText.split("\n");
var tempo =document.getElementsByTagName('p')[6].textContent;
var cid = tempo.split(":")
var tc = trimAll(cid[1]);
var tempcid = tc.split(" ")
var datcid = tempcid[0];
var logo = document.createElement("div");
logo.style.color = 'red';
var text = document.createTextNode(" None ");
for (x in atcid)
{
var str = trimAll(atcid[x]);
var ttcid = trimAll(datcid);
var result = str.match(ttcid);
if (result != null)
{text.textContent = ' ' +atcid[++x];
break;}
else{ ++x;
text.textContent = ' ';}
}