add esline

This commit is contained in:
Harvey Zack committed 2018-10-11 12:16:57 +08:00
1 parent 5db0050584
commit 70864abf44
17 files changed
+528 -31

No files matched your search

+216
View File
@@ -0,0 +1,216 @@
{
"root": true,
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"globalReturn": true,
"impliedStrict": true
}
},
"env": {
"es6": true,
"amd": true,
"node": true,
"mocha": true,
"worker": true,
"jquery": true,
"browser": true,
"commonjs": true,
"serviceworker": true,
"shared-node-browser": true
},
"rules": {
"no-await-in-loop": 2,
"no-compare-neg-zero": 2,
"no-cond-assign": 2,
"no-console": 0,
"no-constant-condition": [2, { "checkLoops": false }],
"no-debugger": 2,
"no-dupe-args": 2,
"no-dupe-keys": 2,
"no-duplicate-case": 2,
"no-empty": 1,
"no-empty-character-class": 2,
"no-ex-assign": 2,
"no-extra-boolean-cast": 2,
"no-extra-parens": 2,
"no-extra-semi": 2,
"no-func-assign": 2,
"no-inner-declarations": 2,
"no-invalid-regexp": 2,
"no-irregular-whitespace": 2,
"no-obj-calls": 2,
"no-regex-spaces": 1,
"no-sparse-arrays": 2,
"no-template-curly-in-string": 2,
"no-unexpected-multiline": 2,
"no-unreachable": 2,
"no-unsafe-finally": 2,
"no-unsafe-negation": 2,
"use-isnan": 2,
"valid-jsdoc": [2, { "requireReturn": false }],
"valid-typeof": 2,
"accessor-pairs": 1,
"array-callback-return": 1,
"block-scoped-var": 1,
"class-methods-use-this": 0,
"curly": 1,
"default-case": 1,
"dot-location": [1, "property"],
"eqeqeq": [1, "smart"],
"guard-for-in": 1,
"no-alert": 2,
"no-caller": 1,
"no-div-regex": 1,
"no-else-return": 1,
"no-empty-function": 1,
"no-empty-pattern": 1,
"no-eq-null": 1,
"no-eval": 0,
"no-extend-native": 2,
"no-extra-bind": 1,
"no-extra-label": 1,
"no-fallthrough": 1,
"no-floating-decimal": 1,
"no-global-assign": 2,
"no-implicit-coercion": 1,
"no-implied-eval": 2,
"no-invalid-this": 1,
"no-iterator": 2,
"no-labels": 1,
"no-lone-blocks": 1,
"no-loop-func": 2,
"no-multi-spaces": 1,
"no-multi-str": 1,
"no-new-func": 0,
"no-new-wrappers": 1,
"no-octal": 1,
"no-octal-escape": 1,
"no-param-reassign": 1,
"no-proto": 1,
"no-redeclare": 1,
"no-return-assign": 1,
"no-return-await": 1,
"no-script-url": 2,
"no-self-assign": 1,
"no-self-compare": 1,
"no-sequences": 1,
"no-throw-literal": 1,
"no-unmodified-loop-condition": 1,
"no-unused-expressions": 0,
"no-unused-labels": 1,
"no-useless-call": 1,
"no-useless-concat": 1,
"no-useless-escape": 1,
"no-useless-return": 1,
"no-void": 1,
"no-with": 2,
"prefer-promise-reject-errors": 1,
"require-await": 2,
"vars-on-top": 1,
"wrap-iife": [1, "any"],
"yoda": 2,
"strict": 2,
"no-catch-shadow": 2,
"no-delete-var": 2,
"no-label-var": 2,
"no-shadow": 2,
"no-shadow-restricted-names": 2,
"no-undef": 2,
"no-undef-init": 2,
"no-undefined": 0,
"no-unused-vars": 2,
"no-use-before-define": 2,
"callback-return": 2,
"global-require": 1,
"handle-callback-err": 1,
"no-mixed-requires": [1, { "allowCall": true }],
"no-new-require": 2,
"no-path-concat": 2,
"no-process-env": 2,
"no-process-exit": 2,
"array-bracket-spacing": 1,
"block-spacing": 1,
"brace-style": 1,
"camelcase": 1,
"capitalized-comments": 0,
"comma-dangle": 1,
"comma-spacing": 1,
"comma-style": 1,
"computed-property-spacing": 1,
"consistent-this": [1, "that", "self"],
"eol-last": 1,
"func-call-spacing": 1,
"func-names": 1,
"indent": [1, 2, { "SwitchCase": 1 }],
"key-spacing": 1,
"keyword-spacing": 1,
"linebreak-style": 1,
"lines-around-comment": 1,
"new-cap": 0,
"new-parens": 1,
"no-array-constructor": 1,
"no-continue": 1,
"no-inline-comments": 1,
"no-mixed-spaces-and-tabs": 2,
"no-multi-assign": 1,
"no-multiple-empty-lines": 1,
"no-negated-condition": 0,
"no-nested-ternary": 2,
"no-new-object": 1,
"no-tabs": 2,
"no-trailing-spaces": 1,
"no-unneeded-ternary": 1,
"no-whitespace-before-property": 1,
"object-curly-spacing": 0,
"object-property-newline": [1, { "allowMultiplePropertiesPerLine": true }],
"one-var": [1, "never"],
"operator-assignment": 1,
"operator-linebreak": 1,
"padded-blocks": 0,
"quotes": [1, "single"],
"require-jsdoc": 2,
"semi": 1,
"semi-spacing": 1,
"space-before-blocks": 1,
"space-before-function-paren": [1, "never"],
"space-in-parens": 1,
"space-infix-ops": 1,
"space-unary-ops": [1, { "words": true, "nonwords": false }],
"spaced-comment": [1, "always"],
"wrap-regex": 1,
"arrow-body-style": 1,
"arrow-parens": 0,
"arrow-spacing": 1,
"constructor-super": 2,
"generator-star-spacing": 1,
"no-class-assign": 2,
"no-confusing-arrow": 2,
"no-const-assign": 2,
"no-dupe-class-members": 2,
"no-duplicate-imports": 2,
"no-new-symbol": 1,
"no-this-before-super": 2,
"no-useless-computed-key": 1,
"no-useless-constructor": 1,
"no-useless-rename": 1,
"no-var": 1,
"prefer-const": 1,
"prefer-destructuring": 1,
"prefer-spread": 1,
"prefer-template": 1,
"require-yield": 2,
"rest-spread-spacing": 1,
"symbol-description": 2,
"template-curly-spacing": 1,
"yield-star-spacing": 1
}
}
+242 -5
View File
@@ -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
View File
@@ -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
+5
View File
@@ -0,0 +1,5 @@
export default class Captions {
constructor({ option }) {
//
}
}
+5
View File
@@ -0,0 +1,5 @@
export default class Contextmenu {
constructor({ option }) {
//
}
}
+5
View File
@@ -0,0 +1,5 @@
export default class Controls {
constructor({ option }) {
//
}
}
File renamed without changes.
+5
View File
@@ -0,0 +1,5 @@
export default class Danmu {
constructor({ option }) {
//
}
}
+5
View File
@@ -0,0 +1,5 @@
export default class Events {
constructor({ option }) {
//
}
}
+5
View File
@@ -0,0 +1,5 @@
export default class Hotkey {
constructor({ option }) {
//
}
}
+10 -10
View File
@@ -1,19 +1,19 @@
import ZHCN from "./zh-CN";
import ZHTW from "./zh-TW";
import EN from "./en";
import JP from "./jp";
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
zh: ZHCN,
'zh-CN': ZHCN,
'zh-TW': ZHTW,
en: EN,
jp: JP
};
export default class I18n {
constructor({ option }) {
this.language = i18nMap[option.language || "en"];
this.language = i18nMap[option.language] || i18nMap.en;
}
get(key) {
+15 -15
View File
@@ -1,16 +1,15 @@
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";
import { verification } from './utils';
import I18n from './i18n';
import Player from './player';
import Controls from './controls';
import Contextmenu from './contextmenu';
import Danmu from './danmu';
import Info from './info';
import Captions from './captions';
import Events from './events';
import Hotkey from './hotkey';
let id = 0;
export const instances = [];
@@ -24,7 +23,7 @@ class Artplayer extends Emitter {
}
static get version() {
return "__VERSION__";
return '__VERSION__';
}
static get DEFAULTS() {
@@ -40,7 +39,6 @@ class Artplayer extends Emitter {
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);
@@ -50,11 +48,13 @@ class Artplayer extends Emitter {
this.id = id++;
instances.push(this);
console.log(this);
}
destroy() {
this.destroyEvents.forEach(event => event.destroy());
this.refs.container.innerHTML = "";
this.refs.container.innerHTML = '';
}
}
+5
View File
@@ -0,0 +1,5 @@
export default class Info {
constructor({ option }) {
//
}
}
+5
View File
@@ -0,0 +1,5 @@
export default class Player {
constructor({ option }) {
//
}
}
+1
View File
@@ -0,0 +1 @@
export * from './verification';
+3
View File
@@ -0,0 +1,3 @@
export function verification(option) {
//
}
View File
Whitespace-only changes.