MediaWiki:Common.js
注意: 保存後、変更を確認するにはブラウザーのキャッシュを消去する必要がある場合があります。
- Firefox / Safari: Shift を押しながら 再読み込み をクリックするか、Ctrl-F5 または Ctrl-R を押してください (Mac では ⌘-R)
- Google Chrome: Ctrl-Shift-R を押してください (Mac では ⌘-Shift-R)
- Microsoft Edge: Ctrl を押しながら 最新の情報に更新 をクリックするか、Ctrl-F5 を押してください。
/* ここにあるすべてのJavaScriptは、すべてのページ読み込みですべての利用者に対して読み込まれます */
/* PCスキンでサブタイトルを消す処理 */
const targetNode = document.getElementById('contentSub');
const config = { childList: true, subtree: true };
const callback = function(mutationsList, observer) {
for (const mutation of mutationsList) {
if (mutation.type === 'childList') {
const subtitleElement = document.getElementById('mw-content-subtitle');
if (subtitleElement) {
const childNodes = subtitleElement.childNodes;
const lastChildNode = childNodes[childNodes.length - 1];
if (lastChildNode && lastChildNode.nodeType === Node.TEXT_NODE) {
lastChildNode.remove();
observer.disconnect();
return;
}
}
}
}
};
const observer = new MutationObserver(callback);
if (targetNode) {
observer.observe(targetNode, config);
}
/* PCスキンでサブタイトルを消す処理 ここまで */
console.log("OK Common.js")