From 6a033c1c087a4e16d0dd2b9d9d34a67c411d09d6 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sat, 8 Sep 2012 07:20:56 -0400 Subject: [PATCH] fixed bug with setting current file when mouse down --- ChangeLog | 3 +++ client.js | 17 ++++++++++++++++- lib/cloudfunc.js | 17 +++++++++-------- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 46380767..dd65f071 100644 --- a/ChangeLog +++ b/ChangeLog @@ -27,6 +27,9 @@ Function scrollIntoViewIfNeeded was polyfilled. * Added classic borders to panels. +* Added ability to download files thrue drag'n'drop. + +* Fixed bug with setting current file when mouse down. 2012.08.24, Version 0.1.6 diff --git a/client.js b/client.js index 9fd57bf4..3c1c7d1f 100644 --- a/client.js +++ b/client.js @@ -1159,7 +1159,7 @@ CloudClient._changeLinks = function(pPanelID){ */ var lOnDragStart_f = function(pEvent){ var lElement = pEvent.target; - + var lLink = lElement.href; var lName = lElement.textContent; @@ -1175,6 +1175,19 @@ CloudClient._changeLinks = function(pPanelID){ lName + ':' + lLink); }; + + var lSetCurrentFile_f = function(pEvent){ + var pElement = pEvent.target; + + var lTag = pElement.tagName; + if(lTag !== 'LI') + do{ + pElement = pElement.parentElement; + lTag = pElement.tagName; + }while(lTag !== 'LI'); + + Util.setCurrentFile(pElement); + }; for(var i=0; i < a.length ; i++) { @@ -1209,6 +1222,8 @@ CloudClient._changeLinks = function(pPanelID){ else { lLi.onclick = CloudClient._setCurrent(); + lLi.onmousedown = lSetCurrentFile_f; + a[i].ondragstart = lOnDragStart_f; /* if right button clicked menu will diff --git a/lib/cloudfunc.js b/lib/cloudfunc.js index f6fda483..95fb3a4e 100644 --- a/lib/cloudfunc.js +++ b/lib/cloudfunc.js @@ -392,7 +392,7 @@ CloudFunc.buildFromJSON = function(pJSON, pKeyBinded) if(lDotDot === '')lDotDot = '/'; /* Сохраняем путь к каталогу верхнего уровня*/ - lFileTable += '
  • '+ + lFileTable += '
  • '+ '' + '' + '' + @@ -408,15 +408,15 @@ CloudFunc.buildFromJSON = function(pJSON, pKeyBinded) var lLength = files.length; for(var i = 1; i < lLength; i++){ - lFileTable += '
  • '; - lFileTable += ''; lFileTable += ''; - lFileTable += '' + + lFileTable += '' + '" + ''; /* если папка - не выводим размер */ - lFileTable +='' + + lFileTable +='' + (files[i].size === 'dir' ? '<dir>' /* если это файл - получаем @@ -445,10 +445,10 @@ CloudFunc.buildFromJSON = function(pJSON, pKeyBinded) : CloudFunc.getShortedSize( files[i].size)); lFileTable +='' + - '' + + '' + (!files[i].uid ? 'root' : files[i].uid) + '' + - '' + + '' + /* конвертируем названия разрешений * из числового формата в буквенный * при этом корневой каталог не трогаем @@ -471,7 +471,8 @@ CloudFunc.buildFromJSON = function(pJSON, pKeyBinded) if(pKeyBinded && lPath === '/'&& lFileTable.indexOf('
  • ') < 0){ lFileTable = lFileTable - .replace('
  • ', '
  • '); + .replace('
  • ', + '
  • '); } return lFileTable;