mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 10:56:15 -08:00
add files
This commit is contained in:
1 parent
70864abf44
commit
a53a1236a3
16 files changed
+581
-276
No files matched your search
@@ -133,7 +133,7 @@
|
||||
"no-mixed-requires": [1, { "allowCall": true }],
|
||||
"no-new-require": 2,
|
||||
"no-path-concat": 2,
|
||||
"no-process-env": 2,
|
||||
"no-process-env": 0,
|
||||
"no-process-exit": 2,
|
||||
|
||||
"array-bracket-spacing": 1,
|
||||
@@ -176,7 +176,7 @@
|
||||
"operator-linebreak": 1,
|
||||
"padded-blocks": 0,
|
||||
"quotes": [1, "single"],
|
||||
"require-jsdoc": 2,
|
||||
"require-jsdoc": 0,
|
||||
"semi": 1,
|
||||
"semi-spacing": 1,
|
||||
"space-before-blocks": 1,
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@
|
||||
opacity: .75 !important;
|
||||
}
|
||||
|
||||
.video-wrap {
|
||||
.artplayer-wrap {
|
||||
width: 600px;
|
||||
height: 340px;
|
||||
margin: 40px auto 0;
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
.consola-container{opacity:.9;position:fixed;background-color:#242424}.consola-container.right{top:0;right:0;bottom:0;height:100%;width:0}.consola-container.bottom{left:0;right:0;bottom:0;width:100%;height:0}.consola-container .consola-tools{position:absolute;left:0;right:0;top:0;z-index:2;display:flex;justify-content:space-between;align-items:center;flex-direction:row;height:30px;padding:0 10px;color:hsla(0,0%,100%,.8);background-color:#141618;border-bottom:1px solid rgba(0,0,0,.3);font-size:12px;box-sizing:border-box}.consola-container .consola-tools .consola-clean{cursor:pointer}.consola-container .consola-wrap{position:relative;z-index:1;height:100%;padding-top:30px;overflow-y:auto;word-break:break-word;box-sizing:border-box}.consola-container .consola-wrap .method.method-log{position:relative;display:flex;color:hsla(0,0%,100%,.9);background-color:transparent;border-top:1px solid hsla(0,0%,100%,.05);border-bottom:1px solid hsla(0,0%,100%,.05);margin-top:-1px;margin-bottom:0;padding-left:10px;box-sizing:border-box}.consola-container .consola-wrap .method.method-log .method-icon{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABpSURBVChTY6A92LNnj96uXbvKoVzsYMeOHVbbt29/D1T4eP/+/QJQYVSwe/duD6CCr0B8A8iWgwqjAqBk2NatW38B6bPbtm0TBYkBFbsA+c9ANFgRCBCtEASAAoSthgGiPAMD2IOHgQEA521bM7uG52wAAAAASUVORK5CYII=)}.consola-container .consola-wrap .method.method-info{position:relative;display:flex;color:hsla(0,0%,100%,.9);background-color:transparent;border-top:1px solid hsla(0,0%,100%,.05);border-bottom:1px solid hsla(0,0%,100%,.05);margin-top:-1px;margin-bottom:0;padding-left:10px;box-sizing:border-box}.consola-container .consola-wrap .method.method-info .method-icon{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADISURBVChTY4ABp/AztmZBZ07qe538rO114rOa8+GTskYHbKHSEOARd6nLIOTsf61gIA46U6kVePYQiK3uc/K/hPG+LrCi8IyrtkZh5yCKgk/80w46ba0RdGYGhH/2v6rXyf88qtttGVwSLp2ECQLxeiAu1wo6uwpJ7L+o2f6TDA6xZz8jCyqFnuHXCj4djywmZXHoM/EK0azGqhBsNYpngL6VCTnGqRF4xgKo+D5IDO4ZEEAKnjcQBafvqwWf/YoSPDCAP8AZGAC7mLM81zgOTQAAAABJRU5ErkJggg==)}.consola-container .consola-wrap .method.method-warn{position:relative;display:flex;color:#ffdc9e;background-color:#332b00;border-top:1px solid #650;border-bottom:1px solid #650;margin-top:-1px;margin-bottom:1px;padding-left:10px;box-sizing:border-box}.consola-container .consola-wrap .method.method-warn .method-icon{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACkSURBVChTbY7BCoJQFERn0Q/3BX1JuxQjsSCXiV8gtCgxhCIrKIRIqKDVzXl5w5cNHBjm6eGinXiAXu5inY2xYm/mbpIh+vcFhLA3sx0athNUhymEsP+10lAEEA17x8o/9wFuNGnYuVlWve0SQl7P0sBu3aq2R1Q/1JzSkYGd29eqNv2wjdnUuvNRciC/N+qe+7gidbA8zyHkOINsvA/sumcOkjcabcBmw2+mMgAAAABJRU5ErkJggg==)}.consola-container .consola-wrap .method.method-error{position:relative;display:flex;color:#ff8080;background-color:#290000;border-top:1px solid #5b0000;border-bottom:1px solid #5b0000;margin-top:-1px;margin-bottom:1px;padding-left:10px;box-sizing:border-box}.consola-container .consola-wrap .method.method-error .method-icon{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADESURBVChTY4CB7ZI8tmfU5E6e01b+DMIgNkgMKg0BR9Vkux6YWPx/bemIgkFiIDmwogOaqrYPzazAEm8DwuGKYGyQHEgNw0VT05Mwib9v3v7/kJEHxiA2TDFIDcNNU4vPMFPACj58/P/v40cwGyYOUsNwy8IZRSFIEUgxskKQGoZrzp4ErQapYbgYHG371M4dLACTQGaD5EBqwD6/FpzQ9dTBE64IhkFiIDmwIhi4mlJqey8o4eR9r8jPIAxig8QgsgwMAFZz1YtGPXgjAAAAAElFTkSuQmCC)}.consola-container .consola-wrap .method.method-debug{position:relative;display:flex;color:#4d88ff;background-color:transparent;border-top:1px solid hsla(0,0%,100%,.05);border-bottom:1px solid hsla(0,0%,100%,.05);margin-top:-1px;margin-bottom:0;padding-left:10px;box-sizing:border-box}.consola-container .consola-wrap .method.method-debug .method-icon{background-image:url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 459 459'%3e%3cpath fill='%234D88FF' d='M433.5 127.5h-71.4a177.7 177.7 0 0 0-45.9-51L357 35.7 321.3 0l-56.1 56.1c-10.2-2.6-23-5.1-35.7-5.1s-25.5 2.5-35.7 5.1L137.7 0 102 35.7l40.8 40.8a177.7 177.7 0 0 0-45.9 51H25.5v51H79c-2.5 7.7-2.5 17.9-2.5 25.5v25.5h-51v51h51V306a88 88 0 0 0 2.5 25.5H25.5v51h71.4A152.2 152.2 0 0 0 229.5 459c56.1 0 107.1-30.6 132.6-76.5h71.4v-51H380c2.5-7.7 2.5-17.9 2.5-25.5v-25.5h51v-51h-51V204c0-7.7 0-17.9-2.5-25.5h53.5v-51zm-153 204h-102v-51h102v51zm0-102h-102v-51h102v51z'/%3e%3c/svg%3e")}.consola-container .consola-wrap .method *{vertical-align:top;box-sizing:border-box;font-family:Consolas,Lucida Console,Courier New,monospace;white-space:pre-wrap;font-size:12px}.consola-container .consola-wrap .method .method-icon{width:10px;height:18px;background-image:noLine truncated
|
||||
+5
-8
@@ -11,7 +11,6 @@
|
||||
<link rel="shortcut icon" href="./img/favicon.ico">
|
||||
<link rel="stylesheet" href="./css/normalize.css">
|
||||
<link rel="stylesheet" href="./css/app.css">
|
||||
<link rel="stylesheet" href="./css/consola.css">
|
||||
<link rel="stylesheet" href="./css/artplayer.css">
|
||||
</head>
|
||||
|
||||
@@ -22,17 +21,15 @@
|
||||
<div class="github">
|
||||
<a href="https://github.com/zhw2590582/artplayer">GITHUB</a>
|
||||
</div>
|
||||
<div id="video-wrap" class="video-wrap"></div>
|
||||
<div class="artplayer-wrap"></div>
|
||||
</div>
|
||||
<script src="./js/consola.js"></script>
|
||||
<script>
|
||||
consola.creat({
|
||||
size: '200px'
|
||||
});
|
||||
</script>
|
||||
<script src="./js/artplayer.js"></script>
|
||||
<script>
|
||||
var player = new Artplayer({
|
||||
container: document.querySelector('.artplayer-wrap'),
|
||||
});
|
||||
|
||||
console.log(player);
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
||||
+476
-230
@@ -1,247 +1,493 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@babel/runtime/helpers/classCallCheck'), require('@babel/runtime/helpers/createClass'), require('@babel/runtime/helpers/possibleConstructorReturn'), require('@babel/runtime/helpers/getPrototypeOf'), require('@babel/runtime/helpers/inherits')) :
|
||||
typeof define === 'function' && define.amd ? define(['exports', '@babel/runtime/helpers/classCallCheck', '@babel/runtime/helpers/createClass', '@babel/runtime/helpers/possibleConstructorReturn', '@babel/runtime/helpers/getPrototypeOf', '@babel/runtime/helpers/inherits'], factory) :
|
||||
(factory((global.artplayer = {}),global._classCallCheck,global._createClass,global._possibleConstructorReturn,global._getPrototypeOf,global._inherits));
|
||||
}(this, (function (exports,_classCallCheck,_createClass,_possibleConstructorReturn,_getPrototypeOf,_inherits) { 'use strict';
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(factory((global.artplayer = {})));
|
||||
}(this, (function (exports) { 'use strict';
|
||||
|
||||
_classCallCheck = _classCallCheck && _classCallCheck.hasOwnProperty('default') ? _classCallCheck['default'] : _classCallCheck;
|
||||
_createClass = _createClass && _createClass.hasOwnProperty('default') ? _createClass['default'] : _createClass;
|
||||
_possibleConstructorReturn = _possibleConstructorReturn && _possibleConstructorReturn.hasOwnProperty('default') ? _possibleConstructorReturn['default'] : _possibleConstructorReturn;
|
||||
_getPrototypeOf = _getPrototypeOf && _getPrototypeOf.hasOwnProperty('default') ? _getPrototypeOf['default'] : _getPrototypeOf;
|
||||
_inherits = _inherits && _inherits.hasOwnProperty('default') ? _inherits['default'] : _inherits;
|
||||
function _classCallCheck(instance, Constructor) {
|
||||
if (!(instance instanceof Constructor)) {
|
||||
throw new TypeError("Cannot call a class as a function");
|
||||
}
|
||||
}
|
||||
|
||||
function E () {
|
||||
// Keep this empty so it's easier to inherit from
|
||||
// (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
|
||||
var classCallCheck = _classCallCheck;
|
||||
|
||||
function _defineProperties(target, props) {
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var descriptor = props[i];
|
||||
descriptor.enumerable = descriptor.enumerable || false;
|
||||
descriptor.configurable = true;
|
||||
if ("value" in descriptor) descriptor.writable = true;
|
||||
Object.defineProperty(target, descriptor.key, descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) {
|
||||
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) _defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
}
|
||||
|
||||
var createClass = _createClass;
|
||||
|
||||
function createCommonjsModule(fn, module) {
|
||||
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
||||
}
|
||||
|
||||
var _typeof_1 = createCommonjsModule(function (module) {
|
||||
function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
|
||||
|
||||
function _typeof(obj) {
|
||||
if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") {
|
||||
module.exports = _typeof = function _typeof(obj) {
|
||||
return _typeof2(obj);
|
||||
};
|
||||
} else {
|
||||
module.exports = _typeof = function _typeof(obj) {
|
||||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
|
||||
};
|
||||
}
|
||||
|
||||
E.prototype = {
|
||||
on: function (name, callback, ctx) {
|
||||
var e = this.e || (this.e = {});
|
||||
return _typeof(obj);
|
||||
}
|
||||
|
||||
(e[name] || (e[name] = [])).push({
|
||||
fn: callback,
|
||||
ctx: ctx
|
||||
module.exports = _typeof;
|
||||
});
|
||||
|
||||
function _assertThisInitialized(self) {
|
||||
if (self === void 0) {
|
||||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
var assertThisInitialized = _assertThisInitialized;
|
||||
|
||||
function _possibleConstructorReturn(self, call) {
|
||||
if (call && (_typeof_1(call) === "object" || typeof call === "function")) {
|
||||
return call;
|
||||
}
|
||||
|
||||
return assertThisInitialized(self);
|
||||
}
|
||||
|
||||
var possibleConstructorReturn = _possibleConstructorReturn;
|
||||
|
||||
var getPrototypeOf = createCommonjsModule(function (module) {
|
||||
function _getPrototypeOf(o) {
|
||||
module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
||||
return o.__proto__ || Object.getPrototypeOf(o);
|
||||
};
|
||||
return _getPrototypeOf(o);
|
||||
}
|
||||
|
||||
module.exports = _getPrototypeOf;
|
||||
});
|
||||
|
||||
var setPrototypeOf = createCommonjsModule(function (module) {
|
||||
function _setPrototypeOf(o, p) {
|
||||
module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
||||
o.__proto__ = p;
|
||||
return o;
|
||||
};
|
||||
|
||||
return _setPrototypeOf(o, p);
|
||||
}
|
||||
|
||||
module.exports = _setPrototypeOf;
|
||||
});
|
||||
|
||||
function _inherits(subClass, superClass) {
|
||||
if (typeof superClass !== "function" && superClass !== null) {
|
||||
throw new TypeError("Super expression must either be null or a function");
|
||||
}
|
||||
|
||||
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
||||
constructor: {
|
||||
value: subClass,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
if (superClass) setPrototypeOf(subClass, superClass);
|
||||
}
|
||||
|
||||
var inherits = _inherits;
|
||||
|
||||
function E () {
|
||||
// Keep this empty so it's easier to inherit from
|
||||
// (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
|
||||
}
|
||||
|
||||
E.prototype = {
|
||||
on: function (name, callback, ctx) {
|
||||
var e = this.e || (this.e = {});
|
||||
|
||||
(e[name] || (e[name] = [])).push({
|
||||
fn: callback,
|
||||
ctx: ctx
|
||||
});
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
once: function (name, callback, ctx) {
|
||||
var self = this;
|
||||
function listener () {
|
||||
self.off(name, listener);
|
||||
callback.apply(ctx, arguments);
|
||||
}
|
||||
listener._ = callback;
|
||||
return this.on(name, listener, ctx);
|
||||
},
|
||||
|
||||
emit: function (name) {
|
||||
var data = [].slice.call(arguments, 1);
|
||||
var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
|
||||
var i = 0;
|
||||
var len = evtArr.length;
|
||||
|
||||
for (i; i < len; i++) {
|
||||
evtArr[i].fn.apply(evtArr[i].ctx, data);
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
off: function (name, callback) {
|
||||
var e = this.e || (this.e = {});
|
||||
var evts = e[name];
|
||||
var liveEvents = [];
|
||||
|
||||
if (evts && callback) {
|
||||
for (var i = 0, len = evts.length; i < len; i++) {
|
||||
if (evts[i].fn !== callback && evts[i].fn._ !== callback)
|
||||
liveEvents.push(evts[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove event from queue to prevent memory leak
|
||||
// Suggested by https://github.com/lazd
|
||||
// Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
|
||||
|
||||
(liveEvents.length)
|
||||
? e[name] = liveEvents
|
||||
: delete e[name];
|
||||
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
var tinyEmitter = E;
|
||||
|
||||
function _isNativeFunction(fn) {
|
||||
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
||||
}
|
||||
|
||||
var isNativeFunction = _isNativeFunction;
|
||||
|
||||
var construct = createCommonjsModule(function (module) {
|
||||
function isNativeReflectConstruct() {
|
||||
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
||||
if (Reflect.construct.sham) return false;
|
||||
if (typeof Proxy === "function") return true;
|
||||
|
||||
try {
|
||||
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function _construct(Parent, args, Class) {
|
||||
if (isNativeReflectConstruct()) {
|
||||
module.exports = _construct = Reflect.construct;
|
||||
} else {
|
||||
module.exports = _construct = function _construct(Parent, args, Class) {
|
||||
var a = [null];
|
||||
a.push.apply(a, args);
|
||||
var Constructor = Function.bind.apply(Parent, a);
|
||||
var instance = new Constructor();
|
||||
if (Class) setPrototypeOf(instance, Class.prototype);
|
||||
return instance;
|
||||
};
|
||||
}
|
||||
|
||||
return _construct.apply(null, arguments);
|
||||
}
|
||||
|
||||
module.exports = _construct;
|
||||
});
|
||||
|
||||
var wrapNativeSuper = createCommonjsModule(function (module) {
|
||||
function _wrapNativeSuper(Class) {
|
||||
var _cache = typeof Map === "function" ? new Map() : undefined;
|
||||
|
||||
module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) {
|
||||
if (Class === null || !isNativeFunction(Class)) return Class;
|
||||
|
||||
if (typeof Class !== "function") {
|
||||
throw new TypeError("Super expression must either be null or a function");
|
||||
}
|
||||
|
||||
if (typeof _cache !== "undefined") {
|
||||
if (_cache.has(Class)) return _cache.get(Class);
|
||||
|
||||
_cache.set(Class, Wrapper);
|
||||
}
|
||||
|
||||
function Wrapper() {
|
||||
return construct(Class, arguments, getPrototypeOf(this).constructor);
|
||||
}
|
||||
|
||||
Wrapper.prototype = Object.create(Class.prototype, {
|
||||
constructor: {
|
||||
value: Wrapper,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return setPrototypeOf(Wrapper, Class);
|
||||
};
|
||||
|
||||
return _wrapNativeSuper(Class);
|
||||
}
|
||||
|
||||
module.exports = _wrapNativeSuper;
|
||||
});
|
||||
|
||||
var ArtPlayerError =
|
||||
/*#__PURE__*/
|
||||
function (_Error) {
|
||||
inherits(ArtPlayerError, _Error);
|
||||
|
||||
function ArtPlayerError(message) {
|
||||
var _this;
|
||||
|
||||
classCallCheck(this, ArtPlayerError);
|
||||
|
||||
_this = possibleConstructorReturn(this, getPrototypeOf(ArtPlayerError).call(this, message));
|
||||
Error.captureStackTrace(assertThisInitialized(assertThisInitialized(_this)), _this.constructor);
|
||||
_this.name = 'ArtPlayerError';
|
||||
return _this;
|
||||
}
|
||||
|
||||
return ArtPlayerError;
|
||||
}(wrapNativeSuper(Error));
|
||||
|
||||
function verification$$1(option) {
|
||||
console.log(option);
|
||||
}
|
||||
|
||||
var ZHCN = {};
|
||||
|
||||
var ZHTW = {};
|
||||
|
||||
var EN = {};
|
||||
|
||||
var JP = {};
|
||||
|
||||
var i18nMap = {
|
||||
zh: ZHCN,
|
||||
'zh-cn': ZHCN,
|
||||
'zh-tw': ZHTW,
|
||||
en: EN,
|
||||
jp: JP
|
||||
};
|
||||
|
||||
var I18n =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function I18n(_ref) {
|
||||
var option = _ref.option;
|
||||
|
||||
classCallCheck(this, I18n);
|
||||
|
||||
this.language = i18nMap[option.lang.toLowerCase()] || i18nMap.en;
|
||||
}
|
||||
|
||||
createClass(I18n, [{
|
||||
key: "get",
|
||||
value: function get(key) {
|
||||
return this.language[key] || key;
|
||||
}
|
||||
}]);
|
||||
|
||||
return I18n;
|
||||
}();
|
||||
|
||||
var Player = function Player(_ref) {//
|
||||
|
||||
var option = _ref.option;
|
||||
|
||||
classCallCheck(this, Player);
|
||||
};
|
||||
|
||||
var Controls = function Controls(_ref) {//
|
||||
|
||||
var option = _ref.option;
|
||||
|
||||
classCallCheck(this, Controls);
|
||||
};
|
||||
|
||||
var Contextmenu = function Contextmenu(_ref) {//
|
||||
|
||||
var option = _ref.option;
|
||||
|
||||
classCallCheck(this, Contextmenu);
|
||||
};
|
||||
|
||||
var Danmu = function Danmu(_ref) {//
|
||||
|
||||
var option = _ref.option;
|
||||
|
||||
classCallCheck(this, Danmu);
|
||||
};
|
||||
|
||||
var Info = function Info(_ref) {//
|
||||
|
||||
var option = _ref.option;
|
||||
|
||||
classCallCheck(this, Info);
|
||||
};
|
||||
|
||||
var Captions = function Captions(_ref) {//
|
||||
|
||||
var option = _ref.option;
|
||||
|
||||
classCallCheck(this, Captions);
|
||||
};
|
||||
|
||||
var Events = function Events(_ref) {//
|
||||
|
||||
var option = _ref.option;
|
||||
|
||||
classCallCheck(this, Events);
|
||||
};
|
||||
|
||||
var Hotkey = function Hotkey(_ref) {//
|
||||
|
||||
var option = _ref.option;
|
||||
|
||||
classCallCheck(this, Hotkey);
|
||||
};
|
||||
|
||||
var id = 0;
|
||||
var instances = [];
|
||||
|
||||
var Artplayer =
|
||||
/*#__PURE__*/
|
||||
function (_Emitter) {
|
||||
inherits(Artplayer, _Emitter);
|
||||
|
||||
function Artplayer(option) {
|
||||
var _this;
|
||||
|
||||
classCallCheck(this, Artplayer);
|
||||
|
||||
_this = possibleConstructorReturn(this, getPrototypeOf(Artplayer).call(this));
|
||||
_this.option = Object.assign({}, Artplayer.DEFAULTS, option);
|
||||
verification$$1(_this.option);
|
||||
|
||||
_this.init();
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
createClass(Artplayer, [{
|
||||
key: "init",
|
||||
value: function init() {
|
||||
this.refs = {
|
||||
container: this.option.container
|
||||
};
|
||||
this.destroyEvents = [];
|
||||
this.i18n = new I18n(this);
|
||||
this.player = new Player(this);
|
||||
this.controls = new Controls(this);
|
||||
this.contextmenu = new Contextmenu(this);
|
||||
this.danmu = new Danmu(this);
|
||||
this.subtitle = new Captions(this);
|
||||
this.info = new Info(this);
|
||||
this.events = new Events(this);
|
||||
this.hotkey = new Hotkey(this);
|
||||
this.id = id++;
|
||||
instances.push(this);
|
||||
}
|
||||
}, {
|
||||
key: "destroy",
|
||||
value: function destroy() {
|
||||
this.destroyEvents.forEach(function (event) {
|
||||
return event.destroy();
|
||||
});
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
once: function (name, callback, ctx) {
|
||||
var self = this;
|
||||
function listener () {
|
||||
self.off(name, listener);
|
||||
callback.apply(ctx, arguments);
|
||||
}
|
||||
listener._ = callback;
|
||||
return this.on(name, listener, ctx);
|
||||
},
|
||||
|
||||
emit: function (name) {
|
||||
var data = [].slice.call(arguments, 1);
|
||||
var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
|
||||
var i = 0;
|
||||
var len = evtArr.length;
|
||||
|
||||
for (i; i < len; i++) {
|
||||
evtArr[i].fn.apply(evtArr[i].ctx, data);
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
off: function (name, callback) {
|
||||
var e = this.e || (this.e = {});
|
||||
var evts = e[name];
|
||||
var liveEvents = [];
|
||||
|
||||
if (evts && callback) {
|
||||
for (var i = 0, len = evts.length; i < len; i++) {
|
||||
if (evts[i].fn !== callback && evts[i].fn._ !== callback)
|
||||
liveEvents.push(evts[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove event from queue to prevent memory leak
|
||||
// Suggested by https://github.com/lazd
|
||||
// Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
|
||||
|
||||
(liveEvents.length)
|
||||
? e[name] = liveEvents
|
||||
: delete e[name];
|
||||
|
||||
return this;
|
||||
this.refs.container.innerHTML = '';
|
||||
instances.splice(instances.indexOf(this), 1);
|
||||
}
|
||||
};
|
||||
|
||||
var tinyEmitter = E;
|
||||
|
||||
function verification(option) {//
|
||||
}
|
||||
|
||||
var ZHCN = {};
|
||||
|
||||
var ZHTW = {};
|
||||
|
||||
var EN = {};
|
||||
|
||||
var JP = {};
|
||||
|
||||
var i18nMap = {
|
||||
"zh": ZHCN,
|
||||
"zh-CN": ZHCN,
|
||||
"zh-TW": ZHTW,
|
||||
"en": EN,
|
||||
"jp": JP
|
||||
};
|
||||
|
||||
var I18n =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function I18n(_ref) {
|
||||
var option = _ref.option;
|
||||
|
||||
_classCallCheck(this, I18n);
|
||||
|
||||
this.language = i18nMap[option.language] || i18nMap.en;
|
||||
}], [{
|
||||
key: "version",
|
||||
get: function get() {
|
||||
return '1.0.0';
|
||||
}
|
||||
|
||||
_createClass(I18n, [{
|
||||
key: "get",
|
||||
value: function get(key) {
|
||||
return this.language[key] || key;
|
||||
}
|
||||
}]);
|
||||
|
||||
return I18n;
|
||||
}();
|
||||
|
||||
var Player = function Player(_ref) {//
|
||||
|
||||
var option = _ref.option;
|
||||
|
||||
_classCallCheck(this, Player);
|
||||
};
|
||||
|
||||
var Controls = function Controls(_ref) {//
|
||||
|
||||
var option = _ref.option;
|
||||
|
||||
_classCallCheck(this, Controls);
|
||||
};
|
||||
|
||||
var Contextmenu = function Contextmenu(_ref) {//
|
||||
|
||||
var option = _ref.option;
|
||||
|
||||
_classCallCheck(this, Contextmenu);
|
||||
};
|
||||
|
||||
var Danmu = function Danmu(_ref) {//
|
||||
|
||||
var option = _ref.option;
|
||||
|
||||
_classCallCheck(this, Danmu);
|
||||
};
|
||||
|
||||
var Info = function Info(_ref) {//
|
||||
|
||||
var option = _ref.option;
|
||||
|
||||
_classCallCheck(this, Info);
|
||||
};
|
||||
|
||||
var Captions = function Captions(_ref) {//
|
||||
|
||||
var option = _ref.option;
|
||||
|
||||
_classCallCheck(this, Captions);
|
||||
};
|
||||
|
||||
var Events = function Events(_ref) {//
|
||||
|
||||
var option = _ref.option;
|
||||
|
||||
_classCallCheck(this, Events);
|
||||
};
|
||||
|
||||
var Hotkey = function Hotkey(_ref) {//
|
||||
|
||||
var option = _ref.option;
|
||||
|
||||
_classCallCheck(this, Hotkey);
|
||||
};
|
||||
|
||||
var id = 0;
|
||||
var instances = [];
|
||||
|
||||
var Artplayer =
|
||||
/*#__PURE__*/
|
||||
function (_Emitter) {
|
||||
_inherits(Artplayer, _Emitter);
|
||||
|
||||
function Artplayer(option) {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, Artplayer);
|
||||
|
||||
_this = _possibleConstructorReturn(this, _getPrototypeOf(Artplayer).call(this));
|
||||
_this.option = Object.assign({}, Artplayer.DEFAULTS, option);
|
||||
verification(_this.option);
|
||||
|
||||
_this.init();
|
||||
|
||||
return _this;
|
||||
}, {
|
||||
key: "DEFAULTS",
|
||||
get: function get() {
|
||||
return {
|
||||
container: document.querySelector('.artplayer'),
|
||||
live: false,
|
||||
autoplay: false,
|
||||
theme: '#b7daff',
|
||||
loop: false,
|
||||
lang: navigator.language.toLowerCase(),
|
||||
screenshot: false,
|
||||
hotkey: true,
|
||||
preload: 'auto',
|
||||
volume: 0.7,
|
||||
logo: '',
|
||||
apiBackend: '',
|
||||
video: {
|
||||
quality: '',
|
||||
defaultQuality: '',
|
||||
url: '',
|
||||
pic: '',
|
||||
thumbnails: '',
|
||||
type: 'auto',
|
||||
customType: ''
|
||||
},
|
||||
subtitle: {
|
||||
url: '',
|
||||
type: 'webvtt',
|
||||
fontSize: '20px',
|
||||
bottom: '40px',
|
||||
color: '#fff'
|
||||
},
|
||||
danmaku: {
|
||||
id: '',
|
||||
api: '',
|
||||
token: '',
|
||||
maximum: '',
|
||||
addition: '',
|
||||
user: '',
|
||||
bottom: '',
|
||||
unlimited: ''
|
||||
},
|
||||
contextmenu: [],
|
||||
highlight: [],
|
||||
mutex: true
|
||||
};
|
||||
}
|
||||
}]);
|
||||
|
||||
_createClass(Artplayer, [{
|
||||
key: "init",
|
||||
value: function init() {
|
||||
this.refs = {};
|
||||
this.destroyEvents = [];
|
||||
this.i18n = new I18n(this);
|
||||
this.player = new Player(this);
|
||||
this.controls = new Controls(this);
|
||||
this.contextmenu = new Contextmenu(this);
|
||||
this.danmu = new Danmu(this);
|
||||
this.captions = new Captions(this);
|
||||
this.info = new Info(this);
|
||||
this.events = new Events(this);
|
||||
this.hotkey = new Hotkey(this);
|
||||
this.id = id++;
|
||||
instances.push(this);
|
||||
console.log(this);
|
||||
}
|
||||
}, {
|
||||
key: "destroy",
|
||||
value: function destroy() {
|
||||
this.destroyEvents.forEach(function (event) {
|
||||
return event.destroy();
|
||||
});
|
||||
this.refs.container.innerHTML = "";
|
||||
}
|
||||
}], [{
|
||||
key: "version",
|
||||
get: function get() {
|
||||
return "1.0.0";
|
||||
}
|
||||
}, {
|
||||
key: "DEFAULTS",
|
||||
get: function get() {
|
||||
return {//
|
||||
};
|
||||
}
|
||||
}]);
|
||||
return Artplayer;
|
||||
}(tinyEmitter);
|
||||
|
||||
return Artplayer;
|
||||
}(tinyEmitter);
|
||||
window.Artplayer = Artplayer;
|
||||
|
||||
window.Artplayer = Artplayer;
|
||||
exports.instances = instances;
|
||||
exports.default = Artplayer;
|
||||
|
||||
exports.instances = instances;
|
||||
exports.default = Artplayer;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
})));
|
||||
//# sourceMappingURL=artplayer.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"artplayer.js","sources":["../../node_modules/tiny-emitter/index.js","../../src/utils/verification.js","../../src/i18n/zh-CN.js","../../src/i18n/zh-TW.js","../../src/i18n/en.js","../../src/i18n/jp.js","../../src/i18n/index.js","../../src/player.js","../../src/controls/index.js","../../src/contextmenu.js","../../src/danmu.js","../../src/info.js","../../src/captions.js","../../src/events.js","../../src/hotkey.js","../../src/index.js"],"sourcesContent":["function E () {\n // Keep this empty so it's easier to inherit from\n // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)\n}\n\nE.prototype = {\n on: function (name, callback, ctx) {\n var e = this.e || (this.e = {});\n\n (e[name] || (e[name] = [])).push({\n fn: callback,\n ctx: ctx\n });\n\n return this;\n },\n\n once: function (name, callback, ctx) {\n var self = this;\n function listener () {\n self.off(name, listener);\n callback.apply(ctx, arguments);\n };\n\n listener._ = callback\n return this.on(name, listener, ctx);\n },\n\n emit: function (name) {\n var data = [].slice.call(arguments, 1);\n var evtArr = ((this.e || (this.e = {}))[name] || []).slice();\n var i = 0;\n var len = evtArr.length;\n\n for (i; i < len; i++) {\n evtArr[i].fn.apply(evtArr[i].ctx, data);\n }\n\n return this;\n },\n\n off: function (name, callback) {\n var e = this.e || (this.e = {});\n var evts = e[name];\n var liveEvents = [];\n\n if (evts && callback) {\n for (var i = 0, len = evts.length; i < len; i++) {\n if (evts[i].fn !== callback && evts[i].fn._ !== callback)\n liveEvents.push(evts[i]);\n }\n }\n\n // Remove event from queue to prevent memory leak\n // Suggested by https://github.com/lazd\n // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910\n\n (liveEvents.length)\n ? e[name] = liveEvents\n : delete e[name];\n\n return this;\n }\n};\n\nmodule.exports = E;\n","export function verification (option) {\n //\n}","export default {\n \n}","export default {\n \n}","export default {\n \n}","export default {\n \n}","import ZHCN from \"./zh-CN\";\nimport ZHTW from \"./zh-TW\";\nimport EN from \"./en\";\nimport JP from \"./jp\";\n\nconst i18nMap = {\n \"zh\": ZHCN,\n \"zh-CN\": ZHCN,\n \"zh-TW\": ZHTW,\n \"en\": EN,\n \"jp\": JP\n};\n\nexport default class I18n {\n constructor({ option }) {\n this.language = i18nMap[option.language] || i18nMap.en;\n }\n\n get(key) {\n return this.language[key] || key;\n }\n}\n","export default class Player {\n constructor({ option }) {\n //\n }\n}\n","export default class Controls {\n constructor({ option }) {\n //\n }\n}\n","export default class Contextmenu {\n constructor({ option }) {\n //\n }\n}\n","export default class Danmu {\n constructor({ option }) {\n //\n }\n}\n","export default class Info {\n constructor({ option }) {\n //\n }\n}\n","export default class Captions {\n constructor({ option }) {\n //\n }\n}\n","export default class Events {\n constructor({ option }) {\n //\n }\n}\n","export default class Hotkey {\n constructor({ option }) {\n //\n }\n}\n","import \"./style/index.scss\";\nimport Emitter from 'tiny-emitter';\nimport { verification } from \"./utils\";\nimport I18n from \"./i18n\";\nimport Player from \"./player\";\nimport Controls from \"./controls\";\nimport Contextmenu from \"./contextmenu\";\nimport Danmu from \"./danmu\";\nimport Info from \"./info\";\nimport Captions from \"./captions\";\nimport Events from \"./events\";\nimport Hotkey from \"./hotkey\";\n\nlet id = 0;\nexport const instances = [];\n\nclass Artplayer extends Emitter {\n constructor(option) {\n super();\n this.option = Object.assign({}, Artplayer.DEFAULTS, option);\n verification(this.option);\n this.init();\n }\n\n static get version() {\n return \"__VERSION__\";\n }\n\n static get DEFAULTS() {\n return {\n //\n };\n }\n\n init() {\n this.refs = {};\n this.destroyEvents = [];\n\n this.i18n = new I18n(this);\n this.player = new Player(this);\n this.controls = new Controls(this);\n this.contextmenu = new Contextmenu(this);\n this.danmu = new Danmu(this);\n this.captions = new Captions(this);\n this.info = new Info(this);\n this.events = new Events(this);\n this.hotkey = new Hotkey(this);\n\n this.id = id++;\n instances.push(this);\n\n console.log(this);\n }\n\n destroy() {\n this.destroyEvents.forEach(event => event.destroy());\n this.refs.container.innerHTML = \"\";\n }\n}\n\nwindow.Artplayer = Artplayer;\nexport default Artplayer;\n"],"names":["verification","option","i18nMap","ZHCN","ZHTW","EN","JP","I18n","language","en","key","Player","Controls","Contextmenu","Danmu","Info","Captions","Events","Hotkey","id","instances","ArLine truncated
|
||||
{"version":3,"file":"artplayer.js","sources":["../../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/setPrototypeOf.js","../../node_modules/@babel/runtime/helpers/inherits.js","../../node_modules/tiny-emitter/index.js","../../node_modules/@babel/runtime/helpers/isNativeFunction.js","../../node_modules/@babel/runtime/helpers/construct.js","../../node_modules/@babel/runtime/helpers/wrapNativeSuper.js","../../src/utils/ArtPlayerError.js","../../src/utils/verification.js","../../src/i18n/zh-CN.js","../../src/i18n/zh-TW.js","../../src/i18n/en.js","../../src/i18n/jp.js","../../src/i18n/index.js","../../src/player.js","../../src/controls/index.js","../../src/contextmenu.js","../../src/danmu.js","../../src/info.js","../../src/subtitle.js","../../src/events.js","../../src/hotkey.js","../../src/index.js"],"sourcesContent":["function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","function _typeof2(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof2(obj); }\n\nfunction _typeof(obj) {\n if (typeof Symbol === \"function\" && _typeof2(Symbol.iterator) === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return _typeof2(obj);\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : _typeof2(obj);\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;","function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized;","var _typeof = require(\"../helpers/typeof\");\n\nvar assertThisInitialized = require(\"./assertThisInitialized\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn;","function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf;","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 _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits;","function E () {\n // Keep this empty so it's easier to inherit from\n // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)\n}\n\nE.prototype = {\n on: function (name, callback, ctx) {\n var e = this.e || (this.e = {});\n\n (e[name] || (e[name] = [])).push({\n fn: callback,\n ctx: ctx\n });\n\n return this;\n },\n\n once: function (name, callback, ctx) {\n var self = this;\n function listener () {\Line truncated
|
||||
@@ -1 +0,0 @@
|
||||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(window,function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t,n){"use strict";function o(e){for(var t=e.length,n=[],o=0;o<t;o+=1)n.push(e[o]);return n}e.exports={select:function(e){return document.querySelector(e)},selectAll:function(e){return o((arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelectorAll(e))},find:function(e,t){return o(e.querySelectorAll(t))},removeClass:function(e,t){e.classList.remove(t)},addClass:function(e,t){e.classList.add(t)},hasClass:function(e,t){return e.classList.contains(t)},removeElement:function(e){e&&e.parentNode&&e.parentNode.removeChild(e)},closest:function(e,t){for(var n=e.matches||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector;e&&!n.call(e,t);)e=e.parentElement;return e},getStyle:function(e,t,n){var o=window.getComputedStyle(e,null).getPropertyValue(t);return n?Number.parseFloat(o,10):o},blur:function(){document.activeElement&&document.activeElement.blur()},insertHtml:function(e,t,n){var o=["beforebegin","afterbegin","beforeend","afterend"];if(!o.includes(t))throw new TypeError("'position' must be one of them: "+o.join("、"));e.insertAdjacentHTML(t,n)},setAttributes:function(e,t){Object.keys(t).forEach(function(n){!1!==t[n]?e.setAttribute(n,t[n]):e.removeAttribute(n)})},setStyles:function(e,t){Object.keys(t).forEach(function(n){e.style[n]=t[n]})}}},,function(e,t,n){},function(e,t,n){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e};n(2);var i,c=(i=n(0))&&i.__esModule?i:{default:i},l={},u={target:"body",position:"bottom",size:"300px",zIndex:99},s=["log","warn","error","info","debug"],a=void 0,f=void 0,d=void 0;l.creat=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e=r({},u,e),!document.querySelector(".consola-container"))return a=document.querySelector(e.target),c.default.insertHtml(a,"beforeend",'<div class="consola-container '+e.position+'" style="z-index: '+e.zIndex+"; "+("bottom"===e.position?"height":"width")+": "+e.size+'">\n <div class="consola-tools">\n <div class="consola-count">Console <span>0</span></div>\n <div class="consola-clean">Clean</div>\n </div>\n <div class="consola-wrap"></div>\n </div>'),f=a.querySelector(".consola-wrap"),d=a.querySelector(".consola-count span"),a.querySelector(".consola-clean").addEventListener("click",l.clean),function(e,t,n){var o=function(t){var o=e[t];e[t]=function(){o.apply(this,arguments),n(t,[].concat(Array.prototype.slice.call(arguments)))}},r=!0,i=!1,c=void 0;try{for(var l,u=t[Symbol.iterator]();!(r=(l=u.next()).done);r=!0){o(l.value)}}catch(e){i=!0,c=e}finally{try{!r&&u.return&&u.return()}finally{if(i)throw c}}}(window.console,s,function(e,t){c.default.insertHtml(f,"beforeend",'<div data-method="'+e+'" class="method method-'+e+'">\n <div class="method-icon"></div>\n <div class="method-text">'+function(e){var t=document.createElement("div");e=e.map(function(e){return"object"===(void 0===e?"undefined":o(e))?function e(t,n){if(null==t)return String(t);switch(void 0===t?"undefined":o(t)){case"string":return'"'+t+'"';case"function":return t.toString();case"object":var r=Array.isArray(t);return"{["[+r]+Object.keys(t).map(function(o){return o+": "+e(t[o],(n||1)+1)}).join(",")+"}]"[+r];default:return t.toString()}}(e):e}),null!=t.textContent?t.textContent=e:t.innerText=e;var n=t.innerHTML;return t=null,n}(t)+"</div>\n </div>"),d.innerHTML=f.children.length,f.scrollTo(0,f.scrollHeight)}),l},l.clean=function(){return f.innerHTML="",d.innerHTML="0",l},window.consola=l,e.exports=l}])});
|
||||
@@ -27,6 +27,7 @@
|
||||
"@babel/plugin-external-helpers": "^7.0.0",
|
||||
"@babel/plugin-transform-runtime": "^7.1.0",
|
||||
"@babel/preset-env": "^7.1.0",
|
||||
"@babel/runtime": "^7.1.2",
|
||||
"autoprefixer": "^9.1.5",
|
||||
"cross-env": "^5.2.0",
|
||||
"cssnano": "^4.1.4",
|
||||
|
||||
+27
-22
@@ -1,40 +1,45 @@
|
||||
const babel = require("rollup-plugin-babel");
|
||||
const commonjs = require("rollup-plugin-commonjs");
|
||||
const nodeResolve = require("rollup-plugin-node-resolve");
|
||||
const postcss = require("rollup-plugin-postcss");
|
||||
const { eslint } = require("rollup-plugin-eslint");
|
||||
const autoprefixer = require("autoprefixer");
|
||||
const cssnano = require("cssnano");
|
||||
const replace = require("rollup-plugin-replace");
|
||||
const { uglify } = require("rollup-plugin-uglify");
|
||||
const version = require("./package.json").version;
|
||||
const isProd = process.env.NODE_ENV === "production";
|
||||
const babel = require('rollup-plugin-babel');
|
||||
const commonjs = require('rollup-plugin-commonjs');
|
||||
const nodeResolve = require('rollup-plugin-node-resolve');
|
||||
const postcss = require('rollup-plugin-postcss');
|
||||
const { eslint } = require('rollup-plugin-eslint');
|
||||
const autoprefixer = require('autoprefixer');
|
||||
const cssnano = require('cssnano');
|
||||
const replace = require('rollup-plugin-replace');
|
||||
const { uglify } = require('rollup-plugin-uglify');
|
||||
const { version } = require('./package.json');
|
||||
const isProd = process.env.NODE_ENV === 'production';
|
||||
|
||||
export default {
|
||||
input: "src/index.js",
|
||||
input: 'src/index.js',
|
||||
output: {
|
||||
name: "artplayer",
|
||||
file: isProd ? "dist/artplayer.js" : "docs/js/artplayer.js",
|
||||
format: "umd"
|
||||
name: 'artplayer',
|
||||
file: isProd ? 'dist/artplayer.js' : 'docs/js/artplayer.js',
|
||||
format: 'umd'
|
||||
},
|
||||
plugins: [
|
||||
eslint({
|
||||
exclude: [
|
||||
'node_modules/**',
|
||||
'docs/**'
|
||||
]
|
||||
}),
|
||||
postcss({
|
||||
plugins: [autoprefixer, cssnano],
|
||||
extract: isProd ? "dist/artplayer.css" : "docs/css/artplayer.css"
|
||||
extract: isProd ? 'dist/artplayer.css' : 'docs/css/artplayer.css'
|
||||
}),
|
||||
nodeResolve(),
|
||||
commonjs(),
|
||||
babel({
|
||||
runtimeHelpers: true,
|
||||
exclude: "node_modules/**",
|
||||
plugins: ["@babel/external-helpers", "@babel/transform-runtime"]
|
||||
exclude: 'node_modules/**',
|
||||
plugins: ['@babel/external-helpers', '@babel/transform-runtime']
|
||||
}),
|
||||
replace({
|
||||
exclude: "node_modules/**",
|
||||
__ENV__: JSON.stringify(process.env.NODE_ENV || "development"),
|
||||
exclude: 'node_modules/**',
|
||||
__ENV__: JSON.stringify(process.env.NODE_ENV || 'development'),
|
||||
__VERSION__: version
|
||||
}),
|
||||
isProd && uglify(),
|
||||
!isProd && eslint()
|
||||
isProd && uglify()
|
||||
]
|
||||
};
|
||||
+3
-3
@@ -5,15 +5,15 @@ import JP from './jp';
|
||||
|
||||
const i18nMap = {
|
||||
zh: ZHCN,
|
||||
'zh-CN': ZHCN,
|
||||
'zh-TW': ZHTW,
|
||||
'zh-cn': ZHCN,
|
||||
'zh-tw': ZHTW,
|
||||
en: EN,
|
||||
jp: JP
|
||||
};
|
||||
|
||||
export default class I18n {
|
||||
constructor({ option }) {
|
||||
this.language = i18nMap[option.language] || i18nMap.en;
|
||||
this.language = i18nMap[option.lang.toLowerCase()] || i18nMap.en;
|
||||
}
|
||||
|
||||
get(key) {
|
||||
|
||||
+48
-6
@@ -7,7 +7,7 @@ import Controls from './controls';
|
||||
import Contextmenu from './contextmenu';
|
||||
import Danmu from './danmu';
|
||||
import Info from './info';
|
||||
import Captions from './captions';
|
||||
import Subtitle from './subtitle';
|
||||
import Events from './events';
|
||||
import Hotkey from './hotkey';
|
||||
|
||||
@@ -28,12 +28,55 @@ class Artplayer extends Emitter {
|
||||
|
||||
static get DEFAULTS() {
|
||||
return {
|
||||
//
|
||||
container: document.querySelector('.artplayer'),
|
||||
live: false,
|
||||
autoplay: false,
|
||||
theme: '#b7daff',
|
||||
loop: false,
|
||||
lang: navigator.language.toLowerCase(),
|
||||
screenshot: false,
|
||||
hotkey: true,
|
||||
preload: 'auto',
|
||||
volume: 0.7,
|
||||
logo: '',
|
||||
apiBackend: '',
|
||||
video: {
|
||||
quality: '',
|
||||
defaultQuality: '',
|
||||
url: '',
|
||||
pic: '',
|
||||
thumbnails: '',
|
||||
type: 'auto',
|
||||
customType: ''
|
||||
},
|
||||
subtitle: {
|
||||
url: '',
|
||||
type: 'webvtt',
|
||||
fontSize: '20px',
|
||||
bottom: '40px',
|
||||
color: '#fff'
|
||||
},
|
||||
danmaku: {
|
||||
id: '',
|
||||
api: '',
|
||||
token: '',
|
||||
maximum: '',
|
||||
addition: '',
|
||||
user: '',
|
||||
bottom: '',
|
||||
unlimited: ''
|
||||
},
|
||||
contextmenu: [],
|
||||
highlight: [],
|
||||
mutex: true
|
||||
};
|
||||
}
|
||||
|
||||
init() {
|
||||
this.refs = {};
|
||||
this.refs = {
|
||||
container: this.option.container
|
||||
};
|
||||
|
||||
this.destroyEvents = [];
|
||||
|
||||
this.i18n = new I18n(this);
|
||||
@@ -41,20 +84,19 @@ class Artplayer extends Emitter {
|
||||
this.controls = new Controls(this);
|
||||
this.contextmenu = new Contextmenu(this);
|
||||
this.danmu = new Danmu(this);
|
||||
this.captions = new Captions(this);
|
||||
this.subtitle = new Subtitle(this);
|
||||
this.info = new Info(this);
|
||||
this.events = new Events(this);
|
||||
this.hotkey = new Hotkey(this);
|
||||
|
||||
this.id = id++;
|
||||
instances.push(this);
|
||||
|
||||
console.log(this);
|
||||
}
|
||||
|
||||
destroy() {
|
||||
this.destroyEvents.forEach(event => event.destroy());
|
||||
this.refs.container.innerHTML = '';
|
||||
instances.splice(instances.indexOf(this), 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File renamed without changes.
@@ -0,0 +1,7 @@
|
||||
export default class ArtPlayerError extends Error {
|
||||
constructor(message) {
|
||||
super(message);
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
this.name = 'ArtPlayerError';
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -1 +1,8 @@
|
||||
import ArtPlayerError from './ArtPlayerError';
|
||||
export * from './verification';
|
||||
|
||||
export function errorHandle(condition, msg) {
|
||||
if (!condition) {
|
||||
throw new ArtPlayerError(msg);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
import { errorHandle } from './index';
|
||||
|
||||
export function verification(option) {
|
||||
//
|
||||
console.log(option);
|
||||
}
|
||||
Reference in new issue
Block a user