new option: danmaku.user, cc #50
This commit is contained in:
parent
0a746326a2
commit
18acaad609
|
|
@ -83,7 +83,8 @@
|
|||
id: '9E2E3368B56CDBB4',
|
||||
api: 'https://api.prprpr.me/dplayer/',
|
||||
token: 'tokendemo',
|
||||
maximum: 3000
|
||||
maximum: 3000,
|
||||
user: 'DIYgod的女粉'
|
||||
}
|
||||
});
|
||||
function switchDPlayer() {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,7 +1,6 @@
|
|||
console.log("\n %c DPlayer 1.1.4 %c http://dplayer.js.org \n\n","color: #fadfa3; background: #030307; padding:5px 0;","background: #fadfa3; padding:5px 0;");
|
||||
|
||||
require('./DPlayer.scss');
|
||||
const defaultApiBackend = require('./api.js');
|
||||
const svg = require('./svg.js');
|
||||
const handleOption = require('./option.js');
|
||||
const i18n = require('./i18n.js');
|
||||
|
|
@ -252,10 +251,12 @@ class DPlayer {
|
|||
}, 100);
|
||||
if (this.option.danmaku && showdan) {
|
||||
danmakuTime = setInterval(() => {
|
||||
let item = this.dan[this.danIndex];
|
||||
while (item && this.video.currentTime > parseFloat(item.time)) {
|
||||
this.pushDanmaku(item.text, item.color, item.type);
|
||||
item = this.dan[++this.danIndex];
|
||||
if (this.dan) {
|
||||
let item = this.dan[this.danIndex];
|
||||
while (item && this.video.currentTime > parseFloat(item.time)) {
|
||||
this.pushDanmaku(item.text, item.color, item.type);
|
||||
item = this.dan[++this.danIndex];
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
|
|
@ -661,7 +662,7 @@ class DPlayer {
|
|||
const danmakuData = {
|
||||
token: this.option.danmaku.token,
|
||||
player: this.option.danmaku.id,
|
||||
author: 'DIYgod',
|
||||
author: this.option.danmaku.user,
|
||||
time: this.video.currentTime,
|
||||
text: commentInput.value,
|
||||
color: this.element.querySelector('.dplayer-comment-setting-color input:checked').value,
|
||||
|
|
@ -748,7 +749,7 @@ class DPlayer {
|
|||
* full screen
|
||||
*/
|
||||
const resetAnimation = () => {
|
||||
danWidth = danContainer.offsetWidth;
|
||||
let danWidth = danContainer.offsetWidth;
|
||||
const items = this.element.getElementsByClassName('dplayer-danmaku-item');
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
items[i].style.transform = `translateX(-${danWidth}px)`;
|
||||
|
|
|
|||
|
|
@ -176,7 +176,6 @@
|
|||
user-select: none;
|
||||
cursor: default;
|
||||
white-space: nowrap;
|
||||
font-weight: bolder;
|
||||
text-shadow: .5px .5px .5px rgba(0,0,0,.5);
|
||||
|
||||
&--demo {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@ module.exports = (option) => {
|
|||
if (!option.video.hasOwnProperty('type')) {
|
||||
option.video.type = 'auto';
|
||||
}
|
||||
if (!option.danmaku.hasOwnProperty('user')) {
|
||||
option.danmaku.user = 'DIYgod';
|
||||
}
|
||||
|
||||
return option;
|
||||
};
|
||||
Loading…
Reference in New Issue