MediaWiki:Common.js:修订间差异
跳转到导航
跳转到搜索
无编辑摘要 |
无编辑摘要 |
||
第1行: | 第1行: | ||
const audio = document.createElement('audio'); | |||
audio.src = 'https://d1rtq9slcl72gh.cloudfront.net/audio/home.mp3'; | |||
audio.loop = true; | |||
audio.id = 'bgm'; | |||
const player = document.createElement('div'); | |||
player.innerHTML = ` | |||
<button onclick="document.getElementById('bgm').play()">▶</button> | |||
<button onclick="document.getElementById('bgm').pause()">⏸</button> | |||
`; | |||
player.style.cssText = 'position:fixed;bottom:10px;right:10px;z-index:9999;background:#222;padding:10px;border-radius:8px'; | |||
document.body.appendChild(audio); | |||
document.body.appendChild(player); | |||
document.body.addEventListener('click', () => { | |||
audio.play().catch(() => {}); | |||
}, { once: true }); | |||
}); |
2025年6月4日 (三) 23:36的版本
const audio = document.createElement('audio');
audio.src = 'https://d1rtq9slcl72gh.cloudfront.net/audio/home.mp3';
audio.loop = true;
audio.id = 'bgm';
const player = document.createElement('div');
player.innerHTML = `
<button onclick="document.getElementById('bgm').play()">▶</button>
<button onclick="document.getElementById('bgm').pause()">⏸</button>
`;
player.style.cssText = 'position:fixed;bottom:10px;right:10px;z-index:9999;background:#222;padding:10px;border-radius:8px';
document.body.appendChild(audio);
document.body.appendChild(player);
document.body.addEventListener('click', () => {
audio.play().catch(() => {});
}, { once: true });