speciale output

Status
Niet open voor verdere reacties.

Clench

Gebruiker
Lid geworden
7 jun 2006
Berichten
5
Onderstaand staat een javascript wat een output genereerd uit http://www.clanbase.com/cbjswarpast.php?cid=1014301.

<script>
var count = 0;
var count2 = 0;

//
// This function is called BEFORE enumerating
// all wars. Use it to start a table etc
//
function cbjsWarPast_Start()
{
document.write("<table border='0' cellpadding='1' cellspacing='1'>");
document.write("<tr>");
document.write("<td class='small'><strong>Opponent</strong></td>");
document.write("<td class='small' align='center'><strong>Date</strong></td>");
document.write("<td class='small' colspan='2'align='center'><strong>Score</strong></td>");
document.write("<td class='small' align='center'><strong>Maps</strong></td>");
document.write("<td class='small' align='center'><strong>Ladder</strong></td>");
document.write("<td class='small'><strong>Forfeit</strong></td>");
document.write("<td class='small'><strong>Demo</strong></td>");
document.write("</tr>");
}

//
// This function is called AFTER enumerating
// all wars. Use it to start end table etc
//
function cbjsWarPast_End()
{
document.write("</table>");
}

//
// This function is called for each war
//
function cbjsWarPast_Each(wid,clan,cid,lid,date,score1,score2,level1,level2,
game,subgame,forfeit,type,hasdemo)
{
if(count >= 40)
return;
// Only official matches
if(type!=0)
return;
// Skip forfeit wins
if(forfeit=='Y')
return;
// score1 is our score
// (an interesting usage would we: if(score1 < score2) return; !
if(score1 > score2)
document.write("<tr bgcolor='#1F8500'>");
else
if(score1 < score2)
document.write("<tr bgcolor='#790000'>");
else
document.write("<tr bgcolor='#ABABAB'>");
document.write("<td class='small'><a href='http://www.clanbase.com/claninfo.php?cid="+cid+"' class='slink' target='bla'>"+clan+"</a></td>");
document.write("<td class='small'><strong>"+date+"</strong></td>");
document.write("<td class='small' align='right'><strong>"+score1+"</strong></td>");
document.write("<td class='small' align='right'><strong>"+score2+"</strong></td>");
document.write("<td class='small'><strong>"+level1+"/"+level2+"</strong></td>");
document.write("<td class='small'><a href='http://www.clanbase.com/rating.php?lid="+lid+"' class='slink' target='bla'>"+game+"/"+subgame+"</a></td>");
document.write("<td class='small' align='center'><strong>"+forfeit+"</strong></td>");

document.write("<td class='small' align='center'>");
if(hasdemo=='Y')
document.write("<a href='http://www.clanbase.com/demolist.php?post=1&wid="+wid+"' class='slink' target='bla'><img src='http://www.clanbase.com/demo.gif' border='0'></a>");
else
document.write(" ");
document.write("</td>");
document.write("</tr>");
count++;
}


function cbjsWarUpcoming_Start()
{
// Do nothing !
}

function cbjsWarUpcoming_End()
{
// Do nothing !
}

function cbjsWarUpcoming_Each(wid,clan,cid,lid,date,level1,level2,game,subgame,type)
{
// Only show first match
if(count2)
return;
// Note: the date is GMT
// Converting this date to localtime is left as an excercise for the reader :-)
document.write("Next war: <a href='http://www.clanbase.com/claninfo.php?cid="+cid+"' class='slink' target='bla'>"+clan+"</a>");
document.write(", "+date+"");
document.write(", <a href='http://www.clanbase.com/rating.php?lid="+lid+"' class='slink' target='bla'>"+game+"/"+subgame+"</a>");
document.write(", <a href='http://www.clanbase.com/warinfo.php?wid="+wid+"' class='slink' target='bla'>details</a>");
count2++;
}


</script>
<strong>Matchresults:</strong><br><br>
<script src='http://www.clanbase.com/cbjswarpast.php?cid=1014301'></script>
<br><br><br>
<strong>Upcoming matches:</strong><br><br>
<script src='http://www.clanbase.com/cbjswarupcoming.php?cid=1014301'></script>

