Array.prototype.tsort = function(alpha,ref,type) { if(alpha) this.sort(function(a,b) { return ((totals[ref][a][type] > totals[ref][b][type]) - (totals[ref][a][type] < totals[ref][b][type])); }); else this.sort(function(a,b) { return (totals[ref][a][type] - totals[ref][b][type]); }); } var versionn = "1.1.3"; var latestVersionn = 0; var features=[]; var proto; var tourReq = []; var totals; var partial; var label; var pfilt = []; var viewer = null; var sorters = {'_players' : new Array(new Sorter(1,null), new Sorter(0,"_total"), new Sorter(0,"_won"), new Sorter(0,"_lost"), new Sorter(0,"_active"), new Sorter(0,"_elim"), new Sorter(1,"_kills")) , '_games' : new Array(new Sorter(0,null), new Sorter(1,"_name"), new Sorter(0, "_round") , new Sorter(1,"_winners"),new Sorter(1,"_elims"))}; var teamsize = {'D' : 2, 'T' : 3, 'Q' : 4}; function Totals() { this._pages = 0; this._counter = 0; this._players = new Object(); this._order = new Array(); this._labels = new Array(); this._games = new Object(); this._gorder = new Array(); this.addGame = function(game,map) { this._games[game] = new Game(map); this._gorder.push(game); } this.addPlayer = function(game,name) { this._players[name] = new Player(); this._order.push(name); } this.addRound = function(game,round) { this._games[game]._round = round; } this.addVictor = function(game,name) { this._games[game]._victor = name; } this.addWinner = function(game,name) { this._players[name]._won++; this._games[game]._winners.push(name); } this.addLoser = function(game,name) { this._players[name]._lost++; this._games[game]._losers.push(name); } this.addActive = function(game,name) { this._players[name]._active++; } this.addTotal = function(game,name) { this._players[name]._total++; } this.addElim = function(game,name) { this._players[name]._lost--; this._players[name]._elim++; } this.addDefeat = function(game,name) { this._games[game]._elims.push(name); } this.setTeam = function(game,team) { this._games[game]._tnums.push(team); } this.addKill = function(kills,name) { this._players[name]._kills+= kills; } } function Sorter(alpha,fn) { this._alpha = alpha; this._dir = 0; this._fn = fn; } function Player() { this._total = 0; this._won = 0; this._lost = 0; this._active = 0; this._elim = 0; this._kills = 0; } function Game(name) { this._name = name; this._round = 0; this._winners = new Array(); this._losers = new Array(); this._elims = new Array(); this._tnums = new Array(); this._victor = ""; } function addState(state, param1,param2,lab,rgx) { label[''][state](param1,param2); if(lab) { label[lab][state](param1,param2); if(rgx && lab.match(rgx)) partial[state](param1,param2); } } function cleanup() { totals = null; tourReq = null; if(viewer != null)viewer.close(); } function removeBox() { viewer.close(); viewer = null; tourReq = []; } function switchTabs(id) { if(id==1) { viewer.document.getElementById('tableContainer').style.visibility = "visible"; viewer.document.getElementById('results').style.visibility = "hidden"; viewer.document.getElementById('labels').style.visibility = "hidden"; viewer.document.getElementById('tab1').style.backgroundColor = "#0f0"; viewer.document.getElementById('tab2').style.backgroundColor = "#cdc"; viewer.document.getElementById('tab3').style.backgroundColor = "#cdc"; } else if(id==2) { viewer.document.getElementById('tableContainer').style.visibility = "hidden"; viewer.document.getElementById('results').style.visibility = "visible"; viewer.document.getElementById('labels').style.visibility = "hidden"; viewer.document.getElementById('tab1').style.backgroundColor = "#cdc"; viewer.document.getElementById('tab2').style.backgroundColor = "#0f0"; viewer.document.getElementById('tab3').style.backgroundColor = "#cdc"; } else if(id==3) { viewer.document.getElementById('tableContainer').style.visibility = "hidden"; viewer.document.getElementById('results').style.visibility = "hidden"; viewer.document.getElementById('labels').style.visibility = "visible"; viewer.document.getElementById('tab1').style.backgroundColor = "#cdc"; viewer.document.getElementById('tab2').style.backgroundColor = "#cdc"; viewer.document.getElementById('tab3').style.backgroundColor = "#0f0"; } } function createBox(txt) { cleanup(); viewer = window.open('','box','width=1040,height=720,scrollbars=yes,resizable=yes,status=no,toolbar=no,location=no,directories=no,menubar=no,copyhistory=no'); viewer.addEventListener('unload', function() { viewer=null; cleanup(); }, false); var style = viewer.document.getElementsByTagName('head')[0].appendChild(viewer.document.createElement("style")); style.type = 'text/css'; style.innerHTML = "#rankDiv {background-color:transparent;position:absolute;width:100%;height:100%;top:0px;left:0px;z-index:10000;} "; style.innerHTML += "#rankBox {position:relative;min-width:1040px;height:100%;margin-top:10px;margin-left:20px;border:2px solid #000;background-color:#F2F5F6;} "; style.innerHTML += "#rankDiv > #rankBox {position:fixed;overflow:auto;} "; style.innerHTML += "#rankBox h1 {margin:0;font:bold 0.9em verdana,arial;background-color:#cdc;color:#000;border-bottom:1px solid #000;padding:2px 0 2px 5px;} "; style.innerHTML += "#rankBox p {font:0.7em verdana,arial;padding-left:50px;width:900px;} .result {font-weight:bold;color:#00f;} .totals {color:#000;} "; style.innerHTML += "#rankBox a {text-decoration:none;} .central {text-align:center} #rankBox #tab1, #rankBox #tab2, #rankBox #tab3, #rankBox #tab4 {border:1px solid black}"; style.innerHTML += "#rankBox #tab1:hover, #rankBox #tab2:hover, #rankBox #tab3:hover, #rankBox #tab4:hover , #rankBox #closeRank:hover {color:#fff} .header {background-color:#cdc;font-weight:bold;} "; style.innerHTML += "#rankBox #closeRank {display:block;position:relative;margin:5px auto;padding:3px;border:2px solid #000;width:70px;font:0.7em verdana,arial;text-transform:uppercase;text-align:center;color:#000;background-color:#cdc;text-decoration:none;} "; style.innerHTML += "#rankBox img {position:relative;top:20px;left:20px;} .rankoptions {width:100px;} .bmedal {font-weight:bold;color:#8C7853} .smedal {font-weight:bold;color:silver} .gmedal {font-weight:bold;color:gold} "; style.innerHTML += ".display_div {width: 48px;padding: 0 2px 0 0;height: 20px;text-align: left;border: 1px solid;} "; style.innerHTML += ".display {background-color: #fff;color: blue;width: 48px;text-align: left;font-size: 8pt;font-family: verdana, arial, helvetica, sans-serif;font-weight: bold;cursor: text;}"; style.innerHTML += "#tabs {text-align:center} #tabs table{align:center;margin-left:30px;} #tabs a {width:100px;font-weight:bold;font: verdana,arial;text-transform:none;color:gray;padding:0 5px} #tabs a:hover {background-color:#cdc}"; style.innerHTML += "#scroller {width: 1000px;} #scroller, #scroller.td, #scroller.a, #summ td, #meds td {color: #000;font: bold 7pt Verdana, Geneva, Arial, Helvetica, sans-serif}"; style.innerHTML += "#resultant, #labelling {width: 1000px;} #resultant, #resultant.td, #resultant.a, #labelling, #labelling.td, #labelling.a {color: #000;font: bold 7pt Verdana, Geneva, Arial, Helvetica, sans-serif}"; style.innerHTML += "div.tableContainer {border: 1px solid #963;height: 535px;overflow:auto;overflow-x: hidden;width: 1000px;margin:10px} span {cursor:pointer;text-decoration:underline}"; style.innerHTML += "#results, #labels {visibility:hidden;border: 1px solid #963;overflow:auto;overflow-x: hidden;width:1000px;height:535px;position:absolute;z-index:200;top:120px;margin:10px;}"; style.innerHTML += "thead.fixedHeader tr, thead.scrollHeader tr, thead.totalsHeader tr {display: block} thead.fixedHeader td, tbody.scrollContent td.banner {background: #cdc;border-bottom: 1px solid #EB8;padding: 4px 3px;text-align: center;width: 1000px}"; style.innerHTML += "thead.scrollHeader td {background: #fff;border-right: 1px solid #B74;border-bottom: 1px solid #EB8;padding: 4px 3px;text-align: center;width: 136px;} "; style.innerHTML += "thead.totalsHeader td {background: #fff;border-right: 1px solid #B74;border-bottom: 1px solid #EB8;padding: 4px 3px;text-align: center;width: 136px;} span.winner {cursor:auto;text-decoration:none;color:red}"; style.innerHTML += "thead.scrollHeader a, thead.scrollHeader a:link, thead.scrollHeader a:visited,thead.totalsHeader a, thead.totalsHeader a:link, thead.totalsHeader a:visited, tbody.scrollContent a, tbody.scrollContent a:link, tbody.scrollContent a:visited {display: block;width: 136px;}"; style.innerHTML += "tbody.scrollContent {width: 100%;} tbody.scrollContent td#tourtitle,tbody.scrollContent td#rtourtitle, tbody.scrollContent td#pl, tbody.scrollContent td#rpl {font-size:12pt;color:blue;} tbody.scrollContent td#tourlabel {font-size:10pt;color:red}"; style.innerHTML += "tbody.scrollContent td {border-right: 1px solid #b74;border-bottom: 1px solid #DDD;padding: 4px 3px;text-align:center;height:20px;} tbody.scrollContent td {width: 136px;vertical-align: middle;} "; style.innerHTML += "tbody.scrollContent tr.mreven {background-color:#ddd} tbody.scrollContent tr.mrodd {background-color:#eee} tbody.scrollContent td.sorton {background-color:cyan;cursor:pointer;} tbody.scrollContent td.tiny {width:10%;} "; mObj = viewer.document.getElementsByTagName("body")[0].appendChild(viewer.document.createElement("div")); mObj.id = "rankDiv"; mObj.style.visibility = 'hidden'; mObj.style.height = viewer.document.documentElement.scrollHeight + "px"; alertObj = mObj.appendChild(viewer.document.createElement("div")); alertObj.id = "rankBox"; alertObj.style.left = (viewer.document.documentElement.scrollWidth - alertObj.offsetWidth)/2 - "px"; h1 = alertObj.appendChild(viewer.document.createElement("h1")); h1.appendChild(viewer.document.createTextNode("TOUR STATS")); msg = alertObj.appendChild(viewer.document.createElement("p")); msg.id = "progress"; msg.innerHTML = txt; btn = alertObj.appendChild(viewer.document.createElement("a")); btn.id = "closeRank"; btn.appendChild(viewer.document.createTextNode("CLOSE")); btn.href = "javascript:void(0);"; btn.style.opacity = "0.5"; btn.addEventListener('click', function() { if(btn.style.backgroundColor == "green") removeBox(); }, true); tabs = viewer.document.getElementById('rankBox').appendChild(viewer.document.createElement("div")); tabs.id = "tabs"; tabs.innerHTML = "
Summary | Results | Labels |