Stats Stat graphs on member lists

File Not Found

Guest
Author
File Not Found
Contributors
N/A
Quickbar Entry
javascript:
table_depth = 3;
name_var = "Name";
show_points = true;
show_villages = true;
show_ODA = true;
show_ODD = true;
dimensions =[180, 96]; /* Change nothing below here */
plus_one = 1;
type = "player";

if (typeof (main) != 'undefined')
{$ = main.$;
game_data = main.game_data;
}

if(game_data.market != "en")
{twstats = "http://"+game_data.market+".twstats.com/";
}
else
{twstats = "http://twstats.com/";
}

if (document.getElementById("ally_content") != null)
{table = document.getElementById("ally_content").getElementsByTagName("table")[0];
plus_one = 0;
}
else if (document.getElementById("player_ranking_table"))
{table = document.getElementById("player_ranking_table");
}
else if (document.getElementById("ally_ranking_table"))
{table = document.getElementById("ally_ranking_table");
type = "tribe";
}
else if (document.getElementById("con_ally_ranking_table"))
{table = document.getElementById("con_ally_ranking_table");
type = "tribe";
}
else if (document.getElementById("con_player_ranking_table"))
{table = document.getElementById("con_player_ranking_table");
}
else if (document.getElementById("kill_player_ranking_table"))
{table = document.getElementById("kill_player_ranking_table").parentNode.getElementsByTagName("table")[1];
}
else if (document.getElementById("kill_ally_ranking_table"))
{table = document.getElementById("kill_ally_ranking_table").parentNode.getElementsByTagName("table")[1];
type="tribe";
}
else
{table = $("table:contains('"+name_var+"')")[table_depth];
plus_one = 1;
}
rows = table.getElementsByTagName("tr");
if (show_points == true)
{ rows[0].innerHTML += "<th><center><b><u>Points</u></b></center></th>";
}
if (show_villages == true)
{ rows[0].innerHTML += "</b></center></th><th><center><b><u>Villages</u></b></center></th>";
}
if (show_ODA == true)
{rows[0].innerHTML += "<th><center><b><u>ODA</u></b></center></th>";
}
if (show_ODD == true)
{rows[0].innerHTML += "<th><center><b><u>ODD</u></b></center></th>";
}
for (i = 1;i < rows.length - 1 + plus_one;i++)
{pid = rows[i].getElementsByTagName("a")[0].toString().match(/id=\d+/).toString().split( "=")[1];
if (show_points == true)
{rows[i].innerHTML += "<td><img src='"+twstats + game_data.world + "/image.php?type=" + type +
"graph&graph=points&id=" + pid + "' style='width:" + dimensions[0] + "px; height:" + dimensions[1] + "px'></img></td>";
}
if (show_villages == true)
{rows[i].innerHTML += "<td><img src='"+twstats + game_data.world + "/image.php?type=" + type + "graph&graph=villages&id=" +
pid + "' style='width:" + dimensions[0] + "px; height:" + dimensions[1] + "px'></img></td>";
}
if (show_ODA == true)
{rows[i].innerHTML += "<td><img src='"+twstats + game_data.world + "/image.php?type=" + type + "graph&graph=oda&id=" + pid + "' style='width:" + dimensions[0] +
"px; height:" + dimensions[1] + "px'></img></td>";
}
if (show_ODD == true)
{rows[i].innerHTML += "<td><img src='"+twstats + game_data.world + "/image.php?type=" + type +
"graph&graph=odd&id=" + pid + "' style='width:" + dimensions[0] + "px; height:" + dimensions[1] +
"px'></img></td>";
}
}
void (0);
Public?
Public
The below will from any tribe member list, including your own, add the four main stat graphs for each user, to your the end of the players row on the list.


Alter these variables (at the start of the script) for the following effect.

table_depth = 3 - adjust this if the script is giving problems, and tell me whether it fixes the issue. *** Use second version, it will work without this ***
name_var = 'Name' - If you play on a non English server, this needs to be the word used for the header of the Name column on the other tribe member list.
show_points = true / false - Enables/Disables the Points Graph
show_villages = true / false - Enables/Disables the Villages Graph
show_ODA = true / false - Enables/Disables the ODA Graph
show_ODD = true / false - Enables/Disables the ODD Graph
dimensions = [180, 96] - Adjusts the size of the displayed graphs.



