2018-05-03 08:14:28 +00:00
|
|
|
const insertArea = document.getElementById('dynDiv');
|
2018-04-22 06:03:43 +00:00
|
|
|
|
|
|
|
function updateHTMLDirList(returnData) {
|
2018-04-22 08:56:25 +00:00
|
|
|
var dirPath = returnData.getElementsByTagName('PATH_HEAD')[0].innerHTML;
|
2018-04-22 06:03:43 +00:00
|
|
|
var dirs = returnData.getElementsByTagName('DIR');
|
|
|
|
var videos = returnData.getElementsByTagName('VID_FILE');
|
|
|
|
var images = returnData.getElementsByTagName('IMG_FILE');
|
|
|
|
var files = returnData.getElementsByTagName('FILE');
|
2018-05-03 08:14:28 +00:00
|
|
|
var dirImg = "resources/images/icons/folder.png";
|
2018-05-03 08:35:41 +00:00
|
|
|
var i = 0;
|
2018-04-22 08:14:40 +00:00
|
|
|
var size = 0;
|
2018-04-22 06:03:43 +00:00
|
|
|
|
|
|
|
// Insert dirs
|
2018-04-22 08:56:25 +00:00
|
|
|
document.getElementById("path").innerHTML = dirPath;
|
2018-04-22 06:03:43 +00:00
|
|
|
insertArea.innerHTML = "";
|
|
|
|
|
2018-04-22 08:14:40 +00:00
|
|
|
size = dirs.length;
|
2018-04-22 06:03:43 +00:00
|
|
|
for (; i < size; i++) {
|
|
|
|
var dir = dirs[i].innerHTML;
|
|
|
|
|
|
|
|
if (dir != "resources/") {
|
2018-05-03 08:14:28 +00:00
|
|
|
createElmBlock("DIV", "dirStyle", "dirID", "systemIcon", dirImg ,
|
|
|
|
"dirTitle", dir);
|
2018-04-22 06:03:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Insert videos
|
2018-04-22 08:14:40 +00:00
|
|
|
var thumbnail = "";
|
|
|
|
var vidNme = "";
|
|
|
|
size = videos .length;
|
|
|
|
|
2018-04-22 06:03:43 +00:00
|
|
|
for (i = 0; i < size; i++) {
|
2018-05-03 08:14:28 +00:00
|
|
|
thumbnail = videos[i].children[0].innerHTML;
|
|
|
|
vidNme = videos[i].children[1].innerHTML;
|
|
|
|
createElmBlock("SPAN", "movieStyle", "movieID", "thumbnail", thumbnail,
|
|
|
|
"movieTitle", vidNme);
|
2018-04-22 06:03:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Insert images
|
2018-05-03 08:14:28 +00:00
|
|
|
var path = document.getElementById("path").innerHTML;
|
|
|
|
var thumbnail = ""
|
|
|
|
size = images.length;
|
2018-04-22 06:03:43 +00:00
|
|
|
|
|
|
|
for (i = 0; i < size; i++) {
|
2018-04-22 08:14:40 +00:00
|
|
|
thumbnail = images[i].children[0].innerHTML;
|
2018-04-22 06:03:43 +00:00
|
|
|
|
2018-04-22 08:14:40 +00:00
|
|
|
if (thumbnail.match(/000\.(jpg|png|gif)\b/) == null &&
|
2018-05-03 08:14:28 +00:00
|
|
|
!thumbnail.includes("favicon.png")) {
|
|
|
|
var imgTag = document.createElement("IMG");
|
|
|
|
imgTag.id = "imageID";
|
|
|
|
imgTag.className = "iconImg";
|
|
|
|
imgTag.src = path + thumbnail;
|
|
|
|
imgTag.alt = thumbnail;
|
|
|
|
insertArea.appendChild(imgTag);
|
2018-04-22 06:03:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-22 08:56:25 +00:00
|
|
|
// Setup background if there is a 000.* in selection
|
2018-04-22 09:21:14 +00:00
|
|
|
var bgImgPth = images[0] ? images[0].children[0].innerHTML : "";
|
2018-04-22 08:56:25 +00:00
|
|
|
if (bgImgPth.match(/000\.(jpg|png|gif)\b/) != null) {
|
|
|
|
updateBG(path + bgImgPth);
|
2018-04-22 06:03:43 +00:00
|
|
|
} else {
|
|
|
|
updateBG("resources/images/backgrounds/000.jpg");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Insert files
|
|
|
|
size = files.length;
|
|
|
|
for (i = 0; i < size; i++) {
|
2018-05-03 08:14:28 +00:00
|
|
|
var fileName = files[i].children[0].innerHTML;
|
|
|
|
createElmBlock("DIV", "fileStyle", "fileID", "systemIcon", setFileIconType(fileName),
|
|
|
|
"fileTitle", fileName);
|
2018-04-22 08:14:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-03 08:14:28 +00:00
|
|
|
function createElmBlock(contnrType, contnrClass, imgID, imgClass,
|
|
|
|
imgSrc, inputClass, fileName) {
|
|
|
|
var contnrTag = document.createElement(contnrType);
|
|
|
|
var imgTag = document.createElement("IMG");
|
|
|
|
var inputTag = document.createElement("INPUT");
|
|
|
|
|
|
|
|
contnrTag.className = contnrClass;
|
|
|
|
contnrTag.title = fileName;
|
2018-05-10 07:42:39 +00:00
|
|
|
contnrTag.tabIndex = "1";
|
2018-05-03 08:14:28 +00:00
|
|
|
imgTag.id = imgID;
|
|
|
|
imgTag.className = imgClass ;
|
|
|
|
imgTag.src = imgSrc;
|
|
|
|
imgTag.alt = fileName;
|
|
|
|
inputTag.type = "text";
|
|
|
|
inputTag.id = "titleID";
|
|
|
|
inputTag.className = inputClass;
|
|
|
|
inputTag.readOnly = "true";
|
|
|
|
inputTag.value = fileName;
|
|
|
|
inputTag.addEventListener("focusout", disableEdits);
|
|
|
|
|
|
|
|
contnrTag.appendChild(imgTag);
|
|
|
|
contnrTag.appendChild(inputTag);
|
|
|
|
insertArea.appendChild(contnrTag);
|
|
|
|
}
|
|
|
|
|
2018-04-22 08:14:40 +00:00
|
|
|
function setFileIconType(fileName) {
|
|
|
|
if (fileName.match(/\.(doc|docx|xls|xlsx|rtf)\b/) != null) {
|
2018-05-03 08:14:28 +00:00
|
|
|
return "resources/images/icons/doc.png";
|
2018-04-22 08:14:40 +00:00
|
|
|
} else if (fileName.match(/\.(7z|7zip|zip|tar.gz|tar.xz|gz|rar|jar)\b/) != null) {
|
2018-05-03 08:14:28 +00:00
|
|
|
return "resources/images/icons/arc.png";
|
2018-04-22 08:14:40 +00:00
|
|
|
} else if (fileName.match(/\.(pdf)\b/) != null) {
|
2018-05-03 08:14:28 +00:00
|
|
|
return "resources/images/icons/pdf.png";
|
2018-04-22 08:14:40 +00:00
|
|
|
} else if (fileName.match(/\.(html)\b/) != null) {
|
2018-05-03 08:14:28 +00:00
|
|
|
return "resources/images/icons/html.png";
|
2018-04-22 08:14:40 +00:00
|
|
|
} else if (fileName.match(/\.(txt|conf)\b/) != null) {
|
2018-05-03 08:14:28 +00:00
|
|
|
return "resources/images/icons/text.png";
|
2018-04-22 08:14:40 +00:00
|
|
|
} else if (fileName.match(/\.(iso|img)\b/) != null) {
|
2018-05-03 08:14:28 +00:00
|
|
|
return "resources/images/icons/img.png";
|
2018-04-22 08:14:40 +00:00
|
|
|
} else if (fileName.match(/\.(sh|batch|exe)\b/) != null) {
|
2018-05-03 08:14:28 +00:00
|
|
|
return "resources/images/icons/scrip.png";
|
2018-04-22 08:14:40 +00:00
|
|
|
} else {
|
2018-05-03 08:14:28 +00:00
|
|
|
return "resources/images/icons/bin.png";
|
2018-04-22 06:03:43 +00:00
|
|
|
}
|
|
|
|
}
|