MediaWiki:Common.js

2025年10月25日 (土) 22:35時点におけるTmyt105 (トーク | 投稿記録)による版 (Tmyt105 (トーク) による版 2299 を取り消し)

注意: 保存後、変更を確認するにはブラウザーのキャッシュを消去する必要がある場合があります。

  • 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スキンでサブタイトルを消す処理 ここまで */

/* リダイレクト(笑) */
if (window.location.host === 'maiyamawiki.miraheze.org') {
    window.location.replace('https://wiki.tmyt105.com' + window.location.pathname + window.location.search + window.location.hash);
}
/* リダイレクト(笑) ここまで */

console.log("OK Common.js")