$(document).ready(function() { $.fn.dataTable.ext.order['sortMln'] = function ( settings, col ) { return this.api().column( col, {order:'index'} ).nodes().map( function ( td ) { return 1*$(td).text().replace(' mln.', ''); } ); }; $.fn.dataTable.ext.order['sortCountryFlag'] = function ( settings, col ) { return this.api().column( col, {order:'index'} ).nodes().map( function ( td ) { return $('i', td).attr('title'); } ); }; $.fn.dataTable.ext.order['sortMostPopular'] = function ( settings, col ) { return this.api().column( col, {order:'index'} ).nodes().map( function ( td ) { return 1*$(td).text().substr(0,$(td).text().indexOf("x")-1); } ); }; }); var countries = {"214":{"id":"214","country":"England","countryCode":"EN","countryTr":"England"},"215":{"id":"215","country":"Scotland","countryCode":"SF","countryTr":"Scotland"},"51":{"id":"51","country":"Australia","countryCode":"AU","countryTr":"Australia"},"216":{"id":"216","country":"Wales","countryCode":"WL","countryTr":"Wales"},"61":{"id":"61","country":"Netherlands","countryCode":"NL","countryTr":"Netherlands"},"217":{"id":"217","country":"Northern Ireland","countryCode":"NIE","countryTr":"Northern Ireland"},"36":{"id":"36","country":"Canada","countryCode":"CA","countryTr":"Canada"},"93":{"id":"93","country":"Austria","countryCode":"AT","countryTr":"Austria"},"14":{"id":"14","country":"Germany","countryCode":"DE","countryTr":"Germany"},"28":{"id":"28","country":"Spain","countryCode":"ES","countryTr":"Spain"},"118":{"id":"118","country":"Ireland","countryCode":"IE","countryTr":"Ireland"},"3":{"id":"3","country":"United States","countryCode":"US","countryTr":"United States"},"76":{"id":"76","country":"Belgium","countryCode":"BE","countryTr":"Belgium"},"88":{"id":"88","country":"Sweden","countryCode":"SE","countryTr":"Sweden"},"218":{"id":"218","country":"Gibraltar","countryCode":"GI","countryTr":"Gibraltar"},"74":{"id":"74","country":"Greece","countryCode":"GR","countryTr":"Greece"},"33":{"id":"33","country":"Poland","countryCode":"PL","countryTr":"Poland"},"2":{"id":"2","country":"India","countryCode":"IN","countryTr":"India"},"26":{"id":"26","country":"South Africa","countryCode":"ZA","countryTr":"South Africa"},"109":{"id":"109","country":"Denmark","countryCode":"DK","countryTr":"Denmark"},"112":{"id":"112","country":"Finland","countryCode":"FI","countryTr":"Finland"},"80":{"id":"80","country":"Hungary","countryCode":"HU","countryTr":"Hungary"},"120":{"id":"120","country":"Croatia","countryCode":"HR","countryTr":"Croatia"},"94":{"id":"94","country":"Swiss","countryCode":"CH","countryTr":"Switzerland"},"117":{"id":"117","country":"Norway","countryCode":"NO","countryTr":"Norway"},"23":{"id":"23","country":"Italy","countryCode":"IT","countryTr":"Italy"},"145":{"id":"145","country":"Slovenia","countryCode":"SI","countryTr":"Slovenia"},"116":{"id":"116","country":"Singapore","countryCode":"SG","countryTr":"Singapore"},"1":{"id":"1","country":"China","countryCode":"CN","countryTr":"China"},"98":{"id":"98","country":"Hong Kong","countryCode":"HK","countryTr":"Hong Kong"},"10":{"id":"10","country":"Japan","countryCode":"JP","countryTr":"Japan"},"12":{"id":"12","country":"Philippines","countryCode":"PH","countryTr":"Philippines"},"124":{"id":"124","country":"New Zealand","countryCode":"NZ","countryTr":"New Zealand"},"78":{"id":"78","country":"Czech Republic","countryCode":"CZ","countryTr":"Czech Republic"},"142":{"id":"142","country":"Latvia","countryCode":"LV","countryTr":"Latvia"},"43":{"id":"43","country":"Malaysia","countryCode":"MY","countryTr":"Malaysia"},"19":{"id":"19","country":"France","countryCode":"FR","countryTr":"France"},"9":{"id":"9","country":"Russia","countryCode":"RU","countryTr":"Russia"},"20":{"id":"20","country":"Thailand","countryCode":"TH","countryTr":"Thailand"},"132":{"id":"132","country":"Lithuania","countryCode":"LT","countryTr":"Lithuania"},"17":{"id":"17","country":"Turkey","countryCode":"TR","countryTr":"Turkey"},"173":{"id":"173","country":"Brunei","countryCode":"BN","countryTr":"Brunei"},"5":{"id":"5","country":"Brasil","countryCode":"BR","countryTr":"Brazil"},"77":{"id":"77","country":"Portugal","countryCode":"PT","countryTr":"Portugal"},"81":{"id":"81","country":"Serbia","countryCode":"RS","countryTr":"Serbia"},"52":{"id":"52","country":"Romania","countryCode":"RO","countryTr":"Romania"},"175":{"id":"175","country":"Iceland","countryCode":"IS","countryTr":"Iceland"},"22":{"id":"22","country":"United Kingdom","countryCode":"GB","countryTr":"United Kingdom"},"27":{"id":"27","country":"Ukraine","countryCode":"UA","countryTr":"Ukraine"},"160":{"id":"160","country":"Bahrain","countryCode":"BH","countryTr":"Bahrain"},"161":{"id":"161","country":"Guyana","countryCode":"GY","countryTr":"Guyana"}}; var teams = {"0":{"id":0,"name":""},"152":{"id":"152","name":"BDO","nameTranslated":"BDO"},"153":{"id":"153","name":"PDC","nameTranslated":"PDC"}}; var sportsmen = [{"id":"4898","tem":"153","ctr":"215","nam":"Anderson, Gary ","namorig":"Anderson, Gary ","cat":"","pri":"22.7 mln.","rat":0,"mw":"M","link":"Anderson, Gary <\/a>","confirmed_b":1},{"id":"4925","tem":"153","ctr":"215","nam":"Wright, Peter ","namorig":"Wright, Peter ","cat":"","pri":"17.2 mln.","rat":0,"mw":"M","link":"Wright, Peter <\/a>","confirmed_b":1},{"id":"4896","tem":"153","ctr":"214","nam":"Lewis, Adrian ","namorig":"Lewis, Adrian ","cat":"","pri":"15.5 mln.","rat":0,"mw":"M","link":"Lewis, Adrian <\/a>","confirmed_b":1},{"id":"4897","tem":"153","ctr":"214","nam":"Wade, James ","namorig":"Wade, James ","cat":"","pri":"13.6 mln.","rat":0,"mw":"M","link":"Wade, James <\/a>","confirmed_b":1},{"id":"4902","tem":"153","ctr":"61","nam":"Barneveld, Raymond van","namorig":"Barneveld, Raymond van","cat":"","pri":"13.1 mln.","rat":0,"mw":"M","link":"Barneveld, Raymond van<\/a>","confirmed_b":1},{"id":"4933","tem":"153","ctr":"214","nam":"Chisnall, Dave ","namorig":"Chisnall, Dave ","cat":"","pri":"12.3 mln.","rat":0,"mw":"M","link":"Chisnall, Dave <\/a>","confirmed_b":1},{"id":"4927","tem":"153","ctr":"61","nam":"Klaasen, Jelle ","namorig":"Klaasen, Jelle ","cat":"","pri":"10.8 mln.","rat":0,"mw":"M","link":"Klaasen, Jelle <\/a>","confirmed_b":1},{"id":"4964","tem":"153","ctr":"76","nam":"Huybrechts, Kim ","namorig":"Huybrechts, Kim ","cat":"","pri":"10 mln.","rat":0,"mw":"M","link":"Huybrechts, Kim <\/a>","confirmed_b":1},{"id":"4955","tem":"153","ctr":"214","nam":"Smith, Michael ","namorig":"Smith, Michael ","cat":"","pri":"9.2 mln.","rat":0,"mw":"M","link":"Smith, Michael <\/a>","confirmed_b":1},{"id":"5172","tem":"153","ctr":"61","nam":"Pas, Benito van de","namorig":"Pas, Benito van de","cat":"","pri":"8.6 mln.","rat":0,"mw":"M","link":"Pas, Benito van de<\/a>","confirmed_b":1},{"id":"4899","tem":"153","ctr":"51","nam":"Whitlock, Simon ","namorig":"Whitlock, Simon ","cat":"","pri":"8.4 mln.","rat":0,"mw":"M","link":"Whitlock, Simon <\/a>","confirmed_b":1},{"id":"6803","tem":"153","ctr":"217","nam":"Gurney, Daryl ","namorig":"Gurney, Daryl ","cat":"","pri":"7.1 mln.","rat":0,"mw":"M","link":"Gurney, Daryl <\/a>","confirmed_b":1},{"id":"4960","tem":"153","ctr":"214","nam":"White, Ian ","namorig":"White, Ian ","cat":"","pri":"6.9 mln.","rat":0,"mw":"M","link":"White, Ian <\/a>","confirmed_b":1},{"id":"5158","tem":"153","ctr":"214","nam":"Norris, Alan ","namorig":"Norris, Alan ","cat":"","pri":"6.5 mln.","rat":0,"mw":"M","link":"Norris, Alan <\/a>","confirmed_b":1},{"id":"4946","tem":"153","ctr":"214","nam":"Cullen, Joe ","namorig":"Cullen, Joe ","cat":"","pri":"6.2 mln.","rat":0,"mw":"M","link":"Cullen, Joe <\/a>","confirmed_b":1},{"id":"4924","tem":"153","ctr":"215","nam":"Thornton, Robert ","namorig":"Thornton, Robert ","cat":"","pri":"5.9 mln.","rat":0,"mw":"M","link":"Thornton, Robert <\/a>","confirmed_b":1},{"id":"6646","tem":"153","ctr":"51","nam":"Anderson, Kyle ","namorig":"Anderson, Kyle ","cat":"","pri":"5.8 mln.","rat":0,"mw":"M","link":"Anderson, Kyle <\/a>","confirmed_b":1},{"id":"10058","tem":"153","ctr":"216","nam":"Price, Gerwyn ","namorig":"Price, Gerwyn ","cat":"","pri":"5.7 mln.","rat":0,"mw":"M","link":"Price, Gerwyn <\/a>","confirmed_b":1},{"id":"6648","tem":"153","ctr":"214","nam":"Webster, Darren ","namorig":"Webster, Darren ","cat":"","pri":"5.4 mln.","rat":0,"mw":"M","link":"Webster, Darren <\/a>","confirmed_b":1},{"id":"11531","tem":"153","ctr":"28","nam":"Reyes, Cristo ","namorig":"Reyes, Cristo ","cat":"","pri":"5.2 mln.","rat":0,"mw":"M","link":"Reyes, Cristo <\/a>","confirmed_b":1},{"id":"4905","tem":"153","ctr":"214","nam":"King, Mervyn ","namorig":"King, Mervyn ","cat":"","pri":"5 mln.","rat":0,"mw":"M","link":"King, Mervyn <\/a>","confirmed_b":1},{"id":"10310","tem":"153","ctr":"214","nam":"Dobey, Chris ","namorig":"Dobey, Chris ","cat":"","pri":"4.6 mln.","rat":0,"mw":"M","link":"Dobey, Chris <\/a>","confirmed_b":1},{"id":"4900","tem":"153","ctr":"216","nam":"Webster, Mark ","namorig":"Webster, Mark ","cat":"","pri":"4.5 mln.","rat":0,"mw":"M","link":"Webster, Mark <\/a>","confirmed_b":1},{"id":"4923","tem":"153","ctr":"214","nam":"Beaton, Steve ","namorig":"Beaton, Steve ","cat":"","pri":"4.3 mln.","rat":0,"mw":"M","link":"Beaton, Steve <\/a>","confirmed_b":1},{"id":"4919","tem":"153","ctr":"217","nam":"Dolan, Brendan ","namorig":"Dolan, Brendan ","cat":"","pri":"4.2 mln.","rat":0,"mw":"M","link":"Dolan, Brendan <\/a>","confirmed_b":1},{"id":"4910","tem":"153","ctr":"61","nam":"Voort, Vincent van der","namorig":"Voort, Vincent van der","cat":"","pri":"4 mln.","rat":0,"mw":"M","link":"Voort, Vincent van der<\/a>","confirmed_b":1},{"id":"5179","tem":"153","ctr":"61","nam":"Kist, Christian ","namorig":"Kist, Christian ","cat":"","pri":"3.9 mln.","rat":0,"mw":"M","link":"Kist, Christian <\/a>","confirmed_b":1},{"id":"4939","tem":"153","ctr":"215","nam":"Henderson, John ","namorig":"Henderson, John ","cat":"","pri":"3.5 mln.","rat":0,"mw":"M","link":"Henderson, John <\/a>","confirmed_b":1},{"id":"4912","tem":"153","ctr":"214","nam":"Caven, Jamie ","namorig":"Caven, Jamie ","cat":"","pri":"3.3 mln.","rat":0,"mw":"M","link":"Caven, Jamie <\/a>","confirmed_b":1},{"id":"7372","tem":"153","ctr":"76","nam":"Huybrechts, Ronny ","namorig":"Huybrechts, Ronny ","cat":"","pri":"3.3 mln.","rat":0,"mw":"M","link":"Huybrechts, Ronny <\/a>","confirmed_b":1},{"id":"7406","tem":"153","ctr":"214","nam":"Evans, Ricky ","namorig":"Evans, Ricky ","cat":"","pri":"3.2 mln.","rat":0,"mw":"M","link":"Evans, Ricky <\/a>","confirmed_b":1},{"id":"15735","tem":"153","ctr":"214","nam":"Cross, Rob ","namorig":"Cross, Rob ","cat":"","pri":"3 mln.","rat":0,"mw":"M","link":"Cross, Rob <\/a>","confirmed_b":1},{"id":"7377","tem":"153","ctr":"214","nam":"Gilding, Andrew ","namorig":"Gilding, Andrew ","cat":"","pri":"3 mln.","rat":0,"mw":"M","link":"Gilding, Andrew <\/a>","confirmed_b":1},{"id":"4922","tem":"153","ctr":"214","nam":"Pipe, Justin ","namorig":"Pipe, Justin ","cat":"","pri":"2.9 mln.","rat":0,"mw":"M","link":"Pipe, Justin <\/a>","confirmed_b":1},{"id":"7384","tem":"153","ctr":"214","nam":"Pallett, David ","namorig":"Pallett, David ","cat":"","pri":"2.8 mln.","rat":0,"mw":"M","link":"Pallett, David <\/a>","confirmed_b":1},{"id":"11539","tem":"153","ctr":"61","nam":"Wattimena, Jermaine ","namorig":"Wattimena, Jermaine ","cat":"","pri":"2.8 mln.","rat":0,"mw":"M","link":"Wattimena, Jermaine <\/a>","confirmed_b":1},{"id":"4952","tem":"153","ctr":"118","nam":"O'Connor, William ","namorig":"O'Connor, William ","cat":"","pri":"2.7 mln.","rat":0,"mw":"M","link":"O'Connor, William <\/a>","confirmed_b":1},{"id":"11873","tem":"153","ctr":"216","nam":"Clayton, Jonny ","namorig":"Clayton, Jonny ","cat":"","pri":"2.6 mln.","rat":0,"mw":"M","link":"Clayton, Jonny <\/a>","confirmed_b":1},{"id":"17495","tem":"153","ctr":"214","nam":"Quantock, Chris ","namorig":"Quantock, Chris ","cat":"","pri":"2.6 mln.","rat":0,"mw":"M","link":"Quantock, Chris <\/a>","confirmed_b":1},{"id":"5003","tem":"153","ctr":"214","nam":"Todd, Mick ","namorig":"Todd, Mick ","cat":"","pri":"2.5 mln.","rat":0,"mw":"M","link":"Todd, Mick <\/a>","confirmed_b":1},{"id":"5173","tem":"153","ctr":"61","nam":"Meulenkamp, Ron ","namorig":"Meulenkamp, Ron ","cat":"","pri":"2.4 mln.","rat":0,"mw":"M","link":"Meulenkamp, Ron <\/a>","confirmed_b":1},{"id":"17507","tem":"153","ctr":"214","nam":"Searle, Ryan ","namorig":"Searle, Ryan ","cat":"","pri":"2.4 mln.","rat":0,"mw":"M","link":"Searle, Ryan <\/a>","confirmed_b":1},{"id":"5091","tem":"153","ctr":"61","nam":"Duijvenbode, Dirk van","namorig":"Duijvenbode, Dirk van","cat":"","pri":"2.2 mln.","rat":0,"mw":"M","link":"Duijvenbode, Dirk van<\/a>","confirmed_b":1},{"id":"4979","tem":"153","ctr":"118","nam":"McGowan, Mick ","namorig":"McGowan, Mick ","cat":"","pri":"2 mln.","rat":0,"mw":"M","link":"McGowan, Mick <\/a>","confirmed_b":1},{"id":"15337","tem":"153","ctr":"214","nam":"Evetts, Ted ","namorig":"Evetts, Ted ","cat":"","pri":"1.8 mln.","rat":0,"mw":"M","link":"Evetts, Ted <\/a>","confirmed_b":1},{"id":"4980","tem":"153","ctr":"214","nam":"Richardson, James ","namorig":"Richardson, James ","cat":"","pri":"1.8 mln.","rat":0,"mw":"M","link":"Richardson, James <\/a>","confirmed_b":1},{"id":"4908","tem":"153","ctr":"214","nam":"Baxter, Ronnie ","namorig":"Baxter, Ronnie ","cat":"","pri":"1.6 mln.","rat":0,"mw":"M","link":"Baxter, Ronnie <\/a>","confirmed_b":1},{"id":"4909","tem":"153","ctr":"214","nam":"Jones, Wayne ","namorig":"Jones, Wayne ","cat":"","pri":"1.6 mln.","rat":0,"mw":"M","link":"Jones, Wayne <\/a>","confirmed_b":1},{"id":"8577","tem":"153","ctr":"61","nam":"Meeuwisse, Yordi ","namorig":"Meeuwisse, Yordi ","cat":"","pri":"1.6 mln.","rat":0,"mw":"M","link":"Meeuwisse, Yordi <\/a>","confirmed_b":1},{"id":"4993","tem":"153","ctr":"214","nam":"Woods, Brian ","namorig":"Woods, Brian ","cat":"","pri":"1.6 mln.","rat":0,"mw":"M","link":"Woods, Brian <\/a>","confirmed_b":1},{"id":"7440","tem":"153","ctr":"214","nam":"Dennant, Matthew ","namorig":"Dennant, Matthew ","cat":"","pri":"1.5 mln.","rat":0,"mw":"M","link":"Dennant, Matthew <\/a>","confirmed_b":1},{"id":"4997","tem":"153","ctr":"74","nam":"Michael, John ","namorig":"Michael, John ","cat":"","pri":"1.5 mln.","rat":0,"mw":"M","link":"Michael, John <\/a>","confirmed_b":1},{"id":"4929","tem":"153","ctr":"216","nam":"Bates, Barrie ","namorig":"Bates, Barrie ","cat":"","pri":"1.4 mln.","rat":0,"mw":"M","link":"Bates, Barrie <\/a>","confirmed_b":1},{"id":"8292","tem":"153","ctr":"214","nam":"Hogan, Paul ","namorig":"Hogan, Paul ","cat":"","pri":"1.4 mln.","rat":0,"mw":"M","link":"Hogan, Paul <\/a>","confirmed_b":1},{"id":"4937","tem":"153","ctr":"214","nam":"Shepherd, Kirk ","namorig":"Shepherd, Kirk ","cat":"","pri":"1.4 mln.","rat":0,"mw":"M","link":"Shepherd, Kirk <\/a>","confirmed_b":1},{"id":"17500","tem":"153","ctr":"214","nam":"Lukeman, Martin ","namorig":"Lukeman, Martin ","cat":"","pri":"1.3 mln.","rat":0,"mw":"M","link":"Lukeman, Martin <\/a>","confirmed_b":1},{"id":"4918","tem":"153","ctr":"214","nam":"Tabern, Alan ","namorig":"Tabern, Alan ","cat":"","pri":"1.3 mln.","rat":0,"mw":"M","link":"Tabern, Alan <\/a>","confirmed_b":1},{"id":"9095","tem":"153","ctr":"214","nam":"Twell, Ross ","namorig":"Twell, Ross ","cat":"","pri":"1.3 mln.","rat":0,"mw":"M","link":"Twell, Ross <\/a>","confirmed_b":1},{"id":"17952","tem":"153","ctr":"214","nam":"Hewson, Rob ","namorig":"Hewson, Rob ","cat":"","pri":"1.2 mln.","rat":0,"mw":"M","link":"Hewson, Rob <\/a>","confirmed_b":1},{"id":"6647","tem":"153","ctr":"214","nam":"Haines, Johnny ","namorig":"Haines, Johnny ","cat":"","pri":"1.1 mln.","rat":0,"mw":"M","link":"Haines, Johnny <\/a>","confirmed_b":1},{"id":"4947","tem":"153","ctr":"214","nam":"Roy, Alex ","namorig":"Roy, Alex ","cat":"","pri":"1.1 mln.","rat":0,"mw":"M","link":"Roy, Alex <\/a>","confirmed_b":1},{"id":"8163","tem":"153","ctr":"214","nam":"Barham, Paul ","namorig":"Barham, Paul ","cat":"","pri":"1 mln.","rat":0,"mw":"M","link":"Barham, Paul <\/a>","confirmed_b":1}]; var sportsmenTeams = []; var showTeams = 0; //*********************** //SPORTSMEN TABLE HEADERS //*********************** var headersTableSportsmen = [ { 'sTitle': 'Nr.' }, { 'sTitle': 'Group' , 'bSearchable': false, 'bVisible': false }, { 'sTitle': 'Country', 'sSortDataType': 'sortCountryFlag', sType : "text" }, { 'sTitle': 'Darts player'}, { 'sTitle': 'Value', 'sSortDataType': 'sortMln', 'sType': 'numeric' }, { 'sTitle': 'Team' , 'bSearchable': false, 'bVisible': false }, { 'sTitle': 'M/F' , 'bSearchable': false, 'bVisible': false } ]; //*********************** //TEAMS TABLE HEADERS //*********************** var headersTableTeams = [ {'sTitle': 'Nr.'}, {'sTitle': '' , 'bSearchable': false, 'bVisible': false }, {'sTitle': 'Country' , 'sSortDataType': 'sortCountryFlag', sType : 'text' }, { 'sTitle': ''}, { 'sTitle': 'Value', 'sSortDataType': 'sortMln', 'sType': 'numeric' } ]; //*********************** //SPORTSMEN TABLE CONTENT //*********************** var contentTableSportsmen = []; $.each(sportsmen, function(k, v) { contentTableSportsmen.push([ k + 1, v['cat'], getFlag(v['ctr']), v['link'], v['pri'], isset(teams[v['tem']])? teams[v['tem']]['name']:'', v['mw'] ]); }); //*********************** //TEAMS TABLE CONTENT //*********************** var contentTableTeams = []; $.each(sportsmenTeams, function(k, v) { contentTableTeams.push([ k + 1, "", getFlag(v['ctr']), v['nam'], v['pri'] ]); }); function isset (va) { return typeof va != 'undefined'; } $(document).ready(function() { $.fn.dataTable.ext.order['sortMln'] = function (settings, col) { return this.api().column(col, {order: 'index'}).nodes().map(function (td) { return parseFloat($(td).text().replace(' mln.', '').replace(',', '.')); } ); }; if (sportsmen.length) { var sportsmenTable = $('#tblSportsmen').dataTable( { "bPaginate": false, "bFilter": true, "bInfo": false, "bAutoWidth": true, "aoColumns" : headersTableSportsmen, "aaData": contentTableSportsmen, "bAutoWidth": false } ); } if (sportsmenTeams.length) { var sportsmenTeamsTable = $('#tblTeams').dataTable( { "bPaginate": false, "bFilter": true, "bInfo": false, "bAutoWidth": true, "aoColumns" : headersTableTeams, "aaData": contentTableTeams, "bAutoWidth": false } ); $('#teamsOverview').show(); } } ); function getFlag(id, margin) { if (!id || typeof countries[id] === "undefined" ) return ""; if (typeof margin == 'undefined') margin = true; return ""; }