コンテンツにスキップ

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

提供: 舞山市ファンWiki
リダイレクト(笑)を追加
Parse error: Unexpected: ; on line 33 in MediaWiki:Common.js←fixed
31行目: 31行目:
/* リダイレクト(笑) */
/* リダイレクト(笑) */
if (window.location.host === 'maiyamawiki.miraheze.org') {
if (window.location.host === 'maiyamawiki.miraheze.org') {
     window.location.replace('https://wiki.tmyt105.com' + window.location.pathname + window.location.search + window.location.hash;);
     window.location.replace('https://wiki.tmyt105.com' + window.location.pathname + window.location.search + window.location.hash);
}
}
/* リダイレクト(笑) ここまで */
/* リダイレクト(笑) ここまで */


console.log("OK Common.js")
console.log("OK Common.js")

2025年10月25日 (土) 22:28時点における版

/* ここにあるすべての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")