Added download functionality
This commit is contained in:
parent
fc03202bf3
commit
d101b97dd3
@ -15,6 +15,7 @@
|
|||||||
<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="tgglElmView('serverMsgView')"></menuitem>
|
<menuitem label="Show Server Messages" onclick="tgglElmView('serverMsgView')"></menuitem>
|
||||||
|
<menuitem label="Download" onclick="downloadItem()"></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>
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
var itemObj = undefined;
|
|
||||||
var binary = null;
|
var binary = null;
|
||||||
var pathNodes = [];
|
var pathNodes = [];
|
||||||
|
|
||||||
@ -87,11 +86,6 @@ function createItem(type) {
|
|||||||
"createItem=true&item=" + fullPth + "&type=" + type);
|
"createItem=true&item=" + fullPth + "&type=" + type);
|
||||||
}
|
}
|
||||||
|
|
||||||
function startDeleteItem(item) {
|
|
||||||
// Get the item name
|
|
||||||
itemObj = item;
|
|
||||||
}
|
|
||||||
|
|
||||||
function deleteItem() {
|
function deleteItem() {
|
||||||
var path = document.getElementById("path").innerHTML;
|
var path = document.getElementById("path").innerHTML;
|
||||||
// Clicked yes to delete and there is an item
|
// Clicked yes to delete and there is an item
|
||||||
|
@ -79,6 +79,21 @@ function clearDirCookie() {
|
|||||||
getDir("/");
|
getDir("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function downloadItem() {
|
||||||
|
var partialPath = document.getElementById("path").innerHTML;
|
||||||
|
var aTag = document.createElement("A");
|
||||||
|
var text = document.createTextNode(itemObj);
|
||||||
|
var fullPath = partialPath + itemObj;
|
||||||
|
aTag.setAttribute("href", fullPath);
|
||||||
|
aTag.setAttribute("target", "_blank");
|
||||||
|
aTag.setAttribute("id", itemObj);
|
||||||
|
aTag.append(text);
|
||||||
|
|
||||||
|
console.log(aTag);
|
||||||
|
document.getElementById("serverMsgView").append(aTag);
|
||||||
|
document.getElementById(itemObj).click();
|
||||||
|
}
|
||||||
|
|
||||||
function clearDlList() { document.getElementById("CLEARBTTN").click(); }
|
function clearDlList() { document.getElementById("CLEARBTTN").click(); }
|
||||||
function onloadSetBG() { updateBG("resources/images/backgrounds/000.jpg"); }
|
function onloadSetBG() { updateBG("resources/images/backgrounds/000.jpg"); }
|
||||||
function updateBG(bgImg) { document.getElementById("bg").src = bgImg; }
|
function updateBG(bgImg) { document.getElementById("bg").src = bgImg; }
|
||||||
|
@ -1,4 +1,25 @@
|
|||||||
// ondblclick
|
var itemObj = undefined;
|
||||||
|
|
||||||
|
document.onclick = function (event) {
|
||||||
|
var obj = event.target;
|
||||||
|
var callingID = obj.id;
|
||||||
|
var classNM = obj.className;
|
||||||
|
|
||||||
|
// right-click detect
|
||||||
|
if (event.which == 3) {
|
||||||
|
if (callingID == "imageID") {
|
||||||
|
setSelectedItem(obj.alt);
|
||||||
|
} else if (callingID == "dirID" || callingID == "fileID" ||
|
||||||
|
callingID == "movieID") {
|
||||||
|
var node = obj.parentNode;
|
||||||
|
setSelectedItem(node.children[1].value);
|
||||||
|
} else if (classNM == "fileStyle" || classNM == "dirStyle" ||
|
||||||
|
classNM == "movieStyle") {
|
||||||
|
setSelectedItem(obj.children[1].value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
document.ondblclick = function (event) {
|
document.ondblclick = function (event) {
|
||||||
var obj = event.target;
|
var obj = event.target;
|
||||||
var callingID = obj.id;
|
var callingID = obj.id;
|
||||||
@ -33,18 +54,6 @@ document.ondblclick = function (event) {
|
|||||||
} else if (callingID == "titleID") {
|
} else if (callingID == "titleID") {
|
||||||
enableEdit(obj);
|
enableEdit(obj);
|
||||||
}
|
}
|
||||||
// Right click detect
|
|
||||||
} else if (event.which == 3) {
|
|
||||||
if (callingID == "imageID") {
|
|
||||||
startDeleteItem(obj.alt);
|
|
||||||
} else if (callingID == "dirID" || callingID == "fileID" ||
|
|
||||||
callingID == "movieID") {
|
|
||||||
var node = obj.parentNode;
|
|
||||||
startDeleteItem(node.children[1].value);
|
|
||||||
} else if (classNM == "fileStyle" || classNM == "dirStyle" ||
|
|
||||||
classNM == "movieStyle") {
|
|
||||||
startDeleteItem(obj.children[1].value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,6 +71,11 @@ document.onkeydown = function (event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setSelectedItem(item) {
|
||||||
|
// Get the item name
|
||||||
|
itemObj = item;
|
||||||
|
}
|
||||||
|
|
||||||
// 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;
|
||||||
|
Loading…
Reference in New Issue
Block a user