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