[spoil]
Code:
javascript: 
table_depth = 3;
name_var = "Name";
show_points = true;
show_villages = true;
show_ODA = true;
show_ODD = true;
dimensions =[180, 96]; /* Change nothing below here */
plus_one = 1;
type = "player";

if (typeof (main) != 'undefined')
   {$ = main.$;
    game_data = main.game_data;
   }

if(game_data.market != "en")
   {twstats = "http://"+game_data.market+".twstats.com/"; 
   } 
else 
   {twstats = "http://twstats.com/";
   }

if (document.getElementById("ally_content") != null)
   {table = document.getElementById("ally_content").getElementsByTagName("table")[0];
    plus_one = 0;
   }
else if (document.getElementById("player_ranking_table"))
   {table = document.getElementById("player_ranking_table");
   }
else if (document.getElementById("ally_ranking_table"))
   {table = document.getElementById("ally_ranking_table");
    type = "tribe";
   }
else if (document.getElementById("con_ally_ranking_table"))
   {table = document.getElementById("con_ally_ranking_table");
    type = "tribe";
   }
else if (document.getElementById("con_player_ranking_table"))
   {table = document.getElementById("con_player_ranking_table");
   }
else if (document.getElementById("kill_player_ranking_table"))
   {table = document.getElementById("kill_player_ranking_table").parentNode.getElementsByTagName("table")[1];
   }
else if (document.getElementById("kill_ally_ranking_table"))
   {table = document.getElementById("kill_ally_ranking_table").parentNode.getElementsByTagName("table")[1];
    type="tribe";
   }
else 
   {table = $("table:contains('"+name_var+"')")[table_depth];
    plus_one = 1;
   }
rows = table.getElementsByTagName("tr");
if (show_points == true)
   {   rows[0].innerHTML += "<th><center><b><u>Points</u></b></center></th>";
   }
if (show_villages == true)
   {   rows[0].innerHTML += "</b></center></th><th><center><b><u>Villages</u></b></center></th>";
   }
if (show_ODA == true)
   {rows[0].innerHTML += "<th><center><b><u>ODA</u></b></center></th>";
   }
if (show_ODD == true)
   {rows[0].innerHTML += "<th><center><b><u>ODD</u></b></center></th>";
   }
for (i = 1;i < rows.length - 1 + plus_one;i++)
   {pid = rows[i].getElementsByTagName("a")[0].toString().match(/id=\d+/).toString().split( "=")[1];
    if (show_points == true)
       {rows[i].innerHTML += "<td><img src='"+twstats + game_data.world + "/image.php?type=" + type + 
          "graph&graph=points&id=" + pid + "' style='width:" + dimensions[0] + "px; height:" + dimensions[1] + "px'></img></td>";
       }
    if (show_villages == true)
       {rows[i].innerHTML += "<td><img src='"+twstats + game_data.world + "/image.php?type=" + type + "graph&graph=villages&id=" + 
          pid + "' style='width:" + dimensions[0] + "px; height:" + dimensions[1] + "px'></img></td>";
       }
    if (show_ODA == true)
       {rows[i].innerHTML += "<td><img src='"+twstats + game_data.world + "/image.php?type=" + type + "graph&graph=oda&id=" + pid + "' style='width:" + dimensions[0] + 
          "px; height:" + dimensions[1] + "px'></img></td>";
       }
    if (show_ODD == true)
       {rows[i].innerHTML += "<td><img src='"+twstats + game_data.world + "/image.php?type=" + type + 
          "graph&graph=odd&id=" + pid + "' style='width:" + dimensions[0] + "px; height:" + dimensions[1] + 
          "px'></img></td>";
       }
   }
void (0);
[/spoil]



This should get around the table depth issue. As usual, let me know.

[spoil]
Code:
javascript:
name_var = 'Name'; 
show_points = true;
show_villages = true;
show_ODA = true;
show_ODD = true;
dimensions =[180, 96]; /* Change nothing below here */
plus_one = 1;
type = "player";

if (typeof (main) != 'undefined')
   {$ = main.$;
    game_data = main.game_data;
   }

if(game_data.market != "en")
   {twstats = "http://"+game_data.market+".twstats.com/"; 
   } 
else 
   {twstats = "http://twstats.com/";
   }

