add aplayer

master
iotcat 4 years ago
parent b1b89c28da
commit edc25df9b4
  1. 1
      layout/_layout.swig
  2. 8
      layout/_partial/head.swig
  3. 33
      layout/_script/aplayer.swig
  4. 3
      source/lib/aplayer/aplayer.min.js

@ -39,5 +39,6 @@
{%- include '_script/libs.swig' -%}
{%- include '_script/theme.swig' -%}
{%- include '_script/aplayer.swig' -%}
</body>
</html>

@ -30,6 +30,14 @@
{#- iziToast -#}
<link rel="stylesheet" type="text/css" href="{{ url_for('lib/iziToast/iziToast.min.css') }}" />
{#- aplayer -#}
{%- if theme.aplayer.enable -%}
<script>
if(window.screen.width < 600) document.write('<link rel="stylesheet" href="https://cdn.yimian.xyz/ushio-js/ushio-js.mobile.min.css">');
else document.write('<link rel="stylesheet" href="https://cdn.yimian.xyz/ushio-js/ushio-js.min.css">');
</script>
{%- endif -%}
{#- Canonical, good for google search engine -#}
<link rel="canonical" href="{{ config.url }}/{{ page.canonical_path.replace('index.html', '') }}"/>

@ -0,0 +1,33 @@
{%- if theme.aplayer.enable -%}
{% set aplayer_js_url = '/lib/aplayer/aplayer.min.js' %}
<script src="{{ aplayer_js_url }}"></script>
<script>
$.post("{{ theme.aplayer.api }}?type=playlist&id={{ theme.aplayer.playlist }}&limit={{ theme.aplayer.limit }}&random={{ theme.aplayer.random }}", function(res){
$('body').append('<div class="aplayer-footer"><div class="ap-f" id="ap-f"></div></div>');
var a = new APlayer({
element:document.getElementById("ap-f"),
autoplay: {{ theme.aplayer.autoplay }},
fixed:true,
loop:"{{ theme.aplayer.loop }}",
order:"list",
listFolded:true,
showlrc:3,
theme:"{{ theme.aplayer.color }}",
listmaxheight:"200px",
music:res
});
window.aplayers || (window.aplayers = []),
window.aplayers.push(a);
window.aplayers[0].lrc.hide();
window.aplayers[0].on('play', function () {
window.aplayers[0].lrc.show();
});
window.aplayers[0].on('pause', function () {
window.aplayers[0].lrc.hide();
});
});
</script>
{%- endif -%}

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save