Benutzer:OwenBlacker/vector.js

aus Wikipedia, der freien Enzyklopädie
Zur Navigation springen Zur Suche springen

Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.

  • Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
  • Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
  • Internet Explorer/Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
  • Opera: Strg+F5
function moreLinks()
{
  if (navigator.userAgent.indexOf("Opera Mini") > 0) return;
 
  var tabs = document.getElementById('p-cactions').cloneNode(true);
  // don't use the same ids twice- replace the p-cactions id and prepend 'mytabs-' to the li's
  tabs.id = 'mytabs';
  // needs this to be set from js, it ignores the css width for some reason
  tabs.style.width = '100%';
  var listitems = tabs.getElementsByTagName('LI');
  for (i = 0; i < listitems.length; i++) {
    if (listitems[i].id) listitems[i].id = 'mytabs-' + listitems[i].id;
    if (listitems[i].accesskey) listitems[i].accesskey = "";
  }
  // drop them at the bottom of the content area
  document.getElementById('column-content').appendChild(tabs);
}
 
function AddGoogleTranslateLink()
{
  var whatLinksHere = document.getElementById('t-whatlinkshere');
  var gLink = whatLinksHere.cloneNode(true);
  gLink.innerText = 'Translate to English';
  gLink.href = 'http://translate.google.com/translate?hl=en&ie=UTF-8&sl=de&tl=en&u=' + document.location.href;
  whatLinksHere.parent.appendChild(gLink);
}
 
function externISBN() {
   for (var i = 0; i < document.links.length; i++)
   {
      if (wgPageName != "Special:BookSources"
         && !(wgTitle == "Book sources" && wgCanonicalNamespace == "Project"))
      {
         if (document.links[i].href.match(/Special:BookSources\/(.{10,13})$/i))
         {
           document.links[i].href = "http://www.amazon.co.uk/o/ASIN/" + RegExp.$1 + "/bookaid";
         }
      }
   }
}
 
function fixBadSearches()
{
   if (navigator.userAgent.indexOf("MSIE") > 0) return;
 
   var elems = document.getElementsByClassName("noarticletext");
   var url = String(document.location) + '';
 
   if (
      elems != null && elems.length > 0
      && (url.indexOf('+') > 0 || url.indexOf('%2B') > 0)
      && url.indexOf("autoredirect=true") < 0
      && url.indexOf("monobook.js") < 0
   )
   {
      document.location.replace(url.replace(/\+|(%2B)/gi, '_') + "?autoredirect=true");
   }
}
 
$(externISBN);
//addOnloadHook(moreLinks);
$(fixBadSearches);
$(AddGoogleTranslateLink);