Greasy Fork is available in English.

Wikidata Links Enhancer

displays wikidata links under any wikimedia projects pages

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name Wikidata Links Enhancer
// @namespace maxlath
// @description displays wikidata links under any wikimedia projects pages
// @include *.wikipedia.org/*
// @include *.wikisource.org/*
// @include *.wikiquote.org/*
// @include *.wikimedia.org/*
// @version 1
// @grant none
// ==/UserScript==


var getLink = function () {
  return $('a').filter(function (index) {
    return /wikidata.org\/wiki\/Q/.test($(this).attr('href'))
  }).first().attr('href');
};

var extractWikidataId = function (href) {
  return href.split('wikidata.org/wiki/')[1]
};

var addLinkAfterHeader = function (href) {
  if (href) {
    var id = extractWikidataId(href);
    console.log('wikidata link found', href, id);
    $el = $(document.createElement('a')).attr('href', href).text(id);
    $('h1').next().prepend($el);
  }
};

// after DOM ready, get link and add it under the page h1
$(function () {
  addLinkAfterHeader(getLink())
});