glbscripts.myfreeforum.org Forum Index glbscripts.myfreeforum.org
Forum dedicated to Greasemonkey Scripts made for Goal Line Blitz online game.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   Join! (free) Join! (free)
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Pulling Winning Streaks

 
Post new topic   Reply to topic    glbscripts.myfreeforum.org Forum Index -> Problems and Support
View previous topic :: View next topic  
Author Message
Parab00n



Joined: 04 Jan 2009
Posts: 3

PostPosted: Sun Jan 04, 2009 5:02 pm    Post subject: Pulling Winning Streaks Reply with quote

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);
}



Back to top
View user's profile Send private message
Parab00n



Joined: 04 Jan 2009
Posts: 3

PostPosted: Sun Jan 04, 2009 5:04 pm    Post subject: Reply with quote

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 + " : " );
}
Back to top
View user's profile Send private message
Parab00n



Joined: 04 Jan 2009
Posts: 3

PostPosted: Sun Jan 04, 2009 5:10 pm    Post subject: Reply with quote

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.




Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    glbscripts.myfreeforum.org Forum Index -> Problems and Support All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Card File  Gallery  Forum Archive
Powered by phpBB © 2001, 2005 phpBB Group
Create your own free forum | Buy a domain to use with your forum