Halo 1 & 2 for PC
This topic has moved here: Subject: Stats Web Script
  • Subject: Stats Web Script
Subject: Stats Web Script
  • gamertag:
  • user homepage:
  • last post: 01.01.0001 12:00 AM PDT

If like me you have a website, and you want to display your Halo 2 Stats on your own website, use the following script (Just replace the RSS Link [Copy Shortcut from the XML button on the stats page - this is for my stats. Have fun ya'll

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>RSS Reader</title>
<script language="Javascript">
var arrTitle = new Array(), arrDesc = new Array(), arrLink = new Array();
function loadXML(url, handler)
{
if (document.implementation && document.implementation.createDocument)
{
var xmldoc = document.implementation.createDocument("", "", null);
xmldoc.onload = function( ) { handler(xmldoc); }
xmldoc.load(url);
}
else if (window.ActiveXObject)
{
var xmldoc = new ActiveXObject("Microsoft.XMLDOM");
xmldoc.onreadystatechange = function( )
{
if (xmldoc.readyState == 4) handler(xmldoc);
}
xmldoc.load(url);
}
}

function formatRSS(xmldoc)
{
var items = xmldoc.getElementsByTagName("item");

for(var i = 0; i < items.length; i++)
{
var e = items[i];
arrTitle[i] = e.getElementsByTagName("title")[0].firstChild.data;
arrDesc[i] = e.getElementsByTagName("description")[0].firstChild .data;
arrLink[i] = e.getElementsByTagName("link")[0].firstChild.data;
}

shownews();
}

function shownews()
{
var strNewsReel = "<FONT FACE=Arial SIZE=-1>";

for(var idx = 0; idx < arrTitle.length; idx++ )
{
strNewsReel = strNewsReel + '<a target="_blank" href="' + arrLink[idx] + '">';
strNewsReel = strNewsReel + arrTitle[idx] + '</a><br/>';
strNewsReel = strNewsReel + splitdescription(arrDesc[idx]) + '<br/>';
}

strNewsReel = strNewsReel + '</FONT>';
document.write(strNewsReel);
}

function splitdescription(indesc)
{
var posboldtag = indesc.indexOf("<b>");
var outputstr = "";

// firststr holds Header information until <b>
var firststr = indesc.slice(0,(posboldtag - 1));
// reststr holds body information to be split into table
var reststr = indesc.slice(posboldtag);

posboldtag = firststr.indexOf("<br/>");

// this is the first line
var title1 = firststr.slice(0,posboldtag);
outputstr = '<h4>' + title1 + '</h4>';

var currpos = firststr.indexOf("<br/>",posboldtag + 10);
// this is the second line
var title2 = firststr.slice(posboldtag + 10,currpos);

outputstr = outputstr + '<i>' + title2 + '</i><br>';

var lastpos = firststr.indexOf("<br/>",currpos + 5);
// this is the third line
var title3 = firststr.slice(currpos + 5,lastpos);

outputstr = outputstr + '<i>' + title3 + '</i><br>';

// ------------------------------------------------------------------
// Now we split the second section ----------------------------------
// ------------------------------------------------------------------

var re = new RegExp (':', 'gi') ;

// first replace colons with commas
var tstring = reststr.replace(re,",");

// first we strip the header line for our table.
var endfirstline = tstring.indexOf("</b>");
var line1 = tstring.slice(3,endfirstline);

// now we remove this line and what's left becomes table content
var tcontent = tstring.slice(endfirstline + 4);

var gentable = tcontent.split("<br/>");

outputstr = outputstr + '<br><table border=1 cellspacing=1 cellpadding=5>';

outputstr = outputstr + returntblstringhdr(line1);

for (var t=0;t<gentable.length;t++)
{
outputstr = outputstr + returntblstring(gentable[t]);
}

outputstr = outputstr + '</table><hr>';

return(outputstr);
}

function returntblstring(inblock)
{
if (inblock.length == 0)
{ return ""; }
else
{
var output = "";
var strarray = inblock.split(",");

output = output + '<tr>';

for(var i = 0; i < strarray.length; i++)
{
output = output + '<td align=right>' + strarray[i] + '</td>';
}

output = output + '</tr>';

return output;
}
}

function returntblstringhdr(inblock)
{
if (inblock.length == 0)
{ return ""; }
else
{
var output = "";
var strarray = inblock.split(",");

output = output + '<tr bgcolor=#0080FF>';

for(var i = 0; i < strarray.length; i++)
{
output = output + '<td align=Right>' + strarray[i] + '</td>';
}

output = output + '</tr>';

return output;
}
}
</script>
</head>
<!-- Replace RSS Link here-->
<!-- replace the first section in '' -->
<body onLoad="loadXML('http://www.bungie.net/stats/halo2rs s.ashx?i=719267&k=1788841343',formatRSS)">
<!-- End Replace RSS Link -->
</body>
</html>

  • 02.25.2005 7:49 AM PDT
  • gamertag:
  • user homepage:
  • last post: 01.01.0001 12:00 AM PDT

this belongs in Zanzibar. PLease get off our beloved PC forum.

  • 02.25.2005 8:44 AM PDT
  • gamertag:
  • user homepage:
  • last post: 01.01.0001 12:00 AM PDT

Well said, ol' chap!

  • 02.25.2005 11:44 AM PDT