MediaWiki:Common.js:修订间差异
MediaWiki界面页面
更多操作
小无编辑摘要 |
小无编辑摘要 |
||
第1行: | 第1行: | ||
/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */ | /* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */ | ||
mw.hook("wikipage.content").add(function () { | |||
const btn = document.querySelector(".toggle-pronunciation-btn"); | const btn = document.querySelector(".toggle-pronunciation-btn"); | ||
const chao = document.getElementById("pron-chao"); | const chao = document.getElementById("pron-chao"); |
2025年7月10日 (四) 06:21的最新版本
/* 这里的任何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 = "切换为潮拼"; } }); });