$(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":"8297","tem":"153","ctr":"214","nam":"Durrant, Glen ","namorig":"Durrant, Glen ","cat":"","pri":"10 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Durrant, Glen <\/a>","confirmed_b":1},{"id":"4925","tem":"153","ctr":"215","nam":"Wright, Peter ","namorig":"Wright, Peter ","cat":"","pri":"9,7 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Wright, Peter <\/a>","confirmed_b":1},{"id":"4898","tem":"153","ctr":"215","nam":"Anderson, Gary ","namorig":"Anderson, Gary ","cat":"","pri":"9,5 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Anderson, Gary <\/a>","confirmed_b":1},{"id":"19174","tem":"153","ctr":"214","nam":"Humphries, Luke ","namorig":"Humphries, Luke ","cat":"","pri":"9,2 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Humphries, Luke <\/a>","confirmed_b":1},{"id":"5164","tem":"153","ctr":"214","nam":"Bunting, Stephen ","namorig":"Bunting, Stephen ","cat":"","pri":"8,9 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Bunting, Stephen <\/a>","confirmed_b":1},{"id":"4927","tem":"153","ctr":"61","nam":"Klaasen, Jelle ","namorig":"Klaasen, Jelle ","cat":"","pri":"8,8 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Klaasen, Jelle <\/a>","confirmed_b":1},{"id":"11531","tem":"153","ctr":"28","nam":"Reyes, Cristo ","namorig":"Reyes, Cristo ","cat":"","pri":"8,1 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Reyes, Cristo <\/a>","confirmed_b":1},{"id":"5183","tem":"153","ctr":"216","nam":"Lewis, Jamie ","namorig":"Lewis, Jamie ","cat":"","pri":"7,7 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Lewis, Jamie <\/a>","confirmed_b":1},{"id":"10848","tem":"153","ctr":"76","nam":"Decker, Mike De","namorig":"Decker, Mike De","cat":"","pri":"7,5 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Decker, Mike De<\/a>","confirmed_b":1},{"id":"17951","tem":"153","ctr":"215","nam":"Murray, Ryan ","namorig":"Murray, Ryan ","cat":"","pri":"7 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Murray, Ryan <\/a>","confirmed_b":1},{"id":"4918","tem":"153","ctr":"214","nam":"Tabern, Alan ","namorig":"Tabern, Alan ","cat":"","pri":"6,6 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Tabern, Alan <\/a>","confirmed_b":1},{"id":"15856","tem":"153","ctr":"216","nam":"Kenny, Nick ","namorig":"Kenny, Nick ","cat":"","pri":"6,3 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Kenny, Nick <\/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 ""; }