(创建页面,内容为“<noinclude> {{Documentation}} </noinclude> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.css"> <div id="ap-{{#var:uid}}" class="aplayer-box"></div> <script> mw.loader.load('https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.js').then(function() { new APlayer({ container: document.getElementById('ap-{{#var:uid}}'), audio: [ {{#loop:i|0|{{#len:{{#ls…”) |
小无编辑摘要 |
||
| (未显示同一用户的4个中间版本) | |||
| 第1行: | 第1行: | ||
< | <includeonly> | ||
<!-- 引入国内CDN加速的APlayer资源 --> | |||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.css"> | |||
<script src="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.js"></script> | |||
<script src="https://cdn.jsdelivr.net/npm/meting@2.0.1/dist/Meting.min.js"></script> | |||
<style> | |||
/* 移动端适配 */ | |||
.aplayer { | |||
max-width: 100%; | |||
margin: 10px auto; | |||
font-family: -apple-system, "PingFang SC", "Microsoft YaHei"; | |||
} | |||
/* 小屏幕优化 */ | |||
@media screen and (max-width: 768px) { | |||
.aplayer-info { | |||
padding: 8px; | |||
} | |||
.aplayer-author { | |||
font-size: 12px; | |||
} | |||
.aplayer-controller .aplayer-bar { | |||
margin: 0 5px; | |||
} | |||
} | |||
</style> | |||
<div class="aplayer-box" | |||
data-title="{{{1|}}}" | |||
data-author="{{{2|}}}" | |||
data-pic="{{{3|}}}" | |||
data-url="{{{4|}}}" | |||
{{#forargs: song | | |||
| data-song-{{#var:key}} = "{{#var:value}}" | |||
}}> | |||
</div> | |||
<script> | |||
(function() { | |||
// 收集歌曲数据 | |||
var songs = []; | |||
var box = document.querySelector('.aplayer-box'); | |||
// 处理多首歌曲参数 | |||
for(var i = 1; ; i++) { | |||
var prefix = "song" + i; | |||
var data = { | |||
title: box.dataset[prefix + 'title'], | |||
author: box.dataset[prefix + 'author'], | |||
url: box.dataset[prefix + 'url'], | |||
pic: box.dataset[prefix + 'pic'] | |||
}; | |||
if(!data.title) break; | |||
songs.push(data); | |||
} | |||
// 初始化播放器 | |||
var ap = new APlayer({ | |||
container: box, | |||
audio: songs, | |||
fixed: false, | |||
listFolded: true, | |||
lrcType: 0, | |||
theme: '#2980b9' | |||
}); | |||
})(); | |||
</script> | |||
</includeonly> | |||