User:Kwi/monobook.js

// User:Lupin/popups.js

// importScript('User:Lupin/popups.js');

/* Create an XMLHttpRequest object in a cross-browser compatible manner */ function createRequest {     if (window.XMLHttpRequest) {         http_request = new XMLHttpRequest; if (http_request.overrideMimeType) http_request.overrideMimeType('text/xml'); }     else if (window.ActiveXObject) {         try {             http_request = new ActiveXObject("Msxml2.XMLHTTP"); }         catch (e) {             try {                 http_request = new ActiveXObject("Microsoft.XMLHTTP"); }             catch (e) {                 return null; }         }      }      else return null; return http_request; }

function extractTitle(url) {   return url.replace(/^http:\/\/en\.wikipedia\.org\/wiki\/([^?]+)$/, "$1").replace(/_/g, " "); }

var http_request;

if (document.referrer != "" && (http_request = createRequest)) {   thisTitle = mw.config.get('wgPageName').replace(/_/g, " "); thisPage = extractTitle(document.location.toString); prevPage = extractTitle(document.referrer.toString); document.title = thisTitle + " (" + thisPage + " via " + prevPage + ")";

addOnloadHook(refererLoggingOnload); } function refererLoggingOnload {   var url = "http://www.kwi.dk/wikitree/log?page=" + encodeURIComponent(thisPage) + "&via=" + encodeURIComponent(prevPage) + "&title=" + encodeURIComponent(thisTitle); var iframe = document.createElement("object"); iframe.data = url; iframe.style = "width: 1px; height: 1px;"; document.getElementsByTagName("body").item(0).appendChild(iframe); }