Warning: is_readable(): open_basedir restriction in effect. File(/gitinfo/info.json) is not within the allowed path(s): (/www/wwwroot/wiki.guguwo.top/:/tmp/) in /www/wwwroot/wiki.guguwo.top/includes/utils/GitInfo.php on line 177
模板:APlayer:修订间差异 - 咕咕窝wiki

模板:APlayer:修订间差异

来自咕咕窝wiki
无编辑摘要
无编辑摘要
第1行: 第1行:
<noinclude>
<div id="aplayer-{{#var:id}}" class="aplayer"></div>
{{Documentation}}
</noinclude>
<div id="aplayer-{{{1|default}}}" class="aplayer"></div>
<script>
<script>
(function() {
(function() {
  // 确保APlayer加载完成
    var ap = new APlayer({
  function initAPlayer() {
        container: document.getElementById('aplayer-{{#var:id}}'),
    if (typeof APlayer === 'undefined') {
        theme: '{{#var:theme | #f5f5f5}}', // 默认主题
      setTimeout(initAPlayer, 100);
        loop: '{{#var:loop | all}}',      // 默认循环播放
      return;
        preload: '{{#var:preload | auto}}', // 默认自动预加载
    }
        volume: {{#var:volume | 0.7}},      // 默认音量
 
        mutex: true,                        // 互斥播放
    // 解析歌曲参数
        listFolded: {{#var:listFolded | false}}, // 默认不折叠列表
    var songs = [];
        listMaxHeight: '{{#var:listMaxHeight | 300px}}', // 列表最大高度
    {{#forargs: song
        audio: [
      | {{{songs|}}}
            {{#forargs:song|index|value|
      | {{#if: {{#pos:{{#var:key}}|song}}
                {
          | songs.push({
                    name: '{{#var:song{{index}}_name}}',
              name: "{{#explode:{{#var:value}}|;|0}}",
                    artist: '{{#var:song{{index}}_artist}}',
              artist: "{{#explode:{{#var:value}}|;|1}}",
                    url: '{{#var:song{{index}}_url}}',
              url: "{{#explode:{{#var:value}}|;|2}}",
                    cover: '{{#var:song{{index}}_cover}}',
              cover: "{{#explode:{{#var:value}}|;|3|https://placehold.co/80x80?text=No+Cover}}"
                },
            });
            }}
        }}
        ]
    }}
 
    // 初始化播放器
    new APlayer({
      container: document.getElementById('aplayer-{{{1|default}}}'),
      audio: songs,
      lrcType: 0,
      fixed: false,
      mini: false,
      theme: '#2980b9'
     });
     });
  }


  // 等待DOM加载完成后执行
    // Widgets 集成 (如果需要)
  document.addEventListener('DOMContentLoaded', initAPlayer);
    if (window.Widget) {
        Widget.instance.registerAPlayer(ap);
    }
})();
})();
</script>
</script>
<noinclude>
{{Documentation}}
</noinclude>

2025年3月16日 (日) 06:21的版本

<script> (function() {

   var ap = new APlayer({
       container: document.getElementById('aplayer-{{#var:id}}'),
       theme: '{{#var:theme | #f5f5f5}}', // 默认主题
       loop: '{{#var:loop | all}}',       // 默认循环播放
       preload: '{{#var:preload | auto}}', // 默认自动预加载
       volume: {{#var:volume | 0.7}},      // 默认音量
       mutex: true,                        // 互斥播放
       listFolded: {{#var:listFolded | false}}, // 默认不折叠列表
       listMaxHeight: '{{#var:listMaxHeight | 300px}}', // 列表最大高度
       audio: [
           {{#forargs:song|index|value|
               {
                   name: '{{#var:song模板:Index_name}}',
                   artist: '{{#var:song模板:Index_artist}}',
                   url: '{{#var:song模板:Index_url}}',
                   cover: '{{#var:song模板:Index_cover}}',
               },
           }}
       ]
   });
   // Widgets 集成 (如果需要)
   if (window.Widget) {
       Widget.instance.registerAPlayer(ap);
   }

})(); </script>

模板:Documentation