fixed bug with setting current file when mouse down

This commit is contained in:
coderaiser 2012-09-08 07:20:56 -04:00
parent ff76ffd69a
commit 6a033c1c08
3 changed files with 28 additions and 9 deletions

View file

@ -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

View file

@ -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

View file

@ -392,7 +392,7 @@ CloudFunc.buildFromJSON = function(pJSON, pKeyBinded)
if(lDotDot === '')lDotDot = '/';
/* Сохраняем путь к каталогу верхнего уровня*/
lFileTable += '<li class=current-file>'+
lFileTable += '<li draggable class=current-file>'+
'<span class="mini-icon directory">' +
'</span>' +
'<span class=name>' +
@ -408,15 +408,15 @@ CloudFunc.buildFromJSON = function(pJSON, pKeyBinded)
var lLength = files.length;
for(var i = 1; i < lLength; i++){
lFileTable += '<li class>';
lFileTable += '<span class="mini-icon ';
lFileTable += '<li draggable class>';
lFileTable += '<span draggable class="mini-icon ';
/* если папка - выводим другую иконку */
lFileTable += (files[i].size==='dir'?
'directory':'text-file') +
'">';
lFileTable += '</span>';
lFileTable += '<span class=name>' +
lFileTable += '<span draggable class=name>' +
'<a href="' + lFS_s + lNoJS_s +
lPath+files[i].name +
'"' +
@ -436,7 +436,7 @@ CloudFunc.buildFromJSON = function(pJSON, pKeyBinded)
"</a>" +
'</span>';
/* если папка - не выводим размер */
lFileTable +='<span class=size>' +
lFileTable +='<span draggable class=size>' +
(files[i].size === 'dir' ?
'&lt;dir&gt;'
/* если это файл - получаем
@ -445,10 +445,10 @@ CloudFunc.buildFromJSON = function(pJSON, pKeyBinded)
: CloudFunc.getShortedSize(
files[i].size));
lFileTable +='</span>' +
'<span class=owner>' +
'<span draggable class=owner>' +
(!files[i].uid ? 'root' : files[i].uid) +
'</span>' +
'<span class=mode>' +
'<span draggable class=mode>' +
/* конвертируем названия разрешений
* из числового формата в буквенный
* при этом корневой каталог не трогаем
@ -471,7 +471,8 @@ CloudFunc.buildFromJSON = function(pJSON, pKeyBinded)
if(pKeyBinded && lPath === '/'&&
lFileTable.indexOf('<li class=current-file>') < 0){
lFileTable = lFileTable
.replace('<li class>', '<li class=current-file>');
.replace('<li draggable class>',
'<li draggable class=current-file>');
}
return lFileTable;