onclick needs if check and simpler title updating

onclick function needed is statement plus passing of event on anon
function to solve repeated CTRL+click issue
Update title not by adjusting hardcoded values but by looking to ID of
targetElem
We're able to get rid of a lot of code here as the onmouseover function
is now looking to a child node item in get-branch.php, so no need to
mess with updating hardcoded string values.
This commit is contained in:
Matt Pass
2013-05-12 13:56:30 +01:00
parent 2dfff50031
commit 535677fc8e

View File

@@ -440,7 +440,11 @@ var ICEcoder = {
openCloseDir: function(dir,load) {
var node, d;
dir.onclick = function() {top.ICEcoder.openCloseDir(this,false)};
dir.onclick = function(event) {
if(!event.ctrlKey) {
top.ICEcoder.openCloseDir(this,false);
}
};
node = dir.parentNode;
if (node.nextSibling) {node = node.nextSibling};
if (node && node.tagName=="UL") {
@@ -807,11 +811,9 @@ var ICEcoder = {
targetElem = document.getElementById('filesFrame').contentWindow.document.getElementById(shortURL);
// Set the name to be as per our new file/folder name
targetElem.innerHTML = file;
// Finally, update the ID of the target & set a new mouseover function for the parent too
// Finally, update the ID of the target & set a new title and perms ID
targetElem.id = location.replace(/\//g,"|") + "|" + file;
newMouseOver = targetElem.parentNode.onmouseover.toString().replace(shortURL.substring(shortURL.lastIndexOf("|")+1),file).split('\'');
eval("targetElem.parentNode.onmouseover = function() { top.ICEcoder.overFileFolder('"+newMouseOver[1]+"','"+newMouseOver[3]+"');}");
targetElem.parentNode.title = function(fileFolder) {return fileFolder.replace(/\|/g,"/");}(newMouseOver[3]);
targetElem.parentNode.title = targetElem.id.replace(/\|/g,"/");
targetElemPerms = document.getElementById('filesFrame').contentWindow.document.getElementById(shortURL+"_perms");
targetElemPerms.id = location.replace(/\//g,"|") + "|" + file + "_perms";
}