Skip to content

Commit 50156af

Browse files
committed
v1.0.0
1 parent f61b7c1 commit 50156af

13 files changed

+7752
-2
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ typings/
8080

8181
# Nuxt.js build / generate output
8282
.nuxt
83-
dist
83+
#dist
8484

8585
# Gatsby files
8686
.cache/

.prettierrc

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Prettier configuration
2+
3+
printWidth: 80
4+
singleQuote: true
5+
tabWidth: 4
6+
useTabs: false
7+
8+
# js and ts rules:
9+
arrowParens: avoid
10+
11+
# jsx and tsx rules:
12+
jsxBracketSameLine: false

README.md

+61-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,62 @@
1-
# docsify-meting-api
1+
# docsify-plugin-meting-api
22
a docsify plugin for meting-api.
3+
4+
[meting-api](https://github.com/topics/meting) plugin for [Docsify](https://docsify.js.org).
5+
6+
## Install
7+
8+
1. Insert APlayer into **head** tag (index.html)
9+
10+
```html
11+
<!-- require APlayer -->
12+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css">
13+
<script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script>
14+
```
15+
16+
2. Then insert docsify-plugin-meting-api plugin into **body** tag
17+
18+
```html
19+
<!-- docsify-plugin-meting-api -->
20+
<!-- required axios -->
21+
<script type="text/javascript" src="https://unpkg.com/axios/dist/axios.min.js"></script>
22+
<script type="text/javascript" src="/docsify-plugin-meting-api.js"></script>
23+
```
24+
25+
## Usage
26+
27+
You can set **MetingAPI** option, example:
28+
29+
```html
30+
window.$docsify = {
31+
MetingAPI: {
32+
elementId: 'meting',
33+
api: 'https://api.i-meto.com/meting/api',
34+
fixed: true,
35+
autoplay: true,
36+
lrcType: 3,
37+
order: 'random',
38+
loop: 'all',
39+
mutex: true,
40+
theme: '#b7daff',
41+
playlists: [
42+
{ server: 'netease', type: 'playlist', id: '7597958861' },
43+
{ server: 'netease', type: 'playlist', id: '379025025' },
44+
{ server: 'netease', type: 'playlist', id: '7383516738' },
45+
],
46+
},
47+
};
48+
```
49+
50+
## Example
51+
52+
1. Run `npm i`
53+
2. Run `npm run demo`
54+
3. Go to [http://localhost:3000/](http://localhost:3000/)
55+
56+
## License
57+
58+
[MIT](LICENSE)
59+
60+
## TODO
61+
62+
- ...

demo/.nojekyll

Whitespace-only changes.

demo/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Headline
2+
3+
> An awesome project.

demo/docsify-plugin-meting-api.js

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*
2+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
3+
* This devtool is neither made for production nor for readable output files.
4+
* It uses "eval()" calls to create a separate source file in the browser devtools.
5+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
6+
* or disable the default devtool with "devtool: false".
7+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
8+
*/
9+
/******/ (() => { // webpackBootstrap
10+
/******/ "use strict";
11+
/******/ var __webpack_modules__ = ({
12+
13+
/***/ "./src/aplayer-meting-api-loader.js":
14+
/*!******************************************!*\
15+
!*** ./src/aplayer-meting-api-loader.js ***!
16+
\******************************************/
17+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
18+
19+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"APlayerMettingAPILoader\": () => (/* binding */ APlayerMettingAPILoader)\n/* harmony export */ });\nclass APlayerMettingAPILoader {\n constructor(options) {\n APlayerMettingAPILoader.instances = {};\n\n this.options = options;\n this.init();\n }\n\n instances() {\n return APlayerMettingAPILoader.instances;\n }\n\n init() {\n const _this = this;\n this.getPlaylist(_this.options.playlists[0], function (data) {\n if (_this.options['audio'] === undefined) {\n _this.options['audio'] = [];\n }\n _this.options.audio = _this.options.audio.concat(data);\n\n if (_this.options['elementId'] === undefined) {\n _this.options['elementId'] = 'aplayer';\n }\n\n if (_this.options['api'] === undefined) {\n _this.options['api'] = 'https://api.i-meto.com/meting/api';\n }\n\n _this.options.element = document.getElementById(\n _this.options.elementId\n );\n\n _this.aplayer = new APlayer(_this.options);\n _this.lazyLoading();\n });\n }\n\n lazyLoading() {\n const _this = this;\n for (var i = 1; i < this.options.playlists.length; i++) {\n this.getPlaylist(this.options.playlists[i], function (data) {\n _this.aplayer.list.add(data);\n console.log('lazyLoaded: playlist +1');\n });\n }\n }\n\n getPlaylist(playlist, success) {\n const _this = this;\n axios\n .get(_this.options['api'], {\n params: playlist,\n })\n .then(function (response) {\n if (response.status == 200) {\n success(response.data);\n }\n })\n .catch(function (error) {\n console.log(error);\n });\n }\n}\n\n\n//# sourceURL=webpack://docsify-plugin-meting-api/./src/aplayer-meting-api-loader.js?");
20+
21+
/***/ }),
22+
23+
/***/ "./src/index.js":
24+
/*!**********************!*\
25+
!*** ./src/index.js ***!
26+
\**********************/
27+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
28+
29+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _aplayer_meting_api_loader__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./aplayer-meting-api-loader */ \"./src/aplayer-meting-api-loader.js\");\n/**\n * docsify-plugin-meting-api\n * lisuke <[email protected]>\n */\n\n\n\nconst MetingAPIOptions = {\n elementId: 'aplayer',\n api: 'https://api.i-meto.com/meting/api',\n fixed: true,\n autoplay: true,\n lrcType: 3,\n order: 'random',\n loop: 'all',\n mutex: true,\n theme: '#b7daff',\n playlists: [],\n};\n\nfunction plugin(hook, vm) {\n let dom = Docsify.dom;\n\n if (!window.$docsify.MetingAPI) {\n return;\n }\n\n hook.mounted(function () {\n let aplayer = dom.create('div');\n aplayer.id = window.$docsify.MetingAPI.elementId;\n dom.appendTo(dom.body, aplayer);\n });\n\n hook.ready(function () {\n let apml = new _aplayer_meting_api_loader__WEBPACK_IMPORTED_MODULE_0__.APlayerMettingAPILoader(window.$docsify.MetingAPI);\n });\n}\n\nwindow.$docsify = window.$docsify || {};\n\nwindow.$docsify.MetingAPI = Object.assign(\n MetingAPIOptions,\n window.$docsify.MetingAPI\n);\n\nwindow.$docsify.plugins = (window.$docsify.plugins || []).concat(plugin);\n\n\n//# sourceURL=webpack://docsify-plugin-meting-api/./src/index.js?");
30+
31+
/***/ })
32+
33+
/******/ });
34+
/************************************************************************/
35+
/******/ // The module cache
36+
/******/ var __webpack_module_cache__ = {};
37+
/******/
38+
/******/ // The require function
39+
/******/ function __webpack_require__(moduleId) {
40+
/******/ // Check if module is in cache
41+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
42+
/******/ if (cachedModule !== undefined) {
43+
/******/ return cachedModule.exports;
44+
/******/ }
45+
/******/ // Create a new module (and put it into the cache)
46+
/******/ var module = __webpack_module_cache__[moduleId] = {
47+
/******/ // no module.id needed
48+
/******/ // no module.loaded needed
49+
/******/ exports: {}
50+
/******/ };
51+
/******/
52+
/******/ // Execute the module function
53+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
54+
/******/
55+
/******/ // Return the exports of the module
56+
/******/ return module.exports;
57+
/******/ }
58+
/******/
59+
/************************************************************************/
60+
/******/ /* webpack/runtime/define property getters */
61+
/******/ (() => {
62+
/******/ // define getter functions for harmony exports
63+
/******/ __webpack_require__.d = (exports, definition) => {
64+
/******/ for(var key in definition) {
65+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
66+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
67+
/******/ }
68+
/******/ }
69+
/******/ };
70+
/******/ })();
71+
/******/
72+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
73+
/******/ (() => {
74+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
75+
/******/ })();
76+
/******/
77+
/******/ /* webpack/runtime/make namespace object */
78+
/******/ (() => {
79+
/******/ // define __esModule on exports
80+
/******/ __webpack_require__.r = (exports) => {
81+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
82+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
83+
/******/ }
84+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
85+
/******/ };
86+
/******/ })();
87+
/******/
88+
/************************************************************************/
89+
/******/
90+
/******/ // startup
91+
/******/ // Load entry module and return exports
92+
/******/ // This entry module can't be inlined because the eval devtool is used.
93+
/******/ var __webpack_exports__ = __webpack_require__("./src/index.js");
94+
/******/
95+
/******/ })()
96+
;

demo/index.html

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8" />
6+
<title>Document</title>
7+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
8+
<meta name="description" content="Description" />
9+
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
10+
11+
<!-- Theme: Defaults -->
12+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-defaults.css">
13+
14+
<!-- require APlayer -->
15+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css">
16+
<script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script>
17+
18+
<!-- fixed APlayer -->
19+
<style>
20+
.aplayer-fixed,
21+
.aplayer-body {
22+
left: -66px !important;
23+
}
24+
25+
.aplayer-fixed:hover,
26+
.aplayer-body:hover {
27+
left: 0px !important;
28+
}
29+
</style>
30+
31+
</head>
32+
33+
<body>
34+
<div id="app"></div>
35+
<script>
36+
window.$docsify = {
37+
name: "docsify-plugin-meting-api",
38+
repo: "https://github.com/lisuke/docsify-plugin-meting-api",
39+
// require
40+
MetingAPI: {
41+
api: 'https://api.i-meto.com/meting/api',
42+
playlists: [
43+
{ server: 'netease', type: 'playlist', id: '7597958861' },
44+
{ server: 'netease', type: 'playlist', id: '379025025' },
45+
{ server: 'netease', type: 'playlist', id: '7383516738' },
46+
],
47+
},
48+
};
49+
</script>
50+
<!-- Docsify v4 -->
51+
<script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
52+
<!-- docsify-themeable -->
53+
<script src="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/js/docsify-themeable.min.js"></script>
54+
55+
<!-- docsify-plugin-meting-api -->
56+
<!-- required axios -->
57+
<script type="text/javascript" src="https://unpkg.com/axios/dist/axios.min.js"></script>
58+
<script type="text/javascript" src="/docsify-plugin-meting-api.js"></script>
59+
60+
</body>
61+
62+
</html>

dist/docsify-plugin-meting-api.js

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*
2+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
3+
* This devtool is neither made for production nor for readable output files.
4+
* It uses "eval()" calls to create a separate source file in the browser devtools.
5+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
6+
* or disable the default devtool with "devtool: false".
7+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
8+
*/
9+
/******/ (() => { // webpackBootstrap
10+
/******/ "use strict";
11+
/******/ var __webpack_modules__ = ({
12+
13+
/***/ "./src/aplayer-meting-api-loader.js":
14+
/*!******************************************!*\
15+
!*** ./src/aplayer-meting-api-loader.js ***!
16+
\******************************************/
17+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
18+
19+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"APlayerMettingAPILoader\": () => (/* binding */ APlayerMettingAPILoader)\n/* harmony export */ });\nclass APlayerMettingAPILoader {\n constructor(options) {\n APlayerMettingAPILoader.instances = {};\n\n this.options = options;\n this.init();\n }\n\n instances() {\n return APlayerMettingAPILoader.instances;\n }\n\n init() {\n const _this = this;\n this.getPlaylist(_this.options.playlists[0], function (data) {\n if (_this.options['audio'] === undefined) {\n _this.options['audio'] = [];\n }\n _this.options.audio = _this.options.audio.concat(data);\n\n if (_this.options['elementId'] === undefined) {\n _this.options['elementId'] = 'aplayer';\n }\n\n if (_this.options['api'] === undefined) {\n _this.options['api'] = 'https://api.i-meto.com/meting/api';\n }\n\n _this.options.element = document.getElementById(\n _this.options.elementId\n );\n\n _this.aplayer = new APlayer(_this.options);\n _this.lazyLoading();\n });\n }\n\n lazyLoading() {\n const _this = this;\n for (var i = 1; i < this.options.playlists.length; i++) {\n this.getPlaylist(this.options.playlists[i], function (data) {\n _this.aplayer.list.add(data);\n console.log('lazyLoaded: playlist +1');\n });\n }\n }\n\n getPlaylist(playlist, success) {\n const _this = this;\n axios\n .get(_this.options['api'], {\n params: playlist,\n })\n .then(function (response) {\n if (response.status == 200) {\n success(response.data);\n }\n })\n .catch(function (error) {\n console.log(error);\n });\n }\n}\n\n\n//# sourceURL=webpack://docsify-plugin-meting-api/./src/aplayer-meting-api-loader.js?");
20+
21+
/***/ }),
22+
23+
/***/ "./src/index.js":
24+
/*!**********************!*\
25+
!*** ./src/index.js ***!
26+
\**********************/
27+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
28+
29+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _aplayer_meting_api_loader__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./aplayer-meting-api-loader */ \"./src/aplayer-meting-api-loader.js\");\n/**\n * docsify-plugin-meting-api\n * lisuke <[email protected]>\n */\n\n\n\nconst MetingAPIOptions = {\n elementId: 'aplayer',\n api: 'https://api.i-meto.com/meting/api',\n fixed: true,\n autoplay: true,\n lrcType: 3,\n order: 'random',\n loop: 'all',\n mutex: true,\n theme: '#b7daff',\n playlists: [],\n};\n\nfunction plugin(hook, vm) {\n let dom = Docsify.dom;\n\n if (!window.$docsify.MetingAPI) {\n return;\n }\n\n hook.mounted(function () {\n let aplayer = dom.create('div');\n aplayer.id = window.$docsify.MetingAPI.elementId;\n dom.appendTo(dom.body, aplayer);\n });\n\n hook.ready(function () {\n let apml = new _aplayer_meting_api_loader__WEBPACK_IMPORTED_MODULE_0__.APlayerMettingAPILoader(window.$docsify.MetingAPI);\n });\n}\n\nwindow.$docsify = window.$docsify || {};\n\nwindow.$docsify.MetingAPI = Object.assign(\n MetingAPIOptions,\n window.$docsify.MetingAPI\n);\n\nwindow.$docsify.plugins = (window.$docsify.plugins || []).concat(plugin);\n\n\n//# sourceURL=webpack://docsify-plugin-meting-api/./src/index.js?");
30+
31+
/***/ })
32+
33+
/******/ });
34+
/************************************************************************/
35+
/******/ // The module cache
36+
/******/ var __webpack_module_cache__ = {};
37+
/******/
38+
/******/ // The require function
39+
/******/ function __webpack_require__(moduleId) {
40+
/******/ // Check if module is in cache
41+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
42+
/******/ if (cachedModule !== undefined) {
43+
/******/ return cachedModule.exports;
44+
/******/ }
45+
/******/ // Create a new module (and put it into the cache)
46+
/******/ var module = __webpack_module_cache__[moduleId] = {
47+
/******/ // no module.id needed
48+
/******/ // no module.loaded needed
49+
/******/ exports: {}
50+
/******/ };
51+
/******/
52+
/******/ // Execute the module function
53+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
54+
/******/
55+
/******/ // Return the exports of the module
56+
/******/ return module.exports;
57+
/******/ }
58+
/******/
59+
/************************************************************************/
60+
/******/ /* webpack/runtime/define property getters */
61+
/******/ (() => {
62+
/******/ // define getter functions for harmony exports
63+
/******/ __webpack_require__.d = (exports, definition) => {
64+
/******/ for(var key in definition) {
65+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
66+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
67+
/******/ }
68+
/******/ }
69+
/******/ };
70+
/******/ })();
71+
/******/
72+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
73+
/******/ (() => {
74+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
75+
/******/ })();
76+
/******/
77+
/******/ /* webpack/runtime/make namespace object */
78+
/******/ (() => {
79+
/******/ // define __esModule on exports
80+
/******/ __webpack_require__.r = (exports) => {
81+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
82+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
83+
/******/ }
84+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
85+
/******/ };
86+
/******/ })();
87+
/******/
88+
/************************************************************************/
89+
/******/
90+
/******/ // startup
91+
/******/ // Load entry module and return exports
92+
/******/ // This entry module can't be inlined because the eval devtool is used.
93+
/******/ var __webpack_exports__ = __webpack_require__("./src/index.js");
94+
/******/
95+
/******/ })()
96+
;

dist/docsify-plugin-meting-api.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)