打开/关闭菜单
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

MediaWiki:Common.js

MediaWiki界面页面

注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的更改的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */
mw.hook("wikipage.content").add(function () {
  const btn = document.querySelector(".toggle-pronunciation-btn");
  const chao = document.getElementById("pron-chao");
  const ipa = document.getElementById("pron-ipa");

  if (!btn || !chao || !ipa) return;

  btn.addEventListener("click", function () {
    const showingIPA = ipa.style.display !== "none";

    if (showingIPA) {
      ipa.style.display = "none";
      chao.style.display = "";
      btn.textContent = "切换为 IPA";
    } else {
      ipa.style.display = "";
      chao.style.display = "none";
      btn.textContent = "切换为潮拼";
    }
  });
});