Een klein stukje uit deze php waarna het javascript komt:
De text met de :( erachter zijn de LID's die ook in het bovenstaande script staan.
Het is de bedoeling dat in de output niet alle LID's worden weergegeven achter elkaar.
Eigenlijk wil ik voor elke LID die we spelen een aparte tabel komt.
Mij lijkt dit het makkelijkste door andere LID's te exclude uit de output.
1011 & 258 zijn de LID's die hieronder ertussen zitten uit het kleine stukje text gesecelteerd uit de source.

Nu zou ik 1011 NIET willen weergeven...
Kan iemand mij vertellen wat ik dan aan het javascript zou moeten toevoegen om dit te kunnen realiseren.



cbjsWarPast_Start();cbjsWarPast_Each(
5681967,
"Vr3",
145940,
258,:(
"2006-06-09",
1,
42,
"CTF-Gauntlet",
"CTF-DukuCB3",
"Unreal",
"iCTF",
"N",
0,
"N"
);cbjsWarPast_Each(
5585951,
"GoC",
113892,
258,:(
"2006-06-08",
9,
9,
"CTF-DukuCB3",
"CTF-Ranel Joltedition",
"Unreal",
"iCTF",
"N",
0,
"N"
);cbjsWarPast_Each(
5669748,
"wGzz",
388546,
1011,:(
"2006-06-05",
6,
24,
"ours",
"yours",
"Unreal",
"iCTF",
"N",
0,
"N"
 
thx

ik kreeg net een hele vriendelijke PM met het antwoord (not)
Nou het antwoord stond erin btw

function cbjsWarPast_Each(wid,clan,cid,lid,date,score1,score2,level1,level2,
game,subgame,forfeit,type,hasdemo)
{
if(count >= 40)
return;
// Alleen speciale lid weergeven
if(lid!=258)
return;


bedankt voor de hulp! :thumb:
 
function cbjsWarUpcoming_Each(wid,clan,cid,lid,date,level1,level2,game,subgame,type)
{
// Only show first match
if(count2)
return;
// Note: the date is GMT
// Converting this date to localtime is left as an excercise for the reader :-)
document.write("Next war: <a href='http://www.clanbase.com/claninfo.php?cid="+cid+"' class='slink' target='bla'>"+clan+"</a>");
document.write(", "+date+"");
document.write(", <a href='http://www.clanbase.com/rating.php?lid="+lid+"' class='slink' target='bla'>"+game+"/"+subgame+"</a>");
document.write(", <a href='http://www.clanbase.com/warinfo.php?wid="+wid+"' class='slink' target='bla'>details</a>");
count2++;
}

om de datum te converten naar lokale tijd heb ik volgens Clanbase dit nodig:

function parseCBDate(str) {
var parts = str.split(' ');
var time = parts[1].split(':');
time[0]+?; //adjust hour here
document.write(parts[0]+" "+time[0]+":"+time[1]+":"+time[2]);
}

waar ? het aantal uren is dat je bij GMT wilt optellen.

om het geheel aan de praat te krijgen moet ik dan:
If you wish to use a local time different from GMT you need to parse the date string, adjust the hour and replace "date" with "parseCBDate(date)".

ik zal iets ubersimpels over het hoofd zien, maar toch krijg ik de boel niet aan de praat..
kan iemand me vertellen hoe ik dit op de juiste manier aan elkaar rijg?
bij mij ziet het er momenteel zo uit:
function parseCBDate(str) {
var parts = str.split(' ');
var time = parts[1].split(':');
time[0]+2; //adjust hour here
document.write(parts[0]+" "+time[0]+":"+time[1]+":"+time[2]);
}

function cbjsWarUpcoming_Each(wid,clan,cid,lid,level1,level2,game,subgame,type)
{
// Only show first match
if(count2)
return;
// Note: the date is GMT
// Converting this date to localtime is left as an excercise for the reader :-)
document.write("Opponent:<br> <a href='http://www.clanbase.com/claninfo.php?cid="+cid+"' class='slink' target='bla'>"+clan+"</a><br>");
document.write("Date:<br> <a href='#'>"+parseCBDate(date)+"</a><br>");
document.write("Ladder:<br> <a href='http://www.clanbase.com/rating.php?lid="+lid+"' class='slink' target='bla'>"+game+"/"+subgame+"</a><br>");
document.write("Maps:<br> <a href='http://www.clanbase.com/warinfo.php?wid="+wid+"' class='slink' target='bla'>"+level1+"<br>"+level2+"</a><br>");
count2++;
}


alvast bedankt!

met vriendelijke groet,
Square-HeX
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan