Cleaned up some code logic.
This commit is contained in:
parent
d0511bc6fb
commit
35402f3906
@ -63,12 +63,6 @@ const showMedia = (mediaLoc, type) => {
|
||||
let imgTag = document.createElement("IMG");
|
||||
let closeText = document.createTextNode("X");
|
||||
|
||||
if (type === "image") {
|
||||
outterDiv.id = "imgView";
|
||||
} else {
|
||||
outterDiv.id = "fileView";
|
||||
}
|
||||
|
||||
closeDiv.className = "closeBttn";
|
||||
closeDiv.title = "Close";
|
||||
closeDiv.setAttribute("onclick", "closeContainer(this)");
|
||||
@ -89,8 +83,8 @@ const showMedia = (mediaLoc, type) => {
|
||||
|
||||
imgDiv.id = "imgArea";
|
||||
imgTag.className = "imgViewImg";
|
||||
imgDiv.appendChild(imgTag);
|
||||
imgTag.src = fullMedia;
|
||||
imgDiv.appendChild(imgTag);
|
||||
|
||||
if (tempRef.includes(".mp4") || tempRef.includes(".webm") ||
|
||||
tempRef.includes(".mp3") || tempRef.includes(".ogg") ||
|
||||
@ -112,8 +106,10 @@ const showMedia = (mediaLoc, type) => {
|
||||
outterDiv.appendChild(toLocDiv);
|
||||
|
||||
if (type === "image") {
|
||||
outterDiv.id = "imgView";
|
||||
outterDiv.appendChild(imgDiv);
|
||||
} else {
|
||||
outterDiv.id = "fileView";
|
||||
outterDiv.appendChild(iframe);
|
||||
}
|
||||
|
||||
|
@ -33,23 +33,23 @@ document.ondblclick = (event) => {
|
||||
if (classNM == "dirStyle") {
|
||||
getDir(obj.children[1].value);
|
||||
} else {
|
||||
showMedia(obj.children[1].value);
|
||||
showMedia(obj.children[1].value, "file");
|
||||
}
|
||||
// If clicking on dir icon
|
||||
} else if (callingID == "dirID") {
|
||||
let node = obj.parentNode;
|
||||
getDir(node.children[1].value);
|
||||
getDir(node.children[1].value, "dir");
|
||||
// If clicking on movie thumbnail
|
||||
} else if (callingID == "movieID") {
|
||||
let node = obj.parentNode;
|
||||
showMedia(node.children[1].value);
|
||||
showMedia(node.children[1].value, "movie");
|
||||
// If clicking on file icon
|
||||
} else if (callingID == "fileID") {
|
||||
let node = obj.parentNode;
|
||||
showMedia(node.children[1].value);
|
||||
showMedia(node.children[1].value, "file");
|
||||
// If clicking on image
|
||||
} else if (callingID == "imageID", "image") {
|
||||
showMedia(obj.alt);
|
||||
} else if (callingID == "imageID") {
|
||||
showMedia(obj.alt, "image");
|
||||
// If clicking on text title
|
||||
} else if (callingID == "titleID") {
|
||||
enableEdit(obj);
|
||||
|
Loading…
Reference in New Issue
Block a user