mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 18:18:56 +00:00
all
This commit is contained in:
parent
200a2e7243
commit
4f8f0ab66f
8 changed files with 60 additions and 40 deletions
|
|
@ -1,7 +1,7 @@
|
|||
Cloud Commander [](http://travis-ci.org/coderaiser/cloudcmd)
|
||||
===============
|
||||
**Cloud Commander** - two-panels file manager, totally writed on js.
|
||||
View [demo](http://demo-cloudcmd.cloudfoundry.com/ "demo").
|
||||
View [demo](http://demo-cloudcmd.cloudfoundry.com/ "demo"), [mirror](http://cloudcmd.nodester.com/ "mirror").
|
||||
|
||||
Google PageSpeed Score : [100](https://developers.google.com/speed/pagespeed/insights#url=http_3A_2F_2Fdemo-cloudcmd.cloudfoundry.com_2F&mobile=false "score") (out of 100).
|
||||
|
||||
|
|
@ -38,7 +38,6 @@ There is a short list:
|
|||
- Alt + s - get all key bindings back
|
||||
- up, down, enter - filesystem navigation
|
||||
|
||||
|
||||
Additional modules:
|
||||
---------------
|
||||
**Cloud Commander** not using additional modules for main functionality.
|
||||
|
|
@ -47,4 +46,8 @@ assingned (and installed) modules:
|
|||
- [UglifyJS] (https://github.com/mishoo/UglifyJS)
|
||||
- [clean-css] (https://github.com/GoalSmashers/clean-css)
|
||||
- [html-minifier] (https://github.com/kangax/html-minifier)
|
||||
- [css-b64-images] (https://github.com/Filirom1/css-base64-images)
|
||||
- [css-b64-images] (https://github.com/Filirom1/css-base64-images)
|
||||
|
||||
Install addtitional modules:
|
||||
|
||||
npm i uglify-js clean-css html-minifier css-b64-images
|
||||
25
client.js
25
client.js
|
|
@ -169,7 +169,7 @@ CloudClient._loadDir=(function(pLink,pNeedRefresh){
|
|||
/* получаем имя каталога в котором находимся*/
|
||||
var lHref;
|
||||
try{
|
||||
lHref=lCurrentFile[0].parentElement.getElementsByClassName('path')[0].innerText;
|
||||
lHref=lCurrentFile[0].parentElement.getElementsByClassName('path')[0].textContent;
|
||||
}catch(error){console.log('error');}
|
||||
|
||||
lHref=CloudFunc.removeLastSlash(lHref);
|
||||
|
|
@ -186,7 +186,7 @@ CloudClient._loadDir=(function(pLink,pNeedRefresh){
|
|||
*/
|
||||
var lA=this.getElementsByTagName('a');
|
||||
/* если нажали на ссылку на верхний каталог*/
|
||||
if(lA.length>0 && lA[0].innerText==='..' &&
|
||||
if(lA.length>0 && lA[0].textContent==='..' &&
|
||||
lHref!=='/'){
|
||||
/* функция устанавливает курсор на каталог
|
||||
* с которого мы пришли, если мы поднялись
|
||||
|
|
@ -266,7 +266,7 @@ CloudClient._currentToParent = (function(pDirName){
|
|||
var lLi=lPanel.getElementsByTagName('li');
|
||||
for(var i=0;i<lLi.length;i++){
|
||||
var lA=lLi[i].getElementsByTagName('a');
|
||||
if(lA.length && lA[0].innerText===pDirName){
|
||||
if(lA.length && lA[0].textContent===pDirName){
|
||||
/* если уже выделен какой-то файл, снимаем
|
||||
* выделение
|
||||
*/
|
||||
|
|
@ -295,7 +295,7 @@ CloudClient.init=(function()
|
|||
* а может и обязательно при переходе, можно будет это сделать
|
||||
*/
|
||||
var lTitle=document.getElementsByTagName('title');
|
||||
if(lTitle.length>0)lTitle[0].innerText='Cloud Commander';
|
||||
if(lTitle.length>0)lTitle[0].textContent='Cloud Commander';
|
||||
|
||||
/* загружаем jquery: */
|
||||
CloudClient.jsload('//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js',function(){
|
||||
|
|
@ -363,7 +363,7 @@ CloudClient.init=(function()
|
|||
|
||||
CloudClient.cssSet({id:'show_2panels',
|
||||
element:document.head,
|
||||
inner:'#left{width:45%;}'
|
||||
inner:'#left{width:46%;}'
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -638,11 +638,8 @@ CloudClient.cssSet = function(pParams_o){
|
|||
*/
|
||||
CloudClient._getJSONfromFileTable=function()
|
||||
{
|
||||
var lLeft=document.getElementById('left');
|
||||
|
||||
|
||||
//var lPath=document.getElementById('path').innerText;
|
||||
var lPath=document.getElementsByClassName('path')[0].innerText;
|
||||
var lLeft=document.getElementById('left');
|
||||
var lPath=document.getElementsByClassName('path')[0].textContent;
|
||||
var lFileTable=[{path:lPath,size:'dir'}];
|
||||
var lLI=lLeft.getElementsByTagName('li');
|
||||
|
||||
|
|
@ -660,10 +657,10 @@ CloudClient._getJSONfromFileTable=function()
|
|||
var lIsDir=lLI[i].getElementsByClassName('mini-icon')[0]
|
||||
.className.replace('mini-icon ','')==='directory'?true:false;
|
||||
|
||||
var lName=lLI[i].getElementsByClassName('name')[0].innerText;
|
||||
var lName=lLI[i].getElementsByClassName('name')[0].textContent;
|
||||
/* если это папка - выводим слово dir вместо размера*/
|
||||
var lSize=lIsDir?'dir':lLI[i].getElementsByClassName('size')[0].innerText;
|
||||
var lMode=lLI[i].getElementsByClassName('mode')[0].innerText;
|
||||
var lSize=lIsDir?'dir':lLI[i].getElementsByClassName('size')[0].textContent;
|
||||
var lMode=lLI[i].getElementsByClassName('mode')[0].textContent;
|
||||
/* переводим права доступа в цыфровой вид
|
||||
* для хранения в localStorage
|
||||
*/
|
||||
|
|
@ -713,4 +710,4 @@ try{
|
|||
CloudCommander.keyBinding();
|
||||
};
|
||||
}
|
||||
catch(err){}
|
||||
catch(err){}
|
||||
9
config.json
Normal file
9
config.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"cache" : {"allowed" : true},
|
||||
"minification" : {
|
||||
"js" : true,
|
||||
"css" : true,
|
||||
"html" : true,
|
||||
"img" : true
|
||||
}
|
||||
}
|
||||
|
|
@ -35,7 +35,7 @@ a:focus { outline: thin dotted; }
|
|||
/* Improve readability when focused and hovered in all browsers: h5bp.com/h */
|
||||
a:hover, a:active { outline: 0; }
|
||||
|
||||
ul{ margin: 1em 0; padding: 0 0 0 40px; }
|
||||
ul{ margin: 1em 0; padding: 0 20px 0 20px; }
|
||||
|
||||
/*
|
||||
* 1. Display hand cursor for clickable form elements
|
||||
|
|
|
|||
|
|
@ -3,21 +3,24 @@
|
|||
*/
|
||||
|
||||
/* Foundation Icons General Enclosed */
|
||||
/*
|
||||
@font-face {
|
||||
font-family: 'FoundationIconsGeneralEnclosed';
|
||||
src: url('//dl.dropbox.com/u/78163899/mnemonia/fonts/foundation-icons-general-enclosed.woff') format('woff');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
/* символьный шрифт от гитхаба*/
|
||||
/*
|
||||
@font-face {
|
||||
font-family: 'Octicons Regular';
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
src: local('Octicons Regular'), url('//dl.dropbox.com/u/78163899/mnemonia/fonts/octicons-regular-webfont.woff') format('woff');
|
||||
}
|
||||
|
||||
*/
|
||||
@font-face {
|
||||
font-family: 'Droid Sans Mono';
|
||||
font-style: normal;
|
||||
|
|
@ -160,7 +163,7 @@ background:url(/img/panel_refresh.png) 0 -15px no-repeat;
|
|||
}
|
||||
.panel{
|
||||
display: table;
|
||||
width:45%;
|
||||
width:46%;
|
||||
}
|
||||
#keyspanel{
|
||||
text-align: center;
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ CloudCommander.keyBinding=(function(){
|
|||
/* получаем имя каталога в котором находимся*/
|
||||
var lHref;
|
||||
try{
|
||||
lHref=lCurrentFile.parentElement.getElementsByClassName('path')[0].innerText;
|
||||
lHref=lCurrentFile.parentElement.getElementsByClassName('path')[0].textContent;
|
||||
}catch(error){console.log('error');}
|
||||
lHref=CloudFunc.removeLastSlash(lHref);
|
||||
var lSubstr=lHref.substr(lHref,lHref.lastIndexOf('/'));
|
||||
|
|
@ -157,7 +157,7 @@ CloudCommander.keyBinding=(function(){
|
|||
lCurrentFile=document.getElementsByClassName(CloudCommander.CURRENT_FILE);
|
||||
if(lCurrentFile.length>0)lCurrentFile=lCurrentFile[0];
|
||||
/* получаем название файла*/
|
||||
var lSelectedName=lCurrentFile.getElementsByTagName('a')[0].innerText;
|
||||
var lSelectedName=lCurrentFile.getElementsByTagName('a')[0].textContent;
|
||||
/* если нашли элемент нажимаем него
|
||||
* а если не можем - нажимаем на
|
||||
* ссылку, на которую повешен eventHandler
|
||||
|
|
@ -179,7 +179,7 @@ CloudCommander.keyBinding=(function(){
|
|||
* 1 - это заголовок файловой таблицы
|
||||
*/
|
||||
for(var i=2;i<lLi.length;i++){
|
||||
lName=lLi[i].getElementsByTagName('a')[0].innerText;
|
||||
lName=lLi[i].getElementsByTagName('a')[0].textContent;
|
||||
if(lSelectedName.length===lName.length &&
|
||||
!lSelectedName.indexOf(lName)){
|
||||
lLi[i].className=CloudCommander.CURRENT_FILE;
|
||||
|
|
|
|||
10
package.json
10
package.json
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "cloudcmd",
|
||||
"version": "0.0.1-12",
|
||||
"version": "0.0.1-11",
|
||||
"scripts": {
|
||||
"test": "sh test/test.sh",
|
||||
"start": "server.js"
|
||||
|
|
@ -8,11 +8,5 @@
|
|||
"engines": {
|
||||
"node": "0.6.x"
|
||||
},
|
||||
"subdomain": "cloudcmd",
|
||||
"dependencies": {
|
||||
"zlib": "*",
|
||||
"uglify-js": "*",
|
||||
"html-minifier": "*",
|
||||
"clean-css": "*"
|
||||
}
|
||||
"subdomain": "cloudcmd"
|
||||
}
|
||||
30
server.js
30
server.js
|
|
@ -184,17 +184,31 @@ CloudServer.init=(function(){
|
|||
console.log('server dir: ' + lServerDir);
|
||||
process.chdir(lServerDir);
|
||||
|
||||
var lConfig={
|
||||
"cache" : {"allowed" : true},
|
||||
"minification" : {
|
||||
"js" : true,
|
||||
"css" : true,
|
||||
"html" : true,
|
||||
"img" : true
|
||||
}
|
||||
};
|
||||
try{
|
||||
console.log('reading configureation file config.json...');
|
||||
lConfig=require('./config');
|
||||
console.log('config.json readed');
|
||||
}catch(pError){
|
||||
console.log('warning: configureation file config.json not found...\n' +
|
||||
'using default values...\n' +
|
||||
JSON.stringify(lConfig));
|
||||
}
|
||||
|
||||
/* Переменная в которой храниться кэш*/
|
||||
CloudServer.Cache.setAllowed(true);
|
||||
CloudServer.Cache.setAllowed(lConfig.cache.allowed);
|
||||
/* Change default parameters of
|
||||
* js/css/html minification
|
||||
*/
|
||||
CloudServer.Minify.setAllowed({
|
||||
js:true,
|
||||
css:true,
|
||||
html:true,
|
||||
img:true
|
||||
});
|
||||
CloudServer.Minify.setAllowed(lConfig.minification);
|
||||
/* Если нужно минимизируем скрипты */
|
||||
CloudServer.Minify.doit();
|
||||
});
|
||||
|
|
@ -615,7 +629,7 @@ CloudServer.getReadFileFunc = function(pName){
|
|||
if(pError.path!=='passwd.json')
|
||||
{
|
||||
console.log(pError);
|
||||
CloudServer.sendResponse('OK',pError.toString());
|
||||
CloudServer.sendResponse('OK',pError.toString(),pName);
|
||||
}else{
|
||||
CloudServer.sendResponse('OK','passwd.json');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue