replace `module.exports` with `export default`; separate js and css files into different folder
This commit is contained in:
parent
407a5ba951
commit
100234774d
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "dplayer",
|
||||
"version": "1.17.4",
|
||||
"version": "1.17.5",
|
||||
"description": "Wow, such a lovely HTML5 danmaku video player",
|
||||
"main": "dist/DPlayer.min.js",
|
||||
"style": "dist/DPlayer.min.css",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
@import '../node_modules/balloon-css/balloon.css';
|
||||
@import '../../node_modules/balloon-css/balloon.css';
|
||||
|
||||
.dplayer {
|
||||
position: relative;
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
import './DPlayer.scss';
|
||||
|
||||
import utils, { isMobile } from './utils';
|
||||
import handleOption from './options';
|
||||
import i18n from './i18n';
|
||||
|
|
@ -497,4 +495,4 @@ class DPlayer {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = DPlayer;
|
||||
export default DPlayer;
|
||||
|
|
@ -27,7 +27,7 @@ const SendXMLHttpRequest = (url, data, success, error, fail) => {
|
|||
xhr.send(data !== null ? JSON.stringify(data) : null);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
send: (endpoint, danmakuData, callback) => {
|
||||
SendXMLHttpRequest(endpoint, danmakuData, (xhr, response) => {
|
||||
console.log('Post danmaku: ', response);
|
||||
|
|
@ -25,4 +25,4 @@ class Bar {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = Bar;
|
||||
export default Bar;
|
||||
|
|
@ -13,4 +13,4 @@ class Bezel {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = Bezel;
|
||||
export default Bezel;
|
||||
|
|
@ -90,4 +90,4 @@ class Comment {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = Comment;
|
||||
export default Comment;
|
||||
|
|
@ -49,4 +49,4 @@ class ContextMenu {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = ContextMenu;
|
||||
export default ContextMenu;
|
||||
|
|
@ -251,4 +251,4 @@ class Controller {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = Controller;
|
||||
export default Controller;
|
||||
|
|
@ -340,4 +340,4 @@ class Danmaku {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = Danmaku;
|
||||
export default Danmaku;
|
||||
|
|
@ -53,4 +53,4 @@ class Events {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = Events;
|
||||
export default Events;
|
||||
|
|
@ -101,4 +101,4 @@ class FullScreen {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = FullScreen;
|
||||
export default FullScreen;
|
||||
|
|
@ -52,4 +52,4 @@ class HotKey {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = HotKey;
|
||||
export default HotKey;
|
||||
|
|
@ -7,7 +7,7 @@ W3C def language codes is :
|
|||
NOTE: use lowercase to prevent case typo from user!
|
||||
Use this as shown below..... */
|
||||
|
||||
module.exports = function (lang) {
|
||||
function i18n (lang) {
|
||||
this.lang = lang;
|
||||
this.tran = (text) => {
|
||||
if (tranTxt[this.lang] && tranTxt[this.lang][text]) {
|
||||
|
|
@ -17,7 +17,7 @@ module.exports = function (lang) {
|
|||
return text;
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
// add translation text here
|
||||
const tranTxt = {
|
||||
|
|
@ -93,4 +93,6 @@ const tranTxt = {
|
|||
'Volume': '音量',
|
||||
'Live': '直播',
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export default i18n;
|
||||
|
|
@ -1,4 +1,7 @@
|
|||
import '../css/index.scss';
|
||||
import DPlayer from './DPlayer';
|
||||
|
||||
/* global DPLAYER_VERSION GIT_HASH */
|
||||
console.log(`${'\n'} %c DPlayer ${DPLAYER_VERSION} ${GIT_HASH} %c http://dplayer.js.org ${'\n'}${'\n'}`, 'color: #fadfa3; background: #030307; padding:5px 0;', 'background: #fadfa3; padding:5px 0;');
|
||||
|
||||
module.exports = require('./DPlayer');
|
||||
export default DPlayer;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/* global DPLAYER_VERSION GIT_HASH */
|
||||
const defaultApiBackend = require('./api.js');
|
||||
import defaultApiBackend from './api.js';
|
||||
|
||||
module.exports = (options) => {
|
||||
export default (options) => {
|
||||
const isMobile = /mobile/i.test(window.navigator.userAgent);
|
||||
// compatibility: some mobile browsers don't suppose autoplay
|
||||
if (isMobile) {
|
||||
|
|
@ -130,4 +130,4 @@ class Setting {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = Setting;
|
||||
export default Setting;
|
||||
|
|
@ -52,4 +52,4 @@ class Subtitle {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = Subtitle;
|
||||
export default Subtitle;
|
||||
|
|
@ -21,4 +21,4 @@ class SvgSource {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = SvgSource;
|
||||
export default SvgSource;
|
||||
|
|
@ -341,4 +341,4 @@ class Template {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = Template;
|
||||
export default Template;
|
||||
|
|
@ -29,4 +29,4 @@ class Thumbnails {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = Thumbnails;
|
||||
export default Thumbnails;
|
||||
|
|
@ -100,4 +100,4 @@ class Time {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = Time;
|
||||
export default Time;
|
||||
|
|
@ -38,4 +38,4 @@ class User {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = User;
|
||||
export default User;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = {
|
||||
export default {
|
||||
|
||||
/**
|
||||
* Parse second to 00:00 format
|
||||
|
|
@ -9,7 +9,7 @@ module.exports = {
|
|||
devtool: 'cheap-module-source-map',
|
||||
|
||||
entry: {
|
||||
'DPlayer': './src/index.js'
|
||||
'DPlayer': './src/js/index.js'
|
||||
},
|
||||
|
||||
output: {
|
||||
|
|
@ -17,6 +17,7 @@ module.exports = {
|
|||
filename: '[name].js',
|
||||
library: '[name]',
|
||||
libraryTarget: 'umd',
|
||||
libraryExport: 'default',
|
||||
umdNamedDefine: true,
|
||||
publicPath: '/'
|
||||
},
|
||||
|
|
@ -33,7 +34,7 @@ module.exports = {
|
|||
test: /\.js$/,
|
||||
enforce: 'pre',
|
||||
loader: require.resolve('eslint-loader'),
|
||||
include: path.resolve(__dirname, '../src'),
|
||||
include: path.resolve(__dirname, '../src/js'),
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ module.exports = {
|
|||
devtool: 'source-map',
|
||||
|
||||
entry: {
|
||||
'DPlayer': './src/index.js'
|
||||
'DPlayer': './src/js/index.js'
|
||||
},
|
||||
|
||||
output: {
|
||||
|
|
@ -20,6 +20,7 @@ module.exports = {
|
|||
filename: '[name].min.js',
|
||||
library: '[name]',
|
||||
libraryTarget: 'umd',
|
||||
libraryExport: 'default',
|
||||
umdNamedDefine: true,
|
||||
publicPath: '/'
|
||||
},
|
||||
|
|
@ -36,7 +37,7 @@ module.exports = {
|
|||
test: /\.js$/,
|
||||
enforce: 'pre',
|
||||
loader: require.resolve('eslint-loader'),
|
||||
include: path.resolve(__dirname, '../src'),
|
||||
include: path.resolve(__dirname, '../src/js'),
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
|
|
|
|||
Loading…
Reference in New Issue