if (document.getElementById("ally_content") != null)
   {table = document.getElementById("ally_content").getElementsByTagName("table")[0];
    plus_one = 0;
   }
else if (document.getElementById("player_ranking_table"))
   {table = document.getElementById("player_ranking_table");
   }
else if (document.getElementById("ally_ranking_table"))
   {table = document.getElementById("ally_ranking_table");
    type = "tribe";
   }
else if (document.getElementById("con_ally_ranking_table"))
   {table = document.getElementById("con_ally_ranking_table");
    type = "tribe";
   }
else if (document.getElementById("con_player_ranking_table"))
   {table = document.getElementById("con_player_ranking_table");
   }
else if (document.getElementById("kill_player_ranking_table"))
   {table = document.getElementById("kill_player_ranking_table").parentNode.getElementsByTagName("table")[1];
   }
else if (document.getElementById("kill_ally_ranking_table"))
   {table = document.getElementById("kill_ally_ranking_table").parentNode.getElementsByTagName("table")[1];
    type="tribe";
   }
else 
   {table = $("table:contains('"+name_var+"')")[$("table:contains('"+name_var+"')").length - 1];
    plus_one = 1;
   }
rows = table.getElementsByTagName("tr");
if (show_points == true)
   {   rows[0].innerHTML += "<th><center><b><u>Points</u></b></center></th>";
   }
if (show_villages == true)
   {   rows[0].innerHTML += "</b></center></th><th><center><b><u>Villages</u></b></center></th>";
   }
if (show_ODA == true)
   {rows[0].innerHTML += "<th><center><b><u>ODA</u></b></center></th>";
   }
if (show_ODD == true)
   {rows[0].innerHTML += "<th><center><b><u>ODD</u></b></center></th>";
   }
for (i = 1;i < rows.length - 1 + plus_one;i++)
   {pid = rows[i].getElementsByTagName("a")[0].toString().match(/id=\d+/).toString().split( "=")[1];
    if (show_points == true)
       {rows[i].innerHTML += "<td><img src='"+twstats + game_data.world + "/image.php?type=" + type + 
          "graph&graph=points&id=" + pid + "' style='width:" + dimensions[0] + "px; height:" + dimensions[1] + "px'></img></td>";
       }
    if (show_villages == true)
       {rows[i].innerHTML += "<td><img src='"+twstats + game_data.world + "/image.php?type=" + type + "graph&graph=villages&id=" + 
          pid + "' style='width:" + dimensions[0] + "px; height:" + dimensions[1] + "px'></img></td>";
       }
    if (show_ODA == true)
       {rows[i].innerHTML += "<td><img src='"+twstats + game_data.world + "/image.php?type=" + type + "graph&graph=oda&id=" + pid + "' style='width:" + dimensions[0] + 
          "px; height:" + dimensions[1] + "px'></img></td>";
       }
    if (show_ODD == true)
       {rows[i].innerHTML += "<td><img src='"+twstats + game_data.world + "/image.php?type=" + type + 
          "graph&graph=odd&id=" + pid + "' style='width:" + dimensions[0] + "px; height:" + dimensions[1] + 
          "px'></img></td>";
       }
   }
void (0);
[/spoil]

12:37:44 27/12/2010 - Update: Should now work from all "Rankings" pages.
13:33:33 27/12/2010 - Update: Reintroduced internationalization patch
13:33:33 27/12/2010 - Update: Added code to enable script for non premium accounts.
16:00:19 27/12/2010 - Update: Added variable for table depth as a debugging option.
0:02:22 28/12/2010 - Update: Added name_var variable, to enable international users to have the script work on other tribe member lists.
 
Last edited:
Upvote 0

File Not Found

Guest
it doesnt work to me...

can someone put again the real code with the fixed one?


Come again?

I've re-introduced the patch for non .net servers, is this what you needed?


Can this work on plemena.net (ba servers)?
When I execute script, it can't show images.
If you need SS, let me know.

In theory, the internationalization patching should fix this issue. Please try again now.
 

DeletedUser

Guest
I use Opera version 11, and it doesn't work on one players page, one tribes page and on another tribes member list. Do you have any idea of why?
 

Apathetic h0llygh0st

Consumer of Beverages
Reaction score
1,193
It works for me on Opera 10. w/e and Opera 11 ^^
And this was before you changed it for the ones that didn't work 0o
 

File Not Found

