阶段2:拆分为 ES Module + Rollup 构建,重写 README

- src/ 下拆分为入口/语言包/默认配置/主函数/工具模块,主函数整体搬入零改动
- rollup 打包 UMD(moeplayer.js + moeplayer.min.js),用户使用方式不变
- 库拷贝逻辑移至 scripts/copy-libs.js
- README 重写:中文文档、快速开始、路线图、致谢原作者
- index.html 增加皮肤切换演示(默认/红色/西瓜)
This commit is contained in:
王阳
2026-07-21 11:16:25 +08:00
parent 5609532c80
commit 159603341e
19 changed files with 15507 additions and 7406 deletions
+26
View File
@@ -0,0 +1,26 @@
import { isUndefined } from './type.js';
/*
* getPath
* 功能:获取该js文件所在路径
*/
function getPath(siz) {
var scriptList = document.scripts,
thisPath = scriptList[scriptList.length - 1].src;
for (var i = 0; i < scriptList.length; i++) {
var scriptName = scriptList[i].getAttribute('name') || scriptList[i].getAttribute('data-name');
var src = scriptList[i].src.slice(scriptList[i].src.lastIndexOf('/') + 1, scriptList[i].src.lastIndexOf('.'));
if ((scriptName && (scriptName == 'moeplayer' || scriptName == 'moeplayer.min')) || (scriptList[i].src && (src == 'moeplayer' || src == 'moeplayer.min'))) {
thisPath = scriptList[i].src;
break;
}
}
var path=thisPath.substring(0, thisPath.lastIndexOf('/js/') + 1);
if(!isUndefined(siz)){
path+=siz+'/';
}
return path;
}
export { getPath };