$(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 = {"109":{"id":"109","country":"Denmark","countryCode":"DK","countryTr":"le Danemark"},"9":{"id":"9","country":"Russia","countryCode":"RU","countryTr":"la Russie"},"76":{"id":"76","country":"Belgium","countryCode":"BE","countryTr":"la Belgique"},"3":{"id":"3","country":"United States","countryCode":"US","countryTr":"les Etats-Unis"},"51":{"id":"51","country":"Australia","countryCode":"AU","countryTr":"l\u2019Australie"},"23":{"id":"23","country":"Italy","countryCode":"IT","countryTr":"l\u2019Italie"},"81":{"id":"81","country":"Serbia","countryCode":"RS","countryTr":"la Servie"},"84":{"id":"84","country":"Belarus","countryCode":"BY","countryTr":"Belarus"},"1":{"id":"1","country":"China","countryCode":"CN","countryTr":"la Chine"},"96":{"id":"96","country":"Israel","countryCode":"IL","countryTr":"Isra\u00ebl"},"33":{"id":"33","country":"Poland","countryCode":"PL","countryTr":"la Pologne"},"19":{"id":"19","country":"France","countryCode":"FR","countryTr":"la France"},"150":{"id":"150","country":"Estonia","countryCode":"EE","countryTr":"l\u2019Estonie"},"28":{"id":"28","country":"Spain","countryCode":"ES","countryTr":"l\u2019Espagne"},"52":{"id":"52","country":"Romania","countryCode":"RO","countryTr":"la Roumanie"},"110":{"id":"110","country":"Slovakia","countryCode":"SK","countryTr":"la Slovaquie"},"14":{"id":"14","country":"Germany","countryCode":"DE","countryTr":"l\u2019Allemagne"},"78":{"id":"78","country":"Czech Republic","countryCode":"CZ","countryTr":"la R\u00e9publique Tch\u00e8que"},"95":{"id":"95","country":"Bulgaria","countryCode":"BG","countryTr":"la Bulgarie"},"27":{"id":"27","country":"Ukraine","countryCode":"UA","countryTr":"l\u2019Ukraine"},"80":{"id":"80","country":"Hungary","countryCode":"HU","countryTr":"l\u2019Hongrie"},"62":{"id":"62","country":"Kazakhstan","countryCode":"KZ","countryTr":"le Kazakhstan"},"94":{"id":"94","country":"Swiss","countryCode":"CH","countryTr":"la Suisse"},"142":{"id":"142","country":"Latvia","countryCode":"LV","countryTr":"la Lettonie"},"145":{"id":"145","country":"Slovenia","countryCode":"SI","countryTr":"la Slov\u00e9nie"},"31":{"id":"31","country":"Argentina","countryCode":"AR","countryTr":"l\u2019Argentine"},"10":{"id":"10","country":"Japan","countryCode":"JP","countryTr":"le Japon"},"88":{"id":"88","country":"Sweden","countryCode":"SE","countryTr":"la Su\u00e8de"},"22":{"id":"22","country":"United Kingdom","countryCode":"GB","countryTr":"le Royaume-Uni"},"20":{"id":"20","country":"Thailand","countryCode":"TH","countryTr":"la Thailande"},"44":{"id":"44","country":"Uzbekistan","countryCode":"UZ","countryTr":"l\u2019Oezb\u00e9kistan"},"93":{"id":"93","country":"Austria","countryCode":"AT","countryTr":"l\u2019Autriche"},"120":{"id":"120","country":"Croatia","countryCode":"HR","countryTr":"la Croatie"},"26":{"id":"26","country":"South Africa","countryCode":"ZA","countryTr":"l\u2019Afrique du Sud"},"36":{"id":"36","country":"Canada","countryCode":"CA","countryTr":"le Canada"},"49":{"id":"49","country":"Taiwan","countryCode":"TW","countryTr":"l\u2019\u00eele de Taiwan"},"29":{"id":"29","country":"Colombia","countryCode":"CO","countryTr":"la Colombie"},"169":{"id":"169","country":"Luxembourg","countryCode":"LU","countryTr":"le Luxembourg"},"61":{"id":"61","country":"Netherlands","countryCode":"NL","countryTr":"les Pays-Bas"},"25":{"id":"25","country":"South Korea","countryCode":"KR","countryTr":"la Cor\u00e9e du Sud"},"2":{"id":"2","country":"India","countryCode":"IN","countryTr":"l\u2019Inde"},"74":{"id":"74","country":"Greece","countryCode":"GR","countryTr":"la Gr\u00e8ce"},"104":{"id":"104","country":"Paraguay","countryCode":"PY","countryTr":"le Paraguay"},"17":{"id":"17","country":"Turkey","countryCode":"TR","countryTr":"la Turquie"},"121":{"id":"121","country":"Georgia","countryCode":"GE","countryTr":"la G\u00e9orgie"},"77":{"id":"77","country":"Portugal","countryCode":"PT","countryTr":"le Portugal"},"98":{"id":"98","country":"Hong Kong","countryCode":"HK","countryTr":"Hong Kong"},"5":{"id":"5","country":"Brasil","countryCode":"BR","countryTr":"le Br\u00e9sil"},"40":{"id":"40","country":"Peru","countryCode":"PE","countryTr":"le P\u00e9rou"},"113":{"id":"113","country":"Kyrgyzstan","countryCode":"KG","countryTr":"le Kirghizistan"},"112":{"id":"112","country":"Finland","countryCode":"FI","countryTr":"la Finlande"},"208":{"id":"208","country":"Liechtenstein","countryCode":"LI","countryTr":"le Liechtenstein"},"86":{"id":"86","country":"Bolivia","countryCode":"BO","countryTr":"la Bolivie"},"124":{"id":"124","country":"New Zealand","countryCode":"NZ","countryTr":"la Nouvelle Z\u00e9lande"},"4":{"id":"4","country":"Indonesia","countryCode":"ID","countryTr":"l\u2019Indon\u00e9sie"},"141":{"id":"141","country":"Oman","countryCode":"OM","countryTr":"l\u2019Oman"},"132":{"id":"132","country":"Lithuania","countryCode":"LT","countryTr":"la Lituanie"},"60":{"id":"60","country":"Chile","countryCode":"CL","countryTr":"la Chile"},"79":{"id":"79","country":"Tunisia","countryCode":"TN","countryTr":"la Tunisie"},"37":{"id":"37","country":"Morocco","countryCode":"MA","countryTr":"le Maroc"},"127":{"id":"127","country":"Bosnia and Herzegovina","countryCode":"BA","countryTr":"la Bosnie et Herzegovina"},"42":{"id":"42","country":"Venezuela","countryCode":"VE","countryTr":"la Venezuela"},"159":{"id":"159","country":"Cyprus","countryCode":"CY","countryTr":"la Chypre"},"134":{"id":"134","country":"Uruguay","countryCode":"UY","countryTr":"l\u2019Uruguay"},"118":{"id":"118","country":"Ireland","countryCode":"IE","countryTr":"l\u2019Irlande"},"66":{"id":"66","country":"Ecuador","countryCode":"EC","countryTr":"l\u2019Equateur"},"82":{"id":"82","country":"Dominican Republic","countryCode":"DO","countryTr":"la R\u00e9publique Dominicaine"},"11":{"id":"11","country":"Mexico","countryCode":"MX","countryTr":"le Mexique"},"131":{"id":"131","country":"Moldova","countryCode":"MD","countryTr":"la Moldavie"},"16":{"id":"16","country":"Egypt","countryCode":"EG","countryTr":"l\u2019Egypte"},"85":{"id":"85","country":"Haiti","countryCode":"HT","countryTr":"le Ha\u00efti"},"209":{"id":"209","country":"Monaco","countryCode":"MC","countryTr":"Monaco"},"126":{"id":"126","country":"Puerto Rico","countryCode":"PR","countryTr":"Porto Rico"},"122":{"id":"122","country":"United Arab Emirates","countryCode":"AE","countryTr":"les Emirats arabes unis"},"164":{"id":"164","country":"Montenegro","countryCode":"ME","countryTr":"le Mont\u00e9n\u00e9gro"},"117":{"id":"117","country":"Norway","countryCode":"NO","countryTr":"la Norv\u00e8ge"},"177":{"id":"177","country":"Barbados","countryCode":"BB","countryTr":"la Barbade"},"144":{"id":"144","country":"North Macedonia","countryCode":"MK","countryTr":"Mac\u00e9doine du Nord"},"99":{"id":"99","country":"El Salvador","countryCode":"SV","countryTr":"El Salvador"},"156":{"id":"156","country":"Qatar","countryCode":"QA","countryTr":"le Qatar"},"69":{"id":"69","country":"Zimbabwe","countryCode":"ZW","countryTr":"le Zimbabwe"},"125":{"id":"125","country":"Lebanon","countryCode":"LB","countryTr":"le Libanon"},"102":{"id":"102","country":"Papua New Guinea","countryCode":"PG","countryTr":"la Papouasie-Nouvelle-Guin\u00e9e"},"199":{"id":"199","country":"Andorra","countryCode":"AD","countryTr":"l\u2019Andorre"},"12":{"id":"12","country":"Philippines","countryCode":"PH","countryTr":"les Philippines"},"92":{"id":"92","country":"Burundi","countryCode":"BI","countryTr":"le Burundi"},"172":{"id":"172","country":"Malta","countryCode":"MT","countryTr":"la Malte"},"13":{"id":"13","country":"Vietnam","countryCode":"VN","countryTr":"le Vietnam"},"105":{"id":"105","country":"Jordan","countryCode":"JO","countryTr":"la Jordanie"}}; var teams = [{"id":0,"name":""}]; var sportsmen = [{"id":"3741","tem":"0","ctr":"36","nam":"Raonic, Milos ","namorig":"Raonic, Milos ","cat":"","pri":"10 mln.","rat":0,"mw":"H","link":"Raonic, Milos <\/a>","confirmed_b":1},{"id":"15867","tem":"45","ctr":"9","nam":"Medvedev, Daniil ","namorig":"Medvedev, Daniil ","cat":"","pri":"9,2 mln.","rat":0,"mw":"H","link":"Medvedev, Daniil <\/a>","confirmed_b":1},{"id":"3814","tem":"0","ctr":"76","nam":"Goffin, David ","namorig":"Goffin, David ","cat":"","pri":"8,5 mln.","rat":0,"mw":"H","link":"Goffin, David <\/a>","confirmed_b":1},{"id":"7446","tem":"45","ctr":"22","nam":"Edmund, Kyle ","namorig":"Edmund, Kyle ","cat":"","pri":"8,4 mln.","rat":0,"mw":"H","link":"Edmund, Kyle <\/a>","confirmed_b":1},{"id":"19251","tem":"45","ctr":"33","nam":"Hurkacz, Hubert ","namorig":"Hurkacz, Hubert ","cat":"","pri":"8,1 mln.","rat":0,"mw":"H","link":"Hurkacz, Hubert <\/a>","confirmed_b":1},{"id":"3197","tem":"0","ctr":"78","nam":"Pliskova, Karolina ","namorig":"Pliskova, Karolina ","cat":"","pri":"8 mln.","rat":0,"mw":"F","link":"Pliskova, Karolina <\/a>","confirmed_b":1},{"id":"3030","tem":"0","ctr":"142","nam":"Sevastova, Anastasija ","namorig":"Sevastova, Anastasija ","cat":"","pri":"7,5 mln.","rat":0,"mw":"F","link":"Sevastova, Anastasija <\/a>","confirmed_b":1},{"id":"3737","tem":"0","ctr":"19","nam":"Paire, Benoit ","namorig":"Paire, Benoit ","cat":"","pri":"7,3 mln.","rat":0,"mw":"H","link":"Paire, Benoit <\/a>","confirmed_b":1},{"id":"2986","tem":"0","ctr":"109","nam":"Wozniacki, Caroline ","namorig":"Wozniacki, Caroline ","cat":"","pri":"7 mln.","rat":0,"mw":"F","link":"Wozniacki, Caroline <\/a>","confirmed_b":1},{"id":"13528","tem":"45","ctr":"3","nam":"Kenin, Sofia ","namorig":"Kenin, Sofia ","cat":"","pri":"6,8 mln.","rat":0,"mw":"F","link":"Kenin, Sofia <\/a>","confirmed_b":1},{"id":"5397","tem":"0","ctr":"27","nam":"Svitolina, Elina ","namorig":"Svitolina, Elina ","cat":"","pri":"6,6 mln.","rat":0,"mw":"F","link":"Svitolina, Elina <\/a>","confirmed_b":1},{"id":"10369","tem":"45","ctr":"9","nam":"Khachanov, Karen ","namorig":"Khachanov, Karen ","cat":"","pri":"6,5 mln.","rat":0,"mw":"H","link":"Khachanov, Karen <\/a>","confirmed_b":1},{"id":"23512","tem":"45","ctr":"3","nam":"Gauff, Coco ","namorig":"Gauff, Coco ","cat":"","pri":"6,3 mln.","rat":0,"mw":"F","link":"Gauff, Coco <\/a>","confirmed_b":1},{"id":"19248","tem":"45","ctr":"81","nam":"Kecmanovic, Miomir ","namorig":"Kecmanovic, Miomir ","cat":"","pri":"5,8 mln.","rat":0,"mw":"H","link":"Kecmanovic, Miomir <\/a>","confirmed_b":1},{"id":"6443","tem":"45","ctr":"9","nam":"Betova, Margarita ","namorig":"Betova, Margarita ","cat":"","pri":"5 mln.","rat":0,"mw":"F","link":"Betova, Margarita <\/a>","confirmed_b":1},{"id":"17000","tem":"45","ctr":"27","nam":"Yastremska, Dayana ","namorig":"Yastremska, Dayana ","cat":"","pri":"4,9 mln.","rat":0,"mw":"F","link":"Yastremska, Dayana <\/a>","confirmed_b":1},{"id":"16963","tem":"45","ctr":"9","nam":"Kudermetova, Veronika ","namorig":"Kudermetova, Veronika ","cat":"","pri":"4,4 mln.","rat":0,"mw":"F","link":"Kudermetova, Veronika <\/a>","confirmed_b":1},{"id":"3594","tem":"0","ctr":"28","nam":"Verdasco, Fernando ","namorig":"Verdasco, Fernando ","cat":"","pri":"4,3 mln.","rat":0,"mw":"H","link":"Verdasco, Fernando <\/a>","confirmed_b":1},{"id":"3160","tem":"0","ctr":"22","nam":"Watson, Heather ","namorig":"Watson, Heather ","cat":"","pri":"4,2 mln.","rat":0,"mw":"F","link":"Watson, Heather <\/a>","confirmed_b":1},{"id":"10785","tem":"45","ctr":"3","nam":"Collins, Danielle ","namorig":"Collins, Danielle ","cat":"","pri":"3,9 mln.","rat":0,"mw":"F","link":"Collins, Danielle <\/a>","confirmed_b":1},{"id":"19701","tem":"45","ctr":"51","nam":"Popyrin, Alexei ","namorig":"Popyrin, Alexei ","cat":"","pri":"3,4 mln.","rat":0,"mw":"H","link":"Popyrin, Alexei <\/a>","confirmed_b":1},{"id":"3650","tem":"0","ctr":"61","nam":"Haase, Robin ","namorig":"Haase, Robin ","cat":"","pri":"2,5 mln.","rat":0,"mw":"H","link":"Haase, Robin <\/a>","confirmed_b":1}]; var sportsmenTeams = []; var showTeams = 0; //*********************** //SPORTSMEN TABLE HEADERS //*********************** var headersTableSportsmen = [ { 'sTitle': 'N°' }, { 'sTitle': 'Groupe' , 'bSearchable': false, 'bVisible': false }, { 'sTitle': 'Pays', 'sSortDataType': 'sortCountryFlag', sType : "text" }, { 'sTitle': 'Joueur de tennis'}, { 'sTitle': 'Valeur', 'sSortDataType': 'sortMln', 'sType': 'numeric' }, { 'sTitle': 'Équipe' , 'bSearchable': false, 'bVisible': false }, { 'sTitle': 'H/F' } ]; //*********************** //TEAMS TABLE HEADERS //*********************** var headersTableTeams = [ {'sTitle': 'N°'}, {'sTitle': '' , 'bSearchable': false, 'bVisible': false }, {'sTitle': 'Pays' , 'sSortDataType': 'sortCountryFlag', sType : 'text' }, { 'sTitle': ''}, { 'sTitle': 'Valeur', '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 ""; }