$(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":"20 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Durrant, Glen <\/a>","confirmed_b":1},{"id":"8576","tem":"153","ctr":"61","nam":"Noppert, Danny ","namorig":"Noppert, Danny ","cat":"","pri":"13,4 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Noppert, Danny <\/a>","confirmed_b":1},{"id":"11041","tem":"153","ctr":"214","nam":"Hughes, Jamie ","namorig":"Hughes, Jamie ","cat":"","pri":"12,5 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Hughes, Jamie <\/a>","confirmed_b":1},{"id":"5155","tem":"153","ctr":"214","nam":"Mitchell, Scott ","namorig":"Mitchell, Scott ","cat":"","pri":"11,3 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Mitchell, Scott <\/a>","confirmed_b":1},{"id":"12050","tem":"153","ctr":"214","nam":"McGeeney, Mark ","namorig":"McGeeney, Mark ","cat":"","pri":"8,6 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"McGeeney, Mark <\/a>","confirmed_b":1},{"id":"5144","tem":"153","ctr":"214","nam":"Waites, Scott ","namorig":"Waites, Scott ","cat":"","pri":"7,9 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Waites, Scott <\/a>","confirmed_b":1},{"id":"5142","tem":"153","ctr":"76","nam":"Vos, Geert De","namorig":"Vos, Geert De","cat":"","pri":"7,2 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Vos, Geert De<\/a>","confirmed_b":1},{"id":"5171","tem":"153","ctr":"61","nam":"Harms, Wesley ","namorig":"Harms, Wesley ","cat":"","pri":"6,8 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Harms, Wesley <\/a>","confirmed_b":1},{"id":"8286","tem":"153","ctr":"216","nam":"Williams, Jim ","namorig":"Williams, Jim ","cat":"","pri":"6,1 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Williams, Jim <\/a>","confirmed_b":1},{"id":"5180","tem":"153","ctr":"215","nam":"Montgomery, Ross ","namorig":"Montgomery, Ross ","cat":"","pri":"5,7 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Montgomery, Ross <\/a>","confirmed_b":1},{"id":"5143","tem":"153","ctr":"214","nam":"Adams, Martin ","namorig":"Adams, Martin ","cat":"","pri":"5 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Adams, Martin <\/a>","confirmed_b":1},{"id":"18940","tem":"153","ctr":"215","nam":"Menzies, Cameron ","namorig":"Menzies, Cameron ","cat":"","pri":"4,8 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Menzies, Cameron <\/a>","confirmed_b":1},{"id":"11038","tem":"152","ctr":"61","nam":"Mandigers, Willem ","namorig":"Mandigers, Willem ","cat":"","pri":"4,4 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Mandigers, Willem <\/a>","confirmed_b":1},{"id":"11181","tem":"153","ctr":"61","nam":"Veenstra, Richard ","namorig":"Veenstra, Richard ","cat":"","pri":"4,1 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Veenstra, Richard <\/a>","confirmed_b":1},{"id":"10317","tem":"152","ctr":"216","nam":"Reynolds, Dean ","namorig":"Reynolds, Dean ","cat":"","pri":"3,6 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Reynolds, Dean <\/a>","confirmed_b":1},{"id":"5184","tem":"152","ctr":"216","nam":"Phillips, Martin ","namorig":"Phillips, Martin ","cat":"","pri":"3,3 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Phillips, Martin <\/a>","confirmed_b":1},{"id":"16823","tem":"153","ctr":"76","nam":"Baetens, Andy ","namorig":"Baetens, Andy ","cat":"","pri":"3,2 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Baetens, Andy <\/a>","confirmed_b":1},{"id":"11040","tem":"153","ctr":"132","nam":"Labanauskas, Darius ","namorig":"Labanauskas, Darius ","cat":"","pri":"3,1 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Labanauskas, Darius <\/a>","confirmed_b":1},{"id":"5154","tem":"152","ctr":"214","nam":"Fitton, Darryl ","namorig":"Fitton, Darryl ","cat":"","pri":"3 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Fitton, Darryl <\/a>","confirmed_b":1},{"id":"19277","tem":"153","ctr":"217","nam":"McKinstry, Kyle ","namorig":"McKinstry, Kyle ","cat":"","pri":"2,9 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"McKinstry, Kyle <\/a>","confirmed_b":1},{"id":"15856","tem":"153","ctr":"216","nam":"Kenny, Nick ","namorig":"Kenny, Nick ","cat":"","pri":"2,8 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Kenny, Nick <\/a>","confirmed_b":1},{"id":"7441","tem":"153","ctr":"214","nam":"Whitehead, Conan ","namorig":"Whitehead, Conan ","cat":"","pri":"2,7 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Whitehead, Conan <\/a>","confirmed_b":1},{"id":"19276","tem":"153","ctr":"214","nam":"Baker, Scott ","namorig":"Baker, Scott ","cat":"","pri":"2,6 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Baker, Scott <\/a>","confirmed_b":1},{"id":"19528","tem":"152","ctr":"216","nam":"Edwards, Richie ","namorig":"Edwards, Richie ","cat":"","pri":"2,5 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Edwards, Richie <\/a>","confirmed_b":1},{"id":"6452","tem":"153","ctr":"216","nam":"Warren, Wayne ","namorig":"Warren, Wayne ","cat":"","pri":"2,5 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Warren, Wayne <\/a>","confirmed_b":1},{"id":"19272","tem":"153","ctr":"214","nam":"Day, Daniel ","namorig":"Day, Daniel ","cat":"","pri":"2,4 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Day, Daniel <\/a>","confirmed_b":1},{"id":"19267","tem":"153","ctr":"51","nam":"Thompson, Justin ","namorig":"Thompson, Justin ","cat":"","pri":"2,3 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Thompson, Justin <\/a>","confirmed_b":1},{"id":"16824","tem":"153","ctr":"61","nam":"Sparidaans, Jeffrey ","namorig":"Sparidaans, Jeffrey ","cat":"","pri":"2,2 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Sparidaans, Jeffrey <\/a>","confirmed_b":1},{"id":"19275","tem":"153","ctr":"61","nam":"Telnekes, Derk ","namorig":"Telnekes, Derk ","cat":"","pri":"2,1 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Telnekes, Derk <\/a>","confirmed_b":1},{"id":"5147","tem":"152","ctr":"214","nam":"Robson, Gary ","namorig":"Robson, Gary ","cat":"","pri":"2 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Robson, Gary <\/a>","confirmed_b":1},{"id":"19274","tem":"153","ctr":"61","nam":"Landman, Chris ","namorig":"Landman, Chris ","cat":"","pri":"1,9 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Landman, Chris <\/a>","confirmed_b":1},{"id":"19270","tem":"152","ctr":"17","nam":"Uyguns\u00f6zl\u00fc, \u00dcmit ","namorig":"Uyguns\u00f6zl\u00fc, \u00dcmit ","cat":"","pri":"1,8 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Uyguns\u00f6zl\u00fc, \u00dcmit <\/a>","confirmed_b":1},{"id":"19268","tem":"153","ctr":"217","nam":"Gilliland, Christopher ","namorig":"Gilliland, Christopher ","cat":"","pri":"1,7 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Gilliland, Christopher <\/a>","confirmed_b":1},{"id":"5048","tem":"153","ctr":"36","nam":"Cameron, David ","namorig":"Cameron, David ","cat":"","pri":"1,6 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Cameron, David <\/a>","confirmed_b":1},{"id":"19271","tem":"152","ctr":"216","nam":"Harris, Chris ","namorig":"Harris, Chris ","cat":"","pri":"1,5 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Harris, Chris <\/a>","confirmed_b":1},{"id":"17282","tem":"153","ctr":"88","nam":"Nilsson, Dennis ","namorig":"Nilsson, Dennis ","cat":"","pri":"1,4 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Nilsson, Dennis <\/a>","confirmed_b":1},{"id":"14927","tem":"153","ctr":"124","nam":"Caldwell, Craig ","namorig":"Caldwell, Craig ","cat":"","pri":"1,3 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Caldwell, Craig <\/a>","confirmed_b":1},{"id":"19269","tem":"153","ctr":"14","nam":"Unterbuchner, Michael ","namorig":"Unterbuchner, Michael ","cat":"","pri":"1,2 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Unterbuchner, Michael <\/a>","confirmed_b":1},{"id":"19273","tem":"152","ctr":"3","nam":"Chaney, Joe ","namorig":"Chaney, Joe ","cat":"","pri":"1,1 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Chaney, Joe <\/a>","confirmed_b":1},{"id":"19266","tem":"152","ctr":"173","nam":"Mohamed, Pengiran ","namorig":"Mohamed, Pengiran ","cat":"","pri":"1 \u043c\u043b\u043d.","rat":0,"mw":"\u041c","link":"Mohamed, Pengiran <\/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 ""; }