您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Shows footnotes inline when clicked.
// ==UserScript== // @name Wikipedia Inline Footnotes // @version 1.2 // @namespace http://github.com/johan // @description Shows footnotes inline when clicked. // @include http://*.wikipedia.org/wiki/* // ==/UserScript== $x('//a[contains(@href,"#cite_note-")]').forEach(function(a) { a.addEventListener('click', inline_footnote, false); }); function inline_footnote(e) { var a = $X('ancestor-or-self::a[1]', e.target); var id = a.hash.slice(1); var tag = document.createElement('span'); var copy = document.getElementById(id).cloneNode(true); var sup = $X('ancestor::sup[1]', a); $x('a[sup] | *[.="^"]', copy).forEach(remove); tag.innerHTML = " ["+ copy.innerHTML.replace(/^[\s^]*/, '') +"]"; a.parentNode.replaceChild(tag, a); if (sup) { sup.parentNode.replaceChild(tag, sup); tag.className = 'citation'; tag.id = sup.id; } e.preventDefault(); e.stopPropagation(); } function remove(node) { node.parentNode.removeChild(node); } function $x( xpath, root ) { var doc = root ? root.evaluate ? root : root.ownerDocument : document; var got = doc.evaluate( xpath, root||doc, null, 0, null ), next, result = []; switch (got.resultType) { case got.STRING_TYPE: return got.stringValue; case got.NUMBER_TYPE: return got.numberValue; case got.BOOLEAN_TYPE: return got.booleanValue; default: while ((next = got.iterateNext())) result.push( next ); return result; } }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址