MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */

function convertDate(dateString) { dc = dateString.split(" "); m = dc[2]; switch(m) { case "Jan": mm = "01"; break; case "Feb": mm = "02"; break; case "Mar": mm = "03"; break; case "Apr": mm = "04"; break; case "May": mm = "05"; break; case "Jun": mm = "06"; break; case "Jul": mm = "07"; break; case "Aug": mm = "08"; break; case "Sep": mm = "09"; break; case "Oct": mm = "10"; break; case "Nov": mm = "11"; break; case "Dec": mm = "12"; break; }   dd = dc[3] + "-" + mm + "-" + dc[1] return dd; }

function convertors {

// getting activity feed

feed1 = document.getElementById("feedholder"); if (feed1) { if (window.XMLHttpRequest) { xhttp=new XMLHttpRequest } else { xhttp=new ActiveXObject("Microsoft.XMLHTTP") } xhttp.open("GET","/export/rss2_keepsake.php?group_id=49159", false); xhttp.send(""); xmlDoc=xhttp.responseXML.getElementsByTagName("item"); str = " Latest activity  "; for(var i=0; i<5; i++){ // str += "" + xmlDoc[i].getElementsByTagName("pubDate")[0].childNodes[0].nodeValue + " : "; str += "" + convertDate(xmlDoc[i].getElementsByTagName("pubDate")[0].childNodes[0].nodeValue) + " : "; str += ""; str += xmlDoc[i].getElementsByTagName("title")[0].childNodes[0].nodeValue; str += ""; }       str += ""; feed1.innerHTML = str; }

// getting mantis feed

feed2 = document.getElementById("mantisholder"); if (feed2) { xhttp.open("GET","/apps/mantisbt/free-cad/issues_rss.php?project_id=0", false); xhttp.send(""); xmlDoc=xhttp.responseXML.getElementsByTagName("item"); str = " Latest issues  "; for(var i=0; i<5; i++){ tag = xmlDoc[i].getElementsByTagName("title")[0].childNodes[0].nodeValue; str += "" + tag.substring(0,7) + " : "; str += ""; str += tag.substring(9,tag.length) + "</a></li>"; }       str += "</ul>"; feed2.innerHTML = str; }

// getting API content

apidiv = document.getElementById("APIcontent"); if (apidiv) { if (window.XMLHttpRequest) { xhttp=new XMLHttpRequest } else { xhttp=new ActiveXObject("Microsoft.XMLHTTP") } xhttp.open("GET","//free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Mod/Part/App/TopoShapePy.xml", false); //xhttp.open("GET","//sourceforge.net/apps/mantisbt/free-cad/issues_rss.php?project_id=0",false); xhttp.send(""); // xmlDoc=xhttp.responseXML.getElementsByTagName("Documentation"); apidiv.innerHTML = "test ok"; }

// getting facebook box

fbdiv = document.getElementById("fbholder"); if (fbdiv) { fbdiv.innerHTML = '<iframe src="http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fpages%2FFreeCAD%2F153482088014175&amp;width=300&amp;connections=5&amp;stream=true&amp;header=false&amp;height=300" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:300px; height:300px;" allowTransparency="true"> '; }

}

addOnloadHook(convertors);