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 { 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; }   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; }   divs = document.getElementByTagName("div"); for (i = 0; i < divs.length; i++) { if (divs[i].className == "youtube") { videotag = divs[i].innerHTML; str = "test"; // str = "<object width=\"560\" height=\"340\"><param name=\"movie\" value=\"http://www.youtube.com/v/";           // str += videotag;            // str += "&amp\;hl=en_US&amp\;fs=1\"> <param name=\"allowFullScreen\" value=\"true\"> "; // str += "<param name=\"allowscriptaccess\" value=\"always\"> <embed src=\"http://www.youtube.com/v/";           // str += videotag;            // str += "&amp\;hl=en_US&amp\;fs=1\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" "; // str += "allowfullscreen=\"true\" width=\"560\" height=\"340\"> "; divs[i].innerHTML = str; }   } }

addOnloadHook(convertors);