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

DeletedUser

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
--

That is the same problem I have as well... and I am a baron on the world I tired to run it on.
 

dalesmckay

Guest
Ok... fixed.

That's what happens when you test it in a one man tribe. :icon_razz:
 

DeletedUser

Guest
Ok... fixed.

That's what happens when you test it in a one man tribe. :icon_razz:

It works now but when you have a big tribe it won't post because of that 1000 brackets thing... now you can copy and paste in sections... but would it not be benefitical to drop all the lines that just show a player as active... so it outputs only idle players and the graphs for all players and perhaps these 2 things could be in seperate boxes for easy copying?
 

DeletedUser

Guest
also.... when I do graphs for more than 1 type of graph (checking the boxes) firefox crashes. I do one at a time and the most I have been able to check is 3. I do it one at a time and wait for everything to load. When I do the 4th type of graph it always crashes and sometimes it will crash on 2 or 3.... perhaps a version that just outputed the bbcode instead of pasting the graph on the screen would help the overload. Anyway... once again any help would be appreciated.
 

dalesmckay

Guest
It works now but when you have a big tribe it won't post because of that 1000 brackets thing... now you can copy and paste in sections... but would it not be benefitical to drop all the lines that just show a player as active... so it outputs only idle players and the graphs for all players and perhaps these 2 things could be in seperate boxes for easy copying?

Stupid bracket limitation... I really don't see why they limit the number of brackets.
Having an "Active" column is just the original method I chose to implement it.
I personally find it nicer to have a single table sorted by Activity.

I have now split it into 3 different tables to show Inactive, Idle & Active Players.

I am showing the Active Players so you can quickly see who is being account sat and whether the sitter is outside the tribe.



also.... when I do graphs for more than 1 type of graph (checking the boxes) firefox crashes. I do one at a time and the most I have been able to check is 3. I do it one at a time and wait for everything to load. When I do the 4th type of graph it always crashes and sometimes it will crash on 2 or 3.... perhaps a version that just outputed the bbcode instead of pasting the graph on the screen would help the overload. Anyway... once again any help would be appreciated.

I can not replicate this issue in Firefox.
It takes a while to add the graphs, but it does not crash.

There is no reason to do a bb-code only version.
If you are having issues viewing all graphs on the Tribe Member screen, then why would you not also have the some issues on the Mail/Tribe-Forums screens?
 

DeletedUser

Guest
Stupid bracket limitation... I really don't see why they limit the number of brackets.
Having an "Active" column is just the original method I chose to implement it.
I personally find it nicer to have a single table sorted by Activity.

I have now split it into 3 different tables to show Inactive, Idle & Active Players.

I am showing the Active Players so you can quickly see who is being account sat and whether the sitter is outside the tribe.





I can not replicate this issue in Firefox.
It takes a while to add the graphs, but it does not crash.

There is no reason to do a bb-code only version.
If you are having issues viewing all graphs on the Tribe Member screen, then why would you not also have the some issues on the Mail/Tribe-Forums screens?


On the first issue.. thanks... and on the 2nd I can tell you it does... but it doesn't matter... because of tw brackets limitation I can't post more than 1 graph at a time so I copy the forum stuff for one type of graph and post and then do next and so on... it is only way it will fit. Anyway.. thanks for splitting your tables regarding the first issue.
 

DeletedUser

Guest
Also... this type of graph from twmaps might be a useful graph for you to add. I love this type of map because it shows your daily conquers for a month.

3383206
 
Top