Cleaned up code...
This commit is contained in:
parent
0651d0e5d2
commit
8c04339398
|
@ -14,14 +14,14 @@
|
||||||
<!-- Create the menu -->
|
<!-- Create the menu -->
|
||||||
<menu type="context" id="menu">
|
<menu type="context" id="menu">
|
||||||
<menuitem label="Home Directory" onclick="clearDirCookie()"></menuitem>
|
<menuitem label="Home Directory" onclick="clearDirCookie()"></menuitem>
|
||||||
<menuitem label="Show Server Messages" onclick="tgglServerMsgView()"></menuitem>
|
<menuitem label="Show Server Messages" onclick="tgglElmView('toggleServerMsg')"></menuitem>
|
||||||
<menuitem label="Clear Upload List" onclick="clearDlList()"></menuitem>
|
<menuitem label="Clear Upload List" onclick="clearDlList()"></menuitem>
|
||||||
<menuitem label="Delete File/Directory" onclick="deleteItem()"></menuitem>
|
<menuitem label="Delete File/Directory" onclick="deleteItem()"></menuitem>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
||||||
<!-- Uploader -->
|
<!-- Uploader -->
|
||||||
<h2 id="fullPathHeader">
|
<h2 id="fullPathHeader">
|
||||||
<button type="button" title="Other Options" name="button" onclick="showOptions()">⚙</button>
|
<button type="button" title="Other Options" name="button" onclick="tgglElmView('popOutControls')">⚙</button>
|
||||||
<button type="button" title="Refresh" name="button" onclick="getDir('./')">↻</button>
|
<button type="button" title="Refresh" name="button" onclick="getDir('./')">↻</button>
|
||||||
<button type="button" title="Back" name="button" onclick="getDir('../')">⇐</button>
|
<button type="button" title="Back" name="button" onclick="getDir('../')">⇐</button>
|
||||||
Path: <span id="path"></span>
|
Path: <span id="path"></span>
|
||||||
|
|
|
@ -13,10 +13,10 @@ if(typeof(EventSource) !== "undefined") {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDir(query) {
|
function getDir(query) {
|
||||||
var formUlPth = document.getElementById("DIRPATHUL");
|
var formUlPth = document.getElementById("DIRPATHUL");
|
||||||
var path = "";
|
var path = "";
|
||||||
var cookies = "";
|
var cookies = "";
|
||||||
var dirCookie = "";
|
var dirCookie = "";
|
||||||
|
|
||||||
// push or pop to path list
|
// push or pop to path list
|
||||||
if (query === "/") {
|
if (query === "/") {
|
||||||
|
@ -50,15 +50,15 @@ function getDir(query) {
|
||||||
path += pathNode;
|
path += pathNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
formUlPth.value = path; // Setup upload path for form
|
formUlPth.value = path; // Setup upload path for form
|
||||||
path = "dirQuery=" + encodeURIComponent(path);
|
path = "dirQuery=" + encodeURIComponent(path);
|
||||||
process(path);
|
process(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get dir info...
|
// Get dir info...
|
||||||
function process(path) {
|
function process(path) {
|
||||||
var mergeType = document.getElementById("MergeType");
|
var mergeType = document.getElementById("MergeType");
|
||||||
var xhttp = new XMLHttpRequest(); // Create the xhttp object
|
var xhttp = new XMLHttpRequest(); // Create the xhttp object
|
||||||
|
|
||||||
// This is actually run after open and send are done
|
// This is actually run after open and send are done
|
||||||
xhttp.onreadystatechange = function() {
|
xhttp.onreadystatechange = function() {
|
||||||
|
|
|
@ -5,27 +5,23 @@ function renameItem(obj) {
|
||||||
var oldName = encodeURIComponent(formerFileName);
|
var oldName = encodeURIComponent(formerFileName);
|
||||||
var newName = encodeURIComponent(obj.value);
|
var newName = encodeURIComponent(obj.value);
|
||||||
var formData = "renameItem=true&oldName=" + oldName + "&newName=" + newName + "&path=" + path;
|
var formData = "renameItem=true&oldName=" + oldName + "&newName=" + newName + "&path=" + path;
|
||||||
var xhttp = new XMLHttpRequest();
|
|
||||||
|
|
||||||
console.log("Old name: " + oldName);
|
console.log("Old name: " + oldName);
|
||||||
console.log("New name: " + newName);
|
console.log("New name: " + newName);
|
||||||
|
|
||||||
xhttp.open("POST", "resources/php/filesystemActions.php", true);
|
doFSAction("resources/php/filesystemActions.php",
|
||||||
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
formData);
|
||||||
xhttp.send(formData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function createItem(type) {
|
function createItem(type) {
|
||||||
var path = document.getElementById("path").innerHTML;
|
var path = document.getElementById("path").innerHTML;
|
||||||
var newItem = document.getElementById("NewItem");
|
var newItem = document.getElementById("NewItem");
|
||||||
var fullPth = path + newItem.value;
|
var fullPth = path + newItem.value;
|
||||||
var xhttp = new XMLHttpRequest();
|
|
||||||
newItem.value = "";
|
newItem.value = "";
|
||||||
fullPth = encodeURIComponent(fullPth);
|
fullPth = encodeURIComponent(fullPth);
|
||||||
|
|
||||||
xhttp.open("POST", "resources/php/filesystemActions.php", true);
|
doFSAction("resources/php/filesystemActions.php",
|
||||||
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
"createItem=true&item=" + fullPth + "&type=" + type);
|
||||||
xhttp.send("createItem=true&item=" + fullPth + "&type=" + type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function startDeleteItem(item) {
|
function startDeleteItem(item) {
|
||||||
|
@ -39,13 +35,10 @@ function deleteItem() {
|
||||||
if (itemObj != undefined && itemObj != null) {
|
if (itemObj != undefined && itemObj != null) {
|
||||||
var fullPth = path + itemObj;
|
var fullPth = path + itemObj;
|
||||||
fullPth = encodeURIComponent(fullPth);
|
fullPth = encodeURIComponent(fullPth);
|
||||||
var answer = confirm("Are you sure you want to delete: " + fullPth);
|
var answer = confirm("Are you sure you want to delete: " + fullPth);
|
||||||
if (answer == true) {
|
if (answer == true) {
|
||||||
var xhttp = new XMLHttpRequest();
|
doFSAction("resources/php/filesystemActions.php",
|
||||||
|
"deleteItem=true&item=" + fullPth);
|
||||||
xhttp.open("POST", "resources/php/filesystemActions.php", true);
|
|
||||||
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
|
||||||
xhttp.send("deleteItem=true&item=" + fullPth);
|
|
||||||
|
|
||||||
console.log("Deleted: " + fullPth);
|
console.log("Deleted: " + fullPth);
|
||||||
itemObj = null;
|
itemObj = null;
|
||||||
|
@ -54,9 +47,13 @@ function deleteItem() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function openInLocalProg(media) {
|
function openInLocalProg(media) {
|
||||||
var xhttp = new XMLHttpRequest();
|
doFSAction("resources/php/filesystemActions.php",
|
||||||
|
"media=" + media);
|
||||||
xhttp.open("POST", "resources/php/filesystemActions.php", true);
|
}
|
||||||
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
|
||||||
xhttp.send("media=" + media);
|
function doFSAction(actionPath, data) {
|
||||||
|
var xhttp = new XMLHttpRequest();
|
||||||
|
xhttp.open("POST", actionPath, true);
|
||||||
|
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||||
|
xhttp.send(data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,37 +1,28 @@
|
||||||
var formerFileName = "";
|
var formerFileName = "";
|
||||||
|
|
||||||
function showOptions() {
|
function tgglElmView(id) {
|
||||||
var popOutControls = document.getElementById("popOutControls");
|
var elm = document.getElementById(id);
|
||||||
if (popOutControls.style.display == "none") {
|
if (elm.style.display == "none") {
|
||||||
popOutControls.style.display = "block";
|
elm.style.display = "block";
|
||||||
} else {
|
} else {
|
||||||
popOutControls.style.display = "none";
|
elm.style.display = "none";
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function tgglServerMsgView() {
|
|
||||||
var serverMsgView = document.getElementById("toggleServerMsg");
|
|
||||||
if (serverMsgView.style.display == "none") {
|
|
||||||
serverMsgView.style.display = "block";
|
|
||||||
} else {
|
|
||||||
serverMsgView.style.display = "none";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function enableEdit(obj) {
|
function 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() {
|
function 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";
|
||||||
this.style.color = '#ffffff';
|
this.style.color = '#ffffff';
|
||||||
this.value = formerFileName;
|
this.value = formerFileName;
|
||||||
this.readOnly = "true";
|
this.readOnly = "true";
|
||||||
}
|
}
|
||||||
|
|
||||||
function showImg(imgLoc) {
|
function showImg(imgLoc) {
|
||||||
|
@ -61,9 +52,9 @@ function showMedia(media) {
|
||||||
var popButton = "<a title=\"New Tab\" href=\"" + fullMedia + "\" target=\"_blank\"><div class=\"popOutBttn\">↗</div></a>";
|
var 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>";
|
var 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;
|
||||||
mediaView.innerHTML += "<iframe id=\"fileViewInner\" src=\"" + fullMedia + "\"></iframe>";
|
mediaView.innerHTML += "<iframe id=\"fileViewInner\" src=\"" + fullMedia + "\"></iframe>";
|
||||||
|
|
||||||
dragContainer(mediaView); // Set for dragging events
|
dragContainer(mediaView); // Set for dragging events
|
||||||
} else {
|
} else {
|
||||||
|
@ -72,13 +63,13 @@ function showMedia(media) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeImg() {
|
function closeImg() {
|
||||||
var imgView = document.getElementById("imgView");
|
var imgView = document.getElementById("imgView");
|
||||||
imgView.style.display = "none";
|
imgView.style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeMedia() {
|
function closeMedia() {
|
||||||
var mediaView = document.getElementById("fileView");
|
var mediaView = document.getElementById("fileView");
|
||||||
mediaView.style.display = "none";
|
mediaView.style.display = "none";
|
||||||
mediaView.children[3].src = "";
|
mediaView.children[3].src = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,14 +79,6 @@ function clearDirCookie() {
|
||||||
getDir("/");
|
getDir("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearDlList() {
|
function clearDlList() { document.getElementById("CLEARBTTN").click(); }
|
||||||
document.getElementById("CLEARBTTN").click();
|
function onloadSetBG() { updateBG("resources/images/backgrounds/000.jpg"); }
|
||||||
}
|
function updateBG(bgImg) { document.getElementById("bg").src = bgImg; }
|
||||||
|
|
||||||
function onloadSetBG() {
|
|
||||||
updateBG("resources/images/backgrounds/000.jpg");
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateBG(bgImg) {
|
|
||||||
document.getElementById("bg").src = bgImg;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// ondblclick
|
// ondblclick
|
||||||
document.ondblclick = function (event) {
|
document.ondblclick = function (event) {
|
||||||
var obj = event.target;
|
var obj = event.target;
|
||||||
var callingID = obj.id;
|
var callingID = obj.id;
|
||||||
var classNM = obj.className;
|
var classNM = obj.className;
|
||||||
|
|
||||||
// Left click detect
|
// Left click detect
|
||||||
if (event.which == 1) {
|
if (event.which == 1) {
|
||||||
|
@ -50,8 +50,8 @@ document.ondblclick = function (event) {
|
||||||
|
|
||||||
// Mainly for rename event
|
// Mainly for rename event
|
||||||
document.onkeydown = function (event) {
|
document.onkeydown = function (event) {
|
||||||
var obj = event.target;
|
var obj = event.target;
|
||||||
var callingID = event.target.id;
|
var callingID = event.target.id;
|
||||||
var keyCodeVal = event.keyCode;
|
var keyCodeVal = event.keyCode;
|
||||||
|
|
||||||
// If keycode == Enter
|
// If keycode == Enter
|
||||||
|
@ -65,7 +65,7 @@ document.onkeydown = function (event) {
|
||||||
// Drage event for the poped out image and media container
|
// Drage event for the poped out image and media container
|
||||||
function dragContainer(elmnt) {
|
function dragContainer(elmnt) {
|
||||||
var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
|
var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
|
||||||
elmnt.onmousedown = dragMouseDown;
|
elmnt.onmousedown = dragMouseDown;
|
||||||
|
|
||||||
function dragMouseDown(e) {
|
function dragMouseDown(e) {
|
||||||
e = e || window.event;
|
e = e || window.event;
|
||||||
|
|
Loading…
Reference in New Issue