Template:Toulouse France/a

function myWikiReady() {

// Counter and Countdown

function render_counter(c) { i = 0; iid = window.setInterval(function(){ if ( (c-i) > (c/200) ) { $('span#counter').html(i); i += Math.round(c/200); } else { $('span#counter').html(c); window.clearInterval(iid); } }, 10); }

if ($('span#counter').length > 0) { $.ajax({ url: "https://2016.igem.org/Special:PopularPages", success: function( html ) { dom = $.parseHTML(html); visitors = $(dom).find('a[title="Team:Toulouse_France"]').parent().text(); visitors = visitors.substring(visitors.indexOf('(')+1); visitors = visitors.substring(0, visitors.indexOf(' ')); visitors = visitors.replace(',', ); render_counter(visitors); }, error: function( xhr, status ) { render_counter(4700); } }); }

if ($('span#countdown').length > 0) { clock = window.setInterval(function(){ jetzt = new Date(); time_left = Date.UTC(2016, 10, 19, 4, 0, 0) - Date.UTC(jetzt.getUTCFullYear(), jetzt.getUTCMonth(), jetzt.getUTCDate(), jetzt.getUTCHours(), jetzt.getUTCMinutes(), jetzt.getUTCSeconds()); time_left = (time_left < 0) ? 0 : time_left ; left_sec = (time_left/1000)%60; left_sec = (left_sec < 10) ? "0" + left_sec : left_sec; left_min = Math.floor(time_left/60000)%60; left_min = (left_min < 10) ? "0" + left_min : left_min; left_h = Math.floor(time_left/3600000)%24; left_h = (left_h < 10) ? "0" + left_h : left_h; left_d = Math.floor(time_left/86400000); left_d = (left_d == 1) ? left_d + " day" : left_d + " days"; $('span#countdown').html(left_d + " " + left_h + ":" + left_min + ":" + left_sec); }, 1000); }


}

$(document).ready(myWikiReady);