1 Star 0 Fork 0

Monika/lukflugmvn

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
navigation.js 1.74 KB
一键复制 编辑 原始数据 按行查看 历史
lukflug 提交于 2021-04-20 20:32 . Started rewrite to not rely on GitHub API
var path=getQueryValue("path");
if (path==null) path="";
else if (path.endsWith("/")) path=path.substring(0,path.length-1);
document.getElementById("location").innerHTML="/"+path;
document.getElementsByTagName("title")[0].innerHTML="Index of /"+path+" - lukflug's website";
var request=new XMLHttpRequest();
request.open("get","/index.txt");
request.responseType="text";
request.onload=function() {
var superDir="";
if (path.lastIndexOf("/")>=0) superDir=path.substring(0,path.lastIndexOf("/"));
var lastDirectory=null;
var list=request.responseText.split("\n");
var table="<tr><th>Filename</th><th>Size</th></tr>";
if (path!="") table+="<tr><td><a href=\"?path="+superDir+"\">../</a></td><td>-</td></tr>";
for (var i=0;i<list.length;i++) {
if (list[i]=="") continue;
var filePath=list[i].substring(list[i].indexOf("\t")+1);
if (path==""||filePath.substring(0,path.length+1)==path+"/") {
var relPath=filePath.substring(path.length+1);
if (path=="") relPath=filePath;
var name=relPath;
if (relPath.indexOf("/")>=0) name=relPath.substring(0,relPath.indexOf("/"));
var size=list[i].substring(list[i].lastIndexOf(" ")+1,list[i].indexOf("\t"));
if (relPath.indexOf("/")<0) table+="<tr><td><a href=\""+filePath+"\">"+name+"</a></td><td>"+size+"</td></tr>";
else if (lastDirectory!=name) {
table+="<tr><td><a href=\"?path="+(path==""?"":path+"/")+name+"\">"+name+"/</a></td><td>-</td></tr>";
lastDirectory=name;
}
//if (list[i].type=="dir") table+="<tr><td><a href=\"?path=/"+list[i].path+"\">"+list[i].name+"/</a></td><td>-</td></tr>";
//else table+="<tr><td><a href=\""+list[i].path+"\">"+list[i].name+"</a></td><td>"+list[i].size+"</td></tr>";
}
}
document.getElementById("directorytable").innerHTML=table;
};
request.send();
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ioypo/lukflugmvn.git
git@gitee.com:ioypo/lukflugmvn.git
ioypo
lukflugmvn
lukflugmvn
main

搜索帮助

0d507c66 1850385 C8b1a773 1850385