User:Zykure/vector.js

/**
 * Sperrstatus
 * Idee: Benutzer:St-fl
 * Umsetzung: Benutzer:St-fl, Benutzer:ParaDox

$(function {  var farbe = '#54ff9f';  if ( document.getElementById('ca-edit') ) {    var obj  = document.getElementById('ca-edit');    var temp = String(wgRestrictionEdit);    if (temp == 'autoconfirmed') {      farbe = '#ffa500';    } else if (temp == 'sysop') {      farbe = '#ff6a6a';    }  }   if ( document.getElementById('ca-viewsource') ) {    var obj = document.getElementById('ca-viewsource');    farbe = '#ff0000';  }  if ( obj ) {    //patched for vector    obj.firstChild.style.color = farbe;  } });

/*
 * Ende Sperrstatus

/**
 * referencesOnDemand
 * shows the references tags contents when a reference link is clicked
 * and hides it when a backlink is clicked

function referencesOnDemand { /** finds the references tag which sadly has no id */ function findReferences { var ols = document.getElementsByTagName("ol"); for (var i=0; i<ols.length; i++) { var ol = ols[i]; if (ol.className == "references")   return ol; }   return null; }

/** show the references tag */ function showReferences { references.style.display   = null; return true; }

/** hide the references tag */ function hideReferences { references.style.display   = "none"; return true; }

var references = findReferences; if (!references)   return;

// patch reference links to show the references tag var sups = document.getElementsByTagName("sup"); for (var i=0; i<sups.length; i++) { var sup = sups[i]; if (sup.className != "reference")  continue; var a  = sup.firstChild; a.onclick = showReferences; }

// patch reference backlinks to hide the references tag var as = references.getElementsByTagName("a"); for (var i=0; i<as.length; i++) { var a  = as[i]; if (!/#_ref-/(a.href)) continue; a.onclick  = hideReferences; }

// initially hide references tag hideReferences; }

$(referencesOnDemand);

/*
 * Ende referencesOnDemand

/**
 * Whois-Links für IPs
 * (aus Greasemonkey-Skript)

function addWhoisLinks { var Link = document.getElementsByTagName('a'); var IPFilter = /^.*([0-9]{0,2})+\.([0-9]{0,2})+\.([0-9]{0,2})+\.([0-9]{0,2})+$/;

var ExtraLinkURL = 'http://ip-lookup.net/index.php?'; var ExtraLinkTarget = '_blank'; var ExtraLinkTitle = 'WHOIS this IP';

//Yes I'm aware this can be written better... for (var i = 0; i < Link.length; i++){

//Filter out external links (eg: Enzyme Commission codes are the same format as an IP) var InWikipedia = /wikipedia/.test(Link[i].href);

if (InWikipedia == true){ if (Link[i].textContent.match(IPFilter)){ ExtraLinkSpan = document.createElement('span'); if (Link[i].textContent.match(/\:/g)){ var NewLink = Link[i].textContent.split(/\:/g); NewLink = NewLink[1]; if (NewLink.match(/\//g)){ var NewLink = Link[i].textContent.split(/\//g); NewLink = NewLink[1]; }           }else{ var NewLink = Link[i].textContent; }           ExtraLink = '?¿ '; ExtraLinkSpan.innerHTML = ExtraLink; Link[i].parentNode.insertBefore(ExtraLinkSpan, Link[i].nextSibling); }   } } }

$(addWhoisLinks);

/*
 * Ende addWhoisLinks