added ability to select files with Insert key

This commit is contained in:
coderaiser 2013-04-05 04:58:45 -04:00
parent 998444da43
commit dcfc7d9fc1
6 changed files with 418 additions and 369 deletions

View file

@ -50,6 +50,8 @@ from storage folder.
* Fixed Util.time and Util.timeEnd
* Added ability to select files with Insert key.
2012.03.01, Version 0.1.9

View file

@ -32,11 +32,10 @@
PATH_TMPL = HTMLDIR + 'path.html',
Template, PathTemplate,
FileTemplate, PathTemplate,
FS = CloudFunc.FS;
/* reinit main dir os if we on
* Win32 should be backslashes */
/* reinit main dir os if we on Win32 should be backslashes */
DIR = main.DIR;
readConfig(init);
@ -46,8 +45,7 @@
* additional processing of index file
*/
function indexProcessing(pData){
var lReplace_s,
lData = pData.data,
var lData = pData.data,
lAdditional = pData.additional;
/*
@ -56,9 +54,9 @@
* минифицированый
*/
if(Minify.allowed.css){
var lPath = '/' + Util.removeStr(Minify.MinFolder, DIR);
lReplace_s = '<link rel=stylesheet href="/css/reset.css">';
lData = Util.removeStr(lData, lReplace_s)
var lPath = '/' + Util.removeStr(Minify.MinFolder, DIR),
lReplace = '<link rel=stylesheet href="/css/reset.css">';
lData = Util.removeStr(lData, lReplace)
.replace('/css/style.css', lPath + 'all.min.css');
}
@ -131,7 +129,7 @@
/**
* rest interface
* @pConnectionData {request, responce}
* @pParams pConnectionData {request, responce}
*/
function rest(pConnectionData){
return Util.exec(main.rest, pConnectionData);
@ -200,7 +198,7 @@
if(pErrors)
Util.log(pErrors);
else{
Template = pFiles[FILE_TMPL].toString();
FileTemplate = pFiles[FILE_TMPL].toString();
PathTemplate = pFiles[PATH_TMPL].toString();
if(Config.ssl)
@ -312,7 +310,7 @@
p.name = Minify.allowed.html ? Minify.getName(INDEX) : INDEX;
fs.readFile(p.name, function(pError, pData){
if(!pError){
var lPanel = CloudFunc.buildFromJSON(pJSON, Template, PathTemplate),
var lPanel = CloudFunc.buildFromJSON(pJSON, FileTemplate, PathTemplate),
lList = '<ul id=left class=panel>' + lPanel + '</ul>' +
'<ul id=right class=panel>' + lPanel + '</ul>';

View file

@ -1,352 +1,356 @@
/*
@import url(//fonts.googleapis.com/css?family=Droid+Sans+Mono);
*/
/* символьный шрифт от гитхаба*/
@font-face {
font-family: "GeneralFoundicons";
src: url('/font/general_foundicons.woff') format('woff');
font-weight: normal;
font-style: normal;
}
/* http://fontello.com/ */
@font-face {
font-family: 'Fontello';
src: url("/font/fontello.eot");
src: url("/font/fontello.eot?#iefix") format('embedded-opentype'), url("/font/fontello.woff") format('woff'), url("/font/fontello.ttf") format('truetype'), url("/font/fontello.svg#cloudcmd") format('svg');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'Droid Sans Mono';
font-style: normal;
font-weight: normal;
src: local('Droid Sans Mono'), local('DroidSansMono'), url('//themes.googleusercontent.com/static/fonts/droidsansmono/v4/ns-m2xQYezAtqh7ai59hJUYuTAAIFFn5GTWtryCmBQ4.woff') format('woff');
}
body{
font:16px "Droid Sans Mono";
background-color:white;
}
.path-icon{
position: relative;
top: 3px;
left: -4px;
display: inline-block;
/* размер иконки и позиция на png-файле*/
width: 15px;
height: 15px;
font-family:'FoundationIconsGeneralEnclosed';
font-size:30px;
color: #46A4C3;/*#55BF3F; green*/
text-shadow:black 0 2px 1px;
}
.path-icon:hover{
cursor:pointer;
}
.path-icon:active{
position: relative;
top: 4px;
text-shadow:black 0 0 1px;
}
.icon{
display:inline-block;
width:16px;
height:16px;
margin-left:0.5%;
/* font-family: 'GeneralFoundicons'; */
font-family: 'Fontello';
}
.error::before{
position: relative;
font-size: 14px;
color: rgb(222, 41, 41);
cursor :default;
content: '\2757';
}
.loading{
position:relative;
top:1px;
background:url(/img/spinner.gif);
}
.error:hover{
color:rgb(222, 41, 41);
color:rgba(222, 41, 41, 0.81);
}
.refresh-icon{
background:url(/img/panel_refresh.png) no-repeat;
}
.refresh-icon:active{
/*background-position-y: -15px;*/
background:url(/img/panel_refresh.png) 0 -15px no-repeat;
}
.cmd-button{
width: 10%;
margin: 20px 2px 0 2px;
overflow: hidden;
color: rgb(49,123,249);
text-overflow: ellipsis;
white-space: nowrap;
background-color: white;
border: 1.5px solid rgba(49,123,249,.40);
}
.cmd-button:hover{
border: 1.5px solid rgb(0,0,0);
}
.cmd-button:active{
color: white;
background-color: rgb(49,123,249);
}
.clear-cache{
margin-right: 6px;
margin-left: 7px;
background:url(/img/console_clear.png) -4px -4px no-repeat;
}
.clear-cache:active{
top:5px;
}
.links{
color:red;
}
.mini-icon {
position: relative;
top: 2px;
left: -5px;
float: left;
width: 16px;
height: 16px;
margin-left: 6px;
/* отступ перед картинкой
* для нормального отображения
* рамки
*/
}
/* уменьшаем отступ
* между между иконкой и
* именем файла во время
* установления курсора
*/
.current-file > .mini-icon{
left: -6px;
}
/* freeupex */
.directory{
/*list-style-image*/
background-image:url('/img/dir.png');
background-position: 0 0;
background-repeat: no-repeat;
}
.text-file{
/*list-style-image*/
background-image:url('/img/txt.png');
background-position: 0 0;
background-repeat: no-repeat;
}
#fm{
height: 90%;
margin: 26px 26px 0 26px;
}
.fm-header{
font-weight: bold;
}
#path{
margin-left:1.5%;
}
.left, #left{
float:left;
}
/* фон файла, на котором курсор*/
.current-file{
border: 1.5px solid rgba(49, 123, 249, .40);
}
.selected-file{
color:white;
background-color: rgb(49, 123, 249);
background-color: rgba(49, 123, 249, .40);
}
.right, #right{
float:right;
}
.panel{
width: 46%;
overflow-y: auto;
border: 1.5px solid rgba(49, 123, 249, .40);
}
#keyspanel{
text-align: center;
}
/* информация о файлах и папках*/
.name{
float: left;
width: 37%;
/* если длина имени файла больше 16 символов
* отрезаем лишнее, оставляя лишь 16,
* и добавляем две точки и тайтл
*/
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.size{
float:left;
width:16%;
/* Ставим отступ, что бы
* size не налазил на uid
* (owner)
*/
margin-right: 27px;
/* Ставим выравнивание,
* что бы размер был в
* одной ровной колонке
*/
text-align: right;
}
.mode{
float: right;
width: 25%;
}
/* changin ul to panel for high speed parsing*/
.panel, li{
list-style-type:none;
/* making cursor just arrow,
* not text editing cursor
*/
cursor:default;
}
button{
width:10%;
}
a{
text-decoration:none;
}
a:hover, a:active {
color: #06e;
cursor:pointer;
}
/* Если размер окна очень маленький
* располагаем имя и атрибуты файла
* друг-под-другом
*/
/* responsive design */
@media only screen and (max-width: 600px){
.panel{
width:94% !important;
}
/* если правая панель не помещаеться - прячем её */
#right{
display:none;
}
/* текущий файл под курсором */
.current-file{
background-color: rgb(49, 123, 249);
background-color: rgba(49, 123, 249, .40);
color:white;
}
/* делаем иконки под курсом белыми*/
.current-file > .mini-icon{
color:white;
}
.current-file > .text-file::before{
color:white;
}
.fm-header{
display:none;
}
/* меняем иконки на шрифтовые*/
.mini-icon {
color: rgb(246, 224, 124);
color: rgba(246, 224, 124, 0.56);
font: 60px 'Fontello';
width: 40%;
height: 0;
margin-left: 0;
float: right;
position: relative;
top: 10px
}
.directory::before{
content: '\1f4c1';
}
.text-file::before{
color: rgb(26, 224, 124);
color: rgba(26, 224, 124, 0.56);
content: '\1f4c4';
}
.text-file{
background-image:none;
}
/* убираем заголовок*/
.fm_header{
display:none;
}
.mode,.size,.owner{
/* располагаем элементы
* один под другим
*/
display: table;
float: none;
width: 0;
text-align: left;
}
/* выводим заголовки рядом с полями */
.name::before{
content: 'name:';
font-weight: bold;
font-size: 13px;
}
.mode::before{
content: 'mode:';
font-weight: bold;
font-size: 13px;
}
.size::before{
content: 'size:';
font-weight: bold;
font-size: 13px;
}
.owner::before{
content: 'owner:';
font-weight: bold;
font-size: 13px;
}
.name{
float: none;
width:100%;
font-size: 18px;
}
}
@media only screen and (min-width: 601px) and (max-width: 785px){
.panel{
width:94% !important;
}
#right{
display:none;
}
}
@media only screen and (min-width:786px) and (max-width: 1155px){
.panel{
width:94% !important;
}
/* если правая панель не помещаеться - прячем её */
#right{
display:none;
}
/*
@import url(//fonts.googleapis.com/css?family=Droid+Sans+Mono);
*/
/* символьный шрифт от гитхаба*/
@font-face {
font-family: "GeneralFoundicons";
src: url('/font/general_foundicons.woff') format('woff');
font-weight: normal;
font-style: normal;
}
/* http://fontello.com/ */
@font-face {
font-family: 'Fontello';
src: url("/font/fontello.eot");
src: url("/font/fontello.eot?#iefix") format('embedded-opentype'), url("/font/fontello.woff") format('woff'), url("/font/fontello.ttf") format('truetype'), url("/font/fontello.svg#cloudcmd") format('svg');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'Droid Sans Mono';
font-style: normal;
font-weight: normal;
src: local('Droid Sans Mono'), local('DroidSansMono'), url('//themes.googleusercontent.com/static/fonts/droidsansmono/v4/ns-m2xQYezAtqh7ai59hJUYuTAAIFFn5GTWtryCmBQ4.woff') format('woff');
}
body{
font:16px "Droid Sans Mono";
background-color:white;
}
.path-icon{
position: relative;
top: 3px;
left: -4px;
display: inline-block;
/* размер иконки и позиция на png-файле*/
width: 15px;
height: 15px;
font-family:'FoundationIconsGeneralEnclosed';
font-size:30px;
color: #46A4C3;/*#55BF3F; green*/
text-shadow:black 0 2px 1px;
}
.path-icon:hover{
cursor:pointer;
}
.path-icon:active{
position: relative;
top: 4px;
text-shadow:black 0 0 1px;
}
.icon{
display:inline-block;
width:16px;
height:16px;
margin-left:0.5%;
/* font-family: 'GeneralFoundicons'; */
font-family: 'Fontello';
}
.error::before{
position: relative;
font-size: 14px;
color: rgb(222, 41, 41);
cursor :default;
content: '\2757';
}
.loading{
position:relative;
top:1px;
background:url(/img/spinner.gif);
}
.error:hover{
color:rgb(222, 41, 41);
color:rgba(222, 41, 41, 0.81);
}
.refresh-icon{
background:url(/img/panel_refresh.png) no-repeat;
}
.refresh-icon:active{
/*background-position-y: -15px;*/
background:url(/img/panel_refresh.png) 0 -15px no-repeat;
}
.cmd-button{
width: 10%;
margin: 20px 2px 0 2px;
overflow: hidden;
color: rgb(49,123,249);
text-overflow: ellipsis;
white-space: nowrap;
background-color: white;
border: 1.5px solid rgba(49,123,249,.40);
}
.cmd-button:hover{
border: 1.5px solid rgb(0,0,0);
}
.cmd-button:active{
color: white;
background-color: rgb(49,123,249);
}
.clear-cache{
margin-right: 6px;
margin-left: 7px;
background:url(/img/console_clear.png) -4px -4px no-repeat;
}
.clear-cache:active{
top:5px;
}
.links{
color:red;
}
.mini-icon {
position: relative;
top: 2px;
left: -5px;
float: left;
width: 16px;
height: 16px;
margin-left: 6px;
/* отступ перед картинкой
* для нормального отображения
* рамки
*/
}
/* уменьшаем отступ
* между между иконкой и
* именем файла во время
* установления курсора
*/
.current-file > .mini-icon{
left: -6px;
}
/* freeupex */
.directory{
/*list-style-image*/
background-image:url('/img/dir.png');
background-position: 0 0;
background-repeat: no-repeat;
}
.text-file{
/*list-style-image*/
background-image:url('/img/txt.png');
background-position: 0 0;
background-repeat: no-repeat;
}
#fm{
height: 90%;
margin: 26px 26px 0 26px;
}
.fm-header{
font-weight: bold;
}
#path{
margin-left:1.5%;
}
.left, #left{
float:left;
}
/* фон файла, на котором курсор*/
.current-file{
border: 1.5px solid rgba(49, 123, 249, .40);
}
.selected-file{
color:white;
background-color: rgb(49, 123, 249);
background-color: rgba(49, 123, 249, .40);
}
.selected-file .name > a{
color:white;
}
.right, #right{
float:right;
}
.panel{
width: 46%;
overflow-y: auto;
border: 1.5px solid rgba(49, 123, 249, .40);
}
#keyspanel{
text-align: center;
}
/* информация о файлах и папках*/
.name{
float: left;
width: 37%;
/* если длина имени файла больше 16 символов
* отрезаем лишнее, оставляя лишь 16,
* и добавляем две точки и тайтл
*/
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.size{
float:left;
width:16%;
/* Ставим отступ, что бы
* size не налазил на uid
* (owner)
*/
margin-right: 27px;
/* Ставим выравнивание,
* что бы размер был в
* одной ровной колонке
*/
text-align: right;
}
.mode{
float: right;
width: 25%;
}
/* changin ul to panel for high speed parsing*/
.panel, li{
list-style-type:none;
/* making cursor just arrow,
* not text editing cursor
*/
cursor:default;
}
button{
width:10%;
}
a{
text-decoration:none;
}
a:hover, a:active {
color: #06e;
cursor:pointer;
}
/* Если размер окна очень маленький
* располагаем имя и атрибуты файла
* друг-под-другом
*/
/* responsive design */
@media only screen and (max-width: 600px){
.panel{
width:94% !important;
}
/* если правая панель не помещаеться - прячем её */
#right{
display:none;
}
/* текущий файл под курсором */
.current-file{
background-color: rgb(49, 123, 249);
background-color: rgba(49, 123, 249, .40);
color:white;
}
/* делаем иконки под курсом белыми*/
.current-file > .mini-icon{
color:white;
}
.current-file > .text-file::before{
color:white;
}
.fm-header{
display:none;
}
/* меняем иконки на шрифтовые*/
.mini-icon {
color: rgb(246, 224, 124);
color: rgba(246, 224, 124, 0.56);
font: 60px 'Fontello';
width: 40%;
height: 0;
margin-left: 0;
float: right;
position: relative;
top: 10px
}
.directory::before{
content: '\1f4c1';
}
.text-file::before{
color: rgb(26, 224, 124);
color: rgba(26, 224, 124, 0.56);
content: '\1f4c4';
}
.text-file{
background-image:none;
}
/* убираем заголовок*/
.fm_header{
display:none;
}
.mode,.size,.owner{
/* располагаем элементы
* один под другим
*/
display: table;
float: none;
width: 0;
text-align: left;
}
/* выводим заголовки рядом с полями */
.name::before{
content: 'name:';
font-weight: bold;
font-size: 13px;
}
.mode::before{
content: 'mode:';
font-weight: bold;
font-size: 13px;
}
.size::before{
content: 'size:';
font-weight: bold;
font-size: 13px;
}
.owner::before{
content: 'owner:';
font-weight: bold;
font-size: 13px;
}
.name{
float: none;
width:100%;
font-size: 18px;
}
}
@media only screen and (min-width: 601px) and (max-width: 785px){
.panel{
width:94% !important;
}
#right{
display:none;
}
}
@media only screen and (min-width:786px) and (max-width: 1155px){
.panel{
width:94% !important;
}
/* если правая панель не помещаеться - прячем её */
#right{
display:none;
}
}

