Converted to ES6 standards where possible.
This commit is contained in:
parent
5ec5517d78
commit
82bf1b0b4a
@ -1,7 +1,7 @@
|
||||
// SSE events if supported
|
||||
if(typeof(EventSource) !== "undefined") {
|
||||
var source = new EventSource("resources/php/sse.php");
|
||||
source.onmessage = function(event) {
|
||||
let source = new EventSource("resources/php/sse.php");
|
||||
source.onmessage = (event) => {
|
||||
if (event.data === "updateListing") {
|
||||
getDir("./");
|
||||
}
|
||||
@ -10,12 +10,12 @@ if(typeof(EventSource) !== "undefined") {
|
||||
console.log("SSE Not Supported In Browser...");
|
||||
}
|
||||
|
||||
function getFavesList() {
|
||||
const getFavesList = () => {
|
||||
doAjax("resources/php/dbController.php", "getTabs=true");
|
||||
}
|
||||
|
||||
function doAjax(actionPath, data) {
|
||||
var xhttp = new XMLHttpRequest();
|
||||
const doAjax = (actionPath, data) => {
|
||||
let xhttp = new XMLHttpRequest();
|
||||
|
||||
xhttp.onreadystatechange = function() {
|
||||
if (this.readyState === 4 && this.status === 200) {
|
||||
@ -36,8 +36,8 @@ function doAjax(actionPath, data) {
|
||||
xhttp.send(data);
|
||||
}
|
||||
|
||||
function fileUploader(data) {
|
||||
var xhttp = new XMLHttpRequest();
|
||||
const fileUploader = (data) => {
|
||||
let xhttp = new XMLHttpRequest();
|
||||
|
||||
xhttp.onreadystatechange = function() {
|
||||
if (this.readyState === 4 && this.status === 200) {
|
||||
|
@ -1,9 +1,9 @@
|
||||
function getCookie(cname) {
|
||||
var name = cname + "=";
|
||||
var decodedCookie = decodeURIComponent(document.cookie);
|
||||
var ca = decodedCookie.split(';');
|
||||
for(var i = 0; i <ca.length; i++) {
|
||||
var c = ca[i];
|
||||
const getCookie = (cname) => {
|
||||
let decodedCookie = decodeURIComponent(document.cookie);
|
||||
let name = cname + "=";
|
||||
let ca = decodedCookie.split(';');
|
||||
for(let i = 0; i <ca.length; i++) {
|
||||
let c = ca[i];
|
||||
while (c.charAt(0) == ' ') {
|
||||
c = c.substring(1);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
function faveManager(elm) {
|
||||
var path = document.getElementById("path").innerHTML;
|
||||
var data = "";
|
||||
const faveManager = (elm) => {
|
||||
let path = document.getElementById("path").innerHTML;
|
||||
let data = "";
|
||||
|
||||
if (elm.style.backgroundColor != "") {
|
||||
elm.style.backgroundColor = "";
|
||||
@ -18,14 +18,14 @@ function faveManager(elm) {
|
||||
|
||||
// Basically resetting path nodes and setting them up
|
||||
// to the new path and just doing a refresh
|
||||
function loadFave(elm) {
|
||||
var path = elm.innerHTML;
|
||||
var parts = path.split("/");
|
||||
var size = parts.length;
|
||||
const loadFave = (elm) => {
|
||||
let path = elm.innerHTML;
|
||||
let parts = path.split("/");
|
||||
let size = parts.length;
|
||||
pathNodes = [];
|
||||
|
||||
pathNodes.push(parts[0] + "/");
|
||||
for (var i = 1; i < size - 1; i++) {
|
||||
for (let i = 1; i < size - 1; i++) {
|
||||
pathNodes.push(parts[i] + "/");
|
||||
}
|
||||
pathNodes.push(parts[size - 1]);
|
||||
|
@ -1,14 +1,14 @@
|
||||
var binary = null;
|
||||
var pathNodes = [];
|
||||
let binary = null;
|
||||
let pathNodes = [];
|
||||
|
||||
|
||||
function getDir(query) {
|
||||
var formUlPth = document.getElementById("DIRPATHUL");
|
||||
var mergeType = document.getElementById("MergeType");
|
||||
var passwd = undefined;
|
||||
var data = "";
|
||||
var cookies = "";
|
||||
var dirCookie = "";
|
||||
const getDir = (query) => {
|
||||
let formUlPth = document.getElementById("DIRPATHUL");
|
||||
let mergeType = document.getElementById("MergeType");
|
||||
let passwd = undefined;
|
||||
let data = "";
|
||||
let cookies = "";
|
||||
let dirCookie = "";
|
||||
|
||||
// push or pop to path list
|
||||
if (query === "/") {
|
||||
@ -18,7 +18,7 @@ function getDir(query) {
|
||||
dirCookie = dirCookie.split("/");
|
||||
dirCookie.pop(); // account for ending empty slot
|
||||
|
||||
var size = dirCookie.length;
|
||||
let size = dirCookie.length;
|
||||
for (var i = 0; i < size; i++) {
|
||||
pathNodes.push(dirCookie[i] + "/");
|
||||
}
|
||||
@ -56,29 +56,29 @@ function getDir(query) {
|
||||
doAjax("resources/php/getDirList.php", data);
|
||||
}
|
||||
|
||||
async function uploadFiles() {
|
||||
var toUpload = document.getElementsByName("filesToUpload[]")[0];
|
||||
var path = document.getElementById("path").innerHTML;
|
||||
var reader = new FileReader();
|
||||
var data = new FormData();
|
||||
var size = toUpload.files.length;
|
||||
const uploadFiles = async () => {
|
||||
let toUpload = document.getElementsByName("filesToUpload[]")[0];
|
||||
let path = document.getElementById("path").innerHTML;
|
||||
let reader = new FileReader();
|
||||
let data = new FormData();
|
||||
let size = toUpload.files.length;
|
||||
|
||||
data.append("UploadFiles", "trut");
|
||||
data.append("DIRPATHUL", path);
|
||||
|
||||
// Add files
|
||||
if (size > 0) {
|
||||
for (var i = 0; i < size; i++) {
|
||||
for (let i = 0; i < size; i++) {
|
||||
data.append("filesToUpload[]", toUpload.files[i]);
|
||||
}
|
||||
fileUploader(data);
|
||||
}
|
||||
}
|
||||
|
||||
function createItem(type) {
|
||||
var path = document.getElementById("path").innerHTML;
|
||||
var newItem = document.getElementById("NewItem");
|
||||
var fullPth = path + newItem.value;
|
||||
const createItem = (type) => {
|
||||
let path = document.getElementById("path").innerHTML;
|
||||
let newItem = document.getElementById("NewItem");
|
||||
let fullPth = path + newItem.value;
|
||||
newItem.value = "";
|
||||
fullPth = encodeURIComponent(fullPth);
|
||||
|
||||
@ -86,13 +86,13 @@ function createItem(type) {
|
||||
"createItem=true&item=" + fullPth + "&type=" + type);
|
||||
}
|
||||
|
||||
function deleteItem() {
|
||||
var path = document.getElementById("path").innerHTML;
|
||||
const deleteItem = () => {
|
||||
let path = document.getElementById("path").innerHTML;
|
||||
// Clicked yes to delete and there is an item
|
||||
if (itemObj != undefined && itemObj != null) {
|
||||
var fullPth = path + itemObj;
|
||||
let fullPth = path + itemObj;
|
||||
fullPth = encodeURIComponent(fullPth);
|
||||
var answer = confirm("Are you sure you want to delete: " + fullPth);
|
||||
let answer = confirm("Are you sure you want to delete: " + fullPth);
|
||||
if (answer == true) {
|
||||
doAjax("resources/php/filesystemActions.php",
|
||||
"deleteItem=true&item=" + fullPth);
|
||||
@ -103,11 +103,11 @@ function deleteItem() {
|
||||
}
|
||||
}
|
||||
|
||||
function renameItem(obj) {
|
||||
var path = encodeURIComponent(document.getElementById("path").innerHTML);
|
||||
var oldName = encodeURIComponent(formerFileName);
|
||||
var newName = encodeURIComponent(obj.value);
|
||||
var formData = "renameItem=true&oldName=" + oldName + "&newName=" + newName + "&path=" + path;
|
||||
const renameItem = (obj) => {
|
||||
let path = encodeURIComponent(document.getElementById("path").innerHTML);
|
||||
let oldName = encodeURIComponent(formerFileName);
|
||||
let newName = encodeURIComponent(obj.value);
|
||||
let formData = "renameItem=true&oldName=" + oldName + "&newName=" + newName + "&path=" + path;
|
||||
|
||||
console.log("Old name: " + oldName);
|
||||
console.log("New name: " + newName);
|
||||
@ -116,7 +116,7 @@ function renameItem(obj) {
|
||||
formData);
|
||||
}
|
||||
|
||||
function openInLocalProg(media) {
|
||||
const openInLocalProg = (media) => {
|
||||
doAjax("resources/php/filesystemActions.php",
|
||||
"media=" + media);
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
function createPassField(data) {
|
||||
insertArea.innerHTML = "";
|
||||
var passField = document.createElement("INPUT");
|
||||
var submitBttn = document.createElement("BUTTON");
|
||||
const createPassField = (data) => {
|
||||
let passField = document.createElement("INPUT");
|
||||
let submitBttn = document.createElement("BUTTON");
|
||||
passField.id = "PASSWD";
|
||||
passField.type = "password";
|
||||
passField.placeholder = "Password...";
|
||||
submitBttn.innerHTML = "Submit";
|
||||
insertArea.innerHTML = "";
|
||||
|
||||
passField.onkeyup = (eve) => {
|
||||
if (eve.key == "Enter") {
|
||||
|
@ -1,7 +1,7 @@
|
||||
var formerFileName = "";
|
||||
let formerFileName = "";
|
||||
|
||||
function tgglElmView(id) {
|
||||
var elm = document.getElementById(id);
|
||||
const tgglElmView = (id) => {
|
||||
let elm = document.getElementById(id);
|
||||
if (elm.style.display == "none") {
|
||||
elm.style.display = "block";
|
||||
} else {
|
||||
@ -9,14 +9,14 @@ function tgglElmView(id) {
|
||||
}
|
||||
}
|
||||
|
||||
function enableEdit(obj) {
|
||||
const enableEdit = (obj) => {
|
||||
obj.style.backgroundColor = "#ffffffff";
|
||||
obj.style.color = '#000000ff';
|
||||
obj.readOnly = '';
|
||||
formerFileName = obj.value;
|
||||
}
|
||||
|
||||
function disableEdits() {
|
||||
const disableEdits = () => {
|
||||
// this references the passed object from
|
||||
// addEventListener than us passing it
|
||||
this.style.backgroundColor = "#ffffff00";
|
||||
@ -25,13 +25,13 @@ function disableEdits() {
|
||||
this.readOnly = "true";
|
||||
}
|
||||
|
||||
function showImg(imgLoc) {
|
||||
var path = document.getElementById("path").innerHTML;
|
||||
var imgView = document.getElementById("imgView");
|
||||
var fullImage = path + imgLoc;
|
||||
var toPlayerButton = "<div title=\"Open In Local Program\" class=\"popOutBttn\" onclick=\"openInLocalProg('" + fullImage + "')\">∽</div>";
|
||||
var popButton = "<a href=\"" + fullImage + "\" target=\"_blank\"><div class=\"popOutBttn\">↗</div></a>";
|
||||
var CloseBttn = "<div class=\"closeBttn\" onclick=\"closeImg()\">X</div>";
|
||||
const showImg = (imgLoc) => {
|
||||
let path = document.getElementById("path").innerHTML;
|
||||
let imgView = document.getElementById("imgView");
|
||||
let fullImage = path + imgLoc;
|
||||
let toPlayerButton = "<div title=\"Open In Local Program\" class=\"popOutBttn\" onclick=\"openInLocalProg('" + fullImage + "')\">∽</div>";
|
||||
let popButton = "<a href=\"" + fullImage + "\" target=\"_blank\"><div class=\"popOutBttn\">↗</div></a>";
|
||||
let CloseBttn = "<div class=\"closeBttn\" onclick=\"closeImg()\">X</div>";
|
||||
imgView.style.display = "block";
|
||||
imgView.innerHTML = CloseBttn + popButton + toPlayerButton;
|
||||
|
||||
@ -39,18 +39,18 @@ function showImg(imgLoc) {
|
||||
dragContainer(imgView); // Set for dragging events
|
||||
}
|
||||
|
||||
function showMedia(media) {
|
||||
var path = document.getElementById("path").innerHTML;
|
||||
var tempRef = media.toLowerCase();
|
||||
var fullMedia = path + media;
|
||||
const showMedia = (media) => {
|
||||
let path = document.getElementById("path").innerHTML;
|
||||
let tempRef = media.toLowerCase();
|
||||
let fullMedia = path + media;
|
||||
|
||||
if (tempRef.includes(".mp4") || tempRef.includes(".webm") ||
|
||||
tempRef.includes(".mp3") || tempRef.includes(".ogg") ||
|
||||
tempRef.includes(".pdf") || tempRef.includes(".flac")) {
|
||||
var mediaView = document.getElementById("fileView");
|
||||
var toPlayerButton = "<div title=\"Open In Local Program\" class=\"popOutBttn\" onclick=\"openInLocalProg('" + fullMedia + "')\">∽</div>";
|
||||
var popButton = "<a title=\"New Tab\" href=\"" + fullMedia + "\" target=\"_blank\"><div class=\"popOutBttn\">↗</div></a>";
|
||||
var CloseBttn = "<div class=\"closeBttn\" title=\"Close\" onclick=\"closeMedia()\">X</div>";
|
||||
let mediaView = document.getElementById("fileView");
|
||||
let toPlayerButton = "<div title=\"Open In Local Program\" class=\"popOutBttn\" onclick=\"openInLocalProg('" + fullMedia + "')\">∽</div>";
|
||||
let popButton = "<a title=\"New Tab\" href=\"" + fullMedia + "\" target=\"_blank\"><div class=\"popOutBttn\">↗</div></a>";
|
||||
let CloseBttn = "<div class=\"closeBttn\" title=\"Close\" onclick=\"closeMedia()\">X</div>";
|
||||
|
||||
mediaView.style.display = "block";
|
||||
mediaView.innerHTML = CloseBttn + popButton + toPlayerButton;
|
||||
@ -62,29 +62,29 @@ function showMedia(media) {
|
||||
}
|
||||
}
|
||||
|
||||
function closeImg() {
|
||||
var imgView = document.getElementById("imgView");
|
||||
const closeImg = () => {
|
||||
let imgView = document.getElementById("imgView");
|
||||
imgView.style.display = "none";
|
||||
}
|
||||
|
||||
function closeMedia() {
|
||||
var mediaView = document.getElementById("fileView");
|
||||
const closeMedia = () => {
|
||||
let mediaView = document.getElementById("fileView");
|
||||
mediaView.style.display = "none";
|
||||
mediaView.children[3].src = "";
|
||||
}
|
||||
|
||||
function clearDirCookie() {
|
||||
var expireDate = "Thu, 01 Jan 1970 00:00:00 UTC";
|
||||
const clearDirCookie = () => {
|
||||
let expireDate = "Thu, 01 Jan 1970 00:00:00 UTC";
|
||||
document.cookie = "dirQuery=; expires=" + expireDate;
|
||||
getDir("/");
|
||||
}
|
||||
|
||||
function downloadItem() {
|
||||
var partialPath = document.getElementById("path").innerHTML;
|
||||
var brTag = document.createElement("BR");
|
||||
var aTag = document.createElement("A");
|
||||
var text = document.createTextNode(itemObj);
|
||||
var fullPath = partialPath + itemObj;
|
||||
const downloadItem = () => {
|
||||
let partialPath = document.getElementById("path").innerHTML;
|
||||
let brTag = document.createElement("BR");
|
||||
let aTag = document.createElement("A");
|
||||
let text = document.createTextNode(itemObj);
|
||||
let fullPath = partialPath + itemObj;
|
||||
aTag.setAttribute("href", fullPath);
|
||||
aTag.setAttribute("target", "_blank");
|
||||
aTag.setAttribute("id", itemObj);
|
||||
@ -94,6 +94,6 @@ function downloadItem() {
|
||||
aTag.click();
|
||||
}
|
||||
|
||||
function clearDlList() { document.getElementById("CLEARBTTN").click(); }
|
||||
function onloadSetBG() { updateBG("resources/images/backgrounds/000.jpg"); }
|
||||
function updateBG(bgImg) { document.getElementById("bg").src = bgImg; }
|
||||
const clearDlList = () => { document.getElementById("CLEARBTTN").click(); }
|
||||
const onloadSetBG = () => { updateBG("resources/images/backgrounds/000.jpg"); }
|
||||
const updateBG = (bgImg) => { document.getElementById("bg").src = bgImg; }
|
||||
|
@ -1,9 +1,9 @@
|
||||
var itemObj = undefined;
|
||||
let itemObj = undefined;
|
||||
|
||||
document.onclick = function (event) {
|
||||
var obj = event.target;
|
||||
var callingID = obj.id;
|
||||
var classNM = obj.className;
|
||||
document.onclick = (event) => {
|
||||
let obj = event.target;
|
||||
let callingID = obj.id;
|
||||
let classNM = obj.className;
|
||||
|
||||
// right-click detect
|
||||
if (event.which == 3) {
|
||||
@ -11,7 +11,7 @@ document.onclick = function (event) {
|
||||
setSelectedItem(obj.alt);
|
||||
} else if (callingID == "dirID" || callingID == "fileID" ||
|
||||
callingID == "movieID") {
|
||||
var node = obj.parentNode;
|
||||
let node = obj.parentNode;
|
||||
setSelectedItem(node.children[1].value);
|
||||
} else if (classNM == "fileStyle" || classNM == "dirStyle" ||
|
||||
classNM == "movieStyle") {
|
||||
@ -20,10 +20,10 @@ document.onclick = function (event) {
|
||||
}
|
||||
}
|
||||
|
||||
document.ondblclick = function (event) {
|
||||
var obj = event.target;
|
||||
var callingID = obj.id;
|
||||
var classNM = obj.className;
|
||||
document.ondblclick = (event) => {
|
||||
let obj = event.target;
|
||||
let callingID = obj.id;
|
||||
let classNM = obj.className;
|
||||
|
||||
// Left click detect
|
||||
if (event.which == 1) {
|
||||
@ -37,15 +37,15 @@ document.ondblclick = function (event) {
|
||||
}
|
||||
// If clicking on dir icon
|
||||
} else if (callingID == "dirID") {
|
||||
var node = obj.parentNode;
|
||||
let node = obj.parentNode;
|
||||
getDir(node.children[1].value);
|
||||
// If clicking on movie thumbnail
|
||||
} else if (callingID == "movieID") {
|
||||
var node = obj.parentNode;
|
||||
let node = obj.parentNode;
|
||||
showMedia(node.children[1].value);
|
||||
// If clicking on file icon
|
||||
} else if (callingID == "fileID") {
|
||||
var node = obj.parentNode;
|
||||
let node = obj.parentNode;
|
||||
showMedia(node.children[1].value);
|
||||
// If clicking on image
|
||||
} else if (callingID == "imageID") {
|
||||
@ -58,10 +58,10 @@ document.ondblclick = function (event) {
|
||||
}
|
||||
|
||||
// Mainly for rename event
|
||||
document.onkeydown = function (event) {
|
||||
var obj = event.target;
|
||||
var callingID = event.target.id;
|
||||
var keyCodeVal = event.keyCode;
|
||||
document.onkeydown = (event) => {
|
||||
let obj = event.target;
|
||||
let callingID = event.target.id;
|
||||
let keyCodeVal = event.keyCode;
|
||||
|
||||
// If keycode == Enter
|
||||
if (keyCodeVal == 13) {
|
||||
@ -71,14 +71,14 @@ document.onkeydown = function (event) {
|
||||
}
|
||||
}
|
||||
|
||||
function setSelectedItem(item) {
|
||||
const setSelectedItem = (item) => {
|
||||
// Get the item name
|
||||
itemObj = item;
|
||||
}
|
||||
|
||||
// Drage event for the poped out image and media container
|
||||
function dragContainer(elmnt) {
|
||||
var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
|
||||
const dragContainer = (elmnt) => {
|
||||
let pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
|
||||
elmnt.onmousedown = dragMouseDown;
|
||||
|
||||
function dragMouseDown(e) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
const insertArea = document.getElementById('dynDiv');
|
||||
|
||||
|
||||
function handleXMLReturnData(data) {
|
||||
const handleXMLReturnData = (data) => {
|
||||
if (data.activeElement.tagName == "DIR_LIST") {
|
||||
updateHTMLDirList(data);
|
||||
} else if (data.activeElement.tagName == "LOCK_MESSAGE") {
|
||||
@ -14,15 +14,15 @@ function handleXMLReturnData(data) {
|
||||
}
|
||||
}
|
||||
|
||||
function generateFavesList(data) {
|
||||
var listView = document.getElementById("favesList");
|
||||
var favesList = data.getElementsByTagName("FAVE_LINK");
|
||||
var size = favesList .length;
|
||||
listView.innerHTML = "";
|
||||
const generateFavesList = (data) => {
|
||||
let listView = document.getElementById("favesList");
|
||||
let favesList = data.getElementsByTagName("FAVE_LINK");
|
||||
let size = favesList .length;
|
||||
listView.innerHTML = "";
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
var liTag = document.createElement("LI");
|
||||
var txtNode = document.createTextNode(favesList[i].innerHTML);
|
||||
let liTag = document.createElement("LI");
|
||||
let txtNode = document.createTextNode(favesList[i].innerHTML);
|
||||
|
||||
liTag.setAttribute("onclick", "loadFave(this)");
|
||||
liTag.appendChild(txtNode);
|
||||
@ -30,16 +30,16 @@ function generateFavesList(data) {
|
||||
}
|
||||
}
|
||||
|
||||
async function updateHTMLDirList(data) {
|
||||
var isInFaves = data.getElementsByTagName('IN_FAVE')[0].innerHTML;
|
||||
var dirPath = data.getElementsByTagName('PATH_HEAD')[0].innerHTML;
|
||||
var dirs = data.getElementsByTagName('DIR');
|
||||
var videos = data.getElementsByTagName('VID_FILE');
|
||||
var images = data.getElementsByTagName('IMG_FILE');
|
||||
var files = data.getElementsByTagName('FILE');
|
||||
var dirImg = "resources/images/icons/folder.png";
|
||||
var i = 0;
|
||||
var size = 0;
|
||||
const updateHTMLDirList = async (data) => {
|
||||
let isInFaves = data.getElementsByTagName('IN_FAVE')[0].innerHTML;
|
||||
let dirPath = data.getElementsByTagName('PATH_HEAD')[0].innerHTML;
|
||||
let dirs = data.getElementsByTagName('DIR');
|
||||
let videos = data.getElementsByTagName('VID_FILE');
|
||||
let images = data.getElementsByTagName('IMG_FILE');
|
||||
let files = data.getElementsByTagName('FILE');
|
||||
let dirImg = "resources/images/icons/folder.png";
|
||||
let i = 0;
|
||||
let size = 0;
|
||||
|
||||
// Insert dirs
|
||||
document.getElementById("path").innerHTML = dirPath;
|
||||
@ -47,18 +47,18 @@ async function updateHTMLDirList(data) {
|
||||
|
||||
// determin whether to style faves or nor
|
||||
if (isInFaves == "true") {
|
||||
var elm = document.getElementById("faves");
|
||||
let elm = document.getElementById("faves");
|
||||
elm.style.backgroundColor = "rgb(255, 255, 255)";
|
||||
elm.style.color = "rgb(0, 0, 0)";
|
||||
} else {
|
||||
var elm = document.getElementById("faves");
|
||||
let elm = document.getElementById("faves");
|
||||
elm.style.backgroundColor = "";
|
||||
elm.style.color = "";
|
||||
}
|
||||
|
||||
size = dirs.length;
|
||||
for (; i < size; i++) {
|
||||
var dir = dirs[i].innerHTML;
|
||||
let dir = dirs[i].innerHTML;
|
||||
|
||||
if (dir != "resources/") {
|
||||
createElmBlock("DIV", "dirStyle", "dirID", "systemIcon", dirImg ,
|
||||
@ -67,8 +67,8 @@ async function updateHTMLDirList(data) {
|
||||
}
|
||||
|
||||
// Insert videos
|
||||
var thumbnail = "";
|
||||
var vidNme = "";
|
||||
let thumbnail = "";
|
||||
let vidNme = "";
|
||||
size = videos .length;
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
@ -79,8 +79,8 @@ async function updateHTMLDirList(data) {
|
||||
}
|
||||
|
||||
// Insert images
|
||||
var path = document.getElementById("path").innerHTML;
|
||||
var thumbnail = ""
|
||||
let path = document.getElementById("path").innerHTML;
|
||||
thumbnail = "";
|
||||
size = images.length;
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
@ -88,7 +88,7 @@ async function updateHTMLDirList(data) {
|
||||
|
||||
if (thumbnail.match(/000\.(jpg|png|gif)\b/) == null &&
|
||||
!thumbnail.includes("favicon.png")) {
|
||||
var imgTag = document.createElement("IMG");
|
||||
let imgTag = document.createElement("IMG");
|
||||
imgTag.id = "imageID";
|
||||
imgTag.className = "iconImg";
|
||||
imgTag.src = path + thumbnail;
|
||||
@ -98,7 +98,7 @@ async function updateHTMLDirList(data) {
|
||||
}
|
||||
|
||||
// Setup background if there is a 000.* in selection
|
||||
var bgImgPth = images[0] ? images[0].children[0].innerHTML : "";
|
||||
let bgImgPth = images[0] ? images[0].children[0].innerHTML : "";
|
||||
if (bgImgPth.match(/000\.(jpg|png|gif)\b/) != null) {
|
||||
updateBG(path + bgImgPth);
|
||||
} else {
|
||||
@ -108,17 +108,17 @@ async function updateHTMLDirList(data) {
|
||||
// Insert files
|
||||
size = files.length;
|
||||
for (i = 0; i < size; i++) {
|
||||
var fileName = files[i].children[0].innerHTML;
|
||||
let fileName = files[i].children[0].innerHTML;
|
||||
createElmBlock("DIV", "fileStyle", "fileID", "systemIcon", setFileIconType(fileName),
|
||||
"fileTitle", fileName);
|
||||
}
|
||||
}
|
||||
|
||||
function createElmBlock(contnrType, contnrClass, imgID, imgClass,
|
||||
imgSrc, inputClass, fileName) {
|
||||
var contnrTag = document.createElement(contnrType);
|
||||
var imgTag = document.createElement("IMG");
|
||||
var inputTag = document.createElement("INPUT");
|
||||
const createElmBlock = (contnrType, contnrClass, imgID, imgClass,
|
||||
imgSrc, inputClass, fileName) => {
|
||||
let contnrTag = document.createElement(contnrType);
|
||||
let imgTag = document.createElement("IMG");
|
||||
let inputTag = document.createElement("INPUT");
|
||||
|
||||
contnrTag.className = contnrClass;
|
||||
contnrTag.title = fileName;
|
||||
@ -139,7 +139,7 @@ function createElmBlock(contnrType, contnrClass, imgID, imgClass,
|
||||
insertArea.appendChild(contnrTag);
|
||||
}
|
||||
|
||||
function setFileIconType(fileName) {
|
||||
const setFileIconType = (fileName) => {
|
||||
if (fileName.match(/\.(doc|docx|xls|xlsx|rtf)\b/) != null) {
|
||||
return "resources/images/icons/doc.png";
|
||||
} else if (fileName.match(/\.(7z|7zip|zip|tar.gz|tar.xz|gz|rar|jar)\b/) != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user