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 imgTag = document.createElement("IMG");
|
||||||
let closeText = document.createTextNode("X");
|
let closeText = document.createTextNode("X");
|
||||||
|
|
||||||
if (type === "image") {
|
|
||||||
outterDiv.id = "imgView";
|
|
||||||
} else {
|
|
||||||
outterDiv.id = "fileView";
|
|
||||||
}
|
|
||||||
|
|
||||||
closeDiv.className = "closeBttn";
|
closeDiv.className = "closeBttn";
|
||||||
closeDiv.title = "Close";
|
closeDiv.title = "Close";
|
||||||
closeDiv.setAttribute("onclick", "closeContainer(this)");
|
closeDiv.setAttribute("onclick", "closeContainer(this)");
|
||||||
@ -89,8 +83,8 @@ const showMedia = (mediaLoc, type) => {
|
|||||||
|
|
||||||
imgDiv.id = "imgArea";
|
imgDiv.id = "imgArea";
|
||||||
imgTag.className = "imgViewImg";
|
imgTag.className = "imgViewImg";
|
||||||
imgDiv.appendChild(imgTag);
|
|
||||||
imgTag.src = fullMedia;
|
imgTag.src = fullMedia;
|
||||||
|
imgDiv.appendChild(imgTag);
|
||||||
|
|
||||||
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") ||
|
||||||
@ -112,8 +106,10 @@ const showMedia = (mediaLoc, type) => {
|
|||||||
outterDiv.appendChild(toLocDiv);
|
outterDiv.appendChild(toLocDiv);
|
||||||
|
|
||||||
if (type === "image") {
|
if (type === "image") {
|
||||||
|
outterDiv.id = "imgView";
|
||||||
outterDiv.appendChild(imgDiv);
|
outterDiv.appendChild(imgDiv);
|
||||||
} else {
|
} else {
|
||||||
|
outterDiv.id = "fileView";
|
||||||
outterDiv.appendChild(iframe);
|
outterDiv.appendChild(iframe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,23 +33,23 @@ document.ondblclick = (event) => {
|
|||||||
if (classNM == "dirStyle") {
|
if (classNM == "dirStyle") {
|
||||||
getDir(obj.children[1].value);
|
getDir(obj.children[1].value);
|
||||||
} else {
|
} else {
|
||||||
showMedia(obj.children[1].value);
|
showMedia(obj.children[1].value, "file");
|
||||||
}
|
}
|
||||||
// If clicking on dir icon
|
// If clicking on dir icon
|
||||||
} else if (callingID == "dirID") {
|
} else if (callingID == "dirID") {
|
||||||
let node = obj.parentNode;
|
let node = obj.parentNode;
|
||||||
getDir(node.children[1].value);
|
getDir(node.children[1].value, "dir");
|
||||||
// If clicking on movie thumbnail
|
// If clicking on movie thumbnail
|
||||||
} else if (callingID == "movieID") {
|
} else if (callingID == "movieID") {
|
||||||
let node = obj.parentNode;
|
let node = obj.parentNode;
|
||||||
showMedia(node.children[1].value);
|
showMedia(node.children[1].value, "movie");
|
||||||
// If clicking on file icon
|
// If clicking on file icon
|
||||||
} else if (callingID == "fileID") {
|
} else if (callingID == "fileID") {
|
||||||
let node = obj.parentNode;
|
let node = obj.parentNode;
|
||||||
showMedia(node.children[1].value);
|
showMedia(node.children[1].value, "file");
|
||||||
// If clicking on image
|
// If clicking on image
|
||||||
} else if (callingID == "imageID", "image") {
|
} else if (callingID == "imageID") {
|
||||||
showMedia(obj.alt);
|
showMedia(obj.alt, "image");
|
||||||
// If clicking on text title
|
// If clicking on text title
|
||||||
} else if (callingID == "titleID") {
|
} else if (callingID == "titleID") {
|
||||||
enableEdit(obj);
|
enableEdit(obj);
|
||||||
|
Loading…
Reference in New Issue
Block a user