User:Digilante/vector.js

/* if (typeof XMLHttpRequest === "undefined") { XMLHttpRequest = function { try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch(e) {} try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch(e) {} try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {} try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {} throw new Error("This browser does not support XMLHttpRequest."); }; } var xmlhttp; var prepWin; function loadXMLDoc(url) { xmlhttp=GetXmlHttpObject; if (xmlhttp==null) { alert ("Your browser does not support XMLHTTP!"); return; } xmlhttp.onreadystatechange=stateChanged; xmlhttp.open("GET",url,true); xmlhttp.send(null); }

function GetXmlHttpObject { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari return new XMLHttpRequest; } if (window.ActiveXObject) { // code for IE6, IE5 return new ActiveXObject("Microsoft.XMLHTTP"); } return null; } function populateIW { infoWin.document.body.appendChild(prepWin); alert (prepWin.outerHtml); } function stateChanged { if (xmlhttp.readyState==4) {   try { window.open("http://pingbad.com/wiki.php?namespace=" + wgCanonicalNamespace + "&title=" + wgPageName, "infoWin", "toolbar=0,menubar=0,resizable=1,height=400,width=700,scrollbars=1", true); } catch (ex) {} if (xmlhttp.status == 200) {     var response = xmlhttp.responseText; infoWin.document.body.innterHtml = response; /* Parse page info */ var NOTOC = (response.indexOf ('') > -1); /* Do some other funky based on previous parse */ if (NOTOC == false) { var dom_content = document.getElementById('content'); for (var i = 1; i <= 6; i++) { var headingelements = dom_content.getElementsByTagName('h' + i); for (var j = 0; j < headingelements.length; j++) { var h = headingelements[j]; var bChange = true; if (h.id == 'siteSub') { bChange = false; } if (typeof (h.parentElement) != 'undefined' && i == 2) { if (h.parentElement.tagName == 'div') { bChange = false; } }           if (i == 2 && h.innerText == 'Contents') { bChange = false; } if (bChange == true) { h.className = (h.className != '' ? h.className + ' TOC' : 'TOC'); } }       }      }    }  } } function wpUPOnLoad { if (wgIsArticle == true || true == true) { loadXMLDoc (mw.config.get('wgServer') + mw.config.get('wgScript') + '?action=raw&title=' + (wgCanonicalNamespace != '' ? wgCanonicalNamespace + ":" : '') + wgPageName); } else { // Do absolutely nuthin } } function aButton { var b = document.createElement('input'); b.type = 'button'; b.onclick = wpUPOnLoad; b.value = 'Check Page'; b.title = b.innerText; b.style.height = '25px'; b.style.width = '100px'; b.style.marginTop = '15px'; // b.innerHtml = ' ' + b.innerText + ' '; document.getElementById('firstHeading').appendChild(b); } try { if (window.attachEvent) { if (!window.attachEvent('onload', aButton)) { window.onload = aButton; } } else { window.onload = aButton; } } catch (ex) { alert (ex.message); }