Cleaning up js files and improving readability to try and trbl shoot PHPSESSION issue
This commit is contained in:
parent
7cc572b78d
commit
3dbbaa063d
@ -4,7 +4,9 @@ function getDirSSE() {
|
|||||||
var path = "";
|
var path = "";
|
||||||
|
|
||||||
// Create path from array of items
|
// Create path from array of items
|
||||||
for (pathNode of pathNodes) { path += pathNode; }
|
for (pathNode of pathNodes) {
|
||||||
|
path += pathNode;
|
||||||
|
}
|
||||||
|
|
||||||
// For some reason, PHPSESSID= gets inserted when in sub dir.
|
// For some reason, PHPSESSID= gets inserted when in sub dir.
|
||||||
// temp work arround is to trim it.
|
// temp work arround is to trim it.
|
||||||
@ -19,12 +21,13 @@ function getDirSSE() {
|
|||||||
function getDir(query) {
|
function getDir(query) {
|
||||||
var formULPTH = document.getElementById("DIRPATHUL");
|
var formULPTH = document.getElementById("DIRPATHUL");
|
||||||
var path = "";
|
var path = "";
|
||||||
|
var temp = "";
|
||||||
|
|
||||||
// push or pop to path list
|
// push or pop to path list
|
||||||
if (query === "/") {
|
if (query === "/") {
|
||||||
// Process path from cookie and set to array/list
|
// Process path from cookie and set to array/list
|
||||||
if (document.cookie) {
|
if (document.cookie) {
|
||||||
var temp = document.cookie.replace("dirQuery=", "");
|
temp = document.cookie.replace("dirQuery=", "");
|
||||||
temp = temp.split("/");
|
temp = temp.split("/");
|
||||||
// Subtract one b/c paths end with / and create empty slot
|
// Subtract one b/c paths end with / and create empty slot
|
||||||
var size = temp.length - 1;
|
var size = temp.length - 1;
|
||||||
@ -32,19 +35,24 @@ function getDir(query) {
|
|||||||
for (var i = 0; i < size; i++) {
|
for (var i = 0; i < size; i++) {
|
||||||
pathNodes.push(temp[i] + "/");
|
pathNodes.push(temp[i] + "/");
|
||||||
}
|
}
|
||||||
// If no cookie, etup path from root
|
// If no cookie, setup path from root
|
||||||
} else {
|
} else {
|
||||||
pathNodes.push("." + query); // If in root of server
|
pathNodes.push("." + query);
|
||||||
}
|
}
|
||||||
} else if (query === "../") {
|
} else if (query === "../") {
|
||||||
if (pathNodes.length > 1) { pathNodes.pop(); } // Only remove while not in root
|
// Only remove while not in root
|
||||||
} else if (query === "./") { // Do nothing since re-scanning dir
|
if (pathNodes.length > 1) {
|
||||||
} else { pathNodes.push(query); } // Add path
|
pathNodes.pop();
|
||||||
|
}
|
||||||
|
} else if (query === "./") {
|
||||||
|
// Do nothing since re-scanning dir
|
||||||
|
} else {
|
||||||
|
pathNodes.push(query); // Add path
|
||||||
|
}
|
||||||
|
|
||||||
// Create path from array of items
|
// Create path from array of items
|
||||||
// for (pathNode of pathNodes) { path += pathNode; console.log(pathNode); }
|
for (pathNode of pathNodes) {
|
||||||
for (var i = 0; i < pathNodes.length; i++) {
|
path += pathNode; console.log(pathNode);
|
||||||
path += pathNodes[i];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// For some reason, PHPSESSID= gets inserted when in sub dir.
|
// For some reason, PHPSESSID= gets inserted when in sub dir.
|
||||||
@ -53,7 +61,7 @@ function getDir(query) {
|
|||||||
path = path.split("; ").pop();
|
path = path.split("; ").pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
formULPTH.value = path; // Used when uploading a file
|
formULPTH.value = path; // Setup upload path for form
|
||||||
path = "dirQuery=" + path;
|
path = "dirQuery=" + path;
|
||||||
console.log("Path : " + path);
|
console.log("Path : " + path);
|
||||||
process(path);
|
process(path);
|
||||||
|
@ -8,14 +8,18 @@ function updateHTMLDirList(returnData) {
|
|||||||
var insertArea = document.getElementById('dynDiv');
|
var insertArea = document.getElementById('dynDiv');
|
||||||
var workingDir = dirPath.innerHTML;
|
var workingDir = dirPath.innerHTML;
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
var size = 0;
|
||||||
|
|
||||||
// Insert dirs
|
// Insert dirs
|
||||||
document.getElementById("path").innerHTML = dirPath.innerHTML;
|
document.getElementById("path").innerHTML = workingDir;
|
||||||
insertArea.innerHTML = "";
|
insertArea.innerHTML = "";
|
||||||
|
|
||||||
if (workingDir === "./") { var i = 2 } // Remove ,. and ../ if in "root"
|
// Remove . and ../ if in "root"
|
||||||
|
if (workingDir === "./") {
|
||||||
|
var i = 2
|
||||||
|
}
|
||||||
|
|
||||||
var size = dirs.length;
|
size = dirs.length;
|
||||||
for (; i < size; i++) {
|
for (; i < size; i++) {
|
||||||
var dir = dirs[i].innerHTML;
|
var dir = dirs[i].innerHTML;
|
||||||
|
|
||||||
@ -30,10 +34,13 @@ function updateHTMLDirList(returnData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Insert videos
|
// Insert videos
|
||||||
size = videos .length;
|
var thumbnail = "";
|
||||||
|
var vidNme = "";
|
||||||
|
size = videos .length;
|
||||||
|
|
||||||
for (i = 0; i < size; i++) {
|
for (i = 0; i < size; i++) {
|
||||||
var thumbnail = videos[i].children[0].innerHTML;
|
thumbnail = videos[i].children[0].innerHTML;
|
||||||
var vidNme = videos[i].children[1].innerHTML;
|
vidNme = videos[i].children[1].innerHTML;
|
||||||
|
|
||||||
insertArea.innerHTML += "<span class=\"movieStyle\" title=\"" + vidNme + "\" >"
|
insertArea.innerHTML += "<span class=\"movieStyle\" title=\"" + vidNme + "\" >"
|
||||||
+ "<img id=\"movieID\" class=\"thumbnail\""
|
+ "<img id=\"movieID\" class=\"thumbnail\""
|
||||||
@ -45,14 +52,15 @@ function updateHTMLDirList(returnData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Insert images
|
// Insert images
|
||||||
var path = document.getElementById("path").innerHTML;
|
var path = document.getElementById("path").innerHTML;
|
||||||
size = images.length;
|
var thumbnail = ""
|
||||||
|
size = images.length;
|
||||||
|
|
||||||
for (i = 0; i < size; i++) {
|
for (i = 0; i < size; i++) {
|
||||||
var thumbnail = images[i].children[0].innerHTML;
|
thumbnail = images[i].children[0].innerHTML;
|
||||||
|
|
||||||
if (!thumbnail.includes("favicon.png") && !thumbnail.includes("000.png") &&
|
if (thumbnail.match(/000\.(jpg|png|gif)\b/) == null &&
|
||||||
!thumbnail.includes("000.jpg") && !thumbnail.includes("000.gif")) {
|
!thumbnail.includes("favicon.png")) {
|
||||||
insertArea.innerHTML += "<img id=\"imageID\" class=\"iconImg\""
|
insertArea.innerHTML += "<img id=\"imageID\" class=\"iconImg\""
|
||||||
+ " src=\"" + path + thumbnail
|
+ " src=\"" + path + thumbnail
|
||||||
+ "\" alt=\"" + thumbnail + "\"/>";
|
+ "\" alt=\"" + thumbnail + "\"/>";
|
||||||
@ -60,9 +68,9 @@ function updateHTMLDirList(returnData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (images[0] != undefined) {
|
if (images[0] != undefined) {
|
||||||
if (images[0].children[0].innerHTML.includes("000.jpg") ||
|
var imgText = images[0].children[0].innerHTML;
|
||||||
images[0].children[0].innerHTML.includes("000.png") ||
|
|
||||||
images[0].children[0].innerHTML.includes("000.gif")) {
|
if (imgText.match(/000\.(jpg|png|gif)\b/) != null) {
|
||||||
updateBG(path + images[0].children[0].innerHTML);
|
updateBG(path + images[0].children[0].innerHTML);
|
||||||
} else {
|
} else {
|
||||||
updateBG("resources/images/backgrounds/000.jpg");
|
updateBG("resources/images/backgrounds/000.jpg");
|
||||||
@ -75,40 +83,34 @@ function updateHTMLDirList(returnData) {
|
|||||||
size = files.length;
|
size = files.length;
|
||||||
for (i = 0; i < size; i++) {
|
for (i = 0; i < size; i++) {
|
||||||
var fileName = files[i].children[0].innerHTML;
|
var fileName = files[i].children[0].innerHTML;
|
||||||
var iconImg = "<img id=\"fileID\" class=\"systemIcon\"";
|
var iconImg = "<img id=\"fileID\" class=\"systemIcon\""
|
||||||
|
+ setFileIconType(fileName);
|
||||||
|
|
||||||
if (fileName.includes(".doc") || fileName.includes(".docx") ||
|
insertArea.innerHTML += "<div class=\"fileStyle\">"
|
||||||
fileName.includes(".xls") || fileName.includes(".xlsx") ||
|
+ iconImg
|
||||||
fileName.includes(".rtf")) {
|
+ "<input type=\"text\" id=\"titleID\" class=\"fileTitle\""
|
||||||
iconImg += " src=\"resources/images/icons/doc.png\" />";
|
+ " readonly=\"true\"" + " value=\"" + fileName + "\" "
|
||||||
} else if (fileName.includes(".7z") || fileName.includes(".7zip") ||
|
+ " onfocusout=\"disableEdits(this)\"/>"
|
||||||
fileName.includes(".zip") || fileName.includes(".tar.gz") ||
|
+ "</dir>";
|
||||||
fileName.includes(".tar.xz") || fileName.includes(".gz") ||
|
}
|
||||||
fileName.includes(".rar") || fileName.includes(".jar")) {
|
}
|
||||||
iconImg += " src=\"resources/images/icons/arc.png\" />";
|
|
||||||
} else if (fileName.includes(".pdf")) {
|
function setFileIconType(fileName) {
|
||||||
iconImg += " src=\"resources/images/icons/pdf.png\" />";
|
if (fileName.match(/\.(doc|docx|xls|xlsx|rtf)\b/) != null) {
|
||||||
} else if (fileName.includes(".html")) {
|
return " src=\"resources/images/icons/doc.png\" />";
|
||||||
iconImg += " src=\"resources/images/icons/html.png\" />";
|
} else if (fileName.match(/\.(7z|7zip|zip|tar.gz|tar.xz|gz|rar|jar)\b/) != null) {
|
||||||
} else if (fileName.includes(".txt") || fileName.includes(".conf")) {
|
return " src=\"resources/images/icons/arc.png\" />";
|
||||||
iconImg += " src=\"resources/images/icons/text.png\" />";
|
} else if (fileName.match(/\.(pdf)\b/) != null) {
|
||||||
} else if (fileName.includes(".iso") || fileName.includes(".img")) {
|
return " src=\"resources/images/icons/pdf.png\" />";
|
||||||
iconImg += " src=\"resources/images/icons/img.png\" />";
|
} else if (fileName.match(/\.(html)\b/) != null) {
|
||||||
} else if (fileName.includes(".sh") || fileName.includes(".batch") ||
|
return " src=\"resources/images/icons/html.png\" />";
|
||||||
fileName.includes(".exe")) {
|
} else if (fileName.match(/\.(txt|conf)\b/) != null) {
|
||||||
iconImg += " src=\"resources/images/icons/scrip.png\" />";
|
return " src=\"resources/images/icons/text.png\" />";
|
||||||
} else {
|
} else if (fileName.match(/\.(iso|img)\b/) != null) {
|
||||||
iconImg += " src=\"resources/images/icons/bin.png\" />";
|
return " src=\"resources/images/icons/img.png\" />";
|
||||||
}
|
} else if (fileName.match(/\.(sh|batch|exe)\b/) != null) {
|
||||||
|
return " src=\"resources/images/icons/scrip.png\" />";
|
||||||
if (fileName != "sse.php" && fileName != "upload.php" &&
|
} else {
|
||||||
fileName != "open.php" && fileName != "process.php") {
|
return " src=\"resources/images/icons/bin.png\" />";
|
||||||
insertArea.innerHTML += "<div class=\"fileStyle\">"
|
|
||||||
+ iconImg
|
|
||||||
+ "<input type=\"text\" id=\"titleID\" class=\"fileTitle\""
|
|
||||||
+ " readonly=\"true\"" + " value=\"" + fileName + "\" "
|
|
||||||
+ " onfocusout=\"disableEdits(this)\"/>"
|
|
||||||
+ "</dir>";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user