From ba634bbeeddeaeda54774a0957ad868ae2341503 Mon Sep 17 00:00:00 2001 From: Andrey Grinenko Date: Mon, 23 Feb 2015 01:51:20 +0300 Subject: [PATCH] fix to isPathFolder function --- lib/ice-coder.js | 14 ++++++++++++-- lib/ice-coder.min.js | 6 +++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/ice-coder.js b/lib/ice-coder.js index c5e6c96..1135783 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -1407,9 +1407,19 @@ var ICEcoder = { // let's enumerate all folders to find whether clicked file is a folder or not var dir = top.filesFrame.contentDocument.getElementsByClassName("pft-directory"); var thisFileId = top.ICEcoder.selectedFiles[0]; + var liNode, aNode, spanNode; for (var i = 0 ; i < dir.length; i++){ - if (thisFileId === dir[i].childNodes[0].childNodes[1].getAttribute('id')){ - return true; + liNode = dir[i]; + if ("underfined" != typeof liNode){ + aNode = liNode.childNodes[0]; + if ("undefined" != typeof aNode){ + spanNode = aNode.childNodes[1]; + if ("undefined" != typeof spanNode){ + if (thisFileId === spanNode.getAttribute('id')){ + return true; + } + } + } } } return false; diff --git a/lib/ice-coder.min.js b/lib/ice-coder.min.js index 5418def..bc95b89 100644 --- a/lib/ice-coder.min.js +++ b/lib/ice-coder.min.js @@ -60,9 +60,9 @@ a?a:top.ICEcoder.selectedFiles;b=a.toString().replace(/\|/g,"/").replace(/,/g,"\ pasteFiles:function(a){if(top.ICEcoder.copiedFiles)for(var b=0;b"+top.t["Pasting File"]+"
"+top.ICEcoder.copiedFiles[b].toString().replace(/\|/g,"/").replace(/,/g,"\n"))):top.ICEcoder.message(top.t["Sorry cannot paste..."]);else top.ICEcoder.message(top.t["Nothing to paste..."])}, duplicateFiles:function(a){var b;top.ICEcoder.copiedFiles&&(b=top.ICEcoder.copiedFiles);top.ICEcoder.copyFiles(a,"dontShowPaste","dontHide");a=a[0].substr(0,a[0].lastIndexOf("|"));top.ICEcoder.pasteFiles(a);"undefined"!=typeof b&&(top.ICEcoder.copiedFiles=b)},uploadFilesSelect:function(a){top.get("uploadDir").value=a;top.get("fileInput").click()},uploadFilesSubmit:function(a){""!=top.get("fileInput").value&&(top.ICEcoder.showHide("show",top.get("loadingMask")),top.get("uploadFilesForm").submit(), event.preventDefault())},showHideFileNav:function(a,b){var c=["optionsFile","optionsEdit","optionsSource","optionsHelp"];if("hide"==a)fileNavInt=setTimeout(function(){for(var a=0;ac&&(b-=b+a-c),top.get("fileMenu").style.top=b+"px");return!1},showFileMenu:function(){top.get("fileMenu").style.display="inline-block";setTimeout(function(){top.get("fileMenu").style.opacity= +top.get(b)),top.get(b+"Nav").style.color="#fff",get("fileOptions").style.opacity=1)},isPathFolder:function(a){a=top.filesFrame.contentDocument.getElementsByClassName("pft-directory");for(var b=top.ICEcoder.selectedFiles[0],c,d=0;dc&&(b-=b+a-c),top.get("fileMenu").style.top=b+"px");return!1},showFileMenu:function(){top.get("fileMenu").style.display="inline-block";setTimeout(function(){top.get("fileMenu").style.opacity= "1"},4)},hideFileMenu:function(){top.get("fileMenu").style.display="none";top.get("fileMenu").style.opacity="0"},updateFileManagerList:function(a,b,c,d,f,e,g){var k,h,l,p,n,m,t;if("add"==a&&!top.get("filesFrame").contentWindow.document.getElementById(b.replace(top.iceRoot,"").replace(/\/$/,"").replace(/\//g,"|")+"|"+c)){k="file"==g?"pft-file ext-"+c.substr(c.indexOf(".")+1):"pft-directory";d="file"==g?top.ICEcoder.newFilePerms:top.ICEcoder.newDirPerms;b||(b="/");b=b.replace(top.iceRoot,"/");b=b.replace("//", "/");h=top.get("filesFrame").contentWindow.document.getElementById(b.replace(/\//g,"|"));l=h.parentNode.parentNode.nextSibling;p=document.createTextNode("\n");n=777==d?"background: #800; color: #eee":"color: #888";n='        '+c+' '+d+"";if(3>l.childNodes.length)m=document.createElement("ul"),l=h.parentNode.parentNode,l.parentNode.insertBefore(m,