$(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(' mil.', ''); } ); }; $.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":"D\u00e1nsko"},"9":{"id":"9","country":"Russia","countryCode":"RU","countryTr":"Rusko"},"76":{"id":"76","country":"Belgium","countryCode":"BE","countryTr":"Belgie"},"3":{"id":"3","country":"United States","countryCode":"US","countryTr":"USA"},"51":{"id":"51","country":"Australia","countryCode":"AU","countryTr":"Austr\u00e1lie"},"23":{"id":"23","country":"Italy","countryCode":"IT","countryTr":"It\u00e1lie"},"81":{"id":"81","country":"Serbia","countryCode":"RS","countryTr":"Srbsko"},"84":{"id":"84","country":"Belarus","countryCode":"BY","countryTr":"B\u011blorusko"},"1":{"id":"1","country":"China","countryCode":"CN","countryTr":"\u010c\u00edna"},"96":{"id":"96","country":"Israel","countryCode":"IL","countryTr":"Izrael"},"33":{"id":"33","country":"Poland","countryCode":"PL","countryTr":"Polsko"},"19":{"id":"19","country":"France","countryCode":"FR","countryTr":"Francie"},"150":{"id":"150","country":"Estonia","countryCode":"EE","countryTr":"Estonsko"},"28":{"id":"28","country":"Spain","countryCode":"ES","countryTr":"\u0160pan\u011blsko"},"52":{"id":"52","country":"Romania","countryCode":"RO","countryTr":"Rumunsko"},"110":{"id":"110","country":"Slovakia","countryCode":"SK","countryTr":"Slovensko"},"14":{"id":"14","country":"Germany","countryCode":"DE","countryTr":"N\u011bmecko"},"78":{"id":"78","country":"Czech Republic","countryCode":"CZ","countryTr":"\u010cesk\u00e1 republika"},"95":{"id":"95","country":"Bulgaria","countryCode":"BG","countryTr":"Bulharsko"},"27":{"id":"27","country":"Ukraine","countryCode":"UA","countryTr":"Ukrajina"},"80":{"id":"80","country":"Hungary","countryCode":"HU","countryTr":"Ma\u010farsko"},"62":{"id":"62","country":"Kazakhstan","countryCode":"KZ","countryTr":"Kazachst\u00e1n"},"94":{"id":"94","country":"Swiss","countryCode":"CH","countryTr":"\u0160v\u00fdcarsko"},"142":{"id":"142","country":"Latvia","countryCode":"LV","countryTr":"Loty\u0161sko"},"145":{"id":"145","country":"Slovenia","countryCode":"SI","countryTr":"Slovinsko"},"31":{"id":"31","country":"Argentina","countryCode":"AR","countryTr":"Argentina"},"10":{"id":"10","country":"Japan","countryCode":"JP","countryTr":"Japonsko"},"88":{"id":"88","country":"Sweden","countryCode":"SE","countryTr":"\u0160v\u00e9dsko"},"22":{"id":"22","country":"United Kingdom","countryCode":"GB","countryTr":"Velk\u00e1 Brit\u00e1nie"},"20":{"id":"20","country":"Thailand","countryCode":"TH","countryTr":"Thajsko"},"44":{"id":"44","country":"Uzbekistan","countryCode":"UZ","countryTr":"Uzbekist\u00e1n"},"93":{"id":"93","country":"Austria","countryCode":"AT","countryTr":"Rakousko"},"120":{"id":"120","country":"Croatia","countryCode":"HR","countryTr":"Chorvatsko"},"26":{"id":"26","country":"South Africa","countryCode":"ZA","countryTr":"Jihoafrick\u00e1 republika"},"36":{"id":"36","country":"Canada","countryCode":"CA","countryTr":"Kanada"},"49":{"id":"49","country":"Taiwan","countryCode":"TW","countryTr":"Tchaj-wan"},"29":{"id":"29","country":"Colombia","countryCode":"CO","countryTr":"Kolumbie"},"169":{"id":"169","country":"Luxembourg","countryCode":"LU","countryTr":"Lucembursko"},"61":{"id":"61","country":"Netherlands","countryCode":"NL","countryTr":"Nizozemsko"},"25":{"id":"25","country":"South Korea","countryCode":"KR","countryTr":"Ji\u017en\u00ed Korea"},"2":{"id":"2","country":"India","countryCode":"IN","countryTr":"Indie"},"74":{"id":"74","country":"Greece","countryCode":"GR","countryTr":"\u0158ecko"},"104":{"id":"104","country":"Paraguay","countryCode":"PY","countryTr":"Paraguay"},"17":{"id":"17","country":"Turkey","countryCode":"TR","countryTr":"Turecko"},"121":{"id":"121","country":"Georgia","countryCode":"GE","countryTr":"Gruzie"},"77":{"id":"77","country":"Portugal","countryCode":"PT","countryTr":"Portugalsko"},"98":{"id":"98","country":"Hong Kong","countryCode":"HK","countryTr":"Hongkong"},"5":{"id":"5","country":"Brasil","countryCode":"BR","countryTr":"Braz\u00edlie"},"40":{"id":"40","country":"Peru","countryCode":"PE","countryTr":"Peru"},"113":{"id":"113","country":"Kyrgyzstan","countryCode":"KG","countryTr":"Kyrgyzst\u00e1n"},"112":{"id":"112","country":"Finland","countryCode":"FI","countryTr":"Finsko"},"208":{"id":"208","country":"Liechtenstein","countryCode":"LI","countryTr":"Lichten\u0161tejnsko"},"86":{"id":"86","country":"Bolivia","countryCode":"BO","countryTr":"Bol\u00edvie"},"124":{"id":"124","country":"New Zealand","countryCode":"NZ","countryTr":"Nov\u00fd Z\u00e9land"},"4":{"id":"4","country":"Indonesia","countryCode":"ID","countryTr":"Indon\u00e9sie"},"141":{"id":"141","country":"Oman","countryCode":"OM","countryTr":"Om\u00e1n"},"132":{"id":"132","country":"Lithuania","countryCode":"LT","countryTr":"Litva"},"60":{"id":"60","country":"Chile","countryCode":"CL","countryTr":"Chile"},"79":{"id":"79","country":"Tunisia","countryCode":"TN","countryTr":"Tunisko"},"37":{"id":"37","country":"Morocco","countryCode":"MA","countryTr":"Maroko"},"127":{"id":"127","country":"Bosnia and Herzegovina","countryCode":"BA","countryTr":"Bosna a Hercegovina"},"42":{"id":"42","country":"Venezuela","countryCode":"VE","countryTr":"Venezuela"},"159":{"id":"159","country":"Cyprus","countryCode":"CY","countryTr":"Kypr"},"134":{"id":"134","country":"Uruguay","countryCode":"UY","countryTr":"Uruguay"},"118":{"id":"118","country":"Ireland","countryCode":"IE","countryTr":"Irsko"},"66":{"id":"66","country":"Ecuador","countryCode":"EC","countryTr":"Ekv\u00e1dor"},"82":{"id":"82","country":"Dominican Republic","countryCode":"DO","countryTr":"Dominik\u00e1nsk\u00e1 republika"},"11":{"id":"11","country":"Mexico","countryCode":"MX","countryTr":"Mexiko"},"131":{"id":"131","country":"Moldova","countryCode":"MD","countryTr":"Moldavsko"},"16":{"id":"16","country":"Egypt","countryCode":"EG","countryTr":"Egypt"},"85":{"id":"85","country":"Haiti","countryCode":"HT","countryTr":"Haiti"},"209":{"id":"209","country":"Monaco","countryCode":"MC","countryTr":"Monako"},"126":{"id":"126","country":"Puerto Rico","countryCode":"PR","countryTr":"Portoriko"},"122":{"id":"122","country":"United Arab Emirates","countryCode":"AE","countryTr":"Spojen\u00e9 arabsk\u00e9 emir\u00e1ty"},"164":{"id":"164","country":"Montenegro","countryCode":"ME","countryTr":"\u010cern\u00e1 hora"},"117":{"id":"117","country":"Norway","countryCode":"NO","countryTr":"Norsko"},"177":{"id":"177","country":"Barbados","countryCode":"BB","countryTr":"Barbados"},"144":{"id":"144","country":"North Macedonia","countryCode":"MK","countryTr":"Severn\u00ed Makedonie"},"99":{"id":"99","country":"El Salvador","countryCode":"SV","countryTr":"Salvador"},"156":{"id":"156","country":"Qatar","countryCode":"QA","countryTr":"Katar"},"69":{"id":"69","country":"Zimbabwe","countryCode":"ZW","countryTr":"Zimbabwe"},"125":{"id":"125","country":"Lebanon","countryCode":"LB","countryTr":"Libanon"},"102":{"id":"102","country":"Papua New Guinea","countryCode":"PG","countryTr":"Papua Nov\u00e1 Guinea"},"199":{"id":"199","country":"Andorra","countryCode":"AD","countryTr":"Andora"},"12":{"id":"12","country":"Philippines","countryCode":"PH","countryTr":"Filip\u00edny"},"92":{"id":"92","country":"Burundi","countryCode":"BI","countryTr":"Burundi"},"172":{"id":"172","country":"Malta","countryCode":"MT","countryTr":"Malta"},"13":{"id":"13","country":"Vietnam","countryCode":"VN","countryTr":"Vietnam"},"105":{"id":"105","country":"Jordan","countryCode":"JO","countryTr":"Jord\u00e1nsko"}}; var teams = [{"id":0,"name":""}]; var sportsmen = [{"id":"7408","tem":"45","ctr":"19","nam":"Pouille, Lucas ","namorig":"Pouille, Lucas ","cat":"","pri":"11,6 mil.","rat":0,"mw":"M","link":"Pouille, Lucas <\/a>","confirmed_b":1},{"id":"3606","tem":"0","ctr":"94","nam":"Wawrinka, Stan ","namorig":"Wawrinka, Stan ","cat":"","pri":"10,9 mil.","rat":0,"mw":"M","link":"Wawrinka, Stan <\/a>","confirmed_b":1},{"id":"3755","tem":"0","ctr":"28","nam":"Bautista Agut, Roberto ","namorig":"Bautista Agut, Roberto ","cat":"","pri":"8,7 mil.","rat":0,"mw":"M","link":"Bautista Agut, Roberto <\/a>","confirmed_b":1},{"id":"8561","tem":"45","ctr":"127","nam":"Dzumhur, Damir ","namorig":"Dzumhur, Damir ","cat":"","pri":"7,3 mil.","rat":0,"mw":"M","link":"Dzumhur, Damir <\/a>","confirmed_b":1},{"id":"15867","tem":"45","ctr":"9","nam":"Medvedev, Daniil ","namorig":"Medvedev, Daniil ","cat":"","pri":"6,8 mil.","rat":0,"mw":"M","link":"Medvedev, Daniil <\/a>","confirmed_b":1},{"id":"3799","tem":"0","ctr":"81","nam":"Krajinovic, Filip ","namorig":"Krajinovic, Filip ","cat":"","pri":"5,2 mil.","rat":0,"mw":"M","link":"Krajinovic, Filip <\/a>","confirmed_b":1},{"id":"10369","tem":"45","ctr":"9","nam":"Khachanov, Karen ","namorig":"Khachanov, Karen ","cat":"","pri":"5 mil.","rat":0,"mw":"M","link":"Khachanov, Karen <\/a>","confirmed_b":1},{"id":"17109","tem":"45","ctr":"74","nam":"Tsitsipas, Stefanos ","namorig":"Tsitsipas, Stefanos ","cat":"","pri":"4,8 mil.","rat":0,"mw":"M","link":"Tsitsipas, Stefanos <\/a>","confirmed_b":1},{"id":"3667","tem":"0","ctr":"14","nam":"Zverev, Mischa ","namorig":"Zverev, Mischa ","cat":"","pri":"4,4 mil.","rat":0,"mw":"M","link":"Zverev, Mischa <\/a>","confirmed_b":1},{"id":"8438","tem":"45","ctr":"19","nam":"Herbert, Pierre-Hugues ","namorig":"Herbert, Pierre-Hugues ","cat":"","pri":"3,7 mil.","rat":0,"mw":"M","link":"Herbert, Pierre-Hugues <\/a>","confirmed_b":1},{"id":"3717","tem":"0","ctr":"19","nam":"Mahut, Nicolas ","namorig":"Mahut, Nicolas ","cat":"","pri":"3,6 mil.","rat":0,"mw":"M","link":"Mahut, Nicolas <\/a>","confirmed_b":1},{"id":"12412","tem":"45","ctr":"14","nam":"Marterer, Maximilian ","namorig":"Marterer, Maximilian ","cat":"","pri":"3,4 mil.","rat":0,"mw":"M","link":"Marterer, Maximilian <\/a>","confirmed_b":1},{"id":"3829","tem":"0","ctr":"77","nam":"Sousa, Joao ","namorig":"Sousa, Joao ","cat":"","pri":"3,3 mil.","rat":0,"mw":"M","link":"Sousa, Joao <\/a>","confirmed_b":1},{"id":"3644","tem":"0","ctr":"62","nam":"Kukushkin, Mikhail ","namorig":"Kukushkin, Mikhail ","cat":"","pri":"2,9 mil.","rat":0,"mw":"M","link":"Kukushkin, Mikhail <\/a>","confirmed_b":1},{"id":"18377","tem":"45","ctr":"36","nam":"Auger-Aliassime, Felix ","namorig":"Auger-Aliassime, Felix ","cat":"","pri":"2,5 mil.","rat":0,"mw":"M","link":"Auger-Aliassime, Felix <\/a>","confirmed_b":1},{"id":"8019","tem":"45","ctr":"81","nam":"Djere, Laslo ","namorig":"Djere, Laslo ","cat":"","pri":"2,4 mil.","rat":0,"mw":"M","link":"Djere, Laslo <\/a>","confirmed_b":1},{"id":"4005","tem":"0","ctr":"23","nam":"Travaglia, Stefano ","namorig":"Travaglia, Stefano ","cat":"","pri":"2,1 mil.","rat":0,"mw":"M","link":"Travaglia, Stefano <\/a>","confirmed_b":1},{"id":"4069","tem":"0","ctr":"110","nam":"Gombos, Norbert ","namorig":"Gombos, Norbert ","cat":"","pri":"1,9 mil.","rat":0,"mw":"M","link":"Gombos, Norbert <\/a>","confirmed_b":1},{"id":"20131","tem":"45","ctr":"19","nam":"Gaston, Hugo ","namorig":"Gaston, Hugo ","cat":"","pri":"1,5 mil.","rat":0,"mw":"M","link":"Gaston, Hugo <\/a>","confirmed_b":1},{"id":"16461","tem":"45","ctr":"84","nam":"Ivashka, Ilya ","namorig":"Ivashka, Ilya ","cat":"","pri":"1,4 mil.","rat":0,"mw":"M","link":"Ivashka, Ilya <\/a>","confirmed_b":1}]; var sportsmenTeams = []; var showTeams = 0; //*********************** //SPORTSMEN TABLE HEADERS //*********************** var headersTableSportsmen = [ { 'sTitle': 'Č.' }, { 'sTitle': 'Skupina' , 'bSearchable': false, 'bVisible': false }, { 'sTitle': 'Země', 'sSortDataType': 'sortCountryFlag', sType : "text" }, { 'sTitle': 'Tenista'}, { 'sTitle': 'Hodnota', 'sSortDataType': 'sortMln', 'sType': 'numeric' }, { 'sTitle': 'Tým' , 'bSearchable': false, 'bVisible': false }, { 'sTitle': 'M/Ž' , 'bSearchable': false, 'bVisible': false } ]; //*********************** //TEAMS TABLE HEADERS //*********************** var headersTableTeams = [ {'sTitle': 'Č.'}, {'sTitle': '' , 'bSearchable': false, 'bVisible': false }, {'sTitle': 'Země' , 'sSortDataType': 'sortCountryFlag', sType : 'text' }, { 'sTitle': ''}, { 'sTitle': 'Hodnota', '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(' mil.', '').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 ""; }