Benutzer:לערי ריינהארט/common.js

aus Wikipedia, der freien Enzyklopädie

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
// [[d:User:Yair rand/WikidataInfo.js]]
mw.loader.load("//www.wikidata.org/w/index.php?title=User:Yair rand/WikidataInfo.js&action=raw&ctype=text/javascript");
 
$(function() { mw.util.addPortletLink('p-cactions', mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=purge', 'purge', 'ca-purge', 'Purge the internal cache for this page'); });

/* BiDi support • function bidiSwitchSetup() */

mw.loader.load('https://de.wikipedia.org/w/index.php?title=user:GFHund/monobook.js&action=raw&ctype=text/javascript');

/* Example for [[Bugzilla:023427#c23]] • ?curid=ArticleId&redirect=no&action=purge#normdaten */
 
mw.loader.load('https://de.wikipedia.org/w/index.php?title=user:%D7%9C%D7%A2%D7%A8%D7%99_%D7%A8%D7%99%D7%99%D7%A0%D7%94%D7%90%D7%A8%D7%98/normdaten/ArticleId.js&action=raw&ctype=text/javascript');

/* **fails** • Example for toggling hidden categories • from [[:eo:MediaWiki:Common.js]] */
 
mw.loader.load('https://de.wikipedia.org/w/index.php?title=user:%D7%9C%D7%A2%D7%A8%D7%99_%D7%A8%D7%99%D7%99%D7%A0%D7%94%D7%90%D7%A8%D7%98/normdaten/hiddencat.js&action=raw&ctype=text/javascript');

/* [[:commons:MediaWiki:Gadget-CategoryAboveAll.js]] • categories at top of page */

mw.loader.load('https://de.wikipedia.org/w/index.php?title=user:%D7%9C%D7%A2%D7%A8%D7%99_%D7%A8%D7%99%D7%99%D7%A0%D7%94%D7%90%D7%A8%D7%98/normdaten/Gadget-CategoryAboveAll.js&action=raw&ctype=text/javascript');

/* Example for Authority control • Normdaten at top of page */

mw.loader.load('https://de.wikipedia.org/w/index.php?title=user:%D7%9C%D7%A2%D7%A8%D7%99_%D7%A8%D7%99%D7%99%D7%A0%D7%94%D7%90%D7%A8%D7%98/normdaten/acsattop.js&action=raw&ctype=text/javascript');

/* **inclusion fails** • Example for linking via VIAF → LT • Authority control • Normdaten • VIAF inter project linking */
/* **inclusion fails** • Example for linking via SELIBR → LT • Authority control • Normdaten • VIAF inter project linking */



function linkingviaSELIBR() {
  var targetURL = "http://epo.librarything.com/commonknowledge/search.php?f=13&exact=1&q=SELIBR:libris.kb.se/auth&debug=ver.05";
  var magicRegex = /libris\.kb\.se\/auth/ig;
  for (var i = 0; i < document.links.length; i++)
  {
    if( document.links[i].href.match(/libris\.kb\.se\/auth\/(.*)/) )
/* open issue(s): should generate links only if at least 4 digits are following immediately  */
    {
/*    document.links[i].href=targetURL.replace(magicRegex, RegExp.$1); */
      document.links[i].href=targetURL.replace(magicRegex, RegExp.$1.replace(/[\D]*/g, ''))
    }
  }
}
$(linkingviaSELIBR);



function searchingVIAFviaGND() {
  var targetURL = "http://viaf.org/viaf/search?query=local.names+all+%22d-nb.info/gnd%22+and+local.sources+any+%22dnb%22&stylesheet=/viaf/xsl/results.xsl&sortKeys=holdingscount&maximumRecords=100#gNd::NOTES:debug:ver.01::";
  var magicRegex = /d\-nb\.info\/gnd/ig;
  for (var i = 0; i < document.links.length; i++)
  {
    if( document.links[i].href.match(/d\-nb\.info\/gnd\/(.*)/) )
/* open issue(s): should generate links only if at least 4 digits are following immediately  */
    {
/*    document.links[i].href=targetURL.replace(magicRegex, RegExp.$1); */
      document.links[i].href=targetURL.replace(magicRegex, RegExp.$1.replace(/[\D]*[\-][\D][x]/ig, ''))
    }
  }

  var magicRegex2 = /portal\.d\-nb\.de\/opac\.htm\?query\=Woe\%3D/ig;
  var targetURL2 = "http://www.librarything.de/commonknowledge/search.php?f=13&exact=1&q=VIAF:PND:portal.d-nb.de/opac.htm?query=Woe%3D";
  for (var i = 0; i < document.links.length; i++)
  {
    if( document.links[i].href.match(/portal\.d\-nb\.de\/opac\.htm\?query\=Woe\%3D(.*)/) )
    {
/*    document.links[i].href=targetURL2.replace(magicRegex2, RegExp.$1); */
      document.links[i].href=targetURL2.replace(magicRegex2, RegExp.$1.replace(/[\D]*[\-][\D][x]/ig, ''))
/* open issue(s): generates a trailer */
    }
  }
}
$(searchingVIAFviaGND);

function replacingLccnWithOrlabs() {
  var targetURL = "http://orlabs.oclc.org/identities/lccn-nlccn.loc.gov/n#oRlaBs::NOTES:debug:ver.01::";
  var magicRegex = /lccn\.loc\.gov\/n/ig;
  for (var i = 0; i < document.links.length; i++)
  {
    if( document.links[i].href.match(/lccn\.loc\.gov\/n(.*)/) )
/* open issue(s): should generate links only if at least 4 digits are following immediately  */
    {
/*    document.links[i].href=targetURL.replace(magicRegex, RegExp.$1); */
      document.links[i].href=targetURL.replace(magicRegex, RegExp.$1.replace(/[\D]*[\-][\D][x]/ig, ''))
    }
  }
}
 
$(replacingLccnWithOrlabs);

if (wgCanonicalSpecialPageName < 1 ) /* if (wgCanonicalSpecialPageName<>"false") */
  {
    var my_short_url2 = '//www.wikidata.org/wiki/Special:ItemByTitle/'+wgDBname+'/'+wgTitle;
    var my_short_name2 = "d:" + wgTitle;
    mw.util.addPortletLink('p-cactions',my_short_url2,my_short_name2);
  };