This commit is contained in:
Harvey Zack committed 2018-10-31 13:03:32 +08:00
1 parent c5c5d6cf04
commit 1fe3ffdeae
9 files changed
+24 -34

No files matched your search

+11 -7
View File
@@ -982,7 +982,7 @@
if (!_this.firstCanplay) {
_this.firstCanplay = true;
_this.art.emit('player:firstCanplay');
_this.art.emit('firstCanplay');
}
_this.art.controls.show();
@@ -1773,6 +1773,7 @@
key: "apply",
value: function apply(art) {
this.art = art;
errorHandle(this.art.controls.progress, '\'thumbnails\' control dependent on \'progress\' control');
this.init();
}
}, {
@@ -1828,7 +1829,6 @@
var _this$art2 = this.art,
$progress = _this$art2.refs.$progress,
controls = _this$art2.controls;
errorHandle(controls.progress, '\'thumbnails\' control dependent on \'progress\' control');
var _controls$progress$ge = controls.progress.getPosFromEvent(event),
posWidth = _controls$progress$ge.width;
@@ -1924,7 +1924,7 @@
this.art = art;
this.$map = {};
this.art.on('player:firstCanplay', function () {
this.art.on('firstCanplay', function () {
_this.init();
_this.mount();
@@ -2113,7 +2113,7 @@
var target = event.target;
var rate = target.innerText;
if (rate) {
if (target.tagName === 'SPAN' && rate) {
player.playbackRate(Number(rate));
var sublings = Array.from(target.parentElement.querySelectorAll('span')).filter(function (item) {
return item !== target;
@@ -2122,6 +2122,8 @@
return item.classList.remove('current');
});
target.classList.add('current');
_this.hide();
}
}
}, {
@@ -2132,7 +2134,7 @@
var target = event.target;
var ratio = target.innerText;
if (ratio) {
if (target.tagName === 'SPAN' && ratio) {
player.aspectRatio(ratio.split(':'));
var sublings = Array.from(target.parentElement.querySelectorAll('span')).filter(function (item) {
return item !== target;
@@ -2141,6 +2143,8 @@
return item.classList.remove('current');
});
target.classList.add('current');
_this.hide();
}
}
}, {
@@ -2149,6 +2153,8 @@
html: i18n.get('Video info'),
click: function click() {
_this.art.info.show();
_this.hide();
}
}, {
disable: false,
@@ -2206,8 +2212,6 @@
event.preventDefault();
item.click(_this2.art, event);
_this2.hide();
_this2.art.emit('contextmenu:click', $menu);
});
}
+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/kind-of/index.js","../../node_modules/option-validator/index.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","../../src/controls/danmu.js","../../src/controls/fullscreen.js","../../src/controls/pip.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/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/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 descriptor.enumerable = descriptor.enumerable || false;\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/kind-of/index.js","../../node_modules/option-validator/index.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","../../src/controls/danmu.js","../../src/controls/fullscreen.js","../../src/controls/pip.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/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/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 descriptor.enumerable = descriptor.enumerable || false;\n Line truncated
+5 -3
View File
@@ -18,11 +18,12 @@ export default class Contextmenu {
click: (art, event) => {
const { target } = event;
const rate = target.innerText;
if (rate) {
if (target.tagName === 'SPAN' && rate) {
player.playbackRate(Number(rate));
const sublings = Array.from(target.parentElement.querySelectorAll('span')).filter(item => item !== target);
sublings.forEach(item => item.classList.remove('current'));
target.classList.add('current');
this.hide();
}
}
},
@@ -33,11 +34,12 @@ export default class Contextmenu {
click: (art, event) => {
const { target } = event;
const ratio = target.innerText;
if (ratio) {
if (target.tagName === 'SPAN' && ratio) {
player.aspectRatio(ratio.split(':'));
const sublings = Array.from(target.parentElement.querySelectorAll('span')).filter(item => item !== target);
sublings.forEach(item => item.classList.remove('current'));
target.classList.add('current');
this.hide();
}
}
},
@@ -47,6 +49,7 @@ export default class Contextmenu {
html: i18n.get('Video info'),
click: () => {
this.art.info.show();
this.hide();
}
},
{
@@ -98,7 +101,6 @@ export default class Contextmenu {
proxy($menu, 'click', event => {
event.preventDefault();
item.click(this.art, event);
this.hide();
this.art.emit('contextmenu:click', $menu);
});
}
+1 -1
View File
@@ -16,7 +16,7 @@ export default class Controls {
constructor(art) {
this.art = art;
this.$map = {};
this.art.on('player:firstCanplay', () => {
this.art.on('firstCanplay', () => {
this.init();
this.mount();
});
+1 -6
View File
@@ -15,12 +15,7 @@ export default class Progress {
}
init() {
const {
option: { highlight, theme },
events: { proxy },
refs: { $video },
player
} = this.art;
const { option: { highlight, theme }, events: { proxy }, refs: { $video }, player } = this.art;
append(
this.option.$control,
+2 -5
View File
@@ -9,14 +9,12 @@ export default class Thumbnails {
apply(art) {
this.art = art;
errorHandle(this.art.controls.progress, '\'thumbnails\' control dependent on \'progress\' control');
this.init();
}
init() {
const {
refs: { $progress },
events: { proxy }
} = this.art;
const { refs: { $progress }, events: { proxy } } = this.art;
proxy($progress, 'mousemove', event => {
if (!this.loading) {
@@ -55,7 +53,6 @@ export default class Thumbnails {
showThumbnails(event) {
const { refs: { $progress }, controls } = this.art;
errorHandle(controls.progress, '\'thumbnails\' control dependent on \'progress\' control');
const { width: posWidth } = controls.progress.getPosFromEvent(event);
const { url, height, width, number, column } = this.art.option.thumbnails;
const perWidth = $progress.clientWidth / number;
+1 -5
View File
@@ -7,11 +7,7 @@ export default class Hotkey {
}
init() {
const {
player,
refs: { $player },
events: { proxy }
} = this.art;
const { player, refs: { $player }, events: { proxy } } = this.art;
proxy(document, 'click', event => {
this.art.isFocus = event.path.indexOf($player) > -1;
+1 -5
View File
@@ -8,11 +8,7 @@ export default class Mask {
}
init() {
const {
player,
refs,
events: { proxy }
} = this.art;
const { player, refs, events: { proxy } } = this.art;
append(refs.$mask, icons.playBig);
+1 -1
View File
@@ -53,7 +53,7 @@ export default class Player {
this.art.on('video:canplay', () => {
if (!this.firstCanplay) {
this.firstCanplay = true;
this.art.emit('player:firstCanplay');
this.art.emit('firstCanplay');
}
this.art.controls.show();