narrow -> mini

This commit is contained in:
DIYgod 2018-03-12 00:38:03 +08:00
parent 8f8cc489a2
commit d54700af5f
No known key found for this signature in database
GPG Key ID: EC0B76A252D3EF67
4 changed files with 13 additions and 9 deletions

View File

@ -1,6 +1,6 @@
const ap1 = new APlayer({
element: document.getElementById('player1'),
narrow: false,
mini: false,
autoplay: true,
lrc: false,
mutex: true,
@ -37,7 +37,7 @@ ap1.on('error', function () {
const ap2 = new APlayer({
element: document.getElementById('player2'),
narrow: true,
mini: true,
autoplay: false,
lrc: false,
mutex: true,
@ -52,7 +52,7 @@ const ap2 = new APlayer({
const ap3 = new APlayer({
element: document.getElementById('player3'),
narrow: false,
mini: false,
autoplay: false,
lrc: 3,
mutex: true,
@ -68,7 +68,7 @@ const ap3 = new APlayer({
const ap4 = new APlayer({
element: document.getElementById('player4'),
narrow: false,
mini: false,
autoplay: false,
lrc: false,
mutex: true,
@ -98,7 +98,7 @@ const ap4 = new APlayer({
const ap5 = new APlayer({
element: document.getElementById('player5'),
narrow: false,
mini: false,
autoplay: false,
lrc: 3,
mutex: true,

View File

@ -471,6 +471,7 @@ $aplayer-height-lrc: $aplayer-height + $lrc-height - 6;
cursor: pointer;
transition: all 0.2s ease;
overflow: hidden;
margin: 0;
&:first-child {
border-top: none;

View File

@ -3,13 +3,16 @@ export default (options) => {
// default options
const defaultOption = {
container: options.element || document.getElementsByClassName('aplayer')[0],
narrow: false,
mini: false,
autoplay: false,
mutex: true,
lrc: 0,
preload: 'auto',
theme: '#b7daff',
loop: 'all',
order: 'list',
volume: 0.7,
listFolded: false,
};
for (const defaultKey in defaultOption) {
if (defaultOption.hasOwnProperty(defaultKey) && !options.hasOwnProperty(defaultKey)) {

View File

@ -44,7 +44,7 @@ class APlayer {
if (this.arrow) {
this.container.classList.add('aplayer-arrow');
}
if (this.options.narrow) {
if (this.options.mini) {
this.container.classList.add('aplayer-narrow');
}
@ -101,7 +101,7 @@ class APlayer {
initAudio () {
this.audio = document.createElement('audio');
this.audio.preload = this.options.preload ? this.options.preload : 'auto';
this.audio.preload = this.options.preload;
for (let i = 0; i < this.events.audioEvents.length; i++) {
this.audio.addEventListener(this.events.audioEvents[i], () => {
@ -178,7 +178,7 @@ class APlayer {
}
});
this.volume(this.user.get('volume'), true, true);
this.volume(this.user.get('volume'), true);
}
switchAudio (index) {