2018-11-23 23:46:40 +00:00
|
|
|
let formerFileName = "";
|
2018-04-18 10:57:57 +00:00
|
|
|
|
2018-11-23 23:46:40 +00:00
|
|
|
const tgglElmView = (id) => {
|
|
|
|
let elm = document.getElementById(id);
|
2018-07-07 20:32:45 +00:00
|
|
|
if (elm.style.display == "none") {
|
|
|
|
elm.style.display = "block";
|
2018-04-23 07:34:12 +00:00
|
|
|
} else {
|
2018-07-07 20:32:45 +00:00
|
|
|
elm.style.display = "none";
|
2018-04-23 07:34:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-23 23:46:40 +00:00
|
|
|
const enableEdit = (obj) => {
|
2018-07-07 20:32:45 +00:00
|
|
|
obj.style.backgroundColor = "#ffffffff";
|
|
|
|
obj.style.color = '#000000ff';
|
|
|
|
obj.readOnly = '';
|
|
|
|
formerFileName = obj.value;
|
2018-04-23 01:43:19 +00:00
|
|
|
}
|
|
|
|
|
2018-11-23 23:46:40 +00:00
|
|
|
const disableEdits = () => {
|
2018-05-03 08:14:28 +00:00
|
|
|
// this references the passed object from
|
|
|
|
// addEventListener than us passing it
|
2018-07-07 20:32:45 +00:00
|
|
|
this.style.backgroundColor = "#ffffff00";
|
|
|
|
this.style.color = '#ffffff';
|
|
|
|
this.value = formerFileName;
|
|
|
|
this.readOnly = "true";
|
2018-04-23 01:43:19 +00:00
|
|
|
}
|
|
|
|
|
2018-11-23 23:46:40 +00:00
|
|
|
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>";
|
2018-04-18 10:57:57 +00:00
|
|
|
imgView.style.display = "block";
|
|
|
|
imgView.innerHTML = CloseBttn + popButton + toPlayerButton;
|
|
|
|
|
|
|
|
imgView.innerHTML += "<div id=\"imgArea\"><img class=\"imgViewImg\" src=\"" + fullImage + "\" /></div>";
|
|
|
|
dragContainer(imgView); // Set for dragging events
|
|
|
|
}
|
|
|
|
|
2018-11-23 23:46:40 +00:00
|
|
|
const showMedia = (media) => {
|
|
|
|
let path = document.getElementById("path").innerHTML;
|
|
|
|
let tempRef = media.toLowerCase();
|
|
|
|
let fullMedia = path + media;
|
2018-04-18 10:57:57 +00:00
|
|
|
|
|
|
|
if (tempRef.includes(".mp4") || tempRef.includes(".webm") ||
|
|
|
|
tempRef.includes(".mp3") || tempRef.includes(".ogg") ||
|
|
|
|
tempRef.includes(".pdf") || tempRef.includes(".flac")) {
|
2018-11-23 23:46:40 +00:00
|
|
|
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>";
|
2018-04-18 10:57:57 +00:00
|
|
|
|
2018-07-07 20:32:45 +00:00
|
|
|
mediaView.style.display = "block";
|
|
|
|
mediaView.innerHTML = CloseBttn + popButton + toPlayerButton;
|
|
|
|
mediaView.innerHTML += "<iframe id=\"fileViewInner\" src=\"" + fullMedia + "\"></iframe>";
|
2018-04-18 10:57:57 +00:00
|
|
|
|
|
|
|
dragContainer(mediaView); // Set for dragging events
|
|
|
|
} else {
|
|
|
|
openInLocalProg(fullMedia);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-23 23:46:40 +00:00
|
|
|
const closeImg = () => {
|
|
|
|
let imgView = document.getElementById("imgView");
|
2018-04-23 01:43:19 +00:00
|
|
|
imgView.style.display = "none";
|
2018-04-18 10:57:57 +00:00
|
|
|
}
|
|
|
|
|
2018-11-23 23:46:40 +00:00
|
|
|
const closeMedia = () => {
|
|
|
|
let mediaView = document.getElementById("fileView");
|
2018-07-07 20:32:45 +00:00
|
|
|
mediaView.style.display = "none";
|
2018-04-23 01:43:19 +00:00
|
|
|
mediaView.children[3].src = "";
|
2018-04-18 10:57:57 +00:00
|
|
|
}
|
|
|
|
|
2018-11-23 23:46:40 +00:00
|
|
|
const clearDirCookie = () => {
|
|
|
|
let expireDate = "Thu, 01 Jan 1970 00:00:00 UTC";
|
2018-04-23 01:43:19 +00:00
|
|
|
document.cookie = "dirQuery=; expires=" + expireDate;
|
|
|
|
getDir("/");
|
2018-04-18 10:57:57 +00:00
|
|
|
}
|
|
|
|
|
2018-11-23 23:46:40 +00:00
|
|
|
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;
|
2018-11-19 23:32:16 +00:00
|
|
|
aTag.setAttribute("href", fullPath);
|
|
|
|
aTag.setAttribute("target", "_blank");
|
|
|
|
aTag.setAttribute("id", itemObj);
|
|
|
|
aTag.append(text);
|
|
|
|
|
|
|
|
document.getElementById("serverMsgView").append(aTag, brTag);
|
|
|
|
aTag.click();
|
|
|
|
}
|
|
|
|
|
2018-11-23 23:46:40 +00:00
|
|
|
const clearDlList = () => { document.getElementById("CLEARBTTN").click(); }
|
|
|
|
const onloadSetBG = () => { updateBG("resources/images/backgrounds/000.jpg"); }
|
|
|
|
const updateBG = (bgImg) => { document.getElementById("bg").src = bgImg; }
|