User:Lopullinen/gadgets/originalSectionTitle.js
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
/*
$(function () {
if (mw.config.get('wgPageName') === "Wikipedia:首页") return;
const styleStr = "font: normal normal normal smaller monospace; margin: auto 1em; border: 1px solid rgb(162, 169, 177); display: inline-block; user-select: all;"
let e, f, titleStr;
// 条目标题
titleStr = mw.config.get('wgPageName').replace(/_/g, " ");
let objTitle = document.querySelector('#firstHeading');
e = document.createElement('span')
e.style = styleStr;
e.innerText = titleStr;
//章节标题
titleStr += '#';
let objs = document.querySelectorAll('span.mw-headline');
for (let i = 0; i < objs.length; i++) {
f = document.createElement('span');
f.style = 'font-size: 0'; // 好吧我没办法了,'display: hidden;' 又复制不上
f.innerText = titleStr;
e = document.createElement('span')
e.style = styleStr;
e.innerText = (objs[i].id).replace(/_/g, " ");
e.prepend(f);
objs[i] = objs[i].parentNode.insertBefore(e, objs[i].nextSibling);
}
*/
});