mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-14 08:26:16 -08:00
add esline
This commit is contained in:
1 parent
5db0050584
commit
70864abf44
17 files changed
+528
-31
No files matched your search
+242
-5
@@ -1,10 +1,247 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(factory());
|
||||
}(this, (function () { 'use strict';
|
||||
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';
|
||||
|
||||
console.log("test");
|
||||
_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 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 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;
|
||||
}
|
||||
|
||||
_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;
|
||||
}
|
||||
|
||||
_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);
|
||||
|
||||
window.Artplayer = Artplayer;
|
||||
|
||||
exports.instances = instances;
|
||||
exports.default = Artplayer;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
})));
|
||||
//# sourceMappingURL=artplayer.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"artplayer.js","sources":["../../src/index.js"],"sourcesContent":["import \"./style/index.scss\";\n\nconsole.log(\"test\");"],"names":["console","log"],"mappings":";;;;;;IAEAA,OAAO,CAACC,GAAR,CAAY,MAAZ;;;;"}
|
||||
{"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
|
||||
Reference in new issue
Block a user