Skip to content

Commit

Permalink
add option.danmaku.margin to prevent block video subtitles
Browse files Browse the repository at this point in the history
  • Loading branch information
woolninesun committed Aug 29, 2017
1 parent 8eb07af commit ce93627
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 4 additions & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ <h2 id="quick-start">Quick Start</h2>
},
danmaku: {
id: '9E2E3368B56CDBB4',
api: 'https://api.prprpr.me/dplayer/'
api: 'https://api.prprpr.me/dplayer/',
margin: {
bottom:'15%'
}
}
});
</script>
Expand Down
12 changes: 11 additions & 1 deletion src/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const html = {
${option.logo ? `
<div class="dplayer-logo"><img src="${option.logo}"></div>
` : ``}
<div class="dplayer-danmaku">
<div class="dplayer-danmaku" style="${option.danmaku ? html.danmakumargin(option.danmaku.margin) : ``}">
<div class="dplayer-danmaku-item dplayer-danmaku-item--demo"></div>
</div>
<div class="dplayer-bezel">
Expand Down Expand Up @@ -174,6 +174,16 @@ const html = {
<div class="dplayer-notice"></div>`;
},

danmakumargin: (margin) => {
let result = '';
if (margin) {
for (const key in margin) {
result += `${key}:${margin[key]};`;
}
}
return result;
},

contextmenuList: (contextmenu) => {
let result = '<div class="dplayer-menu">';
for (let i = 0; i < contextmenu.length; i++) {
Expand Down

0 comments on commit ce93627

Please sign in to comment.