Merged media container creation. Allows for multiple now.
This commit is contained in:
parent
4c17be62b3
commit
d0511bc6fb
@ -38,8 +38,6 @@
|
|||||||
<!-- Dynamic content targets -->
|
<!-- Dynamic content targets -->
|
||||||
<ul id="favesList" style="display: none;"> </ul>
|
<ul id="favesList" style="display: none;"> </ul>
|
||||||
<div id="dynDiv"></div>
|
<div id="dynDiv"></div>
|
||||||
<div id="imgView" style="display:none;"></div>
|
|
||||||
<div id="fileView" style="display:none;"></div>
|
|
||||||
|
|
||||||
<div id="popOutControls" style="display:none;">
|
<div id="popOutControls" style="display:none;">
|
||||||
<center>
|
<center>
|
||||||
|
@ -48,52 +48,81 @@ const disableEdits = () => {
|
|||||||
this.readOnly = "true";
|
this.readOnly = "true";
|
||||||
}
|
}
|
||||||
|
|
||||||
const showImg = (imgLoc) => {
|
const showMedia = (mediaLoc, type) => {
|
||||||
let path = document.getElementById("path").innerHTML;
|
let path = document.getElementById("path").innerHTML;
|
||||||
let imgView = document.getElementById("imgView");
|
let tempRef = mediaLoc.toLowerCase();
|
||||||
let fullImage = path + imgLoc;
|
let fullMedia = path + mediaLoc;
|
||||||
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;
|
|
||||||
|
|
||||||
imgView.innerHTML += "<div id=\"imgArea\"><img class=\"imgViewImg\" src=\"" + fullImage + "\" /></div>";
|
let iframe = document.createElement("IFRAME");
|
||||||
dragContainer(imgView); // Set for dragging events
|
let outterDiv = document.createElement("DIV");
|
||||||
}
|
let popOutDiv = document.createElement("DIV");
|
||||||
|
let closeDiv = document.createElement("DIV");
|
||||||
|
let toLocDiv = document.createElement("DIV");
|
||||||
|
let imgDiv = document.createElement("DIV");
|
||||||
|
let aTag = document.createElement("A");
|
||||||
|
let imgTag = document.createElement("IMG");
|
||||||
|
let closeText = document.createTextNode("X");
|
||||||
|
|
||||||
const showMedia = (media) => {
|
if (type === "image") {
|
||||||
let path = document.getElementById("path").innerHTML;
|
outterDiv.id = "imgView";
|
||||||
let tempRef = media.toLowerCase();
|
} else {
|
||||||
let fullMedia = path + media;
|
outterDiv.id = "fileView";
|
||||||
|
}
|
||||||
|
|
||||||
|
closeDiv.className = "closeBttn";
|
||||||
|
closeDiv.title = "Close";
|
||||||
|
closeDiv.setAttribute("onclick", "closeContainer(this)");
|
||||||
|
closeDiv.appendChild(closeText);
|
||||||
|
|
||||||
|
aTag.title = "New Tab";
|
||||||
|
aTag.target = "_blank";
|
||||||
|
aTag.href = fullMedia;
|
||||||
|
|
||||||
|
popOutDiv.className = "popOutBttn";
|
||||||
|
popOutDiv.innerHTML = "↗";
|
||||||
|
aTag.appendChild(popOutDiv);
|
||||||
|
|
||||||
|
toLocDiv.title = "Open In Local Program";
|
||||||
|
toLocDiv.className = "popOutBttn";
|
||||||
|
toLocDiv.innerHTML = "∽";
|
||||||
|
toLocDiv.setAttribute("onclick", "openInLocalProg('" + fullMedia + "')");
|
||||||
|
|
||||||
|
imgDiv.id = "imgArea";
|
||||||
|
imgTag.className = "imgViewImg";
|
||||||
|
imgDiv.appendChild(imgTag);
|
||||||
|
imgTag.src = fullMedia;
|
||||||
|
|
||||||
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") ||
|
||||||
let mediaView = document.getElementById("fileView");
|
tempRef.includes(".mkv") || tempRef.includes(".avi")) {
|
||||||
let toPlayerButton = "<div title=\"Open In Local Program\" class=\"popOutBttn\" onclick=\"openInLocalProg('" + fullMedia + "')\">∽</div>";
|
if (tempRef.includes(".mkv") || tempRef.includes(".avi")) {
|
||||||
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;
|
|
||||||
mediaView.innerHTML += "<iframe id=\"fileViewInner\" src=\"" + fullMedia + "\"></iframe>";
|
|
||||||
|
|
||||||
dragContainer(mediaView); // Set for dragging events
|
|
||||||
} else {
|
|
||||||
openInLocalProg(fullMedia);
|
openInLocalProg(fullMedia);
|
||||||
|
return;
|
||||||
|
// Future option to convert container and view certain media.
|
||||||
|
// fullMedia = quickRemux(fullMedia);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
iframe.id = "fileViewInner";
|
||||||
|
iframe.src = fullMedia;
|
||||||
|
|
||||||
|
outterDiv.appendChild(closeDiv);
|
||||||
|
outterDiv.appendChild(aTag);
|
||||||
|
outterDiv.appendChild(toLocDiv);
|
||||||
|
|
||||||
|
if (type === "image") {
|
||||||
|
outterDiv.appendChild(imgDiv);
|
||||||
|
} else {
|
||||||
|
outterDiv.appendChild(iframe);
|
||||||
|
}
|
||||||
|
|
||||||
|
document.body.appendChild(outterDiv);
|
||||||
|
dragContainer(outterDiv); // Set for dragging events
|
||||||
}
|
}
|
||||||
|
|
||||||
const closeImg = () => {
|
const closeContainer = (elm) => {
|
||||||
let imgView = document.getElementById("imgView");
|
elm.parentElement.parentElement.removeChild(elm.parentElement);
|
||||||
imgView.style.display = "none";
|
|
||||||
}
|
|
||||||
|
|
||||||
const closeMedia = () => {
|
|
||||||
let mediaView = document.getElementById("fileView");
|
|
||||||
mediaView.style.display = "none";
|
|
||||||
mediaView.children[3].src = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const clearDirCookie = () => {
|
const clearDirCookie = () => {
|
||||||
|
@ -48,8 +48,8 @@ document.ondblclick = (event) => {
|
|||||||
let 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", "image") {
|
||||||
showImg(obj.alt);
|
showMedia(obj.alt);
|
||||||
// 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