mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-22 05:11:20 -08:00
build all packages
This commit is contained in:
1 parent
df3f633e78
commit
339996a873
26 files changed
+329
-317
No files matched your search
@@ -43,6 +43,7 @@ var art = new Artplayer({
|
||||
art.notice.show(`发送弹幕成功: ${danmuku.remaining} / ${danmuku.limit}`);
|
||||
art.plugins.artplayerPluginDanmuku.emit({
|
||||
...data,
|
||||
mode: 'scroll',
|
||||
time: art.player.currentTime,
|
||||
border: data.color,
|
||||
});
|
||||
|
||||
+94
-78
@@ -1,87 +1,103 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Artplayer.js</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
||||
<meta name="keywords" content="artplayer, player, js, html5, video"/>
|
||||
<meta name="description" content="ArtPlayer is a modern HTML5 video player"/>
|
||||
<link rel="shortcut icon" href="./assets/img/favicon.ico" type="image/x-icon" />
|
||||
<link rel="stylesheet" href="./assets/css/normalize.css" />
|
||||
<link rel="stylesheet" href="./assets/css/codemirror.css" />
|
||||
<link rel="stylesheet" href="./assets/css/dracula.css" />
|
||||
<link rel="stylesheet" href="./assets/css/consola.css" />
|
||||
<link rel="stylesheet" href="./assets/css/style.css" />
|
||||
<link rel="stylesheet" href="./uncompiled/artplayer.css" />
|
||||
</head>
|
||||
<body>
|
||||
<section class="main">
|
||||
<div class="part-left">
|
||||
<header class="header">
|
||||
<a href="./" class="logo">Artplayer.js</a>
|
||||
<div class="menus">
|
||||
<div class="item ecosystem">
|
||||
Ecosystem
|
||||
<div class="sub-menu">
|
||||
<ul>
|
||||
<li class="title">Plugins</li>
|
||||
<li><a href="./?libs=.%2Funcompiled%2Fartplayer-plugin-gif.js&example=gif">artplayer-plugin-gif</a></li>
|
||||
<li><a href="./?libs=.%2Funcompiled%2Fartplayer-plugin-backlight.js&example=backlight">artplayer-plugin-backlight</a></li>
|
||||
<li><a href="./?libs=.%2Funcompiled%2Fartplayer-plugin-danmuku.js&example=danmuku">artplayer-plugin-danmuku</a></li>
|
||||
<li><a href="./?libs=.%2Funcompiled%2Fartplayer-plugin-playlist.js%0A.%2Funcompiled%2Fartplayer-plugin-playlist.css&example=playlist">artplayer-plugin-playlist</a></li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li class="title">Tools</li>
|
||||
<li><a href="./?libs=.%2Funcompiled%2Fartplayer-tool-thumbnail.js&example=thumbnail">artplayer-tool-thumbnail</a></li>
|
||||
<li><a href="./?libs=.%2Funcompiled%2Fartplayer-tool-github.js%0A.%2Funcompiled%2Fartplayer-plugin-danmuku.js&example=github">artplayer-tool-github</a></li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li class="title">Component</li>
|
||||
<li><a href="https://codesandbox.io/s/n74859y9rl">artplayer-react</a></li>
|
||||
<li><a href="https://codesandbox.io/s/6z76lm109n">artplayer-vue</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Artplayer.js</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
||||
<meta name="keywords" content="artplayer, player, js, html5, video" />
|
||||
<meta name="description" content="ArtPlayer is a modern HTML5 video player" />
|
||||
<link rel="shortcut icon" href="./assets/img/favicon.ico" type="image/x-icon" />
|
||||
<link rel="stylesheet" href="./assets/css/normalize.css" />
|
||||
<link rel="stylesheet" href="./assets/css/codemirror.css" />
|
||||
<link rel="stylesheet" href="./assets/css/dracula.css" />
|
||||
<link rel="stylesheet" href="./assets/css/consola.css" />
|
||||
<link rel="stylesheet" href="./assets/css/style.css" />
|
||||
<link rel="stylesheet" href="./uncompiled/artplayer.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<section class="main">
|
||||
<div class="part-left">
|
||||
<header class="header">
|
||||
<a href="./" class="logo">Artplayer.js</a>
|
||||
<div class="menus">
|
||||
<div class="item ecosystem">
|
||||
Ecosystem
|
||||
<div class="sub-menu">
|
||||
<ul>
|
||||
<li class="title">Plugins</li>
|
||||
<li><a
|
||||
href="./?libs=.%2Funcompiled%2Fartplayer-plugin-gif.js&example=gif">artplayer-plugin-gif</a>
|
||||
</li>
|
||||
<li><a
|
||||
href="./?libs=.%2Funcompiled%2Fartplayer-plugin-backlight.js&example=backlight">artplayer-plugin-backlight</a>
|
||||
</li>
|
||||
<li><a
|
||||
href="./?libs=.%2Funcompiled%2Fartplayer-plugin-danmuku.js&example=danmuku">artplayer-plugin-danmuku</a>
|
||||
</li>
|
||||
<li><a
|
||||
href="./?libs=.%2Funcompiled%2Fartplayer-plugin-playlist.js%0A.%2Funcompiled%2Fartplayer-plugin-playlist.css&example=playlist">artplayer-plugin-playlist</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li class="title">Tools</li>
|
||||
<li><a
|
||||
href="./?libs=.%2Funcompiled%2Fartplayer-tool-thumbnail.js&example=thumbnail">artplayer-tool-thumbnail</a>
|
||||
</li>
|
||||
<li><a
|
||||
href="./?libs=.%2Funcompiled%2Fartplayer-tool-github.js%0A.%2Funcompiled%2Fartplayer-plugin-danmuku.js&example=github">artplayer-tool-github</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li class="title">Component</li>
|
||||
<li><a href="https://codesandbox.io/s/n74859y9rl">artplayer-react</a></li>
|
||||
<li><a href="https://codesandbox.io/s/6z76lm109n">artplayer-vue</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<a class="item" href="./document/">Document</a>
|
||||
<a class="item" href="https://github.com/zhw2590582/ArtPlayer">Github</a>
|
||||
</div>
|
||||
<div class="run">Run Code</div>
|
||||
</header>
|
||||
<div class="libs">
|
||||
<textarea
|
||||
class="libsInput"
|
||||
placeholder="Other dependencies, support for js and css, multiple line breaks"
|
||||
spellcheck="false"
|
||||
></textarea>
|
||||
</div>
|
||||
<div class="code">
|
||||
<div class="codeMirrorWrap"></div>
|
||||
<a class="item" href="./document/">Document</a>
|
||||
<a class="item" href="https://github.com/zhw2590582/ArtPlayer">Github</a>
|
||||
</div>
|
||||
<div class="run">Run Code</div>
|
||||
</header>
|
||||
<div class="libs">
|
||||
<textarea class="libsInput"
|
||||
placeholder="Other dependencies, support for js and css, multiple line breaks"
|
||||
spellcheck="false"></textarea>
|
||||
</div>
|
||||
<div class="part-right">
|
||||
<div class="video-wrap">
|
||||
<div class="artplayer-app"></div>
|
||||
</div>
|
||||
<div class="console"></div>
|
||||
<div class="code">
|
||||
<div class="codeMirrorWrap"></div>
|
||||
</div>
|
||||
</section>
|
||||
<div class="popups">
|
||||
<div class="popinner"></div>
|
||||
</div>
|
||||
<script src="./assets/js/codemirror.js"></script>
|
||||
<script src="./assets/js/javascript.js"></script>
|
||||
<script src="./assets/js/consola.js"></script>
|
||||
<script src="./uncompiled/artplayer.js"></script>
|
||||
<script src="./assets/js/common.js"></script>
|
||||
<script>
|
||||
var _hmt = _hmt || [];
|
||||
(function() {
|
||||
var hm = document.createElement("script");
|
||||
hm.src = "https://hm.baidu.com/hm.js?b6c9b8bafbf5fe7225160101dafbbc7d";
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
<div class="part-right">
|
||||
<div class="video-wrap">
|
||||
<div class="artplayer-app"></div>
|
||||
</div>
|
||||
<div class="console"></div>
|
||||
</div>
|
||||
</section>
|
||||
<div class="popups">
|
||||
<div class="popinner"></div>
|
||||
</div>
|
||||
<script src="./assets/js/codemirror.js"></script>
|
||||
<script src="./assets/js/javascript.js"></script>
|
||||
<script src="./assets/js/consola.js"></script>
|
||||
<script src="./uncompiled/artplayer.js"></script>
|
||||
<script src="./assets/js/common.js"></script>
|
||||
<script>
|
||||
var _hmt = _hmt || [];
|
||||
(function () {
|
||||
if (Artplayer.env !== "\"development\"") {
|
||||
var hm = document.createElement("script");
|
||||
hm.src = "https://hm.baidu.com/hm.js?b6c9b8bafbf5fe7225160101dafbbc7d";
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
}
|
||||
})();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -281,26 +281,8 @@
|
||||
});
|
||||
}
|
||||
|
||||
function getDanmuTopByDiff(danmus) {
|
||||
function calculatedTop(danmus) {
|
||||
var top = 0;
|
||||
var maxDiff = 0;
|
||||
|
||||
for (var index = 1; index < danmus.length; index += 1) {
|
||||
var item = danmus[index];
|
||||
var prev = danmus[index - 1];
|
||||
var prevTop = prev.top + prev.height;
|
||||
var diff = item.top - prevTop;
|
||||
|
||||
if (diff > maxDiff) {
|
||||
top = prevTop;
|
||||
maxDiff = diff;
|
||||
}
|
||||
}
|
||||
|
||||
return top;
|
||||
}
|
||||
|
||||
function getDanmuTopBySparse(danmus) {
|
||||
var topMap = {};
|
||||
|
||||
for (var index = 0; index < danmus.length; index += 1) {
|
||||
@@ -313,48 +295,108 @@
|
||||
}
|
||||
}
|
||||
|
||||
var maxRight = 0;
|
||||
var top = 0;
|
||||
var topMapKeys = Object.keys(topMap);
|
||||
var maxDiff = 0;
|
||||
|
||||
for (var _index = 0; _index < topMapKeys.length; _index += 1) {
|
||||
var minRight = danmus[0].width;
|
||||
var topKey = topMapKeys[_index];
|
||||
var danmuArr = topMap[topKey];
|
||||
for (var _index = 1; _index < danmus.length; _index += 1) {
|
||||
var _item = danmus[_index];
|
||||
var prev = danmus[_index - 1];
|
||||
var prevTop = prev.top + prev.height;
|
||||
var diff = _item.top - prevTop;
|
||||
|
||||
for (var _index2 = 0; _index2 < danmuArr.length; _index2 += 1) {
|
||||
var danmu = danmuArr[_index2];
|
||||
|
||||
if (danmu.right < minRight) {
|
||||
minRight = danmu.right;
|
||||
}
|
||||
}
|
||||
|
||||
if (minRight > maxRight) {
|
||||
maxRight = minRight;
|
||||
|
||||
var _danmuArr = slicedToArray(danmuArr, 1);
|
||||
|
||||
top = _danmuArr[0].top;
|
||||
if (diff > maxDiff) {
|
||||
top = prevTop;
|
||||
maxDiff = diff;
|
||||
}
|
||||
}
|
||||
|
||||
if (top === 0) {
|
||||
var randomKey = Math.floor(Math.random() * (2 - topMapKeys.length) + topMapKeys.length - 1);
|
||||
top = topMapKeys[randomKey];
|
||||
var maxRight = 0;
|
||||
|
||||
for (var _index2 = 0; _index2 < topMapKeys.length; _index2 += 1) {
|
||||
var minRight = danmus[0].width;
|
||||
var topKey = topMapKeys[_index2];
|
||||
var danmuArr = topMap[topKey];
|
||||
|
||||
for (var _index3 = 0; _index3 < danmuArr.length; _index3 += 1) {
|
||||
var danmu = danmuArr[_index3];
|
||||
|
||||
if (danmu.right < minRight) {
|
||||
minRight = danmu.right;
|
||||
}
|
||||
}
|
||||
|
||||
if (minRight > maxRight) {
|
||||
maxRight = minRight;
|
||||
|
||||
var _danmuArr = slicedToArray(danmuArr, 1);
|
||||
|
||||
top = _danmuArr[0].top;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (top === 0) {
|
||||
var _topMapKeys$filter$so = topMapKeys.filter(function (item, index) {
|
||||
return index !== 0 && index !== topMapKeys.length - 1;
|
||||
}).sort(function (prev, next) {
|
||||
return topMap[prev].length - topMap[next].length;
|
||||
});
|
||||
|
||||
var _topMapKeys$filter$so2 = slicedToArray(_topMapKeys$filter$so, 1);
|
||||
|
||||
top = _topMapKeys$filter$so2[0];
|
||||
}
|
||||
|
||||
return top;
|
||||
}
|
||||
|
||||
function getDanmuTop(danmus) {
|
||||
var top = getDanmuTopByDiff(danmus);
|
||||
function getDanmuTop(ins, danmu) {
|
||||
var _ins$option$margin = slicedToArray(ins.option.margin, 2),
|
||||
marginTop = _ins$option$margin[0],
|
||||
marginBottom = _ins$option$margin[1];
|
||||
|
||||
if (top === 0) {
|
||||
top = getDanmuTopBySparse(danmus);
|
||||
var playerData = getRect(ins.art.template.$player);
|
||||
var danmus = ins.queue.filter(function (item) {
|
||||
return item.mode === danmu.mode && item.$state === 'emit' && item.$ref && item.$ref.style.fontSize === danmu.$ref.style.fontSize;
|
||||
}).map(function (item) {
|
||||
var danmuData = getRect(item.$ref);
|
||||
var width = danmuData.width,
|
||||
height = danmuData.height;
|
||||
var top = danmuData.top - playerData.top;
|
||||
var left = danmuData.left - playerData.left;
|
||||
var right = playerData.width - left - width;
|
||||
return {
|
||||
top: top,
|
||||
left: left,
|
||||
height: height,
|
||||
width: width,
|
||||
right: right,
|
||||
item: item
|
||||
};
|
||||
}).sort(function (prev, next) {
|
||||
return prev.top - next.top;
|
||||
});
|
||||
|
||||
if (danmus.length === 0) {
|
||||
return marginTop;
|
||||
}
|
||||
|
||||
return top;
|
||||
danmus.unshift({
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: marginTop,
|
||||
width: playerData.width
|
||||
});
|
||||
danmus.push({
|
||||
top: playerData.height - marginBottom,
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: marginBottom,
|
||||
width: playerData.width
|
||||
});
|
||||
return calculatedTop(danmus);
|
||||
}
|
||||
|
||||
var Danmuku =
|
||||
@@ -371,7 +413,6 @@
|
||||
art.setting.add(speed);
|
||||
this.art = art;
|
||||
this.queue = [];
|
||||
this.refs = [];
|
||||
this.option = {};
|
||||
this.config(option);
|
||||
this.isStop = false;
|
||||
@@ -477,61 +518,6 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "getDanmuTop",
|
||||
value: function getDanmuTop$1(mode) {
|
||||
var $player = this.art.template.$player;
|
||||
|
||||
var _getRect3 = getRect($player),
|
||||
playerLeft = _getRect3.left,
|
||||
playerTop = _getRect3.top,
|
||||
playerHeight = _getRect3.height,
|
||||
playerWidth = _getRect3.width;
|
||||
|
||||
var danmus = this.queue.filter(function (danmu) {
|
||||
return danmu.mode === mode && danmu.$state === 'emit';
|
||||
});
|
||||
|
||||
if (danmus.length === 0) {
|
||||
return this.option.margin[0];
|
||||
}
|
||||
|
||||
var danmusBySort = danmus.map(function (danmu) {
|
||||
var _getRect4 = getRect(danmu.$ref),
|
||||
danmuLeft = _getRect4.left,
|
||||
danmuTop = _getRect4.top,
|
||||
danmuWidth = _getRect4.width,
|
||||
danmuHeight = _getRect4.height;
|
||||
|
||||
var top = danmuTop - playerTop;
|
||||
var left = danmuLeft - playerLeft;
|
||||
var right = playerWidth - left - danmuWidth;
|
||||
return {
|
||||
top: top,
|
||||
left: left,
|
||||
right: right,
|
||||
height: danmuHeight,
|
||||
width: danmuWidth
|
||||
};
|
||||
}).sort(function (prev, next) {
|
||||
return prev.top - next.top;
|
||||
});
|
||||
danmusBySort.unshift({
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: this.option.margin[0],
|
||||
width: playerWidth
|
||||
});
|
||||
danmusBySort.push({
|
||||
top: playerHeight - this.option.margin[1],
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: this.option.margin[1],
|
||||
width: playerWidth
|
||||
});
|
||||
return getDanmuTop(danmusBySort);
|
||||
}
|
||||
}, {
|
||||
key: "update",
|
||||
value: function update() {
|
||||
@@ -560,15 +546,10 @@
|
||||
_this2.queue.filter(function (danmu) {
|
||||
return player.currentTime + 0.1 >= danmu.time && danmu.time >= player.currentTime - 0.1 && danmu.$state === 'wait';
|
||||
}).forEach(function (danmu) {
|
||||
danmu.$state = 'emit';
|
||||
danmu.$ref = getDanmuRef(_this2.queue);
|
||||
|
||||
_this2.$danmuku.appendChild(danmu.$ref);
|
||||
|
||||
if (!_this2.refs.includes(danmu.$ref)) {
|
||||
_this2.refs.push(danmu.$ref);
|
||||
}
|
||||
|
||||
danmu.$ref.style.opacity = _this2.option.opacity;
|
||||
danmu.$ref.style.fontSize = "".concat(_this2.option.fontSize, "px");
|
||||
danmu.$ref.innerText = danmu.text;
|
||||
@@ -577,8 +558,8 @@
|
||||
danmu.$restTime = _this2.option.speed;
|
||||
danmu.$lastStartTime = Date.now();
|
||||
var danmuWidth = getRect(danmu.$ref, 'width');
|
||||
|
||||
var danmuTop = _this2.getDanmuTop(danmu.mode);
|
||||
var danmuTop = getDanmuTop(_this2, danmu);
|
||||
danmu.$state = 'emit';
|
||||
|
||||
switch (danmu.mode) {
|
||||
case 'scroll':
|
||||
@@ -658,7 +639,9 @@
|
||||
danmu.time = player.currentTime;
|
||||
}
|
||||
|
||||
this.queue.push(objectSpread({}, danmu, {
|
||||
this.queue.push(objectSpread({
|
||||
mode: 'scroll'
|
||||
}, danmu, {
|
||||
$state: 'wait',
|
||||
$ref: null,
|
||||
$restTime: 0,
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"artplayer-plugin-danmuku.js","sources":["../../node_modules/@babel/runtime/helpers/defineProperty.js","../../node_modules/@babel/runtime/helpers/objectSpread.js","../../node_modules/@babel/runtime/helpers/classCallCheck.js","../../node_modules/@babel/runtime/helpers/createClass.js","../../packages/artplayer-plugin-danmuku/src/i18n.js","../../packages/artplayer-plugin-danmuku/src/setting.js","../../packages/artplayer-plugin-danmuku/src/utils.js","../../node_modules/@babel/runtime/helpers/arrayWithHoles.js","../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../../node_modules/@babel/runtime/helpers/nonIterableRest.js","../../node_modules/@babel/runtime/helpers/slicedToArray.js","../../packages/artplayer-plugin-danmuku/src/bilibili.js","../../packages/artplayer-plugin-danmuku/src/getDanmuTop.js","../../packages/artplayer-plugin-danmuku/src/danmuku.js","../../packages/artplayer-plugin-danmuku/src/index.js"],"sourcesContent":["function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;","var defineProperty = require(\"./defineProperty\");\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n\n ownKeys.forEach(function (key) {\n defineProperty(target, key, source[key]);\n });\n }\n\n return target;\n}\n\nmodule.exports = _objectSpread;","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","export default {\n 'zh-cn': {\n 'Danmu opacity': '弹幕透明度',\n 'Danmu speed': '弹幕速度',\n 'Danmu size': '弹幕大小',\n 'Danmu text cannot be empty': '弹幕文本不能为空',\n 'The length of the danmu does not exceed': '弹幕文本字数不能超过',\n },\n 'zh-tw': {\n 'Danmu opacity': '彈幕透明度',\n 'Danmu speed': '彈幕速度',\n 'Danmu size': '弹幕大小',\n 'Danmu text cannot be empty': '彈幕文本不能為空',\n 'The length of the danmu does not exceed': '彈幕文本字數不能超過',\n },\n};","export function opacity(art) {\n const {\n i18n,\n events: { proxy },\n } = art;\n\n return {\n name: 'danmuku-opacity',\n index: 30,\n html: `\n <div class=\"art-setting-header\">\n ${i18n.get('Danmu opacity')}: <span class=\"art-value\">100</span>%\n </div>\n <div class=\"art-setting-range\">\n <input type=\"range\" value=\"1\" min=\"0.1\" max=\"1\" step=\"0.1\">\n </div>\n `,\n mounted: $setting => {\n const $range = $setting.querySelector('input[type=range]');\n const $value = $setting.querySelector('.art-value');\n proxy($range, 'change', () => {\n const { value } = $range;\n $value.innerText = Number(value) * 100;\n\n art.plugins.artplayerPluginDanmuku.config({\n opacity: Number(value),\n });\n\n art.on('artplayerPluginDanmuku:config', config => {\n if ($range.value !== config.opacity) {\n $range.value = config.opacity;\n $value.innerText = config.opacity * 100;\n }\n });\n });\n },\n };\n}\n\nexport function size(art) {\n const {\n i18n,\n events: { proxy },\n } = art;\n\n return {\n name: 'danmuku-size',\n index: 50,\n html: `\n <div class=\"art-setting-header\">\n ${i18n.get('Danmu size')}: <span class=\"art-value\">25</span>px\n </Line truncated
|
||||
{"version":3,"file":"artplayer-plugin-danmuku.js","sources":["../../node_modules/@babel/runtime/helpers/defineProperty.js","../../node_modules/@babel/runtime/helpers/objectSpread.js","../../node_modules/@babel/runtime/helpers/classCallCheck.js","../../node_modules/@babel/runtime/helpers/createClass.js","../../packages/artplayer-plugin-danmuku/src/i18n.js","../../packages/artplayer-plugin-danmuku/src/setting.js","../../packages/artplayer-plugin-danmuku/src/utils.js","../../node_modules/@babel/runtime/helpers/arrayWithHoles.js","../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../../node_modules/@babel/runtime/helpers/nonIterableRest.js","../../node_modules/@babel/runtime/helpers/slicedToArray.js","../../packages/artplayer-plugin-danmuku/src/bilibili.js","../../packages/artplayer-plugin-danmuku/src/getDanmuTop.js","../../packages/artplayer-plugin-danmuku/src/danmuku.js","../../packages/artplayer-plugin-danmuku/src/index.js"],"sourcesContent":["function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;","var defineProperty = require(\"./defineProperty\");\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n\n ownKeys.forEach(function (key) {\n defineProperty(target, key, source[key]);\n });\n }\n\n return target;\n}\n\nmodule.exports = _objectSpread;","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","export default {\n 'zh-cn': {\n 'Danmu opacity': '弹幕透明度',\n 'Danmu speed': '弹幕速度',\n 'Danmu size': '弹幕大小',\n 'Danmu text cannot be empty': '弹幕文本不能为空',\n 'The length of the danmu does not exceed': '弹幕文本字数不能超过',\n },\n 'zh-tw': {\n 'Danmu opacity': '彈幕透明度',\n 'Danmu speed': '彈幕速度',\n 'Danmu size': '弹幕大小',\n 'Danmu text cannot be empty': '彈幕文本不能為空',\n 'The length of the danmu does not exceed': '彈幕文本字數不能超過',\n },\n};","export function opacity(art) {\n const {\n i18n,\n events: { proxy },\n } = art;\n\n return {\n name: 'danmuku-opacity',\n index: 30,\n html: `\n <div class=\"art-setting-header\">\n ${i18n.get('Danmu opacity')}: <span class=\"art-value\">100</span>%\n </div>\n <div class=\"art-setting-range\">\n <input type=\"range\" value=\"1\" min=\"0.1\" max=\"1\" step=\"0.1\">\n </div>\n `,\n mounted: $setting => {\n const $range = $setting.querySelector('input[type=range]');\n const $value = $setting.querySelector('.art-value');\n proxy($range, 'change', () => {\n const { value } = $range;\n $value.innerText = Number(value) * 100;\n\n art.plugins.artplayerPluginDanmuku.config({\n opacity: Number(value),\n });\n\n art.on('artplayerPluginDanmuku:config', config => {\n if ($range.value !== config.opacity) {\n $range.value = config.opacity;\n $value.innerText = config.opacity * 100;\n }\n });\n });\n },\n };\n}\n\nexport function size(art) {\n const {\n i18n,\n events: { proxy },\n } = art;\n\n return {\n name: 'danmuku-size',\n index: 50,\n html: `\n <div class=\"art-setting-header\">\n ${i18n.get('Danmu size')}: <span class=\"art-value\">25</span>px\n </Line truncated
|
||||
Reference in new issue
Block a user