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