mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 19:06:15 -08:00
调整传参方式
This commit is contained in:
1 parent
d0fdab870d
commit
e4668df2db
20 files changed
+127
-163
No files matched your search
@@ -1,11 +1,11 @@
|
||||
.artplayer-video-player .artplayer-video{position:absolute;z-index:10;left:0;top:0;right:0;bottom:0;width:100%;height:100%;background-color:#000;outline:0}
|
||||
.artplayer-video-player{position:relative;width:100%;height:100%;overflow:hidden;outline:0;font-family:Roboto,Arial,Helvetica,sans-serif;color:#eee;text-align:left;direction:ltr;font-size:14px;line-height:1.3;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);touch-action:manipulation;-ms-high-contrast-adjust:none}.artplayer-video-player *{box-sizing:border-box}.artplayer-video-player .art-icon{display:inline-block}.artplayer-video-player .art-icon svg{fill:#fff}
|
||||
.artplayer-video-player .artplayer-subtitle{position:absolute;z-index:20;bottom:40px;width:100%;padding:0 20px;text-align:center;color:#fff;text-shadow:.5px .5px .5px rgba(0,0,0,.5);font-size:20px;pointer-events:none}.artplayer-video-player .artplayer-subtitle p{margin:5px 0}
|
||||
.artplayer-video-player .artplayer-video{position:absolute;z-index:10;left:0;top:0;right:0;bottom:0;width:100%;height:100%;background-color:#000;outline:0}
|
||||
.artplayer-video-player .artplayer-layers{position:absolute;z-index:40;left:0;top:0;right:0;bottom:0;width:100%;height:100%}.artplayer-video-player .artplayer-layers .art-layer{position:absolute}
|
||||
.artplayer-video-player .artplayer-danmu{position:absolute;z-index:30;left:0;top:0;right:0;bottom:0;width:100%;height:100%}
|
||||
.artplayer-video-player .artplayer-mask{display:none;position:absolute;z-index:50;left:0;top:0;right:0;bottom:0;width:100%;height:100%;cursor:pointer}.artplayer-video-player .artplayer-mask .art-icon-playBig{position:absolute;right:30px;bottom:65px;opacity:.6}
|
||||
.artplayer-video-player .artplayer-loading{display:none;position:absolute;z-index:70;left:0;top:0;right:0;bottom:0;width:100%;height:100%;align-items:center;justify-content:center}
|
||||
.artplayer-video-player .artplayer-bottom{position:absolute;z-index:60;left:0;right:0;bottom:0;height:100px;padding:60px 10px 0;opacity:0;visibility:hidden;transition:all .2s ease-in-out;pointer-events:none;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAADGCAYAAAAT+OqFAAAAdklEQVQoz42QQQ7AIAgEF/T/D+kbq/RWAlnQyyazA4aoAB4FsBSA/bFjuF1EOL7VbrIrBuusmrt4ZZORfb6ehbWdnRHEIiITaEUKa5EJqUakRSaEYBJSCY2dEstQY7AuxahwXFrvZmWl2rh4JZ07z9dLtesfNj5q0FU3A5ObbwAAAABJRU5ErkJggg==) repeat-x bottom}.artplayer-video-player .artplayer-bottom .artplayer-progress{position:relative;pointer-events:all}.artplayer-video-player .artplayer-bottom .artplayer-progress .art-control-progress{position:relative;height:5px;padding:1px 0;cursor:pointer}.artplayer-video-player .artplayer-bottom .artplayer-progress .art-control-progress .art-control-progress-inner{position:relative;height:100%;background:hsla(0,0%,100%,.2)}.artplayer-video-player .artplayer-bottom .artplayer-progress .art-control-progress .art-control-progress-inner .art-progress-loaded{position:absolute;z-index:10;left:0;top:0;right:0;bottom:0;height:100%;width:0;background:hsla(0,0%,100%,.4)}.artplayer-video-player .artplayer-bottom .artplayer-progress .art-control-progress .art-control-progress-inner .art-progress-played{position:absolute;z-index:20;left:0;top:0;right:0;bottom:0;height:100%;width:0}.artplayer-video-player .artplayer-bottom .artplayer-progress .art-control-progress .art-control-progress-inner .art-progress-highlight{position:absolute;z-index:30;left:0;top:0;right:0;bottom:0;height:0}.artplayer-video-player .artplayer-bottom .artplayer-progress .art-control-progress .art-control-progress-inner .art-progress-highlight span{display:inline-block;position:absolute;left:0;top:0;width:7px;height:3px;background:#fff;border-radius:3px}.artplayer-video-player .artplayer-bottom .artplayer-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{display:none;position:absolute;z-index:40;top:-5px;left:-6.5px;width:13px;height:13px;border-radius:50%}.artplayer-video-player .artplayer-bottom .artplayer-progress .art-control-progress .art-control-progress-inner .art-progress-indicator.show-indicator{display:block}.artplayer-video-player .artplayer-bottom .artplayer-progress .art-control-progress .art-control-progress-inner .art-progress-tip{display:none;position:absolute;z-index:50;top:-25px;left:0;height:20px;padding:0 5px;line-height:20px;color:#fff;font-size:12px;text-align:center;background:rgba(0,0,0,.7);border-radius:3px;font-weight:700}.artplayer-video-player .artplayer-bottom .artplayer-progress .art-control-progress:hover .art-progress-indicator,.artplayer-video-player .artplayer-bottom .artplayer-progress .art-control-progress:hover .art-progress-tip{display:block}.artplayer-video-player .artplayer-bottom .artplayer-progress .art-control-thumbnails{display:none;position:absolute;bottom:8px;left:0;pointer-events:none;background-color:rgba(0,0,0,.7)}.artplayer-video-player .artplayer-bottom .artplayer-controls{position:relative;pointer-events:all;display:flex;align-items:center;justify-content:space-between;height:36px}.artplayer-video-player .artplayer-bottom .artplayer-controls .art-control{opacity:.9;float:left;font-size:12px;height:36px;cursor:pointer}.artplayer-video-player .artplayer-bottom .artplayer-controls .art-control .art-icon{display:flex;align-items:center;justify-content:center;float:left;height:36px;width:36px;padding:7px}.artplayer-video-player .artplayer-bottom .artplayer-controls .art-control:hover{opacity:1}.artplayer-video-player .artplayer-bottom .artplayer-controls .art-control-volume .art-volume-panel{position:relative;float:left;width:0;height:100%;transition:margin .2s cubic-bezier(.4,0,1,1),width .2s cubic-bezier(.4,0,1,1);overflow:hidden}.artplayer-video-player .artplayer-bottom .artplayer-controls .art-control-volume .art-volume-panel .art-volume-slider-handle{position:absolute;top:50%;left:0;width:12px;height:12px;border-radius:12px;margin-top:-6px;background:#fff}.artplayer-video-player .artplayer-bottom .artplayer-controls .art-control-volume .art-volume-panel .art-volume-slider-handle:before{left:-54px;background:#fff}.artplayer-video-player .artplayer-bottom .artplayer-controls .art-control-volume .art-volume-panel .art-volume-slider-handle:after{left:6px;background:hsla(0,0%,100%,.2)}.artplayer-video-player .artplayer-bottom .artplayer-controls .art-control-volume .art-volume-panel .art-volume-slider-handle:after,.artplayer-video-player .artplayer-bottom .artplayer-controls .art-control-volume .art-volume-panel .art-volume-slider-handle:before{content:"";position:absolute;display:block;top:50%;height:3px;margin-top:-2px;width:60px}.artplayer-video-player .artplayer-bottom .artplayer-controls .art-control-volume .art-volume-panel.art-volume-panel-hover{width:60px}.artplayer-video-player .artplayer-bottom .artplayer-controls .art-control-time{line-height:36px;padding:0 10px}.artplayer-video-playeLine truncated
|
||||
.artplayer-video-player .artplayer-loading{display:none;position:absolute;z-index:70;left:0;top:0;right:0;bottom:0;width:100%;height:100%;align-items:center;justify-content:center;pointer-events:none}
|
||||
.artplayer-video-player .artplayer-notice{display:none;font-size:14px;position:absolute;z-index:80;left:0;top:0;padding:10px;width:100%;pointer-events:none}.artplayer-video-player .artplayer-notice .artplayer-notice-inner{display:inline-block;padding:5px 10px;color:#fff;background:rgba(0,0,0,.6);border-radius:3px}
|
||||
.artplayer-video-player .artplayer-contextmenu{position:absolute;z-index:100;left:0;top:0;min-width:200px;padding:5px 0;background:rgba(0,0,0,.8);border-radius:3px}.artplayer-video-player .artplayer-contextmenu .art-menu{cursor:pointer;font-size:13px;display:block;color:#fff;padding:7px 10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-shadow:0 0 2px rgba(0,0,0,.5);border-bottom:1px solid hsla(0,0%,100%,.1)}.artplayer-video-player .artplayer-contextmenu .art-menu a{color:#fff;text-decoration:none}.artplayer-video-player .artplayer-contextmenu .art-menu span{display:inline-block;padding:0 7px}.artplayer-video-player .artplayer-contextmenu .art-menu span.current,.artplayer-video-player .artplayer-contextmenu .art-menu span:hover{color:#00c9ff}.artplayer-video-player .artplayer-contextmenu .art-menu:hover{background-color:hsla(0,0%,100%,.1)}.artplayer-video-player .artplayer-contextmenu .art-menu:last-child{border-bottom:none}
|
||||
.artplayer-video-player .artplayer-info{display:none;position:absolute;left:10px;top:10px;z-index:100;width:350px;min-height:150px;padding:10px;color:#fff;font-size:12px;font-family:Noto Sans CJK SC DemiLight,Roboto,Segoe UI,Tahoma,Arial,Helvetica,sans-serif;-webkit-font-smoothing:antialiased;background:rgba(0,0,0,.7)}.artplayer-video-player .artplayer-info .art-info-item{display:flex;margin-bottom:5px}.artplayer-video-player .artplayer-info .art-info-item .art-info-title{width:100px;text-align:right}.artplayer-video-player .artplayer-info .art-info-item .art-info-content{flex:1;padding-left:5px}.artplayer-video-player .artplayer-info .artplayer-info-close{position:absolute;top:5px;right:5px;cursor:pointer}
|
||||
|
||||
+68
-89
@@ -1154,7 +1154,7 @@
|
||||
|
||||
var screenshot = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\" style=\"width: 100%; height: 100%\">\n\t<g id=\"surface1\">\n\t\t<path d=\"M 19.402344 6 C 17.019531 6 14.96875 7.679688 14.5 10.011719 L 14.097656 12 L 9 12 C 6.238281 12 4 14.238281 4 17 L 4 38 C 4 40.761719 6.238281 43 9 43 L 41 43 C 43.761719 43 46 40.761719 46 38 L 46 17 C 46 14.238281 43.761719 12 41 12 L 35.902344 12 L 35.5 10.011719 C 35.03125 7.679688 32.980469 6 30.597656 6 Z M 25 17 C 30.519531 17 35 21.480469 35 27 C 35 32.519531 30.519531 37 25 37 C 19.480469 37 15 32.519531 15 27 C 15 21.480469 19.480469 17 25 17 Z M 25 19 C 20.589844 19 17 22.589844 17 27 C 17 31.410156 20.589844 35 25 35 C 29.410156 35 33 31.410156 33 27 C 33 22.589844 29.410156 19 25 19 Z \"/>\n\t</g>\n</svg>\n";
|
||||
|
||||
var danmu = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 60 60\" style=\"width: 85%; height: 85%\">\r\n\t<path d=\"M54,2.5H6c-3.252,0-6,2.748-6,6v33c0,3.252,2.748,6,6,6h14.555l8.702,9.669C29.446,57.38,29.717,57.5,30,57.5 s0.554-0.12,0.743-0.331l8.702-9.669H54c3.252,0,6-2.748,6-6v-33C60,5.248,57.252,2.5,54,2.5z M16,28.5c-2.206,0-4-1.794-4-4 s1.794-4,4-4s4,1.794,4,4S18.206,28.5,16,28.5z M30,28.5c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S32.206,28.5,30,28.5z M44,28.5c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S46.206,28.5,44,28.5z\"/>\r\n</svg>\r\n";
|
||||
var danmu = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 60 60\" style=\"width: 85%; height: 85%\">\n\t<path d=\"M54,2.5H6c-3.252,0-6,2.748-6,6v33c0,3.252,2.748,6,6,6h14.555l8.702,9.669C29.446,57.38,29.717,57.5,30,57.5 s0.554-0.12,0.743-0.331l8.702-9.669H54c3.252,0,6-2.748,6-6v-33C60,5.248,57.252,2.5,54,2.5z M16,28.5c-2.206,0-4-1.794-4-4 s1.794-4,4-4s4,1.794,4,4S18.206,28.5,16,28.5z M30,28.5c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S32.206,28.5,30,28.5z M44,28.5c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S46.206,28.5,44,28.5z\"/>\n</svg>\n";
|
||||
|
||||
var setting = "<svg xmlns=\"http://www.w3.org/2000/svg\" style=\"width: 100%; height: 100%\" viewBox=\"0 0 22 22\">\n <circle cx=\"11\" cy=\"11\" r=\"2\"></circle>\n <path d=\"M19.164 8.861L17.6 8.6a6.978 6.978 0 0 0-1.186-2.099l.574-1.533a1 1 0 0 0-.436-1.217l-1.997-1.153a1.001 1.001 0 0 0-1.272.23l-1.008 1.225a7.04 7.04 0 0 0-2.55.001L8.716 2.829a1 1 0 0 0-1.272-.23L5.447 3.751a1 1 0 0 0-.436 1.217l.574 1.533A6.997 6.997 0 0 0 4.4 8.6l-1.564.261A.999.999 0 0 0 2 9.847v2.306c0 .489.353.906.836.986l1.613.269a7 7 0 0 0 1.228 2.075l-.558 1.487a1 1 0 0 0 .436 1.217l1.997 1.153c.423.244.961.147 1.272-.23l1.04-1.263a7.089 7.089 0 0 0 2.272 0l1.04 1.263a1 1 0 0 0 1.272.23l1.997-1.153a1 1 0 0 0 .436-1.217l-.557-1.487c.521-.61.94-1.31 1.228-2.075l1.613-.269a.999.999 0 0 0 .835-.986V9.847a.999.999 0 0 0-.836-.986zM11 15a4 4 0 1 1 0-8 4 4 0 0 1 0 8z\"></path>\n</svg>";
|
||||
|
||||
@@ -1197,10 +1197,9 @@
|
||||
|
||||
createClass(Danmu, [{
|
||||
key: "apply",
|
||||
value: function apply(art) {
|
||||
value: function apply(art, $control) {
|
||||
var _this = this;
|
||||
|
||||
var $control = this.option.$control;
|
||||
var proxy = art.events.proxy,
|
||||
i18n = art.i18n,
|
||||
danmu = art.danmu;
|
||||
@@ -1234,7 +1233,7 @@
|
||||
|
||||
createClass(Fullscreen, [{
|
||||
key: "apply",
|
||||
value: function apply(art) {
|
||||
value: function apply(art, $control) {
|
||||
this.art = art;
|
||||
}
|
||||
}]);
|
||||
@@ -1253,7 +1252,7 @@
|
||||
|
||||
createClass(FullscreenWeb, [{
|
||||
key: "apply",
|
||||
value: function apply(art) {
|
||||
value: function apply(art, $control) {
|
||||
this.art = art;
|
||||
}
|
||||
}]);
|
||||
@@ -1272,7 +1271,7 @@
|
||||
|
||||
createClass(Pip, [{
|
||||
key: "apply",
|
||||
value: function apply(art) {
|
||||
value: function apply(art, $control) {
|
||||
this.art = art;
|
||||
}
|
||||
}]);
|
||||
@@ -1291,14 +1290,14 @@
|
||||
|
||||
createClass(PlayAndPause, [{
|
||||
key: "apply",
|
||||
value: function apply(art) {
|
||||
value: function apply(art, $control) {
|
||||
var _this = this;
|
||||
|
||||
var proxy = art.events.proxy,
|
||||
player = art.player,
|
||||
i18n = art.i18n;
|
||||
this.$play = append(this.option.$control, icons$1.play);
|
||||
this.$pause = append(this.option.$control, icons$1.pause);
|
||||
this.$play = append($control, icons$1.play);
|
||||
this.$pause = append($control, icons$1.pause);
|
||||
tooltip(this.$play, i18n.get('Play'));
|
||||
tooltip(this.$pause, i18n.get('Pause'));
|
||||
setStyle(this.$pause, 'display', 'none');
|
||||
@@ -1337,28 +1336,23 @@
|
||||
|
||||
createClass(Progress, [{
|
||||
key: "apply",
|
||||
value: function apply(art) {
|
||||
this.art = art;
|
||||
this.init();
|
||||
}
|
||||
}, {
|
||||
key: "init",
|
||||
value: function init() {
|
||||
value: function apply(art, $control) {
|
||||
var _this = this;
|
||||
|
||||
var _this$art = this.art,
|
||||
_this$art$option = _this$art.option,
|
||||
highlight = _this$art$option.highlight,
|
||||
theme = _this$art$option.theme,
|
||||
proxy = _this$art.events.proxy,
|
||||
$video = _this$art.refs.$video,
|
||||
player = _this$art.player;
|
||||
append(this.option.$control, "\n <div class=\"art-control-progress-inner\">\n <div class=\"art-progress-loaded\"></div>\n <div class=\"art-progress-played\" style=\"background: ".concat(theme, "\"></div>\n <div class=\"art-progress-highlight\"></div>\n <div class=\"art-progress-indicator\" style=\"background: ").concat(theme, "\"></div>\n <div class=\"art-progress-tip art-tip\"></div>\n </div>\n "));
|
||||
this.$loaded = this.option.$control.querySelector('.art-progress-loaded');
|
||||
this.$played = this.option.$control.querySelector('.art-progress-played');
|
||||
this.$highlight = this.option.$control.querySelector('.art-progress-highlight');
|
||||
this.$indicator = this.option.$control.querySelector('.art-progress-indicator');
|
||||
this.$tip = this.option.$control.querySelector('.art-progress-tip');
|
||||
this.art = art;
|
||||
this.$control = $control;
|
||||
var _art$option = art.option,
|
||||
highlight = _art$option.highlight,
|
||||
theme = _art$option.theme,
|
||||
proxy = art.events.proxy,
|
||||
$video = art.refs.$video,
|
||||
player = art.player;
|
||||
append($control, "\n <div class=\"art-control-progress-inner\">\n <div class=\"art-progress-loaded\"></div>\n <div class=\"art-progress-played\" style=\"background: ".concat(theme, "\"></div>\n <div class=\"art-progress-highlight\"></div>\n <div class=\"art-progress-indicator\" style=\"background: ").concat(theme, "\"></div>\n <div class=\"art-progress-tip art-tip\"></div>\n </div>\n "));
|
||||
this.$loaded = $control.querySelector('.art-progress-loaded');
|
||||
this.$played = $control.querySelector('.art-progress-played');
|
||||
this.$highlight = $control.querySelector('.art-progress-highlight');
|
||||
this.$indicator = $control.querySelector('.art-progress-indicator');
|
||||
this.$tip = $control.querySelector('.art-progress-tip');
|
||||
this.set('loaded', this.getLoaded());
|
||||
highlight.forEach(function (item) {
|
||||
var left = Number(item.time) / $video.duration;
|
||||
@@ -1373,7 +1367,7 @@
|
||||
this.art.on('video:ended', function () {
|
||||
_this.set('played', 1);
|
||||
});
|
||||
proxy(this.option.$control, 'mousemove', function (event) {
|
||||
proxy($control, 'mousemove', function (event) {
|
||||
setStyle(_this.$tip, 'display', 'block');
|
||||
|
||||
if (event.path.indexOf(_this.$highlight) > -1) {
|
||||
@@ -1382,10 +1376,10 @@
|
||||
_this.showTime(event);
|
||||
}
|
||||
});
|
||||
proxy(this.option.$control, 'mouseout', function () {
|
||||
proxy($control, 'mouseout', function () {
|
||||
setStyle(_this.$tip, 'display', 'none');
|
||||
});
|
||||
proxy(this.option.$control, 'click', function (event) {
|
||||
proxy($control, 'click', function (event) {
|
||||
if (event.target !== _this.$indicator) {
|
||||
var _this$getPosFromEvent = _this.getPosFromEvent(event),
|
||||
second = _this$getPosFromEvent.second,
|
||||
@@ -1428,7 +1422,7 @@
|
||||
text = _event$target$dataset.text,
|
||||
time = _event$target$dataset.time;
|
||||
this.$tip.innerHTML = text;
|
||||
var left = Number(time) / $video.duration * this.option.$control.clientWidth + event.target.clientWidth / 2 - this.$tip.clientWidth / 2;
|
||||
var left = Number(time) / $video.duration * this.$control.clientWidth + event.target.clientWidth / 2 - this.$tip.clientWidth / 2;
|
||||
setStyle(this.$tip, 'left', "".concat(left, "px"));
|
||||
}
|
||||
}, {
|
||||
@@ -1443,8 +1437,8 @@
|
||||
|
||||
if (width <= tipWidth / 2) {
|
||||
setStyle(this.$tip, 'left', 0);
|
||||
} else if (width > this.option.$control.clientWidth - tipWidth / 2) {
|
||||
setStyle(this.$tip, 'left', "".concat(this.option.$control.clientWidth - tipWidth, "px"));
|
||||
} else if (width > this.$control.clientWidth - tipWidth / 2) {
|
||||
setStyle(this.$tip, 'left', "".concat(this.$control.clientWidth - tipWidth, "px"));
|
||||
} else {
|
||||
setStyle(this.$tip, 'left', "".concat(width - tipWidth / 2, "px"));
|
||||
}
|
||||
@@ -1507,10 +1501,9 @@
|
||||
|
||||
createClass(Subtitle, [{
|
||||
key: "apply",
|
||||
value: function apply(art) {
|
||||
value: function apply(art, $control) {
|
||||
var _this = this;
|
||||
|
||||
var $control = this.option.$control;
|
||||
var proxy = art.events.proxy,
|
||||
i18n = art.i18n,
|
||||
subtitle = art.subtitle;
|
||||
@@ -1544,24 +1537,19 @@
|
||||
|
||||
createClass(Time, [{
|
||||
key: "apply",
|
||||
value: function apply(art) {
|
||||
this.art = art;
|
||||
this.init();
|
||||
}
|
||||
}, {
|
||||
key: "init",
|
||||
value: function init() {
|
||||
value: function apply(art, $control) {
|
||||
var _this = this;
|
||||
|
||||
this.option.$control.innerHTML = '00:00 / 00:00';
|
||||
this.art = art;
|
||||
$control.innerHTML = '00:00 / 00:00';
|
||||
this.art.on('video:canplay', function () {
|
||||
_this.option.$control.innerHTML = _this.getTime();
|
||||
$control.innerHTML = _this.getTime();
|
||||
});
|
||||
this.art.on('video:timeupdate', function () {
|
||||
_this.option.$control.innerHTML = _this.getTime();
|
||||
$control.innerHTML = _this.getTime();
|
||||
});
|
||||
this.art.on('video:seeking', function () {
|
||||
_this.option.$control.innerHTML = _this.getTime();
|
||||
$control.innerHTML = _this.getTime();
|
||||
});
|
||||
}
|
||||
}, {
|
||||
@@ -1587,8 +1575,9 @@
|
||||
|
||||
createClass(Volume, [{
|
||||
key: "apply",
|
||||
value: function apply(art) {
|
||||
value: function apply(art, $control) {
|
||||
this.art = art;
|
||||
this.$control = $control;
|
||||
this.init();
|
||||
}
|
||||
}, {
|
||||
@@ -1600,9 +1589,9 @@
|
||||
proxy = _this$art.events.proxy,
|
||||
player = _this$art.player,
|
||||
i18n = _this$art.i18n;
|
||||
this.$volume = append(this.option.$control, icons$1.volume);
|
||||
this.$volumeClose = append(this.option.$control, icons$1.volumeClose);
|
||||
this.$volumePanel = append(this.option.$control, '<div class="art-volume-panel"></div>');
|
||||
this.$volume = append(this.$control, icons$1.volume);
|
||||
this.$volumeClose = append(this.$control, icons$1.volumeClose);
|
||||
this.$volumePanel = append(this.$control, '<div class="art-volume-panel"></div>');
|
||||
this.$volumeHandle = append(this.$volumePanel, '<div class="art-volume-slider-handle"></div>');
|
||||
tooltip(this.$volume, i18n.get('Mute'));
|
||||
setStyle(this.$volumeClose, 'display', 'none');
|
||||
@@ -1619,7 +1608,7 @@
|
||||
setStyle(_this.$volumeClose, 'display', 'none');
|
||||
player.volume(getStorage('volume'));
|
||||
});
|
||||
proxy(this.option.$control, 'mouseenter', function () {
|
||||
proxy(this.$control, 'mouseenter', function () {
|
||||
_this.$volumePanel.classList.add('art-volume-panel-hover'); // TODO
|
||||
|
||||
|
||||
@@ -1627,7 +1616,7 @@
|
||||
_this.setVolumeHandle(player.volume());
|
||||
}, 200);
|
||||
});
|
||||
proxy(this.option.$control, 'mouseleave', function () {
|
||||
proxy(this.$control, 'mouseleave', function () {
|
||||
_this.$volumePanel.classList.remove('art-volume-panel-hover');
|
||||
});
|
||||
proxy(this.$volumePanel, 'click', function (event) {
|
||||
@@ -1705,10 +1694,9 @@
|
||||
|
||||
createClass(Setting, [{
|
||||
key: "apply",
|
||||
value: function apply(art) {
|
||||
value: function apply(art, $control) {
|
||||
var _this = this;
|
||||
|
||||
var $control = this.option.$control;
|
||||
var proxy = art.events.proxy,
|
||||
i18n = art.i18n,
|
||||
setting = art.setting;
|
||||
@@ -1744,19 +1732,14 @@
|
||||
|
||||
createClass(Thumbnails, [{
|
||||
key: "apply",
|
||||
value: function apply(art) {
|
||||
this.art = art;
|
||||
errorHandle(this.art.controls.progress, '\'thumbnails\' control dependent on \'progress\' control');
|
||||
this.init();
|
||||
}
|
||||
}, {
|
||||
key: "init",
|
||||
value: function init() {
|
||||
value: function apply(art, $control) {
|
||||
var _this = this;
|
||||
|
||||
var _this$art = this.art,
|
||||
$progress = _this$art.refs.$progress,
|
||||
proxy = _this$art.events.proxy;
|
||||
this.art = art;
|
||||
errorHandle(art.controls.progress, '\'thumbnails\' control dependent on \'progress\' control');
|
||||
var $progress = art.refs.$progress,
|
||||
proxy = art.events.proxy;
|
||||
this.$control = $control;
|
||||
proxy($progress, 'mousemove', function (event) {
|
||||
if (!_this.loading) {
|
||||
_this.loading = true;
|
||||
@@ -1767,13 +1750,13 @@
|
||||
}
|
||||
|
||||
if (_this.isLoad) {
|
||||
setStyle(_this.option.$control, 'display', 'block');
|
||||
setStyle($control, 'display', 'block');
|
||||
|
||||
_this.showThumbnails(event);
|
||||
}
|
||||
});
|
||||
proxy($progress, 'mouseout', function () {
|
||||
setStyle(_this.option.$control, 'display', 'none');
|
||||
setStyle($control, 'display', 'none');
|
||||
});
|
||||
}
|
||||
}, {
|
||||
@@ -1799,9 +1782,9 @@
|
||||
}, {
|
||||
key: "showThumbnails",
|
||||
value: function showThumbnails(event) {
|
||||
var _this$art2 = this.art,
|
||||
$progress = _this$art2.refs.$progress,
|
||||
controls = _this$art2.controls;
|
||||
var _this$art = this.art,
|
||||
$progress = _this$art.refs.$progress,
|
||||
controls = _this$art.controls;
|
||||
|
||||
var _controls$progress$ge = controls.progress.getPosFromEvent(event),
|
||||
posWidth = _controls$progress$ge.width;
|
||||
@@ -1816,17 +1799,17 @@
|
||||
var perIndex = Math.ceil(posWidth / perWidth);
|
||||
var yIndex = Math.ceil(perIndex / column);
|
||||
var xIndex = perIndex % column || column;
|
||||
setStyle(this.option.$control, 'backgroundImage', "url(".concat(url, ")"));
|
||||
setStyle(this.option.$control, 'height', "".concat(height, "px"));
|
||||
setStyle(this.option.$control, 'width', "".concat(width, "px"));
|
||||
setStyle(this.option.$control, 'backgroundPosition', "-".concat(--xIndex * width, "px -").concat(--yIndex * height, "px"));
|
||||
setStyle(this.$control, 'backgroundImage', "url(".concat(url, ")"));
|
||||
setStyle(this.$control, 'height', "".concat(height, "px"));
|
||||
setStyle(this.$control, 'width', "".concat(width, "px"));
|
||||
setStyle(this.$control, 'backgroundPosition', "-".concat(--xIndex * width, "px -").concat(--yIndex * height, "px"));
|
||||
|
||||
if (posWidth <= width / 2) {
|
||||
setStyle(this.option.$control, 'left', 0);
|
||||
setStyle(this.$control, 'left', 0);
|
||||
} else if (posWidth > $progress.clientWidth - width / 2) {
|
||||
setStyle(this.option.$control, 'left', "".concat($progress.clientWidth - width, "px"));
|
||||
setStyle(this.$control, 'left', "".concat($progress.clientWidth - width, "px"));
|
||||
} else {
|
||||
setStyle(this.option.$control, 'left', "".concat(posWidth - width / 2, "px"));
|
||||
setStyle(this.$control, 'left', "".concat(posWidth - width / 2, "px"));
|
||||
}
|
||||
}
|
||||
}]);
|
||||
@@ -1845,7 +1828,7 @@
|
||||
|
||||
createClass(Screenshot, [{
|
||||
key: "apply",
|
||||
value: function apply(art) {
|
||||
value: function apply(art, $control) {
|
||||
var _this = this;
|
||||
|
||||
this.art = art;
|
||||
@@ -1853,7 +1836,7 @@
|
||||
proxy = _this$art.events.proxy,
|
||||
i18n = _this$art.i18n,
|
||||
notice = _this$art.notice;
|
||||
this.$screenshot = append(this.option.$control, icons$1.screenshot);
|
||||
this.$screenshot = append($control, icons$1.screenshot);
|
||||
tooltip(this.$screenshot, i18n.get('Screenshot'));
|
||||
proxy(this.$screenshot, 'click', function () {
|
||||
try {
|
||||
@@ -1897,10 +1880,9 @@
|
||||
|
||||
createClass(Quality, [{
|
||||
key: "apply",
|
||||
value: function apply(art) {
|
||||
value: function apply(art, $control) {
|
||||
var _this = this;
|
||||
|
||||
var $control = this.option.$control;
|
||||
var option = art.option,
|
||||
_art$events = art.events,
|
||||
proxy = _art$events.proxy,
|
||||
@@ -2055,10 +2037,9 @@
|
||||
var $control = document.createElement('div');
|
||||
$control.setAttribute('class', "art-control art-control-".concat(name));
|
||||
$control.dataset.controlIndex = option.index || id;
|
||||
option.$control = $control;
|
||||
this.commonMethod(control);
|
||||
(this.$map[option.position] || (this.$map[option.position] = [])).push($control);
|
||||
control.apply && control.apply(this.art);
|
||||
control.apply && control.apply(this.art, $control);
|
||||
this[name] = control;
|
||||
}
|
||||
}
|
||||
@@ -2970,9 +2951,8 @@
|
||||
|
||||
createClass(Common, [{
|
||||
key: "apply",
|
||||
value: function apply(art) {
|
||||
value: function apply(art, $setting) {
|
||||
this.art = art;
|
||||
var $setting = this.option.$setting;
|
||||
this.$header = $setting.querySelector('.art-setting-header');
|
||||
this.$body = $setting.querySelector('.art-setting-body');
|
||||
append(this.$body, '———— 先占坑,暂无设置 ————');
|
||||
@@ -3032,9 +3012,8 @@
|
||||
$setting.dataset.settingIndex = option.index || id$3;
|
||||
append($setting, "<div class=\"art-setting-header\">".concat(this.art.i18n.get(title), "</div>"));
|
||||
append($setting, '<div class="art-setting-body"></div>');
|
||||
option.$setting = $setting;
|
||||
this.$settings.push($setting);
|
||||
setting.apply && setting.apply(this.art);
|
||||
setting.apply && setting.apply(this.art, $setting);
|
||||
this[name] = setting;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"artplayer.js","sources":["../../node_modules/@babel/runtime/helpers/setPrototypeOf.js","../../node_modules/@babel/runtime/helpers/construct.js","../../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js","../../node_modules/@babel/runtime/helpers/iterableToArray.js","../../node_modules/@babel/runtime/helpers/nonIterableSpread.js","../../node_modules/@babel/runtime/helpers/toConsumableArray.js","../../node_modules/@babel/runtime/helpers/classCallCheck.js","../../node_modules/@babel/runtime/helpers/createClass.js","../../node_modules/@babel/runtime/helpers/typeof.js","../../node_modules/@babel/runtime/helpers/assertThisInitialized.js","../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","../../node_modules/@babel/runtime/helpers/getPrototypeOf.js","../../node_modules/@babel/runtime/helpers/inherits.js","../../node_modules/@babel/runtime/helpers/defineProperty.js","../../node_modules/@babel/runtime/helpers/objectSpread.js","../../node_modules/@babel/runtime/helpers/isNativeFunction.js","../../node_modules/@babel/runtime/helpers/wrapNativeSuper.js","../../src/utils/index.js","../../node_modules/option-validator/dist/option-validator.js","../../src/scheme/validElement.js","../../src/scheme/index.js","../../src/config/mimeCodec.js","../../src/config/mse.js","../../src/config/video.js","../../src/config/index.js","../../node_modules/tiny-emitter/index.js","../../src/template.js","../../src/i18n.js","../../src/player.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","../../src/icons/index.js","../../src/controls/danmu.js","../../src/controls/fullscreen.js","../../src/controls/fullscreen-web.js","../../src/controls/pip.js","../../src/controls/playAndPause.js","../../src/controls/progress.js","../../src/controls/subtitle.js","../../src/controls/time.js","../../src/controls/volume.js","../../src/controls/setting.js","../../src/controls/thumbnails.js","../../src/controls/screenshot.js","../../src/controls/quality.js","../../src/controls/index.js","../../src/contextmenu/playbackRate.js","../../src/contextmenu/aspectRatio.js","../../src/contextmenu/info.js","../../src/contextmenu/version.js","../../src/contextmenu/close.js","../../src/contextmenu/index.js","../../src/danmu.js","../../src/info.js","../../src/subtitle.js","../../src/events.js","../../src/hotkey.js","../../src/layers.js","../../src/loading.js","../../src/notice.js","../../src/mask.js","../../src/setting/common.js","../../src/setting/index.js","../../src/index.js"],"sourcesContent":["function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nfunction isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _construct(Parent, args, Class) {\n if (isNativeReflectConstruct()) {\n module.exports = _construct = Reflect.construct;\n } else {\n module.exports = _construct = function _construct(Parent, args, Class) {\n var a = [null];\n a.push.apply(a, args);\n var Constructor = Function.bind.apply(Parent, a);\n var instance = new Constructor();\n if (Class) setPrototypeOf(instance, Class.prototype);\n return instance;\n };\n }\n\n return _construct.apply(null, arguments);\n}\n\nmodule.exports = _construct;","function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n }\n}\n\nmodule.exports = _arrayWithoutHoles;","function _iterableToArray(iter) {\n if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter);\n}\n\nmodule.exports = _iterableToArray;","function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance\");\n}\n\nmodule.exports = _nonIterableSpread;","var arrayWithoutHoles = require(\"./arrayWithoutHoles\");\n\nvar iterableToArray = require(\"./iterableToArray\");\n\nvar nonIterableSpread = require(\"./nonIterableSpread\");\n\nfunction _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread();\n}\n\nmodule.exports = _toConsumableArray;","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n Line truncated
|
||||
{"version":3,"file":"artplayer.js","sources":["../../node_modules/@babel/runtime/helpers/setPrototypeOf.js","../../node_modules/@babel/runtime/helpers/construct.js","../../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js","../../node_modules/@babel/runtime/helpers/iterableToArray.js","../../node_modules/@babel/runtime/helpers/nonIterableSpread.js","../../node_modules/@babel/runtime/helpers/toConsumableArray.js","../../node_modules/@babel/runtime/helpers/classCallCheck.js","../../node_modules/@babel/runtime/helpers/createClass.js","../../node_modules/@babel/runtime/helpers/typeof.js","../../node_modules/@babel/runtime/helpers/assertThisInitialized.js","../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","../../node_modules/@babel/runtime/helpers/getPrototypeOf.js","../../node_modules/@babel/runtime/helpers/inherits.js","../../node_modules/@babel/runtime/helpers/defineProperty.js","../../node_modules/@babel/runtime/helpers/objectSpread.js","../../node_modules/@babel/runtime/helpers/isNativeFunction.js","../../node_modules/@babel/runtime/helpers/wrapNativeSuper.js","../../src/utils/index.js","../../node_modules/option-validator/dist/option-validator.js","../../src/scheme/validElement.js","../../src/scheme/index.js","../../src/config/mimeCodec.js","../../src/config/mse.js","../../src/config/video.js","../../src/config/index.js","../../node_modules/tiny-emitter/index.js","../../src/template.js","../../src/i18n.js","../../src/player.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","../../src/icons/index.js","../../src/controls/danmu.js","../../src/controls/fullscreen.js","../../src/controls/fullscreen-web.js","../../src/controls/pip.js","../../src/controls/playAndPause.js","../../src/controls/progress.js","../../src/controls/subtitle.js","../../src/controls/time.js","../../src/controls/volume.js","../../src/controls/setting.js","../../src/controls/thumbnails.js","../../src/controls/screenshot.js","../../src/controls/quality.js","../../src/controls/index.js","../../src/contextmenu/playbackRate.js","../../src/contextmenu/aspectRatio.js","../../src/contextmenu/info.js","../../src/contextmenu/version.js","../../src/contextmenu/close.js","../../src/contextmenu/index.js","../../src/danmu.js","../../src/info.js","../../src/subtitle.js","../../src/events.js","../../src/hotkey.js","../../src/layers.js","../../src/loading.js","../../src/notice.js","../../src/mask.js","../../src/setting/common.js","../../src/setting/index.js","../../src/index.js"],"sourcesContent":["function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nfunction isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _construct(Parent, args, Class) {\n if (isNativeReflectConstruct()) {\n module.exports = _construct = Reflect.construct;\n } else {\n module.exports = _construct = function _construct(Parent, args, Class) {\n var a = [null];\n a.push.apply(a, args);\n var Constructor = Function.bind.apply(Parent, a);\n var instance = new Constructor();\n if (Class) setPrototypeOf(instance, Class.prototype);\n return instance;\n };\n }\n\n return _construct.apply(null, arguments);\n}\n\nmodule.exports = _construct;","function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n }\n}\n\nmodule.exports = _arrayWithoutHoles;","function _iterableToArray(iter) {\n if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter);\n}\n\nmodule.exports = _iterableToArray;","function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance\");\n}\n\nmodule.exports = _nonIterableSpread;","var arrayWithoutHoles = require(\"./arrayWithoutHoles\");\n\nvar iterableToArray = require(\"./iterableToArray\");\n\nvar nonIterableSpread = require(\"./nonIterableSpread\");\n\nfunction _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread();\n}\n\nmodule.exports = _toConsumableArray;","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n Line truncated
|
||||
@@ -6,8 +6,7 @@ export default class Danmu {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
apply(art) {
|
||||
const { $control } = this.option;
|
||||
apply(art, $control) {
|
||||
const { events: { proxy }, i18n, danmu } = art;
|
||||
this.$danmu = append($control, icons.danmu);
|
||||
tooltip(this.$danmu, i18n.get('Hide danmu'));
|
||||
|
||||
@@ -3,7 +3,7 @@ export default class FullscreenWeb {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
apply(art) {
|
||||
apply(art, $control) {
|
||||
this.art = art;
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ export default class Fullscreen {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
apply(art) {
|
||||
apply(art, $control) {
|
||||
this.art = art;
|
||||
}
|
||||
}
|
||||
@@ -129,10 +129,9 @@ export default class Controls {
|
||||
const $control = document.createElement('div');
|
||||
$control.setAttribute('class', `art-control art-control-${name}`);
|
||||
$control.dataset.controlIndex = option.index || id;
|
||||
option.$control = $control;
|
||||
this.commonMethod(control);
|
||||
(this.$map[option.position] || (this.$map[option.position] = [])).push($control);
|
||||
control.apply && control.apply(this.art);
|
||||
control.apply && control.apply(this.art, $control);
|
||||
this[name] = control;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ export default class Pip {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
apply(art) {
|
||||
apply(art, $control) {
|
||||
this.art = art;
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,10 @@ export default class PlayAndPause {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
apply(art) {
|
||||
apply(art, $control) {
|
||||
const { events: { proxy }, player, i18n } = art;
|
||||
this.$play = append(this.option.$control, icons.play);
|
||||
this.$pause = append(this.option.$control, icons.pause);
|
||||
this.$play = append($control, icons.play);
|
||||
this.$pause = append($control, icons.pause);
|
||||
tooltip(this.$play, i18n.get('Play'));
|
||||
tooltip(this.$pause, i18n.get('Pause'));
|
||||
setStyle(this.$pause, 'display', 'none');
|
||||
|
||||
+15
-18
@@ -9,16 +9,13 @@ export default class Progress {
|
||||
this.set = this.set.bind(this);
|
||||
}
|
||||
|
||||
apply(art) {
|
||||
apply(art, $control) {
|
||||
this.art = art;
|
||||
this.init();
|
||||
}
|
||||
|
||||
init() {
|
||||
const { option: { highlight, theme }, events: { proxy }, refs: { $video }, player } = this.art;
|
||||
this.$control = $control;
|
||||
const { option: { highlight, theme }, events: { proxy }, refs: { $video }, player } = art;
|
||||
|
||||
append(
|
||||
this.option.$control,
|
||||
$control,
|
||||
`
|
||||
<div class="art-control-progress-inner">
|
||||
<div class="art-progress-loaded"></div>
|
||||
@@ -30,11 +27,11 @@ export default class Progress {
|
||||
`
|
||||
);
|
||||
|
||||
this.$loaded = this.option.$control.querySelector('.art-progress-loaded');
|
||||
this.$played = this.option.$control.querySelector('.art-progress-played');
|
||||
this.$highlight = this.option.$control.querySelector('.art-progress-highlight');
|
||||
this.$indicator = this.option.$control.querySelector('.art-progress-indicator');
|
||||
this.$tip = this.option.$control.querySelector('.art-progress-tip');
|
||||
this.$loaded = $control.querySelector('.art-progress-loaded');
|
||||
this.$played = $control.querySelector('.art-progress-played');
|
||||
this.$highlight = $control.querySelector('.art-progress-highlight');
|
||||
this.$indicator = $control.querySelector('.art-progress-indicator');
|
||||
this.$tip = $control.querySelector('.art-progress-tip');
|
||||
|
||||
this.set('loaded', this.getLoaded());
|
||||
highlight.forEach(item => {
|
||||
@@ -57,7 +54,7 @@ export default class Progress {
|
||||
this.set('played', 1);
|
||||
});
|
||||
|
||||
proxy(this.option.$control, 'mousemove', event => {
|
||||
proxy($control, 'mousemove', event => {
|
||||
setStyle(this.$tip, 'display', 'block');
|
||||
if (event.path.indexOf(this.$highlight) > -1) {
|
||||
this.showHighlight(event);
|
||||
@@ -66,11 +63,11 @@ export default class Progress {
|
||||
}
|
||||
});
|
||||
|
||||
proxy(this.option.$control, 'mouseout', () => {
|
||||
proxy($control, 'mouseout', () => {
|
||||
setStyle(this.$tip, 'display', 'none');
|
||||
});
|
||||
|
||||
proxy(this.option.$control, 'click', event => {
|
||||
proxy($control, 'click', event => {
|
||||
if (event.target !== this.$indicator) {
|
||||
const { second, percentage } = this.getPosFromEvent(event);
|
||||
this.set('played', percentage);
|
||||
@@ -104,7 +101,7 @@ export default class Progress {
|
||||
const { text, time } = event.target.dataset;
|
||||
this.$tip.innerHTML = text;
|
||||
const left =
|
||||
Number(time) / $video.duration * this.option.$control.clientWidth +
|
||||
Number(time) / $video.duration * this.$control.clientWidth +
|
||||
event.target.clientWidth / 2 -
|
||||
this.$tip.clientWidth / 2;
|
||||
setStyle(this.$tip, 'left', `${left}px`);
|
||||
@@ -116,8 +113,8 @@ export default class Progress {
|
||||
this.$tip.innerHTML = time;
|
||||
if (width <= tipWidth / 2) {
|
||||
setStyle(this.$tip, 'left', 0);
|
||||
} else if (width > this.option.$control.clientWidth - tipWidth / 2) {
|
||||
setStyle(this.$tip, 'left', `${this.option.$control.clientWidth - tipWidth}px`);
|
||||
} else if (width > this.$control.clientWidth - tipWidth / 2) {
|
||||
setStyle(this.$tip, 'left', `${this.$control.clientWidth - tipWidth}px`);
|
||||
} else {
|
||||
setStyle(this.$tip, 'left', `${width - tipWidth / 2}px`);
|
||||
}
|
||||
|
||||
@@ -6,8 +6,7 @@ export default class Quality {
|
||||
this.playIndex = -1;
|
||||
}
|
||||
|
||||
apply(art) {
|
||||
const { $control } = this.option;
|
||||
apply(art, $control) {
|
||||
const { option, events: { proxy, hover }, player } = art;
|
||||
const defaultQuality = option.quality.find(item => item.default) || option.quality[0];
|
||||
this.playIndex = option.quality.indexOf(defaultQuality);
|
||||
|
||||
@@ -6,10 +6,10 @@ export default class Screenshot {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
apply(art) {
|
||||
apply(art, $control) {
|
||||
this.art = art;
|
||||
const { events: { proxy }, i18n, notice } = this.art;
|
||||
this.$screenshot = append(this.option.$control, icons.screenshot);
|
||||
this.$screenshot = append($control, icons.screenshot);
|
||||
tooltip(this.$screenshot, i18n.get('Screenshot'));
|
||||
proxy(this.$screenshot, 'click', () => {
|
||||
try {
|
||||
|
||||
@@ -6,8 +6,7 @@ export default class Setting {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
apply(art) {
|
||||
const { $control } = this.option;
|
||||
apply(art, $control) {
|
||||
const { events: { proxy }, i18n, setting } = art;
|
||||
this.$setting = append($control, icons.setting);
|
||||
tooltip(this.$setting, i18n.get('Show setting'));
|
||||
|
||||
@@ -6,8 +6,7 @@ export default class Subtitle {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
apply(art) {
|
||||
const { $control } = this.option;
|
||||
apply(art, $control) {
|
||||
const { events: { proxy }, i18n, subtitle } = art;
|
||||
this.$subtitle = append($control, icons.subtitle);
|
||||
tooltip(this.$subtitle, i18n.get('Hide subtitle'));
|
||||
|
||||
+13
-16
@@ -7,14 +7,11 @@ export default class Thumbnails {
|
||||
this.isLoad = false;
|
||||
}
|
||||
|
||||
apply(art) {
|
||||
apply(art, $control) {
|
||||
this.art = art;
|
||||
errorHandle(this.art.controls.progress, '\'thumbnails\' control dependent on \'progress\' control');
|
||||
this.init();
|
||||
}
|
||||
|
||||
init() {
|
||||
const { refs: { $progress }, events: { proxy } } = this.art;
|
||||
errorHandle(art.controls.progress, '\'thumbnails\' control dependent on \'progress\' control');
|
||||
const { refs: { $progress }, events: { proxy } } = art;
|
||||
this.$control = $control;
|
||||
|
||||
proxy($progress, 'mousemove', event => {
|
||||
if (!this.loading) {
|
||||
@@ -25,13 +22,13 @@ export default class Thumbnails {
|
||||
}
|
||||
|
||||
if (this.isLoad) {
|
||||
setStyle(this.option.$control, 'display', 'block');
|
||||
setStyle($control, 'display', 'block');
|
||||
this.showThumbnails(event);
|
||||
}
|
||||
});
|
||||
|
||||
proxy($progress, 'mouseout', () => {
|
||||
setStyle(this.option.$control, 'display', 'none');
|
||||
setStyle($control, 'display', 'none');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -60,17 +57,17 @@ export default class Thumbnails {
|
||||
let yIndex = Math.ceil(perIndex / column);
|
||||
let xIndex = perIndex % column || column;
|
||||
|
||||
setStyle(this.option.$control, 'backgroundImage', `url(${url})`);
|
||||
setStyle(this.option.$control, 'height', `${height}px`);
|
||||
setStyle(this.option.$control, 'width', `${width}px`);
|
||||
setStyle(this.option.$control, 'backgroundPosition', `-${--xIndex * width}px -${--yIndex * height}px`);
|
||||
setStyle(this.$control, 'backgroundImage', `url(${url})`);
|
||||
setStyle(this.$control, 'height', `${height}px`);
|
||||
setStyle(this.$control, 'width', `${width}px`);
|
||||
setStyle(this.$control, 'backgroundPosition', `-${--xIndex * width}px -${--yIndex * height}px`);
|
||||
|
||||
if (posWidth <= width / 2) {
|
||||
setStyle(this.option.$control, 'left', 0);
|
||||
setStyle(this.$control, 'left', 0);
|
||||
} else if (posWidth > $progress.clientWidth - width / 2) {
|
||||
setStyle(this.option.$control, 'left', `${$progress.clientWidth - width}px`);
|
||||
setStyle(this.$control, 'left', `${$progress.clientWidth - width}px`);
|
||||
} else {
|
||||
setStyle(this.option.$control, 'left', `${posWidth - width / 2}px`);
|
||||
setStyle(this.$control, 'left', `${posWidth - width / 2}px`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,24 +5,20 @@ export default class Time {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
apply(art) {
|
||||
apply(art, $control) {
|
||||
this.art = art;
|
||||
this.init();
|
||||
}
|
||||
|
||||
init() {
|
||||
this.option.$control.innerHTML = '00:00 / 00:00';
|
||||
$control.innerHTML = '00:00 / 00:00';
|
||||
|
||||
this.art.on('video:canplay', () => {
|
||||
this.option.$control.innerHTML = this.getTime();
|
||||
$control.innerHTML = this.getTime();
|
||||
});
|
||||
|
||||
this.art.on('video:timeupdate', () => {
|
||||
this.option.$control.innerHTML = this.getTime();
|
||||
$control.innerHTML = this.getTime();
|
||||
});
|
||||
|
||||
this.art.on('video:seeking', () => {
|
||||
this.option.$control.innerHTML = this.getTime();
|
||||
$control.innerHTML = this.getTime();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -7,16 +7,17 @@ export default class Volume {
|
||||
this.isDroging = false;
|
||||
}
|
||||
|
||||
apply(art) {
|
||||
apply(art, $control) {
|
||||
this.art = art;
|
||||
this.$control = $control;
|
||||
this.init();
|
||||
}
|
||||
|
||||
init() {
|
||||
const { events: { proxy }, player, i18n } = this.art;
|
||||
this.$volume = append(this.option.$control, icons.volume);
|
||||
this.$volumeClose = append(this.option.$control, icons.volumeClose);
|
||||
this.$volumePanel = append(this.option.$control, '<div class="art-volume-panel"></div>');
|
||||
this.$volume = append(this.$control, icons.volume);
|
||||
this.$volumeClose = append(this.$control, icons.volumeClose);
|
||||
this.$volumePanel = append(this.$control, '<div class="art-volume-panel"></div>');
|
||||
this.$volumeHandle = append(this.$volumePanel, '<div class="art-volume-slider-handle"></div>');
|
||||
tooltip(this.$volume, i18n.get('Mute'));
|
||||
setStyle(this.$volumeClose, 'display', 'none');
|
||||
@@ -37,7 +38,7 @@ export default class Volume {
|
||||
player.volume(getStorage('volume'));
|
||||
});
|
||||
|
||||
proxy(this.option.$control, 'mouseenter', () => {
|
||||
proxy(this.$control, 'mouseenter', () => {
|
||||
this.$volumePanel.classList.add('art-volume-panel-hover');
|
||||
|
||||
// TODO
|
||||
@@ -46,7 +47,7 @@ export default class Volume {
|
||||
}, 200);
|
||||
});
|
||||
|
||||
proxy(this.option.$control, 'mouseleave', () => {
|
||||
proxy(this.$control, 'mouseleave', () => {
|
||||
this.$volumePanel.classList.remove('art-volume-panel-hover');
|
||||
});
|
||||
|
||||
|
||||
@@ -5,9 +5,8 @@ export default class Common {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
apply(art) {
|
||||
apply(art, $setting) {
|
||||
this.art = art;
|
||||
const { $setting } = this.option;
|
||||
this.$header = $setting.querySelector('.art-setting-header');
|
||||
this.$body = $setting.querySelector('.art-setting-body');
|
||||
append(this.$body, '———— 先占坑,暂无设置 ————');
|
||||
|
||||
@@ -39,9 +39,8 @@ export default class Setting {
|
||||
$setting.dataset.settingIndex = option.index || id;
|
||||
append($setting, `<div class="art-setting-header">${this.art.i18n.get(title)}</div>`);
|
||||
append($setting, '<div class="art-setting-body"></div>');
|
||||
option.$setting = $setting;
|
||||
this.$settings.push($setting);
|
||||
setting.apply && setting.apply(this.art);
|
||||
setting.apply && setting.apply(this.art, $setting);
|
||||
this[name] = setting;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,5 +11,6 @@
|
||||
height: 100%;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user