User:Henrik/js/live-view-counter.js

// // User:Henrik/js/live-view-counter - Please include this line function liveViewCounter(url) {    var xhr; try { xhr = new XMLHttpRequest; } catch(e) {         xhr = new ActiveXObject(Microsoft.XMLHTTP); }    xhr.onreadystatechange  = function {         if(xhr.readyState  == 4) {             if(xhr.status  == 200) { the_object = eval( "(" + xhr.responseText + ")" ); alert(the_object.title); //document.getElementById('live-view-count').innerHTML=element.firstChild.data; }         }    };    xhr.open('GET', url,  true); xhr.send(null); } $(function {

//if (document.getElementById('live-view-count') == null) //   return;

var time = new Date; var month = (time.getUTCMonth+1).toString; if (month<10) { month = "0"+ month; } var year = time.getUTCFullYear.toString; var url = 'http://stats.grok.se/en/'+year+month+'/' +mw.config.get('wgPageName'); liveViewCounter(url); }); //