$(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(' млн.', ''); } ); }; $.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":"\u0410\u043d\u0433\u043b\u0438\u044f"},"215":{"id":"215","country":"Scotland","countryCode":"SF","countryTr":"\u0428\u043e\u0442\u043b\u0430\u043d\u0434\u0438\u044f"},"51":{"id":"51","country":"Australia","countryCode":"AU","countryTr":"\u0410\u0432\u0441\u0442\u0440\u0430\u043b\u0438\u044f"},"216":{"id":"216","country":"Wales","countryCode":"WL","countryTr":"\u0423\u044d\u043b\u044c\u0441"},"61":{"id":"61","country":"Netherlands","countryCode":"NL","countryTr":"\u041d\u0438\u0434\u0435\u0440\u043b\u0430\u043d\u0434\u044b"},"217":{"id":"217","country":"Northern Ireland","countryCode":"NIE","countryTr":"\u0421\u0435\u0432\u0435\u0440\u043d\u0430\u044f \u0418\u0440\u043b\u0430\u043d\u0434\u0438\u044f"},"36":{"id":"36","country":"Canada","countryCode":"CA","countryTr":"\u041a\u0430\u043d\u0430\u0434\u0430"},"93":{"id":"93","country":"Austria","countryCode":"AT","countryTr":"\u0410\u0432\u0441\u0442\u0440\u0438\u044f"},"14":{"id":"14","country":"Germany","countryCode":"DE","countryTr":"\u0413\u0435\u0440\u043c\u0430\u043d\u0438\u044f"},"28":{"id":"28","country":"Spain","countryCode":"ES","countryTr":"\u0418\u0441\u043f\u0430\u043d\u0438\u044f"},"118":{"id":"118","country":"Ireland","countryCode":"IE","countryTr":"\u0418\u0440\u043b\u0430\u043d\u0434\u0438\u044f"},"3":{"id":"3","country":"United States","countryCode":"US","countryTr":"\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0435 \u0428\u0442\u0430\u0442\u044b"},"76":{"id":"76","country":"Belgium","countryCode":"BE","countryTr":"\u0411\u0435\u043b\u044c\u0433\u0438\u044f"},"88":{"id":"88","country":"Sweden","countryCode":"SE","countryTr":"\u0428\u0432\u0435\u0446\u0438\u044f"},"218":{"id":"218","country":"Gibraltar","countryCode":"GI","countryTr":"Gibraltar"},"74":{"id":"74","country":"Greece","countryCode":"GR","countryTr":"\u0413\u0440\u0435\u0446\u0438\u044f"},"33":{"id":"33","country":"Poland","countryCode":"PL","countryTr":"\u041f\u043e\u043b\u044c\u0448\u0430"},"2":{"id":"2","country":"India","countryCode":"IN","countryTr":"\u0418\u043d\u0434\u0438\u044f"},"26":{"id":"26","country":"South Africa","countryCode":"ZA","countryTr":"\u042e\u0436\u043d\u0430\u044f \u0410\u0444\u0440\u0438\u043a\u0430"},"109":{"id":"109","country":"Denmark","countryCode":"DK","countryTr":"\u0414\u0430\u043d\u0438\u044f"},"112":{"id":"112","country":"Finland","countryCode":"FI","countryTr":"\u0424\u0438\u043d\u043b\u044f\u043d\u0434\u0438\u044f"},"80":{"id":"80","country":"Hungary","countryCode":"HU","countryTr":"\u0412\u0435\u043d\u0433\u0440\u0438\u044f"},"120":{"id":"120","country":"Croatia","countryCode":"HR","countryTr":"\u0425\u043e\u0440\u0432\u0430\u0442\u0438\u044f"},"94":{"id":"94","country":"Swiss","countryCode":"CH","countryTr":"\u0428\u0432\u0435\u0439\u0446\u0430\u0440\u0438\u044f"},"117":{"id":"117","country":"Norway","countryCode":"NO","countryTr":"\u041d\u043e\u0440\u0432\u0435\u0433\u0438\u044f"},"23":{"id":"23","country":"Italy","countryCode":"IT","countryTr":"\u0418\u0442\u0430\u043b\u0438\u044f"},"145":{"id":"145","country":"Slovenia","countryCode":"SI","countryTr":"\u0421\u043b\u043e\u0432\u0435\u043d\u0438\u044f"},"116":{"id":"116","country":"Singapore","countryCode":"SG","countryTr":"\u0421\u0438\u043d\u0433\u0430\u043f\u0443\u0440"},"1":{"id":"1","country":"China","countryCode":"CN","countryTr":"\u041a\u0438\u0442\u0430\u0439"},"98":{"id":"98","country":"Hong Kong","countryCode":"HK","countryTr":"\u0413\u043e\u043d\u043a\u043e\u043d\u0433"},"10":{"id":"10","country":"Japan","countryCode":"JP","countryTr":"\u042f\u043f\u043e\u043d\u0438\u044f"},"12":{"id":"12","country":"Philippines","countryCode":"PH","countryTr":"\u0424\u0438\u043b\u0438\u043f\u0438\u043d\u044b"},"124":{"id":"124","country":"New Zealand","countryCode":"NZ","countryTr":"\u041d\u043e\u0432\u0430\u044f \u0417\u0435\u043b\u0430\u043d\u0434\u0438\u044f"},"78":{"id":"78","country":"Czech Republic","countryCode":"CZ","countryTr":"\u0427\u0435\u0445\u0438\u044f"},"142":{"id":"142","country":"Latvia","countryCode":"LV","countryTr":"\u041b\u0430\u0442\u0432\u0438\u044f"},"43":{"id":"43","country":"Malaysia","countryCode":"MY","countryTr":"\u041c\u0430\u043b\u0430\u0439\u0437\u0438\u044f"},"19":{"id":"19","country":"France","countryCode":"FR","countryTr":"\u0424\u0440\u0430\u043d\u0446\u0438\u044f"},"9":{"id":"9","country":"Russia","countryCode":"RU","countryTr":"\u0420\u043e\u0441\u0441\u0438\u044f"},"20":{"id":"20","country":"Thailand","countryCode":"TH","countryTr":"\u0422\u0430\u0439\u043b\u0430\u043d\u0434"},"132":{"id":"132","country":"Lithuania","countryCode":"LT","countryTr":"\u041b\u0438\u0442\u0432\u0430"},"17":{"id":"17","country":"Turkey","countryCode":"TR","countryTr":"\u0422\u0443\u0440\u0446\u0438\u044f"},"173":{"id":"173","country":"Brunei","countryCode":"BN","countryTr":"\u0411\u0440\u0443\u043d\u0435\u0439"},"5":{"id":"5","country":"Brasil","countryCode":"BR","countryTr":"\u0411\u0440\u0430\u0437\u0438\u043b\u0438\u044f"},"77":{"id":"77","country":"Portugal","countryCode":"PT","countryTr":"\u041f\u043e\u0440\u0442\u0443\u0433\u0430\u043b\u0438\u044f"},"81":{"id":"81","country":"Serbia","countryCode":"RS","countryTr":"\u0421\u0435\u0440\u0431\u0438\u044f"},"52":{"id":"52","country":"Romania","countryCode":"RO","countryTr":"\u0420\u0443\u043c\u044b\u043d\u0438\u044f"},"175":{"id":"175","country":"Iceland","countryCode":"IS","countryTr":"\u0418\u0441\u043b\u0430\u043d\u0434\u0438\u044f"},"22":{"id":"22","country":"United Kingdom","countryCode":"GB","countryTr":"\u0412\u0435\u043b\u0438\u043a\u043e\u0431\u0440\u0438\u0442\u0430\u043d\u0438\u044f"},"27":{"id":"27","country":"Ukraine","countryCode":"UA","countryTr":"\u0423\u043a\u0440\u0430\u0438\u043d\u0430"},"160":{"id":"160","country":"Bahrain","countryCode":"BH","countryTr":"\u0411\u0430\u0445\u0440\u0435\u0439\u043d"},"161":{"id":"161","country":"Guyana","countryCode":"GY","countryTr":"\u0413\u0430\u0439\u0430\u043d\u0430"}}; var teams = {"0":{"id":0,"name":""},"152":{"id":"152","name":"BDO","nameTranslated":"BDO"},"153":{"id":"153","name":"PDC","nameTranslated":"PDC"}}; var sportsmen = [{"id":"10446","tem":"153","ctr":"61","nam":"Danny Noppert, Dirk van Duijvenbode ","namorig":"Danny Noppert, Dirk van Duijvenbode ","cat":"","pri":"20 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Danny Noppert, Dirk van Duijvenbode <\/a>","confirmed_b":1},{"id":"10447","tem":"153","ctr":"215","nam":"Peter Wright, John Henderson ","namorig":"Peter Wright, John Henderson ","cat":"","pri":"18,4 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Peter Wright, John Henderson <\/a>","confirmed_b":1},{"id":"10445","tem":"153","ctr":"214","nam":"Michael Smith, James Wade ","namorig":"Michael Smith, James Wade ","cat":"","pri":"13,8 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Michael Smith, James Wade <\/a>","confirmed_b":1},{"id":"10448","tem":"153","ctr":"51","nam":"Damon Heta, Simon Whitlock ","namorig":"Damon Heta, Simon Whitlock ","cat":"","pri":"11,5 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Damon Heta, Simon Whitlock <\/a>","confirmed_b":1},{"id":"10449","tem":"153","ctr":"216","nam":"Gerwyn Price, Jonny Clayton ","namorig":"Gerwyn Price, Jonny Clayton ","cat":"","pri":"9,2 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Gerwyn Price, Jonny Clayton <\/a>","confirmed_b":1},{"id":"10454","tem":"153","ctr":"93","nam":"Mensur Suljovic, Rowby-John Rodriguez ","namorig":"Mensur Suljovic, Rowby-John Rodriguez ","cat":"","pri":"6,9 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Mensur Suljovic, Rowby-John Rodriguez <\/a>","confirmed_b":1},{"id":"10451","tem":"153","ctr":"76","nam":"Dimitri Van den Bergh, Kim Huybrechts ","namorig":"Dimitri Van den Bergh, Kim Huybrechts ","cat":"","pri":"6,3 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Dimitri Van den Bergh, Kim Huybrechts <\/a>","confirmed_b":1},{"id":"10450","tem":"153","ctr":"217","nam":"Daryl Gurney, Brendan Dolan ","namorig":"Daryl Gurney, Brendan Dolan ","cat":"","pri":"6,1 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Daryl Gurney, Brendan Dolan <\/a>","confirmed_b":1},{"id":"10452","tem":"153","ctr":"118","nam":"William O'Connor, Steve Lennon ","namorig":"William O'Connor, Steve Lennon ","cat":"","pri":"4,8 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"William O'Connor, Steve Lennon <\/a>","confirmed_b":1},{"id":"10455","tem":"153","ctr":"36","nam":"Jeff Smith, Matt Campbell ","namorig":"Jeff Smith, Matt Campbell ","cat":"","pri":"4,4 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Jeff Smith, Matt Campbell <\/a>","confirmed_b":1},{"id":"10459","tem":"153","ctr":"28","nam":"Jose Justicia, Tony Martinez ","namorig":"Jose Justicia, Tony Martinez ","cat":"","pri":"3,9 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Jose Justicia, Tony Martinez <\/a>","confirmed_b":1},{"id":"10453","tem":"153","ctr":"14","nam":"Gabriel Clemens, Martin Schindler ","namorig":"Gabriel Clemens, Martin Schindler ","cat":"","pri":"3,7 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Gabriel Clemens, Martin Schindler <\/a>","confirmed_b":1},{"id":"15862","tem":"153","ctr":"74","nam":"John Michael, Veniamin Symeonidis ","namorig":"John Michael, Veniamin Symeonidis ","cat":"","pri":"3,3 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"John Michael, Veniamin Symeonidis <\/a>","confirmed_b":1},{"id":"10475","tem":"153","ctr":"26","nam":"Devon Petersen, Stefan Vermaak ","namorig":"Devon Petersen, Stefan Vermaak ","cat":"","pri":"3,1 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Devon Petersen, Stefan Vermaak <\/a>","confirmed_b":1},{"id":"10473","tem":"153","ctr":"9","nam":"Boris Koltsov, Evgenii Izotov ","namorig":"Boris Koltsov, Evgenii Izotov ","cat":"","pri":"3 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Boris Koltsov, Evgenii Izotov <\/a>","confirmed_b":1},{"id":"10460","tem":"153","ctr":"3","nam":"Danny Baggish, Jules van Dongen ","namorig":"Danny Baggish, Jules van Dongen ","cat":"","pri":"2,8 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Danny Baggish, Jules van Dongen <\/a>","confirmed_b":1},{"id":"18142","tem":"153","ctr":"5","nam":"Diogo Portela, Artur Valle ","namorig":"Diogo Portela, Artur Valle ","cat":"","pri":"2,6 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Diogo Portela, Artur Valle <\/a>","confirmed_b":1},{"id":"10456","tem":"153","ctr":"112","nam":"Marko Kantele, Aki Paavilainen ","namorig":"Marko Kantele, Aki Paavilainen ","cat":"","pri":"2,5 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Marko Kantele, Aki Paavilainen <\/a>","confirmed_b":1},{"id":"10462","tem":"153","ctr":"109","nam":"Vladimir Andersen, Andreas Toft J\u00f8rgensen ","namorig":"Vladimir Andersen, Andreas Toft J\u00f8rgensen ","cat":"","pri":"2,4 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Vladimir Andersen, Andreas Toft J\u00f8rgensen <\/a>","confirmed_b":1},{"id":"10470","tem":"153","ctr":"124","nam":"Ben Robb, Warren Parry ","namorig":"Ben Robb, Warren Parry ","cat":"","pri":"2,3 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Ben Robb, Warren Parry <\/a>","confirmed_b":1},{"id":"18143","tem":"153","ctr":"94","nam":"Patrick Rey, Philipp Ruckstuhl ","namorig":"Patrick Rey, Philipp Ruckstuhl ","cat":"","pri":"2,2 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Patrick Rey, Philipp Ruckstuhl <\/a>","confirmed_b":1},{"id":"10457","tem":"153","ctr":"98","nam":"Lok Yin Lee, Ho Tung Ching ","namorig":"Lok Yin Lee, Ho Tung Ching ","cat":"","pri":"2 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Lok Yin Lee, Ho Tung Ching <\/a>","confirmed_b":1},{"id":"10472","tem":"153","ctr":"33","nam":"Krzysztof Ratajski, Sebastian Bialecki ","namorig":"Krzysztof Ratajski, Sebastian Bialecki ","cat":"","pri":"1,9 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Krzysztof Ratajski, Sebastian Bialecki <\/a>","confirmed_b":1},{"id":"10458","tem":"153","ctr":"88","nam":"Daniel Larsson, Johan Engstr\u00f6m ","namorig":"Daniel Larsson, Johan Engstr\u00f6m ","cat":"","pri":"1,8 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Daniel Larsson, Johan Engstr\u00f6m <\/a>","confirmed_b":1},{"id":"10465","tem":"153","ctr":"80","nam":"N\u00e1ndor Pr\u00e9s, Gergely Lakatos ","namorig":"N\u00e1ndor Pr\u00e9s, Gergely Lakatos ","cat":"","pri":"1,7 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"N\u00e1ndor Pr\u00e9s, Gergely Lakatos <\/a>","confirmed_b":1},{"id":"10468","tem":"153","ctr":"10","nam":"Tomoya Goto, Toru Suzuki ","namorig":"Tomoya Goto, Toru Suzuki ","cat":"","pri":"1,5 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Tomoya Goto, Toru Suzuki <\/a>","confirmed_b":1},{"id":"10476","tem":"153","ctr":"20","nam":"Thanawat Gaweenuntawong, Attapol Eupakaree ","namorig":"Thanawat Gaweenuntawong, Attapol Eupakaree ","cat":"","pri":"1,4 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Thanawat Gaweenuntawong, Attapol Eupakaree <\/a>","confirmed_b":1},{"id":"10467","tem":"153","ctr":"23","nam":"Guiseppe Di Rocco, Gabriel Rollo ","namorig":"Guiseppe Di Rocco, Gabriel Rollo ","cat":"","pri":"1,3 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Guiseppe Di Rocco, Gabriel Rollo <\/a>","confirmed_b":1},{"id":"10461","tem":"153","ctr":"1","nam":"Di Zhuang, Zizhao Zheng ","namorig":"Di Zhuang, Zizhao Zheng ","cat":"","pri":"1,2 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Di Zhuang, Zizhao Zheng <\/a>","confirmed_b":1},{"id":"10464","tem":"153","ctr":"218","nam":"Justin Hewitt, Craig Galliano ","namorig":"Justin Hewitt, Craig Galliano ","cat":"","pri":"1,1 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Justin Hewitt, Craig Galliano <\/a>","confirmed_b":1},{"id":"10474","tem":"153","ctr":"116","nam":"Paul Lim, Harith Lim ","namorig":"Paul Lim, Harith Lim ","cat":"","pri":"1,1 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Paul Lim, Harith Lim <\/a>","confirmed_b":1},{"id":"12396","tem":"153","ctr":"78","nam":"Adam Gawlas, Karel Sedlacek ","namorig":"Adam Gawlas, Karel Sedlacek ","cat":"","pri":"1 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Adam Gawlas, Karel Sedlacek <\/a>","confirmed_b":1}]; var sportsmenTeams = []; var showTeams = 0; //*********************** //SPORTSMEN TABLE HEADERS //*********************** var headersTableSportsmen = [ { 'sTitle': '№.' }, { 'sTitle': 'Группа' , 'bSearchable': false, 'bVisible': false }, { 'sTitle': 'Страна', 'sSortDataType': 'sortCountryFlag', sType : "text" }, { 'sTitle': 'игрок в дартс'}, { 'sTitle': 'Стоимость', 'sSortDataType': 'sortMln', 'sType': 'numeric' }, { 'sTitle': 'Команда' , 'bSearchable': false, 'bVisible': false }, { 'sTitle': 'М/Ж' , 'bSearchable': false, 'bVisible': false } ]; //*********************** //TEAMS TABLE HEADERS //*********************** var headersTableTeams = [ {'sTitle': '№.'}, {'sTitle': '' , 'bSearchable': false, 'bVisible': false }, {'sTitle': 'Страна' , 'sSortDataType': 'sortCountryFlag', sType : 'text' }, { 'sTitle': ''}, { 'sTitle': 'Стоимость', '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(' млн.', '').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 ""; }