Archive for glbscripts.myfreeforum.org Forum dedicated to Greasemonkey Scripts made for Goal Line Blitz online game.
 



       glbscripts.myfreeforum.org Forum Index -> Problems and Support
Parab00n

Pulling Winning Streaks

I was passed on a Script that automatically goes in and pulls all the current winning streaks over 19 games. However, I was trying to get the results to display a little differently and so far I can't seem to get it to do so. Any help would be greatly appreciated.

Code:
// ==UserScript==
// @name           Winning Streaks
// @namespace      GLB
// @include        http://goallineblitz.com/game/leagues.pl
// ==/UserScript==

//Find all the leagues

var longWinStreaks = Array();


docsQueued = 0;

window.xpath = function(query, node) {
return document.evaluate(query, node, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
}

window.getDocument = function(url) {
docsQueued++;
GM_xmlhttpRequest( {
method: 'GET',
url: url,
headers: {
'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
'Accept': 'text/xml',
},
onload: function(responseDetails) {
findWinStreaks(responseDetails.responseText);
docsQueued--;
if(docsQueued==0)
{
for(index = 0; index < longWinStreaks.length; index++)
{
contentElement.innerHTML += longWinStreaks[index] + "<br/>";
}
contentElement.innerHTML += "<br/><br/>";
for(index = 0; index < longLosingStreaks.length; index++)
{
contentElement.innerHTML += longLosingStreaks[index] + "<br/>";
}
}
}
} );
}

window.findWinStreaks = function(doc) {
var div = document.createElement("div");
div.style.display = "none";
div.innerHTML = doc;

teamLinks = xpath(".//div//div[contains(@id,'conferences')]//div//table//tr//td//a[contains(@href, '/game/team.pl?team_id=')]", div);
league = xpath(".//div//div//a[contains(@href,'/game/league.pl?league_id=')]", div);
//nextGameTime = xpath(".//div//div[contains(@innerHTML,'Next sim in')]");
for(var teamIndex = 0; teamIndex < teamLinks.snapshotLength; teamIndex++)
{

streak = teamLinks.snapshotItem(teamIndex).parentNode.parentNode.childNodes[7].innerHTML;
indexOfW =streak.indexOf("W");

if(indexOfW != -1)
{

if(streak.substring(1) > 19)
{
longWinStreaks.push(teamLinks.snapshotItem(teamIndex).parentNode.parentNode.childNodes[3].innerHTML
+ ":" + teamLinks.snapshotItem(teamIndex).parentNode.parentNode.childNodes[7].innerHTML
+ " : " + league.snapshotItem(0).innerHTML + " : " );
}

}
}


}



contentElement = document.getElementById("content");
leagueLinks = xpath(".//div//a[contains(@href, '/game/league.pl?league_id=')]", contentElement);

for(var leagueIndex = 0; leagueIndex < leagueLinks.snapshotLength; leagueIndex++)
{
getDocument(leagueLinks.snapshotItem(leagueIndex).href);
}
Parab00n

This was the area that I thought I should change and no matter what changes I made it wouldn't work without it exactly like this. My desired result would be for it to list them like this:


1 . . . . . . . . . . . . W52 . . . . . . . . . . . . . . .SAPL . . . . . . . . .Santiago Benitos


I know how to make it list the . . . . no problems, however I just want the order changed if anyone is able to help me out.


Listed below is what I thought I should be adjusting.

Code:
if(streak.substring(1) > 19)
{
longWinStreaks.push(teamLinks.snapshotItem(teamIndex).parentNode.parentNode.childNodes[3].innerHTML
+ ":" + teamLinks.snapshotItem(teamIndex).parentNode.parentNode.childNodes[7].innerHTML
+ " : " + league.snapshotItem(0).innerHTML + " : " );
}
Parab00n

This is the post I am starting to maintain on GLB.

http://goallineblitz.com/game/forum_thread.pl?thread_id=1786170


Here is a SS of how the script currently puts out the info.


       glbscripts.myfreeforum.org Forum Index -> Problems and Support
Page 1 of 1
Create your own free forum | Buy a domain to use with your forum