<html> |
= |
<html> |
<head> |
|
<head> |
<meta http-equiv="content-type" content="text/html; charset=<charset>" /> |
|
<meta http-equiv="content-type" content="text/html; charset=<charset>" /> |
<title>Tournament Director Player Statistics</title> |
|
<title>Tournament Director Player Statistics</title> |
</head> |
|
</head> |
|
|
|
<style type="text/css"> |
|
<style type="text/css"> |
BODY |
|
BODY |
{ |
|
{ |
background-color: #7288a3; |
<> |
background-color: #5f7a96; |
} |
= |
} |
|
|
|
.infotable |
|
.infoTable |
{ |
|
{ |
border: 2px solid #000000; |
<> |
border: 2px solid #000; |
|
|
border-radius: 6px; |
|
|
font-family: Segoe UI; |
|
|
font-size: 12pt; |
|
|
background-color: #fff; |
|
|
color: #000; |
|
|
text-align: center; |
|
|
display: inline-block; |
|
|
} |
|
= |
|
|
-+ |
.tableHeader |
|
|
{ |
padding: 8px; |
= |
padding: 8px; |
background-color: #ffffff; |
<> |
background-color: #000; |
color: #000000; |
|
color: #fff; |
font-family: Tahoma; |
|
|
font-size: 12pt; |
|
text-align: center; |
} |
= |
} |
|
|
|
.eventname |
|
.eventname |
{ |
|
{ |
font-size: 16pt; |
|
font-size: 16pt; |
font-weight: bold; |
|
font-weight: bold; |
} |
|
} |
|
|
|
.description |
|
.description |
{ |
|
{ |
font-weight: bold; |
|
font-weight: bold; |
} |
|
} |
|
|
|
.statsTable |
|
.statsTable |
{ |
|
{ |
border: 2px solid #000000; |
+- |
|
padding: 8px; |
= |
padding: 8px; |
background-color: #ffffff; |
<> |
background-color: #fff; |
color: #000000; |
|
color: #000; |
font-family: Tahoma; |
|
font-family: Segoe UI; |
font-size: 10pt; |
|
font-size: <fontSize>; |
|
|
border-radius: 6px; |
} |
= |
} |
|
|
|
.statsColumnHeader |
|
.statsColumnHeader |
{ |
|
{ |
font-weight: bold; |
|
font-weight: bold; |
padding-left: 5px; |
+- |
|
padding-right: 5px; |
|
|
white-space: nowrap; |
|
|
} |
= |
} |
|
|
|
.statsColumn |
|
.statsColumn |
{ |
|
{ |
padding-left: 5px; |
<> |
|
padding-right: 5px; |
|
padding: <listPadding>px 5px; |
white-space: nowrap; |
= |
white-space: nowrap; |
} |
|
} |
|
|
|
.odd |
|
.odd |
{ |
|
{ |
} |
|
} |
|
|
|
.even |
|
.even |
{ |
|
{ |
background-color: #eeeeee; |
<> |
background-color: #eee; |
} |
= |
} |
|
|
|
|
-+ |
.playerImageWidthWise |
|
|
{ |
|
|
width: <playerImageDim>px; |
|
|
} |
|
= |
|
|
-+ |
.playerImageHeightWise |
|
|
{ |
|
|
height: <playerImageDim>px; |
|
|
} |
|
= |
|
</style> |
|
</style> |
|
|
|
<script> |
|
<script> |
|
|
|
|
|
|
var TDSort = (function() |
|
var TDSort = (function() |
{ |
|
{ |
// the column index on which we are sorting |
|
// the column index on which we are sorting |
var sortIndex = -1; |
|
var sortIndex = -1; |
// was the last sort a reverse sort? |
|
// was the last sort a reverse sort? |
var reverseSort = false; |
|
var reverseSort = false; |
// not going to try too hard for browser compatibility - just check for IE or non-IE |
|
// not going to try too hard for browser compatibility - just check for IE or non-IE |
var mTextKey = document.all ? "innerText" : "textContent"; |
|
var mTextKey = document.all ? "innerText" : "textContent"; |
var mTableID = ""; |
|
var mTableID = ""; |
var mHeaderRowID = ""; |
|
var mHeaderRowID = ""; |
var mData = <playerdata>; |
|
var mData = <playerdata>; |
|
<> |
var mColumns = <columnsdata>; |
var mIndexCol = -1; |
|
var mIndexCol = <indexColumn>; |
|
= |
|
|
|
|
|
|
|
// initialize the page |
|
// initialize the page |
function init(inTableID, inHeaderRowID) |
|
function init(inTableID, inHeaderRowID) |
{ |
|
{ |
mTableID = inTableID; |
|
mTableID = inTableID; |
mHeaderRowID = inHeaderRowID; |
|
mHeaderRowID = inHeaderRowID; |
|
|
|
// set the "Index" column |
+- |
|
if(mData.length > 0) |
|
|
{ |
|
|
for(var i=0, iLen = mData[0].length; i < iLen; i++) |
|
|
{ |
|
|
if(mData[0][i]["IsIndex"]) |
|
|
mIndexCol = i; |
|
|
} |
|
|
} |
|
|
|
= |
|
// install an onClick handler for each column header |
|
// install an onClick handler for each column header |
var theRow = document.getElementById(mHeaderRowID); |
|
var theRow = document.getElementById(mHeaderRowID); |
var getSortFn = function(inIndex) { return function() { sortByColumn(inIndex); }; } |
|
var getSortFn = function(inIndex) { return function() { sortByColumn(inIndex); }; } |
|
|
|
if(theRow) |
|
if(theRow) |
{ |
|
{ |
for(var i=0, iLen = theRow.cells.length; i < iLen; i++) |
|
for(var i=0, iLen = theRow.cells.length; i < iLen; i++) |
{ |
|
{ |
if(i != mIndexCol) |
<> |
if((i != mIndexCol) && (mColumns[i].Key != "_PlayerImage") && (mColumns[i].Key != "_HitmanImage")) |
{ |
= |
{ |
theRow.cells[i].onclick = getSortFn(i); |
|
theRow.cells[i].onclick = getSortFn(i); |
theRow.cells[i].style.cursor = "pointer"; |
|
theRow.cells[i].style.cursor = "pointer"; |
} |
|
} |
} |
|
} |
} |
|
} |
|
|
|
// put a reference to each row in the data, if we haven't already |
|
// put a reference to each row in the data, if we haven't already |
var theRows = document.getElementById(mTableID).rows; |
|
var theRows = document.getElementById(mTableID).rows; |
|
|
|
for(var i=0, iLen = mData.length; i < iLen; i++) |
|
for(var i=0, iLen = mData.length; i < iLen; i++) |
mData[i].Row = theRows[i + 1]; |
|
mData[i].Row = theRows[i + 1]; |
} |
|
} |
|
|
|
|
|
|
|
|
|
// sort fn |
|
// sort fn |
function sortRow(a, b) |
|
function sortRow(a, b) |
{ |
|
{ |
var aVal = a[sortIndex].SortValue; |
<> |
var aVal = a.Columns[sortIndex].SortValue; |
var bVal = b[sortIndex].SortValue; |
|
var bVal = b.Columns[sortIndex].SortValue; |
|
= |
|
if((aVal === null) || (bVal === null)) |
|
if((aVal === null) || (bVal === null)) |
{ |
|
{ |
// for equal values, fall back on the row index |
|
// for equal values, fall back on the row index |
if(aVal === bVal) |
|
if(aVal === bVal) |
return a[0].Index - b[0].Index; |
<> |
return a.Index - b.Index; |
|
= |
|
return aVal === null ? -1 : 1; |
|
return aVal === null ? -1 : 1; |
} |
|
} |
|
|
|
if(aVal < bVal) |
|
if(aVal < bVal) |
return -1; |
|
return -1; |
else if(aVal > bVal) |
|
else if(aVal > bVal) |
return 1; |
|
return 1; |
|
|
|
// for equal values, fall back on the row index |
|
// for equal values, fall back on the row index |
return a[0].Index - b[0].Index; |
<> |
return a.Index - b.Index; |
} |
= |
} |
|
|
|
|
|
|
|
|
|
function sortByColumn(inIndex) |
|
function sortByColumn(inIndex) |
{ |
|
{ |
if(mData.length == 0) |
|
if(mData.length == 0) |
return; |
|
return; |
|
|
|
if(inIndex == sortIndex) |
|
if(inIndex == sortIndex) |
reverseSort = !reverseSort; // sorting the same column, again, so reverse the current sort |
|
reverseSort = !reverseSort; // sorting the same column, again, so reverse the current sort |
else |
|
else |
reverseSort = false; // if sorting on a new column, always reset to forward sort |
|
reverseSort = false; // if sorting on a new column, always reset to forward sort |
|
|
|
sortIndex = inIndex; |
|
sortIndex = inIndex; |
|
|
|
var theTable = document.getElementById(mTableID); |
|
var theTable = document.getElementById(mTableID); |
var theParent = theTable.rows[0].parentNode; |
|
var theParent = theTable.rows[0].parentNode; |
|
|
|
// remove all rows, in current sort order (appears to be the fastest way) |
|
// remove all rows, in current sort order (appears to be the fastest way) |
for(var i=0, iLen = mData.length; i < iLen; i++) |
|
for(var i=0, iLen = mData.length; i < iLen; i++) |
theParent.removeChild(mData[i].Row); |
|
theParent.removeChild(mData[i].Row); |
|
|
|
// sort the rows |
|
// sort the rows |
mData.sort(sortRow); |
|
mData.sort(sortRow); |
|
|
|
if(reverseSort) |
|
if(reverseSort) |
mData.reverse(); |
|
mData.reverse(); |
|
|
|
// put the rows back in the new sorted order |
|
// put the rows back in the new sorted order |
// there may or may not be an empty row followed by a sum and average rows, so for an easy solution insert the |
|
// there may or may not be an empty row followed by a sum and average rows, so for an easy solution insert the |
// rows before the header row, then pop the header row off and put it back in front of the first row |
|
// rows before the header row, then pop the header row off and put it back in front of the first row |
var theHeader = theParent.rows[0]; |
|
var theHeader = theParent.rows[0]; |
|
|
|
for(var i=0, iLen = mData.length; i < iLen; i++) |
|
for(var i=0, iLen = mData.length; i < iLen; i++) |
{ |
|
{ |
// set the row's class to maintain even/odd row shading |
|
// set the row's class to maintain even/odd row shading |
mData[i].Row.className = (i % 2) ? "odd" : "even"; |
|
mData[i].Row.className = (i % 2) ? "odd" : "even"; |
theParent.insertBefore(mData[i].Row, theHeader); |
|
theParent.insertBefore(mData[i].Row, theHeader); |
} |
|
} |
|
|
|
theParent.removeChild(theHeader); |
|
theParent.removeChild(theHeader); |
theParent.insertBefore(theHeader, mData[0].Row); |
|
theParent.insertBefore(theHeader, mData[0].Row); |
|
|
|
// update the index column |
|
// update the index column |
if(mIndexCol >= 0) |
|
if(mIndexCol >= 0) |
{ |
|
{ |
for(var i=0, iLen = mData.length; i < iLen; i++) |
|
for(var i=0, iLen = mData.length; i < iLen; i++) |
mData[i].Row.cells[mIndexCol][mTextKey] = "" + (i+1); |
|
mData[i].Row.cells[mIndexCol][mTextKey] = "" + (i+1); |
} |
|
} |
} |
|
} |
|
|
|
|
|
|
|
|
|
return { |
|
return { |
init: init |
|
init: init |
}; |
|
}; |
|
|
|
}()); |
|
}()); |
|
|
|
</script> |
|
</script> |
|
|
|
<body onLoad="if(TDSort) { TDSort.init('pTable', 'pColumns') }"> |
|
<body onLoad="if(TDSort) { TDSort.init('pTable', 'pColumns') }"> |
|
|
|
<center> |
<> |
<div style="text-align: center"> |
|
|
<div class="infoTable"> |
<table border="0" class="infoTable"> |
|
<div class="tableHeader"> |
<tr> |
|
|
<td class="eventname" align="center">Player Statistics</td> |
|
<div class="eventname" align="center">Player Statistics</div> |
</tr> |
|
|
<tr> |
|
|
<td class="description" align="center"><statsinfo></td> |
|
<div class="description" align="center"><statsinfo></div> |
</tr> |
|
</div> |
</table> |
|
|
|
= |
|
<p> |
+- |
|
|
= |
|
<table id="pTable" border="0" cellspacing="0" class="statsTable"> |
|
<table id="pTable" border="0" cellspacing="0" class="statsTable"> |
<stats> |
|
<stats> |
</table> |
|
</table> |
</center> |
<> |
</div> |
|
|
</div> |
|
= |
|
</body> |
|
</body> |
</html> |
|
</html> |