1 Star 0 Fork 292

黄双全/Neditor

forked from Notadd/Neditor 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
neditor.parse.js 1.40 KB
一键复制 编辑 原始数据 按行查看 历史
tianjign 提交于 2017-09-05 12:06 . replace ueditor to neditor
(function() {
var paths = [
'parse.js',
'insertcode.js',
'table.js',
'charts.js',
'background.js',
'list.js',
'video.js'
];
function getUEBasePath(docUrl, confUrl) {
return getBasePath(
docUrl || self.document.URL || self.location.href,
confUrl || getConfigFilePath()
);
}
function getConfigFilePath() {
var configPath = document.getElementsByTagName("script");
return configPath[configPath.length - 1].src;
}
function getBasePath(docUrl, confUrl) {
var basePath = confUrl;
if (!/^[a-z]+:/i.test(confUrl)) {
docUrl = docUrl.split("#")[0].split("?")[0].replace(/[^\\\/]+$/, "");
basePath = docUrl + "" + confUrl;
}
return optimizationPath(basePath);
}
function optimizationPath(path) {
var protocol = /^[a-z]+:\/\//.exec(path)[0],
tmp = null,
res = [];
path = path.replace(protocol, "").split("?")[0].split("#")[0];
path = path.replace(/\\/g, "/").split(/\//);
path[path.length - 1] = "";
while (path.length) {
if ((tmp = path.shift()) === "..") {
res.pop();
} else if (tmp !== ".") {
res.push(tmp);
}
}
return protocol + res.join("/");
}
var baseURL = getUEBasePath() + "_parse/";
for (var i = 0, pi; (pi = paths[i++]); ) {
document.write(
'<script type="text/javascript" src="' + baseURL + pi + '"></script>'
);
}
})();
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/yingzhiyun_hsq/neditor.git
git@gitee.com:yingzhiyun_hsq/neditor.git
yingzhiyun_hsq
neditor
Neditor
master

搜索帮助