View file

@ -3,7 +3,7 @@
"appcache" : false,
"minification" : {
"js" : false,
"css" : true,
"css" : false,
"html" : true,
"img" : true
},

View file

@ -4,6 +4,7 @@ var CloudCommander, Util, DOM = {}, CloudFunc;
'use strict';
var CURRENT_FILE = 'current-file',
SELECTED_FILE = 'selected-file',
XMLHTTP,
Title,
@ -150,9 +151,10 @@ var CloudCommander, Util, DOM = {}, CloudFunc;
var lClassList = pElement.classList;
if(lClassList){
if( !lClassList.contains(pClass) )
lRet = !lClassList.contains(pClass);
if( lRet )
lClassList.add(pClass);
lRet = true;
}
}
@ -964,11 +966,22 @@ var CloudCommander, Util, DOM = {}, CloudFunc;
* @pCurrentFile
*/
DOM.getCurrentFile = function(){
var lRet = DOM.getByClass(CURRENT_FILE )[0];
var lRet = DOM.getByClass( CURRENT_FILE )[0];
return lRet;
};
/**
* unified way to get current file
*
* @pCurrentFile
*/
DOM.getSelectedFiles = function(){
var lRet = DOM.getByClass(SELECTED_FILE);
return lRet.length ? lRet : !lRet;
};
/**
* get size
* @pCurrentFile
@ -1120,7 +1133,33 @@ var CloudCommander, Util, DOM = {}, CloudFunc;
return lRet;
};
/**
* select current file
* @param pCurrent
*/
DOM.selectFile = function(pCurrent){
var lCurrent = pCurrent || DOM.getCurrentFile(),
lRet = DOM.addClass(pCurrent, SELECTED_FILE);
if(!lRet)
DOM.unSelectFile(lCurrent);
return lRet;
};
/**
* unselect current file
* @param pCurrent
*/
DOM.unSelectFile = function(pCurrent){
var lCurrent = pCurrent || DOM.getCurrentFile(),
lRet = DOM.removeClass(lCurrent, SELECTED_FILE);
return lRet;
};
/**
* setting history wrapper
*/

View file

@ -18,7 +18,8 @@ var CloudCommander, Util, DOM;
UP : 38,
DOWN : 40,
Delete : 46,
INSERT : 45,
DELETE : 46,
D : 68,
@ -87,7 +88,7 @@ var CloudCommander, Util, DOM;
}
else if(lKeyCode >= KEY.F1 && lKeyCode <= KEY.TRA ||
lKeyCode >= KEY.TAB && lKeyCode <= KEY.Delete)
lKeyCode >= KEY.TAB && lKeyCode <= KEY.DELETE)
switch(lKeyCode){
case KEY.TAB:
@ -111,7 +112,12 @@ var CloudCommander, Util, DOM;
DOM.preventDefault(pEvent);//запрет на дальнейшее действие
break;
case KEY.Delete:
case KEY.INSERT:
DOM.selectFile(lCurrentFile);
DOM.setCurrentFile( lCurrentFile.nextSibling );
break;
case KEY.DELETE:
if(pEvent.shiftKey){
var lUrl = DOM.getCurrentPath(lCurrentFile);