「MediaWiki:Common.js」の版間の差分
MediaWikiインターフェイスページ
その他の操作
細 Parse error: Unexpected: ; on line 33 in MediaWiki:Common.js←fixed |
編集の要約なし |
||
| 29行目: | 29行目: | ||
/* PCスキンでサブタイトルを消す処理 ここまで */ | /* PCスキンでサブタイトルを消す処理 ここまで */ | ||
console.log("OK Common.js") | console.log("OK Common.js") | ||
2025年10月25日 (土) 22:35時点における版
/* ここにあるすべての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")