コンテンツにスキップ

「MediaWiki:Common.js」の版間の差分

提供: 舞山市ファンWiki
編集の要約なし
編集の要約なし
1行目: 1行目:
/* ここにあるすべてのJavaScriptは、すべてのページ読み込みですべての利用者に対して読み込まれます */
/* ここにあるすべてのJavaScriptは、すべてのページ読み込みですべての利用者に対して読み込まれます */
/* PCスキンでサブタイトルを消す処理 */
const targetNode = document.getElementById('contentSub');
const targetNode = document.getElementById('contentSub');
const config = { childList: true, subtree: true };
const config = { childList: true, subtree: true };
18行目: 20行目:
   observer.observe(targetNode, config);
   observer.observe(targetNode, config);
}
}
/* PCスキンでサブタイトルを消す処理 ここまで */
console.log("OK Common.js")
console.log("OK Common.js")

2025年8月8日 (金) 10:10時点における版

/* ここにあるすべての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) {
        subtitleElement.textContent = '';
        observer.disconnect();
        return;
      }
    }
  }
};
const observer = new MutationObserver(callback);
if (targetNode) {
  observer.observe(targetNode, config);
}

/* PCスキンでサブタイトルを消す処理 ここまで */

console.log("OK Common.js")