分离所有默认菜单

This commit is contained in:
Harvey Zack committed 2018-11-02 10:00:27 +08:00
1 parent 245a423aca
commit 249242ae96
17 files changed
+320 -255

No files matched your search

+4 -4
View File
@@ -1,13 +1,13 @@
.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{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-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-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-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-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{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-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-player .artplayer-bottom .artplayer-controls .art-control-quality{position:relative;z-index:30;line-height:Line 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}
.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-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-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{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-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-player .artplayer-bottom .artplayer-controls .art-control-quality{position:relative;z-index:30;line-height:Line truncated
.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:90;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}
.artplayer-video-player[data-aspect-ratio] video{box-sizing:content-box;-o-object-fit:fill;object-fit:fill}
.artplayer-video-player .artplayer-info{display:none;position:absolute;left:10px;top:10px;z-index:90;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}
button[data-balloon]{overflow:visible}[data-balloon]{position:relative;cursor:pointer}[data-balloon]:after{font-family:sans-serif!important;font-weight:400!important;font-style:normal!important;text-shadow:none!important;font-size:12px!important;background:rgba(17,17,17,.9);border-radius:4px;color:#fff;content:attr(data-balloon);padding:.5em 1em;white-space:nowrap}[data-balloon]:after,[data-balloon]:before{filter:alpha(opactiy=0);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";-moz-opacity:0;-khtml-opacity:0;opacity:0;pointer-events:none;transition:all .18s ease-out .18s;position:absolute;z-index:10}[data-balloon]:before{background:no-repeat url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='12'%3E%3Cpath fill='rgba(17,17,17,0.9)' d='M2.658 0h32.004c-6 0-11.627 12.002-16.002 12.002C14.285 12.002 8.594 0 2.658 0z'/%3E%3C/svg%3E");background-size:100% auto;width:18px;height:6px;content:""}[data-balloon]:hover:after,[data-balloon]:hover:before,[data-balloon][data-balloon-visible]:after,[data-balloon][data-balloon-visible]:before{filter:alpha(opactiy=100);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";-moz-opacity:1;-khtml-opacity:1;opacity:1;pointer-events:auto}[data-balloon].font-awesome:after{font-family:FontAwesome}[data-balloon][data-balloon-break]:after{white-space:pre}[data-balloon][data-balloon-blunt]:after,[data-balloon][data-balloon-blunt]:before{transition:none}[data-balloon][data-balloon-pos=up]:after{margin-bottom:11px}[data-balloon][data-balloon-pos=up]:after,[data-balloon][data-balloon-pos=up]:before{bottom:100%;left:50%;-webkit-transform:translate(-50%,10px);transform:translate(-50%,10px);-webkit-transform-origin:top;transform-origin:top}[data-balloon][data-balloon-pos=up]:before{margin-bottom:5px}[data-balloon][data-balloon-pos=up]:hover:after,[data-balloon][data-balloon-pos=up]:hover:before,[data-balloon][data-balloon-pos=up][data-balloon-visible]:after,[data-balloon][data-balloon-pos=up][data-balloon-visible]:before{-webkit-transform:translate(-50%);transform:translate(-50%)}[data-balloon][data-balloon-pos=up-left]:after{left:0;margin-bottom:11px}[data-balloon][data-balloon-pos=up-left]:after,[data-balloon][data-balloon-pos=up-left]:before{bottom:100%;-webkit-transform:translateY(10px);transform:translateY(10px);-webkit-transform-origin:top;transform-origin:top}[data-balloon][data-balloon-pos=up-left]:before{left:5px;margin-bottom:5px}[data-balloon][data-balloon-pos=up-left]:hover:after,[data-balloon][data-balloon-pos=up-left]:hover:before,[data-balloon][data-balloon-pos=up-left][data-balloon-visible]:after,[data-balloon][data-balloon-pos=up-left][data-balloon-visible]:before{-webkit-transform:translate(0);transform:translate(0)}[data-balloon][data-balloon-pos=up-right]:after{right:0;margin-bottom:11px}[data-balloon][data-balloon-pos=up-right]:after,[data-balloon][data-balloon-pos=up-right]:before{bottom:100%;-webkit-transform:translateY(10px);transform:translateY(10px);-webkit-transform-origin:top;transform-origin:top}[data-balloon][data-balloon-pos=up-right]:before{right:5px;margin-bottom:5px}[data-balloon][data-balloon-pos=up-right]:hover:after,[data-balloon][data-balloon-pos=up-right]:hover:before,[data-balloon][data-balloon-pos=up-right][data-balloon-visible]:after,[data-balloon][data-balloon-pos=up-right][data-balloon-visible]:before{-webkit-transform:translate(0);transform:translate(0)}[data-balloon][data-balloon-pos=down]:after{margin-top:11px}[data-balloon][data-balloon-pos=down]:after,[data-balloon][data-balloon-pos=down]:before{left:50%;top:100%;-webkit-transform:translate(-50%,-10px);transform:translate(-50%,-10px)}[data-balloon][data-balloon-pos=down]:before{background:no-repeat url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='12'%3E%3Cpath fill='rgba(17,17,17,0.9)' d='M33.342 12H1.338c6 0 11.627-12.002 16.002-12.002C21.715-.002 27.406 12 33.342 12z'/%3E%3C/svg%3E");background-size:100% auto;width:18px;height:6px;margin-top:5px}[data-balloon][data-balloon-pos=down]:hover:after,[data-balloon][data-balloon-pos=down]:hover:before,[data-balloon][data-balloon-pos=down][data-balloon-visible]:after,[data-balloon][data-balloon-pos=down][data-balloon-visible]:before{-webkit-transform:translate(-50%);transform:translate(-50%)}[data-balloon][data-balloon-pos=down-left]:after{left:0;margin-top:11px;top:100%;-webkit-transform:translateY(-10px);transform:translateY(-10px)}[data-balloon][data-balloon-pos=down-left]:before{background:no-repeat url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='12'%3E%3Cpath fill='rgba(17,17,17,0.9)' d='M33.342 12H1.338c6 0 11.627-12.002 16.002-12.002C21.715-.002 27.406 12 33.342 12z'/%3E%3C/svg%3E");background-size:100% auto;width:18px;height:6px;left:5px;margin-top:5px;top:100%;-webkit-transform:translateY(-10px);transform:translateY(-10px)}[data-balloon][data-balloon-pos=down-left]Line truncated
+114 -77
View File
@@ -669,8 +669,8 @@
'Reconnect': '重新连接',
'Hide subtitle': '隐藏字幕',
'Show subtitle': '显示字幕',
'Hide danmu': '隐藏彈幕',
'Show danmu': '显示彈幕',
'Hide danmu': '隐藏弹幕',
'Show danmu': '显示弹幕',
'Screenshot': '截图',
'Play speed': '播放速度',
'Aspect ratio': '画面比例',
@@ -1138,9 +1138,9 @@
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 32 32\" style=\"width: 100%; height: 100%\">\n <path d=\"M 3 6 L 3 26 L 12.585938 26 L 16 29.414063 L 19.414063 26 L 29 26 L 29 6 Z M 5 8 L 27 8 L 27 24 L 18.585938 24 L 16 26.585938 L 13.414063 24 L 5 24 Z M 9 11 L 9 13 L 23 13 L 23 11 Z M 9 15 L 9 17 L 23 17 L 23 15 Z M 9 19 L 9 21 L 19 21 L 19 19 Z \"/>\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 danmuClose = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\" style=\"width: 100%; height: 100%; opacity: .5\">\n <path d=\"M 3 6 L 3 26 L 12.585938 26 L 16 29.414063 L 19.414063 26 L 29 26 L 29 6 Z M 5 8 L 27 8 L 27 24 L 18.585938 24 L 16 26.585938 L 13.414063 24 L 5 24 Z M 9 11 L 9 13 L 23 13 L 23 11 Z M 9 15 L 9 17 L 23 17 L 23 15 Z M 9 19 L 9 21 L 19 21 L 19 19 Z \"/>\n</svg>\n";
var danmuClose = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 60 60\" style=\"width: 85%; height: 85%; opacity: .5\">\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 icons = {
loading: loading,
@@ -1196,11 +1196,11 @@
proxy(this.$danmu, 'click', function () {
danmu.hide();
setStyle(_this.$danmu, 'display', 'none');
setStyle(_this.$danmuClose, 'display', 'block');
setStyle(_this.$danmuClose, 'display', 'flex');
});
proxy(this.$danmuClose, 'click', function () {
danmu.show();
setStyle(_this.$danmu, 'display', 'block');
setStyle(_this.$danmu, 'display', 'flex');
setStyle(_this.$danmuClose, 'display', 'none');
});
}
@@ -1507,11 +1507,11 @@
proxy(this.$subtitle, 'click', function () {
subtitle.hide();
setStyle(_this.$subtitle, 'display', 'none');
setStyle(_this.$subtitleClose, 'display', 'block');
setStyle(_this.$subtitleClose, 'display', 'flex');
});
proxy(this.$subtitleClose, 'click', function () {
subtitle.show();
setStyle(_this.$subtitle, 'display', 'block');
setStyle(_this.$subtitle, 'display', 'flex');
setStyle(_this.$subtitleClose, 'display', 'none');
});
}
@@ -2087,6 +2087,84 @@
return Controls;
}();
function playbackRate(art) {
var option = art.option,
i18n = art.i18n,
player = art.player,
contextmenu = art.contextmenu;
return {
disable: !option.playbackRate,
name: 'playbackRate',
html: "\n ".concat(i18n.get('Play speed'), ":\n <span data-rate=\"0.5\">0.5</span>\n <span data-rate=\"0.75\">0.75</span>\n <span data-rate=\"1\" class=\"normal current\">").concat(i18n.get('Normal'), "</span>\n <span data-rate=\"1.25\">1.25</span>\n <span data-rate=\"1.5\">1.5</span>\n <span data-rate=\"2.0\">2.0</span>\n "),
click: function click(event) {
var target = event.target;
var rate = target.dataset.rate;
if (rate) {
player.playbackRate(Number(rate));
sublings(target).forEach(function (item) {
return item.classList.remove('current');
});
target.classList.add('current');
contextmenu.hide();
}
}
};
}
function aspectRatio(art) {
var option = art.option,
i18n = art.i18n,
player = art.player,
contextmenu = art.contextmenu;
return {
disable: !option.aspectRatio,
name: 'aspectRatio',
html: "\n ".concat(i18n.get('Aspect ratio'), ":\n <span data-ratio=\"default\" class=\"default current\">").concat(i18n.get('Default'), "</span>\n <span data-ratio=\"4:3\">4:3</span>\n <span data-ratio=\"16:9\">16:9</span>\n "),
click: function click(event) {
var target = event.target;
var ratio = target.dataset.ratio;
if (ratio) {
player.aspectRatio(ratio.split(':'));
sublings(target).forEach(function (item) {
return item.classList.remove('current');
});
target.classList.add('current');
contextmenu.hide();
}
}
};
}
function info(art) {
return {
name: 'info',
html: art.i18n.get('Video info'),
click: function click() {
art.info.show();
art.contextmenu.hide();
}
};
}
var version = {
disable: false,
name: 'version',
html: '<a href="https://github.com/zhw2590582/artplayer" target="_blank">ArtPlayer 1.0.0</a>'
};
function close(art) {
return {
disable: false,
name: 'close',
html: art.i18n.get('Close'),
click: function click() {
art.contextmenu.hide();
}
};
}
var id$1 = 0;
var Contextmenu =
@@ -2106,67 +2184,9 @@
var _this$art = this.art,
option = _this$art.option,
player = _this$art.player,
i18n = _this$art.i18n,
refs = _this$art.refs,
proxy = _this$art.events.proxy;
option.contextmenu.push({
disable: !option.playbackRate,
name: 'playbackRate',
html: "\n ".concat(i18n.get('Play speed'), ":\n <span data-rate=\"0.5\">0.5</span>\n <span data-rate=\"0.75\">0.75</span>\n <span data-rate=\"1\" class=\"normal current\">").concat(i18n.get('Normal'), "</span>\n <span data-rate=\"1.25\">1.25</span>\n <span data-rate=\"1.5\">1.5</span>\n <span data-rate=\"2.0\">2.0</span>\n "),
click: function click(art, event) {
var target = event.target;
var rate = target.dataset.rate;
if (rate) {
player.playbackRate(Number(rate));
sublings(target).forEach(function (item) {
return item.classList.remove('current');
});
target.classList.add('current');
_this.hide();
}
}
}, {
disable: !option.aspectRatio,
name: 'aspectRatio',
html: "\n ".concat(i18n.get('Aspect ratio'), ":\n <span data-ratio=\"default\" class=\"default current\">").concat(i18n.get('Default'), "</span>\n <span data-ratio=\"4:3\">4:3</span>\n <span data-ratio=\"16:9\">16:9</span>\n "),
click: function click(art, event) {
var target = event.target;
var ratio = target.dataset.ratio;
if (ratio) {
player.aspectRatio(ratio.split(':'));
sublings(target).forEach(function (item) {
return item.classList.remove('current');
});
target.classList.add('current');
_this.hide();
}
}
}, {
disable: false,
name: 'info',
html: i18n.get('Video info'),
click: function click() {
_this.art.info.show();
_this.hide();
}
}, {
disable: false,
name: 'version',
html: '<a href="https://github.com/zhw2590582/artplayer" target="_blank">ArtPlayer 1.0.0</a>'
}, {
disable: false,
name: 'close',
html: i18n.get('Close'),
click: function click() {
_this.hide();
}
});
option.contextmenu.push(playbackRate, aspectRatio, info, version, close);
proxy(refs.$player, 'contextmenu', function (event) {
event.preventDefault();
_this.art.isFocus = true;
@@ -2200,22 +2220,23 @@
return !item.disable;
}).forEach(function (item) {
id$1++;
var menu = typeof item === 'function' ? item(_this2.art) : item;
var $menu = document.createElement('div');
$menu.setAttribute('data-art-menu-id', id$1);
$menu.setAttribute('class', "art-menu art-menu-".concat(item.name || id$1));
append($menu, item.html);
setStyles($menu, item.style || {});
$menu.setAttribute('class', "art-menu art-menu-".concat(menu.name || id$1));
append($menu, menu.html);
setStyles($menu, menu.style || {});
if (item.click) {
if (menu.click) {
proxy($menu, 'click', function (event) {
event.preventDefault();
item.click(_this2.art, event);
menu.click(event);
_this2.art.emit('contextmenu:click', $menu);
});
}
_this2["$".concat(item.name || id$1)] = append(refs.$contextmenu, $menu);
_this2["$".concat(menu.name || id$1)] = append(refs.$contextmenu, $menu);
});
append(refs.$player, refs.$contextmenu);
}
@@ -2292,15 +2313,23 @@
}, {
key: "show",
value: function show() {
var $danmu = this.art.refs.$danmu;
var _this$art = this.art,
$danmu = _this$art.refs.$danmu,
i18n = _this$art.i18n,
notice = _this$art.notice;
setStyle($danmu, 'display', 'block');
notice.show(i18n.get('Show danmu'));
this.art.emit('danmu:show', $danmu);
}
}, {
key: "hide",
value: function hide() {
var $danmu = this.art.refs.$danmu;
var _this$art2 = this.art,
$danmu = _this$art2.refs.$danmu,
i18n = _this$art2.i18n,
notice = _this$art2.notice;
setStyle($danmu, 'display', 'none');
notice.show(i18n.get('Hide danmu'));
this.art.emit('danmu:hide', $danmu);
}
}]);
@@ -2523,15 +2552,23 @@
}, {
key: "show",
value: function show() {
var $subtitle = this.art.refs.$subtitle;
var _this$art2 = this.art,
$subtitle = _this$art2.refs.$subtitle,
i18n = _this$art2.i18n,
notice = _this$art2.notice;
setStyle($subtitle, 'display', 'block');
notice.show(i18n.get('Show subtitle'));
this.art.emit('subtitle:show', $subtitle);
}
}, {
key: "hide",
value: function hide() {
var $subtitle = this.art.refs.$subtitle;
var _this$art3 = this.art,
$subtitle = _this$art3.refs.$subtitle,
i18n = _this$art3.i18n,
notice = _this$art3.notice;
setStyle($subtitle, 'display', 'none');
notice.show(i18n.get('Hide subtitle'));
this.art.emit('subtitle:hide', $subtitle);
}
}, {
+1 -1
View File
@@ -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.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/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 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 descriptoLine 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/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 throw new TypeError(\"Cannot call a class as a function\Line truncated
-159
View File
@@ -1,159 +0,0 @@
import { append, setStyles, setStyle, sublings } from './utils';
let id = 0;
export default class Contextmenu {
constructor(art) {
this.art = art;
this.init();
}
init() {
const { option, player, i18n, refs, events: { proxy } } = this.art;
option.contextmenu.push(
{
disable: !option.playbackRate,
name: 'playbackRate',
html: `
${i18n.get('Play speed')}:
<span data-rate="0.5">0.5</span>
<span data-rate="0.75">0.75</span>
<span data-rate="1" class="normal current">${i18n.get('Normal')}</span>
<span data-rate="1.25">1.25</span>
<span data-rate="1.5">1.5</span>
<span data-rate="2.0">2.0</span>
`,
click: (art, event) => {
const { target } = event;
const { rate } = target.dataset;
if (rate) {
player.playbackRate(Number(rate));
sublings(target).forEach(item => item.classList.remove('current'));
target.classList.add('current');
this.hide();
}
}
},
{
disable: !option.aspectRatio,
name: 'aspectRatio',
html: `
${i18n.get('Aspect ratio')}:
<span data-ratio="default" class="default current">${i18n.get('Default')}</span>
<span data-ratio="4:3">4:3</span>
<span data-ratio="16:9">16:9</span>
`,
click: (art, event) => {
const { target } = event;
const { ratio } = target.dataset;
if (ratio) {
player.aspectRatio(ratio.split(':'));
sublings(target).forEach(item => item.classList.remove('current'));
target.classList.add('current');
this.hide();
}
}
},
{
disable: false,
name: 'info',
html: i18n.get('Video info'),
click: () => {
this.art.info.show();
this.hide();
}
},
{
disable: false,
name: 'version',
html: '<a href="https://github.com/zhw2590582/artplayer" target="_blank">ArtPlayer __VERSION__</a>'
},
{
disable: false,
name: 'close',
html: i18n.get('Close'),
click: () => {
this.hide();
}
}
);
proxy(refs.$player, 'contextmenu', event => {
event.preventDefault();
this.art.isFocus = true;
if (!refs.$contextmenu) {
this.creatMenu();
}
this.show();
this.setPos(event);
});
proxy(refs.$player, 'click', event => {
if (refs.$contextmenu && !event.path.includes(refs.$contextmenu)) {
this.hide();
}
});
}
creatMenu() {
const { option, refs, events: { proxy } } = this.art;
refs.$contextmenu = document.createElement('div');
refs.$contextmenu.classList.add('artplayer-contextmenu');
option.contextmenu
.filter(item => !item.disable)
.forEach(item => {
id++;
const $menu = document.createElement('div');
$menu.setAttribute('data-art-menu-id', id);
$menu.setAttribute('class', `art-menu art-menu-${item.name || id}`);
append($menu, item.html);
setStyles($menu, item.style || {});
if (item.click) {
proxy($menu, 'click', event => {
event.preventDefault();
item.click(this.art, event);
this.art.emit('contextmenu:click', $menu);
});
}
this[`$${item.name || id}`] = append(refs.$contextmenu, $menu);
});
append(refs.$player, refs.$contextmenu);
}
setPos(event) {
const { refs } = this.art;
const mouseX = event.clientX;
const mouseY = event.clientY;
const { height: cHeight, width: cWidth, left: cLeft, top: cTop } = refs.$player.getBoundingClientRect();
const { height: mHeight, width: mWidth } = refs.$contextmenu.getBoundingClientRect();
let menuLeft = mouseX - cLeft;
let menuTop = mouseY - cTop;
if (mouseX + mWidth > cLeft + cWidth) {
menuLeft = cWidth - mWidth;
}
if (mouseY + mHeight > cTop + cHeight) {
menuTop = cHeight - mHeight;
}
setStyle(refs.$contextmenu, 'left', `${menuLeft}px`);
setStyle(refs.$contextmenu, 'top', `${menuTop}px`);
}
hide() {
const { refs: { $contextmenu } } = this.art;
if ($contextmenu) {
setStyle($contextmenu, 'display', 'none');
this.art.emit('contextmenu:hide', $contextmenu);
}
}
show() {
const { refs: { $contextmenu } } = this.art;
if ($contextmenu) {
setStyle($contextmenu, 'display', 'block');
this.art.emit('contextmenu:show', $contextmenu);
}
}
}
+25
View File
@@ -0,0 +1,25 @@
import { sublings } from '../utils';
export default function aspectRatio(art) {
const { option, i18n, player, contextmenu } = art;
return {
disable: !option.aspectRatio,
name: 'aspectRatio',
html: `
${i18n.get('Aspect ratio')}:
<span data-ratio="default" class="default current">${i18n.get('Default')}</span>
<span data-ratio="4:3">4:3</span>
<span data-ratio="16:9">16:9</span>
`,
click: event => {
const { target } = event;
const { ratio } = target.dataset;
if (ratio) {
player.aspectRatio(ratio.split(':'));
sublings(target).forEach(item => item.classList.remove('current'));
target.classList.add('current');
contextmenu.hide();
}
}
};
}
+10
View File
@@ -0,0 +1,10 @@
export default function close(art) {
return {
disable: false,
name: 'close',
html: art.i18n.get('Close'),
click: () => {
art.contextmenu.hide();
}
};
}
+105
View File
@@ -0,0 +1,105 @@
import { append, setStyles, setStyle } from '../utils';
import playbackRate from './playbackRate';
import aspectRatio from './aspectRatio';
import info from './info';
import version from './version';
import close from './close';
let id = 0;
export default class Contextmenu {
constructor(art) {
this.art = art;
this.init();
}
init() {
const { option, refs, events: { proxy } } = this.art;
option.contextmenu.push(
playbackRate,
aspectRatio,
info,
version,
close
);
proxy(refs.$player, 'contextmenu', event => {
event.preventDefault();
this.art.isFocus = true;
if (!refs.$contextmenu) {
this.creatMenu();
}
this.show();
this.setPos(event);
});
proxy(refs.$player, 'click', event => {
if (refs.$contextmenu && !event.path.includes(refs.$contextmenu)) {
this.hide();
}
});
}
creatMenu() {
const { option, refs, events: { proxy } } = this.art;
refs.$contextmenu = document.createElement('div');
refs.$contextmenu.classList.add('artplayer-contextmenu');
option.contextmenu
.filter(item => !item.disable)
.forEach(item => {
id++;
const menu = typeof item === 'function' ? item(this.art) : item;
const $menu = document.createElement('div');
$menu.setAttribute('data-art-menu-id', id);
$menu.setAttribute('class', `art-menu art-menu-${menu.name || id}`);
append($menu, menu.html);
setStyles($menu, menu.style || {});
if (menu.click) {
proxy($menu, 'click', event => {
event.preventDefault();
menu.click(event);
this.art.emit('contextmenu:click', $menu);
});
}
this[`$${menu.name || id}`] = append(refs.$contextmenu, $menu);
});
append(refs.$player, refs.$contextmenu);
}
setPos(event) {
const { refs } = this.art;
const mouseX = event.clientX;
const mouseY = event.clientY;
const { height: cHeight, width: cWidth, left: cLeft, top: cTop } = refs.$player.getBoundingClientRect();
const { height: mHeight, width: mWidth } = refs.$contextmenu.getBoundingClientRect();
let menuLeft = mouseX - cLeft;
let menuTop = mouseY - cTop;
if (mouseX + mWidth > cLeft + cWidth) {
menuLeft = cWidth - mWidth;
}
if (mouseY + mHeight > cTop + cHeight) {
menuTop = cHeight - mHeight;
}
setStyle(refs.$contextmenu, 'left', `${menuLeft}px`);
setStyle(refs.$contextmenu, 'top', `${menuTop}px`);
}
hide() {
const { refs: { $contextmenu } } = this.art;
if ($contextmenu) {
setStyle($contextmenu, 'display', 'none');
this.art.emit('contextmenu:hide', $contextmenu);
}
}
show() {
const { refs: { $contextmenu } } = this.art;
if ($contextmenu) {
setStyle($contextmenu, 'display', 'block');
this.art.emit('contextmenu:show', $contextmenu);
}
}
}
+10
View File
@@ -0,0 +1,10 @@
export default function info(art) {
return {
name: 'info',
html: art.i18n.get('Video info'),
click: () => {
art.info.show();
art.contextmenu.hide();
}
};
}
+28
View File
@@ -0,0 +1,28 @@
import { sublings } from '../utils';
export default function playbackRate(art) {
const { option, i18n, player, contextmenu } = art;
return {
disable: !option.playbackRate,
name: 'playbackRate',
html: `
${i18n.get('Play speed')}:
<span data-rate="0.5">0.5</span>
<span data-rate="0.75">0.75</span>
<span data-rate="1" class="normal current">${i18n.get('Normal')}</span>
<span data-rate="1.25">1.25</span>
<span data-rate="1.5">1.5</span>
<span data-rate="2.0">2.0</span>
`,
click: event => {
const { target } = event;
const { rate } = target.dataset;
if (rate) {
player.playbackRate(Number(rate));
sublings(target).forEach(item => item.classList.remove('current'));
target.classList.add('current');
contextmenu.hide();
}
}
};
}
+5
View File
@@ -0,0 +1,5 @@
export default {
disable: false,
name: 'version',
html: '<a href="https://github.com/zhw2590582/artplayer" target="_blank">ArtPlayer __VERSION__</a>'
};
+2 -2
View File
@@ -17,12 +17,12 @@ export default class Danmu {
proxy(this.$danmu, 'click', () => {
danmu.hide();
setStyle(this.$danmu, 'display', 'none');
setStyle(this.$danmuClose, 'display', 'block');
setStyle(this.$danmuClose, 'display', 'flex');
});
proxy(this.$danmuClose, 'click', () => {
danmu.show();
setStyle(this.$danmu, 'display', 'block');
setStyle(this.$danmu, 'display', 'flex');
setStyle(this.$danmuClose, 'display', 'none');
});
}
+2 -2
View File
@@ -17,12 +17,12 @@ export default class Subtitle {
proxy(this.$subtitle, 'click', () => {
subtitle.hide();
setStyle(this.$subtitle, 'display', 'none');
setStyle(this.$subtitleClose, 'display', 'block');
setStyle(this.$subtitleClose, 'display', 'flex');
});
proxy(this.$subtitleClose, 'click', () => {
subtitle.show();
setStyle(this.$subtitle, 'display', 'block');
setStyle(this.$subtitle, 'display', 'flex');
setStyle(this.$subtitleClose, 'display', 'none');
});
}
+4 -2
View File
@@ -11,14 +11,16 @@ export default class Danmu {
}
show() {
const { $danmu } = this.art.refs;
const { refs: { $danmu }, i18n, notice } = this.art;
setStyle($danmu, 'display', 'block');
notice.show(i18n.get('Show danmu'));
this.art.emit('danmu:show', $danmu);
}
hide() {
const { $danmu } = this.art.refs;
const { refs: { $danmu }, i18n, notice } = this.art;
setStyle($danmu, 'display', 'none');
notice.show(i18n.get('Hide danmu'));
this.art.emit('danmu:hide', $danmu);
}
}
+2 -2
View File
@@ -12,8 +12,8 @@ let i18nMap = {
'Reconnect': '重新连接',
'Hide subtitle': '隐藏字幕',
'Show subtitle': '显示字幕',
'Hide danmu': '隐藏彈幕',
'Show danmu': '显示彈幕',
'Hide danmu': '隐藏弹幕',
'Show danmu': '显示弹幕',
'Screenshot': '截图',
'Play speed': '播放速度',
'Aspect ratio': '画面比例',
+2 -2
View File
@@ -1,3 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" style="width: 100%; height: 100%; opacity: .5">
<path d="M 3 6 L 3 26 L 12.585938 26 L 16 29.414063 L 19.414063 26 L 29 26 L 29 6 Z M 5 8 L 27 8 L 27 24 L 18.585938 24 L 16 26.585938 L 13.414063 24 L 5 24 Z M 9 11 L 9 13 L 23 13 L 23 11 Z M 9 15 L 9 17 L 23 17 L 23 15 Z M 9 19 L 9 21 L 19 21 L 19 19 Z "/>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60" style="width: 85%; height: 85%; opacity: .5">
<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"/>
</svg>

Before

Width:  |  Height:  |  Size: 378 B

After

Width:  |  Height:  |  Size: 549 B

+2 -2
View File
@@ -1,3 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" style="width: 100%; height: 100%">
<path d="M 3 6 L 3 26 L 12.585938 26 L 16 29.414063 L 19.414063 26 L 29 26 L 29 6 Z M 5 8 L 27 8 L 27 24 L 18.585938 24 L 16 26.585938 L 13.414063 24 L 5 24 Z M 9 11 L 9 13 L 23 13 L 23 11 Z M 9 15 L 9 17 L 23 17 L 23 15 Z M 9 19 L 9 21 L 19 21 L 19 19 Z "/>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60" style="width: 85%; height: 85%">
<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"/>
</svg>

Before

Width:  |  Height:  |  Size: 365 B

After

Width:  |  Height:  |  Size: 536 B

+4 -2
View File
@@ -90,14 +90,16 @@ export default class Subtitle {
}
show() {
const { $subtitle } = this.art.refs;
const { refs: { $subtitle }, i18n, notice } = this.art;
setStyle($subtitle, 'display', 'block');
notice.show(i18n.get('Show subtitle'));
this.art.emit('subtitle:show', $subtitle);
}
hide() {
const { $subtitle } = this.art.refs;
const { refs: { $subtitle }, i18n, notice } = this.art;
setStyle($subtitle, 'display', 'none');
notice.show(i18n.get('Hide subtitle'));
this.art.emit('subtitle:hide', $subtitle);
}