您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
displays wikidata links under any wikimedia projects pages
// ==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()) });