mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-10 10:36:47 +01:00
fileManager() gone, new openCloseDir() function
The fileManager function was only being called once onLoad of files.php This was really only adding onClick events and setting classNames and style.displays, no need to do this really with JS, merged into files.php as it's creating the tree openCloseDir function now available to deal with open & close of dirs This is less code, less JS to run on boot and paves the way towards multiple treeTypes
This commit is contained in:
@@ -377,37 +377,14 @@ var ICEcoder = {
|
||||
// FILES
|
||||
// ==============
|
||||
|
||||
// Setup the file manager
|
||||
fileManager: function() {
|
||||
ICEcoder.filesFrame = top.document.getElementById('filesFrame');
|
||||
if (!ICEcoder.filesFrame.contentWindow.document.getElementsByTagName) {return;};
|
||||
|
||||
var aMenus = ICEcoder.filesFrame.contentWindow.document.getElementsByTagName("LI");
|
||||
for (var i=0; i<aMenus.length; i++) {
|
||||
var mclass = aMenus[i].className;
|
||||
if (mclass.indexOf("pft-directory")>-1) {
|
||||
var submenu=aMenus[i].childNodes;
|
||||
for (var j=0; j<submenu.length; j++) {
|
||||
if (submenu[j].tagName=="A") {
|
||||
submenu[j].onclick = function() {
|
||||
var node = this.parentNode.nextSibling.nextSibling;
|
||||
if (node && node.tagName=="UL") {
|
||||
var d = node.style.display=="none";
|
||||
node.style.display = d ? "block" : "none";
|
||||
this.parentNode.className=this.className = d ? "pft-directory dirOpen" : "pft-directory";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Open/close dirs on demand
|
||||
openCloseDir: function(dir) {
|
||||
var node = dir.parentNode.nextSibling.nextSibling;
|
||||
if (node && node.tagName=="UL") {
|
||||
var d = node.style.display=="none";
|
||||
node.style.display = d ? "block" : "none";
|
||||
dir.parentNode.className=dir.className = d ? "pft-directory dirOpen" : "pft-directory";
|
||||
}
|
||||
var ulElems = ICEcoder.filesFrame.contentWindow.document.getElementsByTagName("UL");
|
||||
for (var i=2; i<ulElems.length; i++) {
|
||||
ulElems[i].style.display = "none";
|
||||
}
|
||||
ulElems[0].childNodes[1].className = "pft-directory dirOpen";
|
||||
ulElems[1].style.display = "block";
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user