mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-29 02:51:20 -08:00
add files
This commit is contained in:
1 parent
ed55ae31d8
commit
5db0050584
15 files changed
+90
-5
No files matched your search
@@ -35,9 +35,13 @@
|
|||||||
"rollup": "^0.66.5",
|
"rollup": "^0.66.5",
|
||||||
"rollup-plugin-babel": "^4.0.3",
|
"rollup-plugin-babel": "^4.0.3",
|
||||||
"rollup-plugin-commonjs": "^9.2.0",
|
"rollup-plugin-commonjs": "^9.2.0",
|
||||||
|
"rollup-plugin-eslint": "^5.0.0",
|
||||||
"rollup-plugin-node-resolve": "^3.4.0",
|
"rollup-plugin-node-resolve": "^3.4.0",
|
||||||
"rollup-plugin-postcss": "^1.6.2",
|
"rollup-plugin-postcss": "^1.6.2",
|
||||||
"rollup-plugin-replace": "^2.1.0",
|
"rollup-plugin-replace": "^2.1.0",
|
||||||
"rollup-plugin-uglify": "^6.0.0"
|
"rollup-plugin-uglify": "^6.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"tiny-emitter": "^2.0.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-1
@@ -2,6 +2,7 @@ const babel = require("rollup-plugin-babel");
|
|||||||
const commonjs = require("rollup-plugin-commonjs");
|
const commonjs = require("rollup-plugin-commonjs");
|
||||||
const nodeResolve = require("rollup-plugin-node-resolve");
|
const nodeResolve = require("rollup-plugin-node-resolve");
|
||||||
const postcss = require("rollup-plugin-postcss");
|
const postcss = require("rollup-plugin-postcss");
|
||||||
|
const { eslint } = require("rollup-plugin-eslint");
|
||||||
const autoprefixer = require("autoprefixer");
|
const autoprefixer = require("autoprefixer");
|
||||||
const cssnano = require("cssnano");
|
const cssnano = require("cssnano");
|
||||||
const replace = require("rollup-plugin-replace");
|
const replace = require("rollup-plugin-replace");
|
||||||
@@ -33,6 +34,7 @@ export default {
|
|||||||
__ENV__: JSON.stringify(process.env.NODE_ENV || "development"),
|
__ENV__: JSON.stringify(process.env.NODE_ENV || "development"),
|
||||||
__VERSION__: version
|
__VERSION__: version
|
||||||
}),
|
}),
|
||||||
isProd && uglify()
|
isProd && uglify(),
|
||||||
|
!isProd && eslint()
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
File renamed without changes.
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1,3 @@
|
|||||||
|
export default {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import ZHCN from "./zh-CN";
|
||||||
|
import ZHTW from "./zh-TW";
|
||||||
|
import EN from "./en";
|
||||||
|
import JP from "./jp";
|
||||||
|
|
||||||
|
const i18nMap = {
|
||||||
|
"zh": ZHCN,
|
||||||
|
"zh-CN": ZHCN,
|
||||||
|
"zh-TW": ZHTW,
|
||||||
|
"en": EN,
|
||||||
|
"jp": JP
|
||||||
|
};
|
||||||
|
|
||||||
|
export default class I18n {
|
||||||
|
constructor({ option }) {
|
||||||
|
this.language = i18nMap[option.language || "en"];
|
||||||
|
}
|
||||||
|
|
||||||
|
get(key) {
|
||||||
|
return this.language[key] || key;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export default {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export default {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export default {
|
||||||
|
|
||||||
|
}
|
||||||
Whitespace-only changes.
+49
-4
@@ -1,17 +1,62 @@
|
|||||||
import "./style/index.scss";
|
import "./style/index.scss";
|
||||||
|
import Emitter from 'tiny-emitter';
|
||||||
|
import { verification } from "./utils";
|
||||||
|
import I18n from "./i18n";
|
||||||
|
import Player from "./player";
|
||||||
|
import Controls from "./controls";
|
||||||
|
import Screenshot from "./screenshot";
|
||||||
|
import Contextmenu from "./contextmenu";
|
||||||
|
import Danmu from "./danmu";
|
||||||
|
import Info from "./info";
|
||||||
|
import Captions from "./captions";
|
||||||
|
import Events from "./events";
|
||||||
|
import Hotkey from "./hotkey";
|
||||||
|
|
||||||
class Artplayer {
|
let id = 0;
|
||||||
|
export const instances = [];
|
||||||
|
|
||||||
|
class Artplayer extends Emitter {
|
||||||
constructor(option) {
|
constructor(option) {
|
||||||
//
|
super();
|
||||||
|
this.option = Object.assign({}, Artplayer.DEFAULTS, option);
|
||||||
|
verification(this.option);
|
||||||
|
this.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
static get version() {
|
static get version() {
|
||||||
return __VERSION__;
|
return "__VERSION__";
|
||||||
}
|
}
|
||||||
|
|
||||||
static get DEFAULTS() {
|
static get DEFAULTS() {
|
||||||
return {
|
return {
|
||||||
//
|
//
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
init() {
|
||||||
|
this.refs = {};
|
||||||
|
this.destroyEvents = [];
|
||||||
|
|
||||||
|
this.i18n = new I18n(this);
|
||||||
|
this.player = new Player(this);
|
||||||
|
this.controls = new Controls(this);
|
||||||
|
this.screenshot = new Screenshot(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);
|
||||||
|
}
|
||||||
|
|
||||||
|
destroy() {
|
||||||
|
this.destroyEvents.forEach(event => event.destroy());
|
||||||
|
this.refs.container.innerHTML = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.Artplayer = Artplayer;
|
||||||
|
export default Artplayer;
|
||||||
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Reference in new issue
Block a user