Guest
-Sondre- @ Single player, and Single tribe pages were never supported, but are planned. As for other tribe member lists, try the second script up top, and it should fix it.


hollygh0st @ Are you saying the new version doesn't work for you?


basketbill @ Ahh, the problem with that, will be the match on Name, to determine the table. I will edit both scripts to allow you to set this at the start.
 

DeletedUser

Guest
On other tribes member lists it doesn't work. I'm on a world with version 7, and it's not .net - but .no.com and .dk.

But I think it's kinda weird that it does work on my tribes member page, but not other tribes member page - so after my opinion the problem shouldn't be the servers.?
 
Last edited by a moderator:

File Not Found

Guest
Right, so, your using it on a non .net server.

Did you update the name_var variable, to the correct word?


-EDIT-

Tested on world54 (TW Version 7.0), works fine

Which leads me to the only conclusion I can come to, which is you need to set name_var

Without creating an account on those servers, I believe the variable should be set to... "Navn"
 
Last edited:

DeletedUser

Guest
No, I didn't. How do I know what is right for .dk for example? Or in other words, how do I find the correct replacement?
 
Last edited by a moderator:

File Not Found

Guest
Ok, to find the value that it should be, goto the member list of another tribe, and look at the header for the name column. The word in the first header (on .net it is "Name") (Arabic servers may vary, I would need to speak to Safastak to confirm this)


Name Rank Points Villages
 

DeletedUser

Guest
I can get this to work for my own tribe member list but not for other tribe member lists... is there anyone that can fix this?
 

File Not Found

Guest
Now... which one of the scripts were you using (there are two in the first post).

I've tested with the second, and had no issues whatsoever.
 

DeletedUser

Guest
Doesn't matter it is working now. don't know what i did wrong. Quite a good script. (i think i might have been using the first one)
 

DeletedUser99686

Guest
Is there any way of getting this to work in a tribe forum area?
I would love to have a forum topic where everybody could just see their tribes mates progress graphically.
Maybe a modified Opp Generator would be able to read the members list and output the required BB codes?
 

dalesmckay

Guest
Is there any way of getting this to work in a tribe forum area?
I would love to have a forum topic where everybody could just see their tribes mates progress graphically.
Maybe a modified Opp Generator would be able to read the members list and output the required BB codes?

Get one of your tribe council to run this script on the Tribe Member Screen and paste the result in the Tribe Forum:

Manage Tribe Script:
[SPOIL]
Code:
javascript:(window.main||self).$.getScript('http://dl.dropbox.com/u/25377948/twscripts/tribe_member_management.js',function(){var script=new ManageTribe();script.execute();});void(0);
[/SPOIL]


Also, here's my version of the Player Graph Script (see FileNotFound's scripts in the original post):
Player Ranking Stats Script:
[SPOIL]
Code:
javascript:
var config={
	showPoints:true,
	showVillages:true,
	showODA:true,
	showODD:true,
	width:'180px',
	height:'96px'
};
(window.main||self).$.getScript('http://dl.dropbox.com/u/25377948/twscripts/ranking_stats.js',function(){var script=new RankingStats();script.execute(config);});void(0);
[/SPOIL]
 
Last edited:

DeletedUser

Guest
Dale your tribe manage script for me... only does myself when run and not the whole tribe. It looks very nice once I can get it to work though for the whole tribe. I use firefox.... any help would be appreciated.
 

DeletedUser99686

Guest
Yes, thank you for the advice but I can only get the currently logged in member output as well as shown below.

Tribe Member Activity


[**]Members[||]Inactive (7+ days)[||]Idle (2+ days)[||]Active[||]Sat[/**]
[*]1[||]0 - (0.00%)[||]0 - (0.00%)[||]1 - (100.00%)[||]0 - (0.00%)

[**]Activity[||]Player[||]Points[||]Villages[||]Sitter[||]Comment[/**]
[*] Active [|][player]-XeLa-[/player][|]6868[|]2[|][|]


Tribe Member Statistics


[**]Player[||]Points[||]Villages[||]ODA Stats[||]ODD Stats[||]Point Stats[||]Village Stats[/**]
[*][player]-XeLa-[/player][|]6868[|]2[|]
image.php
[|]
image.php
[|]
image.php
[|]
image.php



Valid @ Server time: 0:28:27 26/09/2011
--
 
Top