From b5d35a53827cbcd3712e85b5a665d105c7198ab6 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 3 Mar 2014 16:34:11 +0200 Subject: [PATCH 001/161] docs(help) add "\n" --- HELP.md | 1 + 1 file changed, 1 insertion(+) diff --git a/HELP.md b/HELP.md index 485150d6..2cdba8a9 100644 --- a/HELP.md +++ b/HELP.md @@ -22,6 +22,7 @@ Cloud Commander v0.8.2 [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status] [HEROKU_LIVE_IMG]: http://status-ok.cloudcmd.io/host/cloudcmd.herokuapp.com/fs?json "Heroku" **Cloud Commander** - cloud file manager with console and editor. Will help you: **create**, **edit**, **move** and **delete files** and **folders** in your favorite browser from any computer. File manager has two parts: + - **client** (with nice and simple interface) - **server** (based on Node.js). From f8964b479570e1529564ed0f981fd24f5d3a7409 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 3 Mar 2014 16:39:37 +0200 Subject: [PATCH 002/161] docs(help) change keys to table view --- HELP.md | 66 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/HELP.md b/HELP.md index 2cdba8a9..cfee1432 100644 --- a/HELP.md +++ b/HELP.md @@ -52,38 +52,40 @@ The installation of file manager is very simple. Hot keys --------------- -- **F1** - help -- **F2** - rename current file -- **F3** - view -- **F4** - edit -- **F5** - copy -- **F6** - rename/move -- **F7** - new dir -- **F7** + **shift** - new file -- **F8, Delete** - remove current file -- **F9** - menu -- **F10** - config -- **(*)** - select/unselect all -- **(+)** - expand selection -- **(-)** - shrink selection -- **Ctrl + r** - reload dir content -- **Ctrl + d** - clear local cache (wich contains dir contents) -- **Alt + q** - disable key bindings -- **Alt + s** - get all key bindings back -- **Ctrl + a** - select all files in a panel -- **up, down, enter** - filesystem navigation -- **Ctrl + \** - go to the root directory -- **Tab** - move via panels -- **Page Up** - up on one page -- **Page Down** - down on one page -- **Home** - to begin of list -- **End** - to end of list -- **Shift + Delete** - remove without prompt -- **Space** - select current file (and show size of directory) -- **Insert** - select current file (and move to next) -- **Shift + F10** - context menu -- **~** - console -- **Ctrl + Click** - open file on new tab +|Key |Operation +|:------------------|:-------------------------------------------- +| `F1` | help +| `F2` | rename current file +| `F3` | view +| `F4` | edit +| `F5` | copy +| `F6` | rename/move +| `F7` | new dir +| `F7` + `shift` | new file +| `F8, Delete` | remove current file +| `F9` | menu +| `F10` | config +| `*` | select/unselect all +| `+` | expand selection +| `-` | shrink selection +| `Ctrl + r` | reload dir content +| `Ctrl + d` | clear local cache (wich contains dir contents) +| `Alt + q` | disable key bindings +| `Alt + s` | get all key bindings back +| `Ctrl + a` | select all files in a panel +| `up, down, enter` | filesystem navigation +| `Ctrl + \` | go to the root directory +| `Tab` | move via panels +| `Page Up` | up on one page +| `Page Down` | down on one page +| `Home` | to begin of list +| `End` | to end of list +| `Shift + Delete` | remove without prompt +| `Space` | select current file (and show size of directory) +| `Insert` | select current file (and move to next) +| `Shift + F10` | context menu +| `~` | console +| `Ctrl + Click` | open file on new tab Edit --------------- From 35d9198e52ded8598fcf4cf3b3481655e9d8b918 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 3 Mar 2014 17:35:13 +0200 Subject: [PATCH 003/161] docs(help) cache -> storage, reload -> refresh --- HELP.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HELP.md b/HELP.md index cfee1432..5bd2273b 100644 --- a/HELP.md +++ b/HELP.md @@ -68,8 +68,8 @@ Hot keys | `*` | select/unselect all | `+` | expand selection | `-` | shrink selection -| `Ctrl + r` | reload dir content -| `Ctrl + d` | clear local cache (wich contains dir contents) +| `Ctrl + r` | refresh dir content +| `Ctrl + d` | clear local storage | `Alt + q` | disable key bindings | `Alt + s` | get all key bindings back | `Ctrl + a` | select all files in a panel From 2e003610e250e8270ef28274525398ebd2ff8459 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 3 Mar 2014 17:35:56 +0200 Subject: [PATCH 004/161] docs(help) rm "`" --- HELP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HELP.md b/HELP.md index 5bd2273b..0c12db12 100644 --- a/HELP.md +++ b/HELP.md @@ -61,7 +61,7 @@ Hot keys | `F5` | copy | `F6` | rename/move | `F7` | new dir -| `F7` + `shift` | new file +| `F7 + shift` | new file | `F8, Delete` | remove current file | `F9` | menu | `F10` | config From 16eab7de388305621fd72e4cb502ef092d8b5e03 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 4 Mar 2014 09:33:26 +0200 Subject: [PATCH 005/161] docs(help) Hot Keys: uppercase keys first letter --- HELP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HELP.md b/HELP.md index 0c12db12..92fefe84 100644 --- a/HELP.md +++ b/HELP.md @@ -73,7 +73,7 @@ Hot keys | `Alt + q` | disable key bindings | `Alt + s` | get all key bindings back | `Ctrl + a` | select all files in a panel -| `up, down, enter` | filesystem navigation +| `Up, Down, Enter` | filesystem navigation | `Ctrl + \` | go to the root directory | `Tab` | move via panels | `Page Up` | up on one page From c5e9a4746a2f199a7dfa64d91ff14dde33391104 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 4 Mar 2014 03:00:04 -0500 Subject: [PATCH 006/161] feature(file) add attribute, tag --- html/fs/file.html | 4 ++-- lib/cloudfunc.js | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/html/fs/file.html b/html/fs/file.html index 5ebe0108..189d65f1 100644 --- a/html/fs/file.html +++ b/html/fs/file.html @@ -1,7 +1,7 @@ -
  • +<{{ tag }} {{ attribute }}class="{{ className }}"> {{ name }} {{ size }} {{ owner }} {{ mode }} -
  • \ No newline at end of file + \ No newline at end of file diff --git a/lib/cloudfunc.js b/lib/cloudfunc.js index ee9519b7..794d4e2c 100644 --- a/lib/cloudfunc.js +++ b/lib/cloudfunc.js @@ -365,6 +365,8 @@ var Util; }), header = Util.render(template, { + tag : 'div', + attribute : '', className : 'fm-header', type : '', name : 'name', @@ -372,9 +374,6 @@ var Util; owner : 'owner', mode : 'mode' }); - - header = Util.replaceStr(header, 'li', 'div'); - header = Util.removeStrOneTime(header, 'draggable '); fileTable += header; @@ -400,7 +399,9 @@ var Util; }); /* Сохраняем путь к каталогу верхнего уровня*/ - fileTable += Util.render(template,{ + fileTable += Util.render(template, { + tag : 'li', + attribute : 'draggable ', className : '', type : 'directory', name : linkResult, @@ -436,6 +437,8 @@ var Util; fileTable += Util.render(template,{ + tag : 'li', + attribute : 'draggable="true" ', className : '', /* Если папка - выводим пиктограмму папки * * В противоположном случае - файла */ From 73806c4eae4db168431e500762e1bed6e62668bd Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 4 Mar 2014 03:24:15 -0500 Subject: [PATCH 007/161] feature(util) ownRender: clean all params after render --- lib/util.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/util.js b/lib/util.js index 8ff2d0f6..d6fe7e43 100644 --- a/lib/util.js +++ b/lib/util.js @@ -601,6 +601,9 @@ ret = Util.replaceStr(ret, expr, str, notEscape); } + expr = firstChar + '.*' + secondChar; + ret = Util.replaceStr(templ, expr, '', notEscape); + return ret; }; From 3239e38e8fb5d75b6e727ba1f898715b042d98a4 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 4 Mar 2014 03:29:27 -0500 Subject: [PATCH 008/161] refactor(util) removeStr --- lib/util.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/util.js b/lib/util.js index d6fe7e43..0d4d43f3 100644 --- a/lib/util.js +++ b/lib/util.js @@ -486,26 +486,26 @@ /** * function remove substring from string - * @param pStr - * @param pSubStr + * @param str + * @param substr */ - this.removeStr = function(pStr, pSubStr) { - var lRet = Util.isString(pStr) && pSubStr; + this.removeStr = function(str, substr) { + var n, isArray, + isString = Util.isString(str); - if ( lRet ) { - var n = pSubStr.length; + if (isString && substr) { + n = substr.length; + isArray = Util.isArray(substr); - if ( Util.isArray(pSubStr) ) - Util.fori(n, function(i) { - lRet = pStr = Util.replaceStr(pStr, pSubStr[i], ''); - }); + if (!isArray) + str = Util.replaceStr(str, substr, ''); else - lRet = Util.replaceStr(pStr, pSubStr, ''); + Util.fori(n, function(i) { + str = Util.replaceStr(str, substr[i], ''); + }); } - else - lRet = pStr; - return lRet; + return str; }; /** From b16dd92a48fa6edc216050e083657fff2eeb018f Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 4 Mar 2014 04:15:15 -0500 Subject: [PATCH 009/161] refactor(util) removeStrOneTime, ownRender --- lib/util.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/util.js b/lib/util.js index 0d4d43f3..be55cbec 100644 --- a/lib/util.js +++ b/lib/util.js @@ -513,23 +513,23 @@ * @param pStr * @param pSubStr */ - this.removeStrOneTime = function(pStr, pSubStr) { - var lRet = Util.isString(pStr) && pSubStr; + this.removeStrOneTime = function(str, substr) { + var n, isArray, + isString = Util.isString(str); - if ( lRet ) { - var n = pSubStr.length; + if (isString && substr) { + n = substr.length; + isArray = Util.isArray(substr); - if ( Util.isArray(pSubStr) ) - Util.fori(n, function(i) { - lRet = pStr = pStr.replace(pSubStr[i], ''); - }); + if (!isArray) + str = str.replace(substr, ''); else - lRet = pStr.replace(pSubStr, ''); + Util.fori(n, function(i) { + str = str.replace(substr[i], ''); + }); } - else - lRet = pStr; - return lRet; + return str; }; /** @@ -602,7 +602,7 @@ } expr = firstChar + '.*' + secondChar; - ret = Util.replaceStr(templ, expr, '', notEscape); + ret = Util.replaceStr(ret, expr, '', notEscape); return ret; }; From 7940f573b5d42c494dd03f8477fa10bfc36c9cee Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 4 Mar 2014 04:17:07 -0500 Subject: [PATCH 010/161] feature(panel) div -> section --- html/fs/panel.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/fs/panel.html b/html/fs/panel.html index 94e921a4..e45a9383 100644 --- a/html/fs/panel.html +++ b/html/fs/panel.html @@ -1 +1 @@ -
    {{ content }}
    \ No newline at end of file +
    {{ content }}
    \ No newline at end of file From 8ca8adf93cc347c53fae852a0df618e1a0f5d06c Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 4 Mar 2014 07:02:58 -0500 Subject: [PATCH 011/161] docs(help) menu: "from cloud" -> "from FilePicker" --- HELP.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HELP.md b/HELP.md index 92fefe84..3d5abfc7 100644 --- a/HELP.md +++ b/HELP.md @@ -132,9 +132,9 @@ Right mouse click button shows context menu with items: - Delete - Zip file - (Un)Select All -- Upload to (Dropbox, Github, GDrive) +- Upload to (Dropbox, Github, GDrive, FilePicker) - Download -- New (File, Dir, from cloud) +- New (File, Dir, from FilePicker) ###Hot keys - **F9** - open From 2356a9b699c4bb9b4d74db358aafd75cfd975750 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 4 Mar 2014 07:28:53 -0500 Subject: [PATCH 012/161] feature(view) style: add overflow-y hidden --- lib/client/view.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/client/view.js b/lib/client/view.js index 1bb20bc1..effb851c 100644 --- a/lib/client/view.js +++ b/lib/client/view.js @@ -143,6 +143,9 @@ var CloudCmd, Util, DOM, CloudFunc, $; '}' + '.fancybox-overlay {' + 'background: rgba(255, 255, 255, 0.1)' + + '}' + + '.fancybox-lock .fancybox-overlay {' + + 'overflow-y: hidden' + '}' }); From a47cb5d0a957c5f7aca92d5ae456d148e13a8531 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 4 Mar 2014 09:56:34 -0500 Subject: [PATCH 013/161] refactor(main) checkParams --- lib/server/main.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/server/main.js b/lib/server/main.js index 99703cff..1885588c 100644 --- a/lib/server/main.js +++ b/lib/server/main.js @@ -383,13 +383,13 @@ return Util.checkObj(pParams, ['error', 'data', 'params']); } - function checkParams(pParams, pAdditional) { - var lRet = Util.checkObjTrue(pParams, ['name', REQUEST, RESPONSE]); + function checkParams(params, additional) { + var ret = Util.checkObjTrue(params, ['name', REQUEST, RESPONSE]); - if (lRet && pAdditional) - lRet = Util.checkObjTrue( pParams, pAdditional); + if (ret && additional) + ret = Util.checkObjTrue(params, additional); - return lRet; + return ret; } function getQuery(req) { From 9ecf00194517692257a0bf6996c7d3adc8a654bc Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 4 Mar 2014 09:58:47 -0500 Subject: [PATCH 014/161] refactor(main) sendFile --- lib/server/main.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/server/main.js b/lib/server/main.js index 1885588c..e99ffe67 100644 --- a/lib/server/main.js +++ b/lib/server/main.js @@ -260,27 +260,28 @@ * @param pName - имя файла * @param pGzip - данные сжаты gzip'ом */ - function sendFile(pParams) { - var header, lRet = checkParams(pParams); + function sendFile(params) { + var isGzip, header, + p = params, + ret = checkParams(params); - if (lRet) { - var p = pParams, - lGzip = isGZIP(p.request) && p.gzip; + if (ret) { + isGzip = isGZIP(p.request) && p.gzip; - mainSetHeader(pParams); + mainSetHeader(params); pipe.create({ from : p.name, write : p.response, - gzip : lGzip, + gzip : isGzip, callback: function(error) { if (error) - sendError(pParams, error); + sendError(params, error); } }); } - return lRet; + return ret; } From d86a13cf72a0ab1df5a5b9af6e620c351f9b3ade Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 4 Mar 2014 10:45:54 -0500 Subject: [PATCH 015/161] refactor(cloudcmd) sendContent -> getContent --- cloudcmd.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cloudcmd.js b/cloudcmd.js index cd2260fb..fa6733a7 100644 --- a/cloudcmd.js +++ b/cloudcmd.js @@ -219,7 +219,7 @@ main.sendFile(params); } else if (isFS) { query = main.getQuery(params.request), - sendContent(name, query, function(name, error, data, isFile) { + getContent(name, query, function(name, error, data, isFile) { if (error) main.sendError(params, error); else if (isFile) { @@ -239,7 +239,7 @@ return ret; } - function sendContent(name, query, callback) { + function getContent(name, query, callback) { name = Util.removeStrOneTime(name, CloudFunc.FS) || main.SLASH; fs.stat(name, function(error, stat) { From ee38bdfe23946d3fa3882ce0464284b134f3e17b Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 4 Mar 2014 10:53:22 -0500 Subject: [PATCH 016/161] refactor(cloudcmd) route, getContent --- cloudcmd.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/cloudcmd.js b/cloudcmd.js index fa6733a7..74f4c2c8 100644 --- a/cloudcmd.js +++ b/cloudcmd.js @@ -198,10 +198,9 @@ * routing of server queries */ function route(request, response, callback) { - var ret, name, params, isAuth, isFS, query; + var name, params, isAuth, isFS, query; if (request && response) { - ret = true; name = main.getPathName(request); isAuth = Util.strCmp(name, ['/auth', '/auth/github']); isFS = Util.strCmp(name, '/') || Util.isContainStrAtBegin(name, FS); @@ -212,7 +211,9 @@ name : name }; - if (isAuth) { + if (!isAuth && !isFS) + Util.exec(callback); + else if (isAuth) { Util.log('* Routing' + '-> ' + name); params.name = main.HTMLDIR + name + '.html'; @@ -230,13 +231,8 @@ main.sendResponse(params, data, true); } }); - } else { - ret = false; - Util.exec(callback); } } - - return ret; } function getContent(name, query, callback) { @@ -249,10 +245,9 @@ func(error); else if (!stat.isDirectory()) - func(error, null, true); - else { + func(null, null, true); + else processContent(name, query, callback); - } }); } From ee91a98641eceecf5cb9ae3165d719a7613639f5 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 4 Mar 2014 11:00:25 -0500 Subject: [PATCH 017/161] refactor(cloudcmd) getContent --- cloudcmd.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/cloudcmd.js b/cloudcmd.js index 74f4c2c8..85cab4ab 100644 --- a/cloudcmd.js +++ b/cloudcmd.js @@ -239,15 +239,14 @@ name = Util.removeStrOneTime(name, CloudFunc.FS) || main.SLASH; fs.stat(name, function(error, stat) { - var func = Util.retExec(callback, name); + var isFile, + isDir = stat && stat.isDirectory(), + func = Util.retExec(callback, name); - if (error) - func(error); + if (!error && isDir) + processContent(name, query, callback); else - if (!stat.isDirectory()) - func(null, null, true); - else - processContent(name, query, callback); + func(error, null, !isDir); }); } From d5bef0e6ce7949bce34255a442f4dd98a67693c8 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 5 Mar 2014 10:46:51 +0200 Subject: [PATCH 018/161] docs(help) benefits: wrote -> written --- HELP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HELP.md b/HELP.md index 3d5abfc7..2d9e0ab6 100644 --- a/HELP.md +++ b/HELP.md @@ -36,7 +36,7 @@ Benefits - Works on Windows, Linux and Mac OS. - Could be used local or remotly. - Has nice console and editor. -- Wrote on JavaScript/Node.js. +- Written in JavaScript/Node.js. - Works in browser. Install From 831982faeabbd07e604929c5569ee8514bc685d9 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 5 Mar 2014 03:58:52 -0500 Subject: [PATCH 019/161] refactor(rest) send --- lib/server/rest.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/server/rest.js b/lib/server/rest.js index a781f382..4b29f474 100644 --- a/lib/server/rest.js +++ b/lib/server/rest.js @@ -77,12 +77,13 @@ * @param pRes * @param pData */ - function send(pParams) { - var lRes = pParams.response, - lData = pParams.data; + function send(params) { + var res = params.response, + data = params.data, + str = Util.stringifyJSON(data); - lRes.writeHead(OK, Header); - lRes.end( Util.stringifyJSON(lData) ); + res.writeHead(OK, Header); + res.end(str); } /** From e9e4df504263d4cebff6e1eb18aa3be33dce993e Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 5 Mar 2014 04:15:37 -0500 Subject: [PATCH 020/161] refactor(rest) onFSGet --- lib/server/rest.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/server/rest.js b/lib/server/rest.js index 4b29f474..fb68fc40 100644 --- a/lib/server/rest.js +++ b/lib/server/rest.js @@ -340,13 +340,13 @@ default: fs.stat(name, function(error, stat) { var getDirContent = main.commander.getDirContent, - isFile = !stat.isDirectory(); + isDir = stat && stat.isDirectory(); if (error) func(error); else - if (isFile) - func(null, null, null, isFile); + if (!isDir) + func(null, null, null, !isDir); else getDirContent(name, function(error, data) { if (!error) { From 9fca915d72e10fef629b62616d039638b4e63a9f Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 5 Mar 2014 04:22:23 -0500 Subject: [PATCH 021/161] refactor(rest) onFSGet: rm name --- lib/server/rest.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/server/rest.js b/lib/server/rest.js index fb68fc40..b9b7ed57 100644 --- a/lib/server/rest.js +++ b/lib/server/rest.js @@ -131,16 +131,15 @@ switch (p.request.method) { case 'GET': - onFSGet(query, p.name, function(error, data, name, isFile) { + onFSGet(query, p.name, function(error, data, isFile) { if (error) sendError(params, error); - else if (isFile) { - p.name = name; - p.data = data; - + else if (isFile) main.sendFile(p); - } else + else { + p.name += '.json'; sendResponse(p, data); + } }); break; @@ -346,15 +345,14 @@ func(error); else if (!isDir) - func(null, null, null, !isDir); + func(null, null, !isDir); else getDirContent(name, function(error, data) { if (!error) { - name += '.json'; data = Util.stringifyJSON(data); } - func(error, name, data); + func(error, data); }); }); break; From e3a5ccc0121cd63c03a54429304db45cae831edf Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 5 Mar 2014 05:53:07 -0500 Subject: [PATCH 022/161] refactor(rest) onFSGet --- lib/server/rest.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/server/rest.js b/lib/server/rest.js index b9b7ed57..35a164d7 100644 --- a/lib/server/rest.js +++ b/lib/server/rest.js @@ -132,13 +132,16 @@ switch (p.request.method) { case 'GET': onFSGet(query, p.name, function(error, data, isFile) { + var str; + if (error) sendError(params, error); else if (isFile) main.sendFile(p); else { p.name += '.json'; - sendResponse(p, data); + str = Util.stringifyJSON(data); + sendResponse(p, str); } }); @@ -347,13 +350,7 @@ if (!isDir) func(null, null, !isDir); else - getDirContent(name, function(error, data) { - if (!error) { - data = Util.stringifyJSON(data); - } - - func(error, data); - }); + getDirContent(name, func); }); break; } From dd315361da4ece0709fa0a73d2745f9a8532ec28 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 5 Mar 2014 05:53:26 -0500 Subject: [PATCH 023/161] refactor(cloudcmd) rm processContent --- cloudcmd.js | 66 ++++++++++++++++++++++++----------------------------- 1 file changed, 30 insertions(+), 36 deletions(-) diff --git a/cloudcmd.js b/cloudcmd.js index 85cab4ab..e6e3a45d 100644 --- a/cloudcmd.js +++ b/cloudcmd.js @@ -198,14 +198,14 @@ * routing of server queries */ function route(request, response, callback) { - var name, params, isAuth, isFS, query; + var name, p, isAuth, isFS, query; if (request && response) { name = main.getPathName(request); isAuth = Util.strCmp(name, ['/auth', '/auth/github']); isFS = Util.strCmp(name, '/') || Util.isContainStrAtBegin(name, FS); - params = { + p = { request : request, response : response, name : name @@ -216,58 +216,52 @@ else if (isAuth) { Util.log('* Routing' + '-> ' + name); - params.name = main.HTMLDIR + name + '.html'; - main.sendFile(params); + p.name = main.HTMLDIR + name + '.html'; + main.sendFile(p); } else if (isFS) { - query = main.getQuery(params.request), - getContent(name, query, function(name, error, data, isFile) { + name = Util.removeStrOneTime(name, CloudFunc.FS) || main.SLASH; + + getContent(name, function(error, data, isFile) { + var json, + query = main.getQuery(request), + isJSON = Util.isContainStr(query, 'json'); + if (error) - main.sendError(params, error); + main.sendError(p, error); else if (isFile) { - params.name = name; - main.sendFile(params); - } else { - params.name = name; - main.sendResponse(params, data, true); - } + p.name = name; + main.sendFile(p); + } else if (isJSON) { + p.name +='.json'; + json = Util.stringifyJSON(data); + main.sendResponse(p, json, true); + } else + readIndex(data, function(error, data) { + p.name = INDEX_PATH; + + if (error) + main.sendError(error); + else + main.sendResponse(p, data, true); + }); }); } } } - function getContent(name, query, callback) { - name = Util.removeStrOneTime(name, CloudFunc.FS) || main.SLASH; - + function getContent(name, callback) { fs.stat(name, function(error, stat) { var isFile, isDir = stat && stat.isDirectory(), - func = Util.retExec(callback, name); + func = Util.retExec(callback); if (!error && isDir) - processContent(name, query, callback); + main.commander.getDirContent(name, callback); else func(error, null, !isDir); }); } - function processContent(name, query, callback) { - main.commander.getDirContent(name, function(error, json) { - var data, name, - isJSON = Util.isContainStr(query, 'json'); - - if (!isJSON && !error) - readIndex(json, Util.retExec(callback, INDEX_PATH)); - else { - if (!error) { - data = Util.stringifyJSON(json); - name +='.json'; - } - - Util.exec(callback, name, error, data); - } - }); - } - function readIndex(json, callback) { Util.ifExec(!Minify, function(params) { var name = params && params.name; From 09a1c7169e20d5fd29ac2ec379ad933fc4407577 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 5 Mar 2014 06:21:50 -0500 Subject: [PATCH 024/161] refactor(rest, cloudcmd) getDirContent --- cloudcmd.js | 8 ++++---- lib/server/rest.js | 9 +++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/cloudcmd.js b/cloudcmd.js index e6e3a45d..fb14b00e 100644 --- a/cloudcmd.js +++ b/cloudcmd.js @@ -251,12 +251,12 @@ function getContent(name, callback) { fs.stat(name, function(error, stat) { - var isFile, - isDir = stat && stat.isDirectory(), - func = Util.retExec(callback); + var getDirContent = main.commander.getDirContent, + isDir = stat && stat.isDirectory(), + func = Util.retExec(callback); if (!error && isDir) - main.commander.getDirContent(name, callback); + getDirContent(name, callback); else func(error, null, !isDir); }); diff --git a/lib/server/rest.js b/lib/server/rest.js index 35a164d7..565c6891 100644 --- a/lib/server/rest.js +++ b/lib/server/rest.js @@ -344,13 +344,10 @@ var getDirContent = main.commander.getDirContent, isDir = stat && stat.isDirectory(); - if (error) - func(error); + if (isDir && !error) + getDirContent(name, func); else - if (!isDir) - func(null, null, !isDir); - else - getDirContent(name, func); + func(error, null, !isDir); }); break; } From 1c1c933a21fe9f82ae7169744b3486cd249a96f1 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 5 Mar 2014 06:42:27 -0500 Subject: [PATCH 025/161] feature(dir) add isDir --- cloudcmd.js | 4 ++-- lib/server/commander.js | 6 ++---- lib/server/dir.js | 13 +++++++++++++ lib/server/rest.js | 24 +++++++++++------------- 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/cloudcmd.js b/cloudcmd.js index fb14b00e..ce133bd9 100644 --- a/cloudcmd.js +++ b/cloudcmd.js @@ -17,6 +17,7 @@ AppCache = main.appcache, Util = main.util, update = main.update, + dir = main.dir, server = main.librequire('server'), Minify = main.minify, @@ -250,9 +251,8 @@ } function getContent(name, callback) { - fs.stat(name, function(error, stat) { + dir.isDir(name, function(error, isDir) { var getDirContent = main.commander.getDirContent, - isDir = stat && stat.isDirectory(), func = Util.retExec(callback); if (!error && isDir) diff --git a/lib/server/commander.js b/lib/server/commander.js index 72a03af9..92e05eb3 100644 --- a/lib/server/commander.js +++ b/lib/server/commander.js @@ -20,17 +20,15 @@ checkParams = main.checkCallBackParams; exports.getDirContent = function(path, callback) { - var ret = Util.isString(path); + var isString = Util.isString(path); - if (!ret) + if (!isString) Util.exec(callback, "First parameter should be a string"); else fs.readdir(path, readDir.bind(null, { callback : callback, path : path })); - - return ret; }; diff --git a/lib/server/dir.js b/lib/server/dir.js index db7a63b1..1521559a 100644 --- a/lib/server/dir.js +++ b/lib/server/dir.js @@ -19,6 +19,19 @@ Util = main.util, path = main.path; + exports.isDir = function(name, callback) { + name += ''; + + fs.stat(name, function(error, stat) { + var isDir; + + if (!error) + isDir = stat.isDirectory(); + + Util.exec(callback, error, isDir); + }); + }; + exports.getSize = function(dir, callback) { var total = 0; diff --git a/lib/server/rest.js b/lib/server/rest.js index 565c6891..4ab1641e 100644 --- a/lib/server/rest.js +++ b/lib/server/rest.js @@ -141,7 +141,7 @@ else { p.name += '.json'; str = Util.stringifyJSON(data); - sendResponse(p, str); + sendResponse(p, str, true); } }); @@ -246,7 +246,7 @@ } function onDelete(name, files, query, callback) { - var i, n, onStat, + var i, n, onStat, isDirFunc, assync = 0, rmFile = fs.unlink.bind(fs), rmDir = fse.remove.bind(fse), @@ -265,17 +265,16 @@ n = files && files.length, dir = name; - onStat = function(name, error, stat) { + onIsDir = function(name, error, isDir) { var log = Util.log.bind(Util); ++assync; if (error) func(error); else { - if (stat.isDirectory()) + if (isDir) rmDir(name, log); - - else if (stat.isFile()) + else rmFile(name, log); if (assync === n) @@ -284,9 +283,11 @@ }; for (i = 0; i < n; i ++) { - name = dir + files[i]; + name = dir + files[i]; + isDirFunc = Util.bind(onIsDir, name); + + dir.isDir(name, isDirFunc); Util.log(name); - fs.stat(name, onStat.bind(null, name)); } break; } @@ -340,9 +341,8 @@ break; default: - fs.stat(name, function(error, stat) { - var getDirContent = main.commander.getDirContent, - isDir = stat && stat.isDirectory(); + dir.isDir(name, function(error, isDir) { + var getDirContent = main.commander.getDirContent; if (isDir && !error) getDirContent(name, func); @@ -398,8 +398,6 @@ lCmd = p.command, lFiles = Util.parseJSON(p.body); - console.log(lFiles); - switch(lCmd) { case 'auth': main.auth(p.body, function(pTocken) { From 54e68952d2f5a9024b8b3573ac9b68d0fe0289cd Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 5 Mar 2014 06:44:28 -0500 Subject: [PATCH 026/161] feature(cloudcmd, rest) add NOT_LOG --- cloudcmd.js | 5 +++-- lib/server/rest.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cloudcmd.js b/cloudcmd.js index ce133bd9..d4beed6a 100644 --- a/cloudcmd.js +++ b/cloudcmd.js @@ -224,6 +224,7 @@ getContent(name, function(error, data, isFile) { var json, + NOT_LOG = true, query = main.getQuery(request), isJSON = Util.isContainStr(query, 'json'); @@ -235,7 +236,7 @@ } else if (isJSON) { p.name +='.json'; json = Util.stringifyJSON(data); - main.sendResponse(p, json, true); + main.sendResponse(p, json, NOT_LOG); } else readIndex(data, function(error, data) { p.name = INDEX_PATH; @@ -243,7 +244,7 @@ if (error) main.sendError(error); else - main.sendResponse(p, data, true); + main.sendResponse(p, data, NOT_LOG); }); }); } diff --git a/lib/server/rest.js b/lib/server/rest.js index 4ab1641e..0a32805f 100644 --- a/lib/server/rest.js +++ b/lib/server/rest.js @@ -132,7 +132,8 @@ switch (p.request.method) { case 'GET': onFSGet(query, p.name, function(error, data, isFile) { - var str; + var str, + NOT_LOG = true; if (error) sendError(params, error); @@ -141,7 +142,7 @@ else { p.name += '.json'; str = Util.stringifyJSON(data); - sendResponse(p, str, true); + sendResponse(p, str, NOT_LOG); } }); From ae4cf5bfb07476119757776033d381dd48b04608 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 5 Mar 2014 06:48:39 -0500 Subject: [PATCH 027/161] refactor(dir) getStat --- lib/server/dir.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/server/dir.js b/lib/server/dir.js index 1521559a..5b241c0f 100644 --- a/lib/server/dir.js +++ b/lib/server/dir.js @@ -63,7 +63,7 @@ function getStat(dir, error, stat) { --fileCounter; - if (!error) { + if (!error) if (stat.isFile()) Util.exec(func, stat); else if (stat.isDirectory()) { @@ -86,11 +86,10 @@ } } - if(!n) + if (!n) execCallBack(); }); } - } execCallBack(); } From c8ccbaade9cc7ebb7d69c264678830481bfbe828 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 5 Mar 2014 07:15:02 -0500 Subject: [PATCH 028/161] refactor(rest) add get, put, delete --- lib/server/rest.js | 186 +---------------------------------- lib/server/rest/fs/delete.js | 60 +++++++++++ lib/server/rest/fs/get.js | 73 ++++++++++++++ lib/server/rest/fs/put.js | 83 ++++++++++++++++ 4 files changed, 221 insertions(+), 181 deletions(-) create mode 100644 lib/server/rest/fs/delete.js create mode 100644 lib/server/rest/fs/get.js create mode 100644 lib/server/rest/fs/put.js diff --git a/lib/server/rest.js b/lib/server/rest.js index 0a32805f..684d7b93 100644 --- a/lib/server/rest.js +++ b/lib/server/rest.js @@ -16,14 +16,15 @@ var main = global.cloudcmd.main, fs = main.fs, path = main.path, - Hash = main.hash, crypto = main.crypto, Util = main.util, pipe = main.pipe, CloudFunc = main.cloudfunc, - dir = main.dir, - diff = main.diff, - time = main.time, + + onFSGet = main.srvrequire('rest/fs/get').onGet, + onFSPut = main.srvrequire('rest/fs/put').onPut, + onDelete = main.srvrequire('rest/fs/delete').onDelete, + JSONDIR = main.JSONDIR, OK = 200, sendError = main.sendError, @@ -33,8 +34,6 @@ }), fse = main.require('fs-extra') || { - remove : fs.rmdir.bind(fs), - mkdirs : fs.mkdir.bind(fs), copy : function(from, to, callback) { pipe.create({ from : from, @@ -179,181 +178,6 @@ return ret; } - function onFSPut(name, query, readStream, callback) { - var func = Util.retExec(callback), - baseName = path.basename(name); - - switch(query) { - case 'dir': - fse.mkdirs(name, function(error) { - var msg; - - if (!error) - msg = CloudFunc.formatMsg('make dir', name); - - func(error, msg); - }); - break; - - default: - pipe.create({ - read : readStream, - to : name, - callback : function(error) { - var msg; - - if (!error) - msg = CloudFunc.formatMsg('save', baseName); - - func(error, msg); - } - }); - break; - - case 'patch': - getBody(readStream, function(patch) { - fs.readFile(name, 'utf8', read); - - function read(error, data) { - var diffResult; - - if (error) - func(error); - else { - error = Util.tryCatchLog(function() { - diffResult = diff.applyPatch(data, patch); - }); - - if (diffResult && !error) - fs.writeFile(name, diffResult, write); - else { - msg = CloudFunc.formatMsg('patch', baseName, 'fail'); - func(null, msg); - } - } - } - - function write(name, error) { - var msg; - - if (!error) - msg = CloudFunc.formatMsg('patch', baseName); - - func(error, msg); - } - }); - break; - } - } - - function onDelete(name, files, query, callback) { - var i, n, onStat, isDirFunc, - assync = 0, - rmFile = fs.unlink.bind(fs), - rmDir = fse.remove.bind(fse), - func = Util.retExec(callback); - - switch(query) { - default: - rmFile(name, func); - break; - - case 'dir': - rmDir(name, func); - break; - - case 'files': - n = files && files.length, - dir = name; - - onIsDir = function(name, error, isDir) { - var log = Util.log.bind(Util); - ++assync; - - if (error) - func(error); - else { - if (isDir) - rmDir(name, log); - else - rmFile(name, log); - - if (assync === n) - func(); - } - }; - - for (i = 0; i < n; i ++) { - name = dir + files[i]; - isDirFunc = Util.bind(onIsDir, name); - - dir.isDir(name, isDirFunc); - Util.log(name); - } - break; - } - } - - function onFSGet(query, name, callback) { - var error, hash, - func = Util.retExec(callback); - - switch (query) { - case 'size': - dir.getSize(name, function(error, size) { - if (!error) - size = CloudFunc.getShortSize(size); - - func(error, size); - }); - break; - - case 'time': - time.get(name, function(error, time) { - var timeStr; - - if (!error) - timeStr = time.toString(); - - func(error, timeStr); - }); - break; - - case 'hash': - hash = Hash.create(); - - if (!hash) { - error = 'not suported, try update node'; - error = CloudFunc.formatMsg('hash', error, 'error'); - func(error); - } else - pipe.create({ - from : name, - write : hash, - callback : function (error) { - var hex; - - if (!error) - hash = hash.get(); - - func(error, hash); - } - }); - break; - - default: - dir.isDir(name, function(error, isDir) { - var getDirContent = main.commander.getDirContent; - - if (isDir && !error) - getDirContent(name, func); - else - func(error, null, !isDir); - }); - break; - } - } - /** * process data on GET request * diff --git a/lib/server/rest/fs/delete.js b/lib/server/rest/fs/delete.js new file mode 100644 index 00000000..ae680ffb --- /dev/null +++ b/lib/server/rest/fs/delete.js @@ -0,0 +1,60 @@ +(function(){ + 'use strict'; + + var main = global.cloudcmd.main, + fs = require('fs'), + Util = main.util, + fse = main.require('fs-extra') || { + remove : fs.rmdir.bind(fs), + }; + + exports.onDelete = onDelete; + + function onDelete(name, files, query, callback) { + var i, n, onStat, isDirFunc, + assync = 0, + rmFile = fs.unlink.bind(fs), + rmDir = fse.remove.bind(fse), + func = Util.retExec(callback); + + switch(query) { + default: + rmFile(name, func); + break; + + case 'dir': + rmDir(name, func); + break; + + case 'files': + n = files && files.length, + dir = name; + + onIsDir = function(name, error, isDir) { + var log = Util.log.bind(Util); + ++assync; + + if (error) + func(error); + else { + if (isDir) + rmDir(name, log); + else + rmFile(name, log); + + if (assync === n) + func(); + } + }; + + for (i = 0; i < n; i ++) { + name = dir + files[i]; + isDirFunc = Util.bind(onIsDir, name); + + dir.isDir(name, isDirFunc); + Util.log(name); + } + break; + } + } +})(); diff --git a/lib/server/rest/fs/get.js b/lib/server/rest/fs/get.js new file mode 100644 index 00000000..889acd85 --- /dev/null +++ b/lib/server/rest/fs/get.js @@ -0,0 +1,73 @@ +(function() { + 'use strict'; + + var main = global.cloudcmd.main, + Hash = main.hash, + dir = main.dir, + time = main.time, + pipe = main.pipe, + CloudFunc = main.cloudfunc, + Util = main.util; + + exports.onGet = onGet; + + function onGet(query, name, callback) { + var error, hash, + func = Util.retExec(callback); + + switch (query) { + case 'size': + dir.getSize(name, function(error, size) { + if (!error) + size = CloudFunc.getShortSize(size); + + func(error, size); + }); + break; + + case 'time': + time.get(name, function(error, time) { + var timeStr; + + if (!error) + timeStr = time.toString(); + + func(error, timeStr); + }); + break; + + case 'hash': + hash = Hash.create(); + + if (!hash) { + error = 'not suported, try update node'; + error = CloudFunc.formatMsg('hash', error, 'error'); + func(error); + } else + pipe.create({ + from : name, + write : hash, + callback : function (error) { + var hex; + + if (!error) + hash = hash.get(); + + func(error, hash); + } + }); + break; + + default: + dir.isDir(name, function(error, isDir) { + var getDirContent = main.commander.getDirContent; + + if (isDir && !error) + getDirContent(name, func); + else + func(error, null, !isDir); + }); + break; + } + } +})(); diff --git a/lib/server/rest/fs/put.js b/lib/server/rest/fs/put.js new file mode 100644 index 00000000..8485a04b --- /dev/null +++ b/lib/server/rest/fs/put.js @@ -0,0 +1,83 @@ +(function(){ + 'use strict'; + + var main = global.cloudcmd.main, + Util = main.util, + pipe = main.pipe, + path = require('path'), + fs = require('fs'), + diff = main.diff, + CloudFunc = main.cloudfunc, + fse = main.require('fs-extra') || { + mkdirs : fs.mkdir.bind(fs), + }; + + exports.onPut = onPut; + + function onPut(name, query, readStream, callback) { + var func = Util.retExec(callback), + baseName = path.basename(name); + + switch(query) { + case 'dir': + fse.mkdirs(name, function(error) { + var msg; + + if (!error) + msg = CloudFunc.formatMsg('make dir', name); + + func(error, msg); + }); + break; + + default: + pipe.create({ + read : readStream, + to : name, + callback : function(error) { + var msg; + + if (!error) + msg = CloudFunc.formatMsg('save', baseName); + + func(error, msg); + } + }); + break; + + case 'patch': + getBody(readStream, function(patch) { + fs.readFile(name, 'utf8', read); + + function read(error, data) { + var diffResult; + + if (error) + func(error); + else { + error = Util.tryCatchLog(function() { + diffResult = diff.applyPatch(data, patch); + }); + + if (diffResult && !error) + fs.writeFile(name, diffResult, write); + else { + msg = CloudFunc.formatMsg('patch', baseName, 'fail'); + func(null, msg); + } + } + } + + function write(name, error) { + var msg; + + if (!error) + msg = CloudFunc.formatMsg('patch', baseName); + + func(error, msg); + } + }); + break; + } + } +})(); From a87618c4e5a0f75c890ad6e8e28f755a808923b8 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 5 Mar 2014 07:21:50 -0500 Subject: [PATCH 029/161] feature(put) add getBody --- lib/server/rest/fs/put.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/server/rest/fs/put.js b/lib/server/rest/fs/put.js index 8485a04b..76c0270e 100644 --- a/lib/server/rest/fs/put.js +++ b/lib/server/rest/fs/put.js @@ -80,4 +80,17 @@ break; } } + + function getBody(req, callback) { + var body = ''; + + req.on('data', function(chunk) { + body += chunk + ''; + }); + + req.on('end', function() { + Util.exec(callback, body); + }); + } + })(); From 16da155f3145fab58b8bafc6e36fbc4b1260bd97 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 5 Mar 2014 07:25:35 -0500 Subject: [PATCH 030/161] feature(pipe) add getBody --- lib/server/pipe.js | 19 +++++++++++++++++++ lib/server/rest.js | 22 ++-------------------- lib/server/rest/fs/put.js | 15 +-------------- 3 files changed, 22 insertions(+), 34 deletions(-) diff --git a/lib/server/pipe.js b/lib/server/pipe.js index bbd1638e..09908a07 100644 --- a/lib/server/pipe.js +++ b/lib/server/pipe.js @@ -16,6 +16,8 @@ Util = main.util, zlib = main.zlib; + exports.getBody = getBody; + exports.create = function(pParams) { var lZlib, lError, lMsg, lRead, lWrite, lIsFsWrite, p = pParams; @@ -62,4 +64,21 @@ } }; + /** + * get body of readStream + * + * @param readStream + * @param callback + */ + function getBody(readStream, callback) { + var body = ''; + + readStream.on('data', function(chunk) { + body += chunk; + }); + + readStream.on('end', function() { + Util.exec(callback, body); + }); + } })(); diff --git a/lib/server/rest.js b/lib/server/rest.js index 684d7b93..1c6dd2ea 100644 --- a/lib/server/rest.js +++ b/lib/server/rest.js @@ -108,7 +108,7 @@ break; case 'PUT': - getBody(p.request, function(pBody) { + pipe.getBody(p.request, function(pBody) { p.body = pBody; onPUT(p); }); @@ -157,7 +157,7 @@ break; case 'DELETE': - getBody(p.request, function(body) { + pipe.getBody(p.request, function(body) { var files = Util.parseJSON(body); onDelete(p.name, files, query, function(error, callback) { @@ -311,24 +311,6 @@ return ret; } - /** - * get body of url query - * - * @param req - * @param callback - */ - function getBody(req, callback) { - var body = ''; - - req.on('data', function(chunk) { - body += chunk.toString(); - }); - - req.on('end', function() { - Util.exec(callback, body); - }); - } - function sendMsg(pParams, pMsg, pName, pStatus) { var msg = CloudFunc.formatMsg(pMsg, pName, pStatus); sendResponse(pParams, msg); diff --git a/lib/server/rest/fs/put.js b/lib/server/rest/fs/put.js index 76c0270e..8a0977da 100644 --- a/lib/server/rest/fs/put.js +++ b/lib/server/rest/fs/put.js @@ -46,7 +46,7 @@ break; case 'patch': - getBody(readStream, function(patch) { + pipe.getBody(readStream, function(patch) { fs.readFile(name, 'utf8', read); function read(error, data) { @@ -80,17 +80,4 @@ break; } } - - function getBody(req, callback) { - var body = ''; - - req.on('data', function(chunk) { - body += chunk + ''; - }); - - req.on('end', function() { - Util.exec(callback, body); - }); - } - })(); From d85117cc6847de5cdfafc959a0fec0579c8989af Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 5 Mar 2014 15:33:39 +0200 Subject: [PATCH 031/161] docs(help) "F7 + shift" -> "Shift + F7" --- HELP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HELP.md b/HELP.md index 2d9e0ab6..4bc7a416 100644 --- a/HELP.md +++ b/HELP.md @@ -61,7 +61,7 @@ Hot keys | `F5` | copy | `F6` | rename/move | `F7` | new dir -| `F7 + shift` | new file +| `Shift + F7` | new file | `F8, Delete` | remove current file | `F9` | menu | `F10` | config From 4dc038b277c607fc0cc97ed8e4e7ca8973cb7fde Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 5 Mar 2014 09:52:13 -0500 Subject: [PATCH 032/161] refactor(rest) onGet --- lib/server/rest.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/server/rest.js b/lib/server/rest.js index 1c6dd2ea..c9f20d52 100644 --- a/lib/server/rest.js +++ b/lib/server/rest.js @@ -184,12 +184,12 @@ * @param pParams {command, method, body, requrest, response} */ function onGET(pParams) { - var ret = main.checkParams(pParams); + var p, cmd, json, ret = main.checkParams(pParams); if (ret) { - var p = pParams, - lCmd = p.command; + p = pParams, + cmd = p.command; - switch(lCmd) { + switch(cmd) { case '': p.data = { info: 'Cloud Commander API v1' @@ -198,10 +198,11 @@ break; default: - p.data = { + json = Util.stringifyJSON({ error: 'command not found' - }; - send(p); + }); + + sendError(p, json); break; } } From 409d1a1c53267265e05995519b52a7aba4f24bea Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 5 Mar 2014 10:59:23 -0500 Subject: [PATCH 033/161] refactor(auth) authenticate --- lib/server/auth.js | 67 +++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/lib/server/auth.js b/lib/server/auth.js index eb474bc2..8c74b072 100644 --- a/lib/server/auth.js +++ b/lib/server/auth.js @@ -11,7 +11,7 @@ '# If you wont to see at work set auth' + '\n' + '# parameters in config.json or environment' + '\n' + '# and start cloudcmd.js or just do' + '\n' + - '# require(\'auth.js\').auth(pCode, pCallBack)' + '\n' + + '# require(\'auth.js\').auth(code, сallback)' + '\n' + '# http://cloudcmd.io' + '\n'); var main = global.cloudcmd.main, @@ -31,56 +31,57 @@ /** * function do authentication - * @param pCode - * @param pCallBack + * @param code + * @param callback */ - exports.auth = function(pCode, pCallBack){ - pCode = pCode.replace('code=', ''); + exports.auth = function(code, callback){ + code = code.replace('code=', ''); - console.log(pCode); - authenticate(pCode, function(token) { + Util.log(code); + authenticate(code, function(token) { var result = { "token": token }; Util.log(result); - Util.exec(pCallBack, result); + Util.exec(callback, result); }); }; - function authenticate(pCode, pCallBack) { - var lStorage = Util.findObjByNameInArr(Modules, 'storage'), - lGitHub = Util.findObjByNameInArr(lStorage, 'GitHub'), + function authenticate(code, callback) { + var body, req, + storage = Util.findObjByNameInArr(Modules, 'storage'), + github = Util.findObjByNameInArr(storage, 'GitHub'), - lId = lGitHub && lGitHub.key, - lSecret = lGitHub && lGitHub.secret, - lEnv = process.env, + id = lGitHub && lGitHub.key, + secret = lGitHub && lGitHub.secret, + env = process.env, - lClientId = lEnv.github_key || lId, - lClientSecret = lEnv.github_secret || lSecret; + clientId = env.github_key || id, + clientSecret = env.github_secret || secret; + + data = qs.stringify({ + client_id : clientId, + client_secret : clientSecret, + code : code + }); - Util.log(lClientId); - Util.log(lClientSecret); - - var data = qs.stringify({ - client_id : lClientId, - client_secret : lClientSecret, - code : pCode - }); - Util.log(data); + Util.log(clientId, clientSecret, data); GithubAuth.headers = { 'content-length': data.length }; - var body = "", - req = https.request(GithubAuth, function(res) { - res.setEncoding('utf8'); - res.on('data', function (chunk) { body += chunk; }); - res.on('end', function() { - Util.exec(pCallBack, qs.parse(body).access_token); - }); + body = "", + req = https.request(GithubAuth, function(res) { + res.setEncoding('utf8'); + res.on('data', function (chunk) { body += chunk; }); + res.on('end', function() { + Util.exec(pCallBack, qs.parse(body).access_token); }); + }); req.write(data); req.end(); - req.on('error', function(e) { Util.exec(pCallBack, e.message); }); + req.on('error', function(e) { + Util.exec(callback, e.message); + }); } })(); From 95c93c03d7353b418fde42541d0e7e888b4f1e1c Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 5 Mar 2014 11:02:47 -0500 Subject: [PATCH 034/161] refactor(auth) authenticate --- lib/server/auth.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/server/auth.js b/lib/server/auth.js index 8c74b072..3a3c9d9b 100644 --- a/lib/server/auth.js +++ b/lib/server/auth.js @@ -18,6 +18,7 @@ https = main.https, qs = main.querystring, + pipe = main.pipe, Modules = main.modules, Util = main.util, @@ -48,7 +49,7 @@ }; function authenticate(code, callback) { - var body, req, + var req, storage = Util.findObjByNameInArr(Modules, 'storage'), github = Util.findObjByNameInArr(storage, 'GitHub'), @@ -67,19 +68,17 @@ Util.log(clientId, clientSecret, data); - GithubAuth.headers = { 'content-length': data.length }; - - body = "", - req = https.request(GithubAuth, function(res) { - res.setEncoding('utf8'); - res.on('data', function (chunk) { body += chunk; }); - res.on('end', function() { - Util.exec(pCallBack, qs.parse(body).access_token); + GithubAuth.headers = { 'content-length': data.length }; + + req = https.request(GithubAuth, function(res) { + pipe.getBody(res, function(body) { + Util.exec(callback, qs.parse(body).access_token); }); }); req.write(data); req.end(); + req.on('error', function(e) { Util.exec(callback, e.message); }); From b74ff62ccd42a61ca9d3f237b727ba737ade55f9 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 5 Mar 2014 11:07:12 -0500 Subject: [PATCH 035/161] chore(auth) GitHub --- html/auth.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/html/auth.html b/html/auth.html index 3d186982..64cd7f32 100644 --- a/html/auth.html +++ b/html/auth.html @@ -6,10 +6,11 @@ (function(){ 'use strict'; - var opener = window.opener; + var GitHub, + opener = window.opener; - if (opener){ - var GitHub = opener.CloudCmd.GitHub; + if (opener) { + GitHub = opener.CloudCmd.GitHub; GitHub.autorize(GitHub.callback, window.location.search); window.close(); } From a0c4ebca0f957dff0d8857e447c1069c1a894133 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 5 Mar 2014 11:10:46 -0500 Subject: [PATCH 036/161] fix(github) rm code --- lib/client/storage/_github.js | 2 +- lib/server/auth.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/client/storage/_github.js b/lib/client/storage/_github.js index b128cb79..0f1debd8 100644 --- a/lib/client/storage/_github.js +++ b/lib/client/storage/_github.js @@ -53,7 +53,7 @@ var CloudCmd, Util, DOM, CloudFunc, Github, cb; GitHub.autorize = function(callback, code) { Storage.get('token', function(token) { - var code, isContain, + var isContain, URL = '//' + window.location.host + '/auth/github'; if (token) { diff --git a/lib/server/auth.js b/lib/server/auth.js index 3a3c9d9b..1ab700e3 100644 --- a/lib/server/auth.js +++ b/lib/server/auth.js @@ -53,12 +53,12 @@ storage = Util.findObjByNameInArr(Modules, 'storage'), github = Util.findObjByNameInArr(storage, 'GitHub'), - id = lGitHub && lGitHub.key, - secret = lGitHub && lGitHub.secret, + id = github && github.key, + secret = github && github.secret, env = process.env, clientId = env.github_key || id, - clientSecret = env.github_secret || secret; + clientSecret = env.github_secret || secret, data = qs.stringify({ client_id : clientId, From dabd9f6814e11f4b85543f63ee6eb549c3249f53 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 5 Mar 2014 11:18:26 -0500 Subject: [PATCH 037/161] refactor(github) uploadFile, login, getUserData --- lib/client/storage/_github.js | 73 ++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/lib/client/storage/_github.js b/lib/client/storage/_github.js index 0f1debd8..6f24c0a5 100644 --- a/lib/client/storage/_github.js +++ b/lib/client/storage/_github.js @@ -89,31 +89,32 @@ var CloudCmd, Util, DOM, CloudFunc, Github, cb; }); }; - GitHub.getUserData = function(pCallBack) { - User.show(null, function(pError, pData) { - if (!pError) { - var lName = pData.name; - Util.log('Hello ' + lName + ' :)!'); - } - else + GitHub.getUserData = function(callback) { + User.show(null, function(error, data) { + var name; + + if (!error) { + name = data.name; + Util.log('Hello ' + name + ' :)!'); + } else DOM.Storage.remove('token'); }); - Util.exec(pCallBack); + Util.exec(callback); }; /* PUBLIC FUNCTIONS */ - GitHub.basicLogin = function(pUser, pPasswd) { + GitHub.basicLogin = function(user, passwd) { GH = new Github({ - username: pUser, - password: pPasswd, + username: user, + password: passwd, auth : 'basic' }); }; - GitHub.Login = function(pToken) { + GitHub.Login = function(token) { GH = new Github({ - token : pToken, + token : token, auth : 'oauth' }); @@ -123,39 +124,41 @@ var CloudCmd, Util, DOM, CloudFunc, Github, cb; /** * function creates gist */ - GitHub.uploadFile = function(pParams, pCallBack) { - var lContent = pParams.data, - lName = pParams.name; + GitHub.uploadFile = function(params, callback) { + var gist, files, host, options, + content = params.data, + name = params.name; - if (lContent) { + if (content) { DOM.Images.showLoad(); - if (!lName) - lName = Util.getDate(); - var lGist = GH.getGist(), - lFiles = {}, - lHost = CloudCmd.HOST, - lOptions = { - description: 'Uplouded by Cloud Commander from ' + lHost, - public: true - }; + if (!name) + name = Util.getDate(); - lFiles[lName] ={ - content: lContent + gist = GH.getGist(), + files = {}, + host = CloudCmd.HOST, + options = { + description: 'Uplouded by Cloud Commander from ' + host, + public: true }; - lOptions.files = lFiles; + files[name] ={ + content: content + }; - lGist.create(lOptions, function(pError, pData) { - DOM.Images.hideLoad(); - Util.log(pError || pData); - Util.log(pData && pData.html_url); + options.files = files; + + gist.create(options, function(error, data) { + Util.log(error || data); + Util.log(data && data.html_url); - Util.exec(pCallBack); + Util.exec(callback); + DOM.Images.hideLoad(); }); } - return lContent; + return content; }; init(callback); From 76d32ab80f00fbf182ff6297016d69315f23b5ac Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 6 Mar 2014 04:25:56 -0500 Subject: [PATCH 038/161] refactor(server) join --- lib/server.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/server.js b/lib/server.js index 0396e5be..b32dbcdf 100644 --- a/lib/server.js +++ b/lib/server.js @@ -292,7 +292,9 @@ gzip.pipe(response); }; - if (isJoin) { + if (!isJoin) + Util.exec(callback); + else { names = CloudFunc.getJoinArray(path); n = names.length; @@ -314,10 +316,10 @@ funcs.push(minify.bind(null, name)); } + Util.asyncCall(funcs, readPipe); } - } else - Util.exec(callback); + } return isJoin; } From 052613a52264e74f6cc126ab313c0c1b5a7713fd Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 6 Mar 2014 05:51:40 -0500 Subject: [PATCH 039/161] refactor(files) read, readPipe --- cloudcmd.js | 17 +++++++++++++++-- lib/server/files.js | 45 +++++++++++++++++++-------------------------- 2 files changed, 34 insertions(+), 28 deletions(-) diff --git a/cloudcmd.js b/cloudcmd.js index d4beed6a..07e0c21b 100644 --- a/cloudcmd.js +++ b/cloudcmd.js @@ -157,9 +157,15 @@ filesList.push(KEY, CERT); files.read(filesList, 'utf-8', function(errors, files) { - if (errors) + var status, name, msg, + namesStr = ''; + + if (errors) { + status = 'error'; Util.log(errors); - else { + } else { + status = 'ok'; + FileTemplate = files[FILE_TMPL]; PanelTemplate = files[PANEL_TMPL]; PathTemplate = files[PATH_TMPL]; @@ -171,6 +177,13 @@ cert : files[CERT] }; + namesStr = filesList.map(function(name) { + return path.basename(name); + }); + + msg = CloudFunc.formatMsg('read', namesStr, status); + Util.log(msg); + server.start(params); } }); diff --git a/lib/server/files.js b/lib/server/files.js index eb482892..9f32073f 100644 --- a/lib/server/files.js +++ b/lib/server/files.js @@ -19,31 +19,19 @@ object.read = function(files, options, callback) { var done = [], errors, - i, n, name, readFiles = {}, doneFunc = function (name, error, data) { - var msg, status; - done.pop(); - if (error) { - status = 'error'; - + if (!error) + readFiles[name] = data; + else { if (!errors) errors = {}; errors[name] = error; } - else { - status = 'ok'; - readFiles[name] = data; - } - - name = path.basename(name); - msg = CloudFunc.formatMsg('read', name, status); - - Util.log(msg); if (!done.length) Util.exec(callback, errors, readFiles); @@ -54,23 +42,24 @@ options = null; } - n = files && files.length; - for (i = 0; i < n; i++) { - name = files.pop(); - done.push(name); - + done = files.map(function(name) { fs.readFile(name, options, doneFunc.bind(null, name)); - } + return name; + }); }; object.readPipe = readPipe; function readPipe(params) { - var name, - p = params, - length = p.names && p.names.length; + var name, lenght, + p = params; - if (!length) { + if (p.names) { + names = p.names.slice(); + lenght = p.names.length; + } + + if (!lenght) { p.write.end(); Util.exec(p.callback); } else { @@ -85,7 +74,11 @@ if (error) Util.exec(p.callback, error); else - readPipe(params); + readPipe({ + names : names, + write : p.write, + gzip : p.gzip + }); } }); } From 8810979a64ec1ed18f5ff8d3236df0e04383864f Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 6 Mar 2014 05:58:24 -0500 Subject: [PATCH 040/161] refactor(cloudcmd) init --- cloudcmd.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cloudcmd.js b/cloudcmd.js index 07e0c21b..7d8d6d31 100644 --- a/cloudcmd.js +++ b/cloudcmd.js @@ -157,8 +157,7 @@ filesList.push(KEY, CERT); files.read(filesList, 'utf-8', function(errors, files) { - var status, name, msg, - namesStr = ''; + var status, name, msg, names; if (errors) { status = 'error'; @@ -172,16 +171,16 @@ LinkTemplate = files[LINK_TMPL]; if (Config.ssl) - params.ssl = { + params.ssl = { key : files[KEY], cert : files[CERT] }; - namesStr = filesList.map(function(name) { + names = filesList.map(function(name) { return path.basename(name); }); - msg = CloudFunc.formatMsg('read', namesStr, status); + msg = CloudFunc.formatMsg('read', namesStr, status); Util.log(msg); server.start(params); From b962215d1ae449ba6b9b70f842aab9d96c39efde Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 6 Mar 2014 06:05:52 -0500 Subject: [PATCH 041/161] fix(cloudcmd) init: nameStr -> names --- cloudcmd.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudcmd.js b/cloudcmd.js index 7d8d6d31..5201606e 100644 --- a/cloudcmd.js +++ b/cloudcmd.js @@ -180,7 +180,7 @@ return path.basename(name); }); - msg = CloudFunc.formatMsg('read', namesStr, status); + msg = CloudFunc.formatMsg('read', names, status); Util.log(msg); server.start(params); From 12efafc3813e86077b5f5e038fa441b05eda7ef0 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 6 Mar 2014 06:08:50 -0500 Subject: [PATCH 042/161] refactor(style) set correct order --- css/style.css | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/css/style.css b/css/style.css index 70296b12..163f2e22 100644 --- a/css/style.css +++ b/css/style.css @@ -26,10 +26,10 @@ html { } body { - height: 95%; - width: 100%; - font:16px "Droid Sans Mono"; - background-color:white; + width : 100%; + height : 95%; + font : 16px "Droid Sans Mono"; + background-color : white; } .hidden { @@ -91,8 +91,8 @@ body { display : inline-block; width : 16px; height : 16px; - background : url(/img/spinner.gif); vertical-align : top; + background : url(/img/spinner.gif); } .refresh-icon { @@ -166,8 +166,8 @@ body { background-image:url('/img/txt.png'); } .fm { + width : 97%; height: 85%; - width: 97%; margin: 26px auto 0 auto; } .fm-header { From 7a6fb849b1bf5e77cf3e7052456a88c612ec07e6 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 6 Mar 2014 06:10:03 -0500 Subject: [PATCH 043/161] fix(test) add FS_DIR --- test/test.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/test.js b/test/test.js index ec18c584..9f6b5612 100644 --- a/test/test.js +++ b/test/test.js @@ -10,10 +10,11 @@ HTMLDIR = main.HTMLDIR, files = main.files, - TEMPLATEPATH = HTMLDIR + 'file.html', - LINK_TEMPLATE_PATH = HTMLDIR + 'link.html', - PATHTEMPLATE_PATH = HTMLDIR + 'path.html', - EXPECT_PATH = DIR + 'test/expect.html', + FS_DIR = HTMLDIR + 'fs/', + TEMPLATEPATH = FS_DIR + 'file.html', + LINK_TEMPLATE_PATH = FS_DIR + 'link.html', + PATHTEMPLATE_PATH = FS_DIR + 'path.html', + EXPECT_PATH = DIR + 'test/expect.html', Files = [TEMPLATEPATH, PATHTEMPLATE_PATH, LINK_TEMPLATE_PATH, EXPECT_PATH], From 46f9494bf39db7899b2311ecbe65e10f405e1c92 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 6 Mar 2014 14:34:27 +0200 Subject: [PATCH 044/161] docs(help) rm badges --- HELP.md | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/HELP.md b/HELP.md index 4bc7a416..dcfb01b8 100644 --- a/HELP.md +++ b/HELP.md @@ -1,17 +1,6 @@ -Cloud Commander v0.8.2 [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![License][LicenseIMGURL]][LicenseURL] [![Flattr][FlattrIMGURL]][FlattrURL] +Cloud Commander v0.8.2 =============== ###[Main][MainURL] [Blog][BlogURL] Live(![IO][IO_LIVE_IMG] [IO][IOURL], ![JitSu][JitSu_LIVE_IMG] [JitSu][JitSuURL], ![Heroku][Heroku_LIVE_IMG] [Heroku][HerokuURL]) -[NPMIMGURL]: https://img.shields.io/npm/v/cloudcmd.svg -[BuildStatusIMGURL]: https://api.travis-ci.org/coderaiser/cloudcmd.png?branch=dev -[DependencyStatusIMGURL]: https://gemnasium.com/coderaiser/cloudcmd.png -[FlattrIMGURL]: https://img.shields.io/badge/flattr-donate-317BF9.svg -[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg -[NPM_INFO_IMG]: http://nodei.co/npm/cloudcmd.png -[NPMURL]: https://npmjs.org/package/cloudcmd "npm" -[BuildStatusURL]: https://travis-ci.org/coderaiser/cloudcmd "Build Status" -[DependencyStatusURL]: https://gemnasium.com/coderaiser/cloudcmd "Dependency Status" -[FlattrURL]: https://flattr.com/submit/auto?user_id=coderaiser&url=github.com/coderaiser/cloudcmd&title=cloudcmd&language=&tags=github&category=software "flattr" -[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License" [MainURL]: http://cloudcmd.io "Main" [BlogURL]: http://blog.cloudcmd.io "Blog" [IOURL]: http://io.cloudcmd.io "IO" From fffbb4da5c5bd3608d3152bcb8640a5a6de81b0c Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 6 Mar 2014 16:03:27 +0200 Subject: [PATCH 045/161] docs(help) add npm info --- HELP.md | 1 + 1 file changed, 1 insertion(+) diff --git a/HELP.md b/HELP.md index dcfb01b8..3b880f0c 100644 --- a/HELP.md +++ b/HELP.md @@ -1,6 +1,7 @@ Cloud Commander v0.8.2 =============== ###[Main][MainURL] [Blog][BlogURL] Live(![IO][IO_LIVE_IMG] [IO][IOURL], ![JitSu][JitSu_LIVE_IMG] [JitSu][JitSuURL], ![Heroku][Heroku_LIVE_IMG] [Heroku][HerokuURL]) +[NPM_INFO_IMG]: https://nodei.co/npm/cloudcmd.png?downloads=true&&stars [MainURL]: http://cloudcmd.io "Main" [BlogURL]: http://blog.cloudcmd.io "Blog" [IOURL]: http://io.cloudcmd.io "IO" From 81fdf2a16ac7244f327ad9b42013fb8570a4a0e3 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 6 Mar 2014 09:36:54 -0500 Subject: [PATCH 046/161] fix(delete) add dir --- lib/server/rest/fs/delete.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/server/rest/fs/delete.js b/lib/server/rest/fs/delete.js index ae680ffb..9048b7b0 100644 --- a/lib/server/rest/fs/delete.js +++ b/lib/server/rest/fs/delete.js @@ -3,6 +3,7 @@ var main = global.cloudcmd.main, fs = require('fs'), + dir = main.dir, Util = main.util, fse = main.require('fs-extra') || { remove : fs.rmdir.bind(fs), @@ -11,7 +12,7 @@ exports.onDelete = onDelete; function onDelete(name, files, query, callback) { - var i, n, onStat, isDirFunc, + var i, n, onStat, isDirFunc, onIsDir, dirPath, assync = 0, rmFile = fs.unlink.bind(fs), rmDir = fse.remove.bind(fse), @@ -28,7 +29,7 @@ case 'files': n = files && files.length, - dir = name; + dirPath = name, onIsDir = function(name, error, isDir) { var log = Util.log.bind(Util); @@ -48,7 +49,7 @@ }; for (i = 0; i < n; i ++) { - name = dir + files[i]; + name = dirPath + files[i]; isDirFunc = Util.bind(onIsDir, name); dir.isDir(name, isDirFunc); From cd1db20a312c65d41c1ad0e80942bb76945840aa Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 6 Mar 2014 09:42:57 -0500 Subject: [PATCH 047/161] fix(files) readPipe: add dir --- lib/server/files.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/server/files.js b/lib/server/files.js index 9f32073f..67c7f56c 100644 --- a/lib/server/files.js +++ b/lib/server/files.js @@ -51,9 +51,10 @@ object.readPipe = readPipe; function readPipe(params) { - var name, lenght, + var name, names, lenght, p = params; - + + console.log(p.names); if (p.names) { names = p.names.slice(); lenght = p.names.length; @@ -63,7 +64,7 @@ p.write.end(); Util.exec(p.callback); } else { - name = p.dir + p.names.shift(); + name = p.dir + names.shift(); pipe.create({ from : name, @@ -75,6 +76,7 @@ Util.exec(p.callback, error); else readPipe({ + dir : p.dir, names : names, write : p.write, gzip : p.gzip From 287a0fd1dc55f67774d10ae213018bb56bf7ea06 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 7 Mar 2014 03:08:37 -0500 Subject: [PATCH 048/161] refactor(dom) pCurrent -> currentFile --- lib/client/dom.js | 134 +++++++++++++++++++++++----------------------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/lib/client/dom.js b/lib/client/dom.js index db1bc6a0..ec16f174 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -609,13 +609,13 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * private function thet unset currentfile * - * @pCurrentFile + * @currentFile */ - function unsetCurrentFile(pCurrentFile) { - var lRet = DOM.isCurrentFile(pCurrentFile); + function unsetCurrentFile(currentFile) { + var lRet = DOM.isCurrentFile(currentFile); if (lRet) - DOM.removeClass(pCurrentFile, CURRENT_FILE); + DOM.removeClass(currentFile, CURRENT_FILE); return lRet; } @@ -696,7 +696,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * delete currentfile, prompt before it * - * @pCurrentFile + * @currentFile */ this.promptDeleteSelected = function(current) { var ret, type, isDir, path, query, msg, @@ -818,7 +818,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * unified way to get current file * - * @pCurrentFile + * @currentFile */ this.getCurrentFile = function() { var ret = this.getByClass(CURRENT_FILE); @@ -842,7 +842,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * unified way to get current file * - * @pCurrentFile + * @currentFile */ this.getSelectedFiles = function() { var selected = this.getByClassAll(SELECTED_FILE), @@ -853,11 +853,11 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * get size - * @pCurrentFile + * @currentFile */ - this.getCurrentSize = function(pCurrentFile) { + this.getCurrentSize = function(currentFile) { var lRet, - lCurrent = pCurrentFile || Cmd.getCurrentFile(), + lCurrent = currentFile || Cmd.getCurrentFile(), lSize = this.getByClass('size', lCurrent); lSize = lSize.textContent; /* если это папка - возвращаем слово dir вместо размера*/ @@ -868,11 +868,11 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * get size - * @pCurrentFile + * @currentFile */ - this.loadCurrentSize = function(pCallBack, pCurrent) { + this.loadCurrentSize = function(pCallBack, currentFile) { var lRet, - lCurrent = pCurrent || this.getCurrentFile(), + lCurrent = currentFile || this.getCurrentFile(), lLink = this.getCurrentPath(lCurrent), lName = this.getCurrentName(lCurrent); @@ -888,11 +888,11 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * load hash * @pCallBack - * @pCurrentFile + * @currentFile */ - this.loadCurrentHash = function(pCallBack, pCurrent) { + this.loadCurrentHash = function(pCallBack, currentFile) { var lRet, - lCurrent = pCurrent || this.getCurrentFile(), + lCurrent = currentFile || this.getCurrentFile(), lLink = this.getCurrentPath(lCurrent), lName = this.getCurrentName(lCurrent); @@ -904,11 +904,11 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * load current modification time of file * @pCallBack - * @pCurrentFile + * @currentFile */ - this.loadCurrentTime = function(pCallBack, pCurrent) { + this.loadCurrentTime = function(pCallBack, currentFile) { var lRet, - lCurrent = pCurrent || this.getCurrentFile(), + lCurrent = currentFile || this.getCurrentFile(), lLink = this.getCurrentPath(lCurrent), lName = this.getCurrentName(lCurrent); @@ -919,10 +919,10 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * set size - * @pCurrentFile + * @currentFile */ - this.setCurrentSize = function(pSize, pCurrentFile) { - var lCurrent = pCurrentFile || this.getCurrentFile(), + this.setCurrentSize = function(pSize, currentFile) { + var lCurrent = currentFile || this.getCurrentFile(), lSizeElement = this.getByClass('size', lCurrent), lSize = CloudFunc.getShortSize(pSize); @@ -931,11 +931,11 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; }; /** - * @pCurrentFile + * @currentFile */ - this.getCurrentMode = function(pCurrentFile) { + this.getCurrentMode = function(currentFile) { var lRet, - lCurrent = pCurrentFile || this.getCurrentFile(), + lCurrent = currentFile || this.getCurrentFile(), lMode = this.getByClass('mode', lCurrent); lRet = lMode.textContent; @@ -943,11 +943,11 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; }; /** - * @pCurrentFile + * @currentFile */ - this.getCurrentOwner = function(pCurrentFile) { + this.getCurrentOwner = function(currentFile) { var ret, - current = pCurrentFile || this.getCurrentFile(), + current = currentFile || this.getCurrentFile(), owner = this.getByClass('owner', current); ret = owner.textContent; @@ -959,11 +959,11 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; * unified way to get current file content * * @pCallBack - callback function or data struct {sucess, error} - * @pCurrentFile + * @currentFile */ - this.getCurrentFileContent = function(pParams, pCurrentFile) { + this.getCurrentFileContent = function(pParams, currentFile) { var lRet, - lCurrentFile = pCurrentFile ? pCurrentFile : this.getCurrentFile(), + lCurrentFile = currentFile ? currentFile : this.getCurrentFile(), lParams = pParams ? pParams : {}, lPath = this.getCurrentPath(lCurrentFile), lErrorWas = pParams.error, @@ -995,11 +995,11 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; * unified way to get current file content * * @pCallBack - function({data, name}) {} - * @pCurrentFile + * @currentFile */ - this.getCurrentData = function(callback, pCurrentFile) { + this.getCurrentData = function(callback, currentFile) { var lHash, - lCurrentFile = pCurrentFile ? pCurrentFile : Cmd.getCurrentFile(), + lCurrentFile = currentFile ? currentFile : Cmd.getCurrentFile(), path = DOM.getCurrentPath(lCurrentFile), isDir = DOM.isCurrentIsDir(lCurrentFile), @@ -1035,7 +1035,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; * unified way to save current file content * * @pCallBack - function({data, name}) {} - * @pCurrentFile + * @currentFile */ this.saveCurrentData = function(pUrl, pData, pCallBack, pQuery) { RESTful.save(pUrl, pData, function() { @@ -1061,18 +1061,18 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * unified way to set current file */ - this.setCurrentFile = function(pCurrentFile) { + this.setCurrentFile = function(currentFile) { var lRet, lCurrentFileWas = this.getCurrentFile(); - if (pCurrentFile) { + if (currentFile) { if (lCurrentFileWas) unsetCurrentFile(lCurrentFileWas); - this.addClass(pCurrentFile, CURRENT_FILE); + this.addClass(currentFile, CURRENT_FILE); /* scrolling to current file */ - this.scrollIntoViewIfNeeded(pCurrentFile); + this.scrollIntoViewIfNeeded(currentFile); lRet = true; @@ -1084,19 +1084,19 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * select current file - * @param pCurrent + * @param currentFile */ - this.toggleSelectedFile = function(pCurrent) { - var lCurrent = pCurrent || this.getCurrentFile(), - lRet = this.toggleClass(pCurrent, SELECTED_FILE); + this.toggleSelectedFile = function(currentFile) { + var lCurrent = currentFile || this.getCurrentFile(), + lRet = this.toggleClass(currentFile, SELECTED_FILE); return this; }; - this.toggleAllSelectedFiles = function(pCurrent) { + this.toggleAllSelectedFiles = function(currentFile) { var i, n, - isStr = Util.isString(pCurrent), - lCurrent = !isStr && pCurrent || Cmd.getCurrentFile(), + isStr = Util.isString(currentFile), + lCurrent = !isStr && currentFile || Cmd.getCurrentFile(), panel = DOM.getPanel(), files = DOM.getFiles(panel), name = DOM.getCurrentName(files[0]); @@ -1224,13 +1224,13 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * current file check * - * @param pCurrentFile + * @param currentFile */ - this.isCurrentFile = function(pCurrent) { + this.isCurrentFile = function(currentFile) { var lRet; - if (pCurrent ) - lRet = this.isContainClass(pCurrent, CURRENT_FILE); + if (currentFile ) + lRet = this.isContainClass(currentFile, CURRENT_FILE); return lRet; }; @@ -1238,7 +1238,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * selected file check * - * @param pCurrentFile + * @param currentFile */ this.isSelected = function(pSelected) { var lRet; @@ -1252,10 +1252,10 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * check is current file is a directory * - * @param pCurrentFile + * @param currentFile */ - this.isCurrentIsDir = function(pCurrent) { - var lCurrent = pCurrent || this.getCurrentFile(), + this.isCurrentIsDir = function(currentFile) { + var lCurrent = currentFile || this.getCurrentFile(), lFileType = this.getByClass('mini-icon', lCurrent), lRet = this.isContainClass(lFileType, 'directory'); @@ -1266,10 +1266,10 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * get link from current (or param) file * - * @param pCurrentFile - current file by default + * @param currentFile - current file by default */ - this.getCurrentLink = function(pCurrentFile) { - var lLink = this.getByTag( 'a', pCurrentFile || this.getCurrentFile()), + this.getCurrentLink = function(currentFile) { + var lLink = this.getByTag( 'a', currentFile || this.getCurrentFile()), lRet = lLink.length > 0 ? lLink[0] : -1; @@ -1279,10 +1279,10 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * get link from current (or param) file * - * @param pCurrentFile - current file by default + * @param currentFile - current file by default */ - this.getCurrentPath = function(pCurrentFile) { - var lCurrent = pCurrentFile || this.getCurrentFile(), + this.getCurrentPath = function(currentFile) { + var lCurrent = currentFile || this.getCurrentFile(), lPath = this.getCurrentLink( lCurrent ).href; lPath = decodeURI(lPath); @@ -1295,10 +1295,10 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * get name from current (or param) file * - * @param pCurrentFile + * @param currentFile */ - this.getCurrentName = function(pCurrentFile) { - var lCurrent = pCurrentFile || this.getCurrentFile(), + this.getCurrentName = function(currentFile) { + var lCurrent = currentFile || this.getCurrentFile(), lLink = this.getCurrentLink( lCurrent ); if (Util.isObject(lLink)) @@ -1604,7 +1604,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * rename current file * - * @pCurrent + * @currentFile */ this.renameCurrent = function(current) { var from, to, dirPath, cmp, files; @@ -1636,7 +1636,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * move current file * - * @pCurrent + * @currentFile */ this.moveCurrent = function(current) { var name, from, to, cmp, files; @@ -1754,9 +1754,9 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; this.CurrentInfo = CurrentInfo, - this.updateCurrentInfo = function(pCurrent) { + this.updateCurrentInfo = function(currentFile) { var info = Cmd.CurrentInfo, - current = pCurrent || Cmd.getCurrentFile(), + current = currentFile || Cmd.getCurrentFile(), files = current.parentElement, panel = files.parentElement, From 541115c7216318125cccaa83610635197c3fce9a Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 7 Mar 2014 03:10:21 -0500 Subject: [PATCH 049/161] fix(dom) renameCurrent: add updateCurrentInfo --- lib/client/dom.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/client/dom.js b/lib/client/dom.js index ec16f174..41ac9f18 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -1628,6 +1628,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; path = CloudFunc.rmLastSlash(dirPath); DOM.setCurrentName(to, current); + Cmd.updateCurrentInfo(); Storage.remove(path); }); } From ee18f3cb13bfb1288a046dff81d07a08f8fd9618 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 11 Mar 2014 05:33:26 -0400 Subject: [PATCH 050/161] chore(files) rm console.log --- lib/server/files.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/server/files.js b/lib/server/files.js index 67c7f56c..b6eb089b 100644 --- a/lib/server/files.js +++ b/lib/server/files.js @@ -53,8 +53,7 @@ function readPipe(params) { var name, names, lenght, p = params; - - console.log(p.names); + if (p.names) { names = p.names.slice(); lenght = p.names.length; From 65b80598627592e3c557c976695b6c42ec2fe779 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 11 Mar 2014 06:05:11 -0400 Subject: [PATCH 051/161] refactor(util) checkExtension --- lib/util.js | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/lib/util.js b/lib/util.js index be55cbec..14ba8658 100644 --- a/lib/util.js +++ b/lib/util.js @@ -98,33 +98,32 @@ /** * Функция ищет в имени файла расширение * и если находит возвращает true - * @param pName - получает имя файла - * @param pExt - расширение + * @param name - получает имя файла + * @param ext - расширение */ - this.checkExtension = function(pName, pExt) { - var i, lExtNum, lExtSub, - lRet = false, - lExtLength = pExt && pExt.length, - lLength = pName && pName.length; /* длина имени*/ + this.checkExtension = function(name, ext) { + var i, extNum, extSub, ret, + extLength = ext && ext.length, + length = name && name.length; - /* если длина имени больше длинны расширения - имеет смысл продолжать - */ - if (Util.isString(pExt) && lLength > lExtLength) { - lExtNum = pName.lastIndexOf(pExt), /* последнее вхождение расширения*/ - lExtSub = lLength - lExtNum; /* длина расширения*/ - - /* если pExt - расширение pName */ - lRet = lExtSub === lExtLength; - - } else if (Util.isObject(pExt) && lExtLength) - for(i = 0; i < pName.length; i++) { - lRet = Util.checkExtension(pName, pExt[i]); + /* если длина имени больше длинны расширения - имеет смысл продолжать */ + if (Util.isObject(ext) && extLength) + for (i = 0; i < length; i++) { + ret = Util.checkExtension(name, ext[i]); - if (lRet) + if (ret) break; } + else if (length > extLength) { + extNum = name.lastIndexOf(ext), /* последнее вхождение расширения*/ + extSub = length - extNum; /* длина расширения*/ + + /* если pExt - расширение pName */ + ret = extSub === extLength; - return lRet; + } + + return ret; }; From ea5021088741613a7753089ce77016a984b86767 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 11 Mar 2014 10:50:09 -0400 Subject: [PATCH 052/161] refactor(util) asyncCall --- lib/util.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/util.js b/lib/util.js index 14ba8658..261b3afd 100644 --- a/lib/util.js +++ b/lib/util.js @@ -23,29 +23,29 @@ var i, element, name, func, funcsCount = funcs.length, count = 0, - data = []; + allData = []; for (i = 0; i < funcsCount; i++) { func = funcs[i]; callCheckFunc(i, func); } - function checkFunc(pNum, pData) { - var i, n = pData.length, + function checkFunc(num, data) { + var i, n = data.length, params = []; ++count; if (n >= 2) { for (i = 0; i < n; i++) - params[i] = pData[i]; + params[i] = data[i]; - data[pNum] = params; + allData[num] = params; } else - data[pNum] = pData[0]; + allData[num] = data[0]; if (count === funcsCount) - Util.retExec(callback).apply(null, data); + Util.retExec(callback).apply(null, allData); } function callCheckFunc(num, func) { From 6653feb6f41f0beab47fcb2d270a507265f482f5 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 11 Mar 2014 10:51:34 -0400 Subject: [PATCH 053/161] refactor(util) addNewLine, rmNewLine --- lib/util.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/util.js b/lib/util.js index 261b3afd..c1d0dce0 100644 --- a/lib/util.js +++ b/lib/util.js @@ -74,25 +74,25 @@ * ad new line (if it's not) * @param {string} pText */ - this.addNewLine = function(pText) { - var lNewLine = '', - n = pText && pText.length; + this.addNewLine = function(text) { + var newLine = '', + n = text && text.length; - if(n && pText[n-1] !== '\n') - lNewLine = '\n'; + if(n && text[n-1] !== '\n') + newLine = '\n'; - return pText + lNewLine; + return text + newLine; }; /** * rm new line (if it's) * @param {string} pText */ - this.rmNewLine = function(pText) { - var strs = ['\n', '\r'], - text = Util.removeStr(pText, strs); + this.rmNewLine = function(text) { + var strs = ['\n', '\r'], + str = Util.removeStr(text, strs); - return text; + return str; }; /** From 5f92d4208f79fee51b3a3707f14f393fcc1942a6 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 11 Mar 2014 10:59:36 -0400 Subject: [PATCH 054/161] refactur(util) mv {add,rm}NewLine to cloudfunc --- lib/cloudfunc.js | 25 +++++++++++++++++++++++++ lib/server/console.js | 8 ++++---- lib/util.js | 25 ------------------------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/lib/cloudfunc.js b/lib/cloudfunc.js index 794d4e2c..c749a047 100644 --- a/lib/cloudfunc.js +++ b/lib/cloudfunc.js @@ -90,6 +90,31 @@ var Util; } }; + /** + * ad new line (if it's not) + * @param {string} pText + */ + this.addNewLine = function(text) { + var newLine = '', + n = text && text.length; + + if(n && text[n-1] !== '\n') + newLine = '\n'; + + return text + newLine; + }; + + /** + * rm new line (if it's) + * @param {string} pText + */ + this.rmNewLine = function(text) { + var strs = ['\n', '\r'], + str = Util.removeStr(text, strs); + + return str; + }; + this.getJoinURL = function(names) { var url, isContain, regExp = new RegExp(',', 'g'), diff --git a/lib/server/console.js b/lib/server/console.js index c465239e..3b5783e4 100644 --- a/lib/server/console.js +++ b/lib/server/console.js @@ -168,7 +168,7 @@ if (firstChar === '#') { pCommand = pCommand.slice(1); pCommand = connName + pCommand; - pCommand = Util.addNewLine(pCommand); + pCommand = CloudFunc.addNewLine(pCommand); Util.exec(callback, { stdout: pCommand @@ -197,7 +197,7 @@ else lErrorStr = lError.toString(); - lErrorStr = Util.addNewLine(lErrorStr); + lErrorStr = CloudFunc.addNewLine(lErrorStr); } lExec = { @@ -263,7 +263,7 @@ update.get(); Util.exec(callback, { - stdout: Util.addNewLine('update: ok') + stdout: CloudFunc.addNewLine('update: ok') }); } @@ -296,7 +296,7 @@ Util.exec(callback, { stderr : lMsg, - stdout : Util.rmNewLine(stdout) + stdout : CloudFunc.rmNewLine(stdout) }); }); } diff --git a/lib/util.js b/lib/util.js index c1d0dce0..017d3a31 100644 --- a/lib/util.js +++ b/lib/util.js @@ -70,31 +70,6 @@ return result; }; - /** - * ad new line (if it's not) - * @param {string} pText - */ - this.addNewLine = function(text) { - var newLine = '', - n = text && text.length; - - if(n && text[n-1] !== '\n') - newLine = '\n'; - - return text + newLine; - }; - - /** - * rm new line (if it's) - * @param {string} pText - */ - this.rmNewLine = function(text) { - var strs = ['\n', '\r'], - str = Util.removeStr(text, strs); - - return str; - }; - /** * Функция ищет в имени файла расширение * и если находит возвращает true From 68b9efb0d12525d067d6237b213e9f864eb20bc4 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 12 Mar 2014 09:57:37 +0200 Subject: [PATCH 055/161] docs(help) refresh dir content -> refresh --- HELP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HELP.md b/HELP.md index 3b880f0c..a0f60958 100644 --- a/HELP.md +++ b/HELP.md @@ -58,7 +58,7 @@ Hot keys | `*` | select/unselect all | `+` | expand selection | `-` | shrink selection -| `Ctrl + r` | refresh dir content +| `Ctrl + r` | refresh | `Ctrl + d` | clear local storage | `Alt + q` | disable key bindings | `Alt + s` | get all key bindings back From 4c45aff2ce6d1a0d8c4033f6d14d2ee4302f70d4 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 12 Mar 2014 09:58:22 +0200 Subject: [PATCH 056/161] docs(help) rename, remove: rm current file --- HELP.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HELP.md b/HELP.md index a0f60958..6d9e0c7b 100644 --- a/HELP.md +++ b/HELP.md @@ -45,14 +45,14 @@ Hot keys |Key |Operation |:------------------|:-------------------------------------------- | `F1` | help -| `F2` | rename current file +| `F2` | rename | `F3` | view | `F4` | edit | `F5` | copy | `F6` | rename/move | `F7` | new dir | `Shift + F7` | new file -| `F8, Delete` | remove current file +| `F8, Delete` | remove | `F9` | menu | `F10` | config | `*` | select/unselect all From 8c8a9fc98e211ea7fc5f575b7bec9611e6ab966c Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 12 Mar 2014 09:59:31 +0200 Subject: [PATCH 057/161] docs(help) select current file: show -> get --- HELP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HELP.md b/HELP.md index 6d9e0c7b..c3233ba5 100644 --- a/HELP.md +++ b/HELP.md @@ -71,7 +71,7 @@ Hot keys | `Home` | to begin of list | `End` | to end of list | `Shift + Delete` | remove without prompt -| `Space` | select current file (and show size of directory) +| `Space` | select current file (and get size of directory) | `Insert` | select current file (and move to next) | `Shift + F10` | context menu | `~` | console From 9d826a90dad2366a730b1150c53bdbfbde1557f8 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 12 Mar 2014 04:14:39 -0400 Subject: [PATCH 058/161] refactor(dom) pUrl -> url --- lib/client/dom.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/client/dom.js b/lib/client/dom.js index 41ac9f18..e7b6ebe4 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -133,30 +133,30 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; }, RESTfulProto = function() { - this.delete = function(pUrl, pData, pCallBack, pQuery) { + this.delete = function(url, pData, pCallBack, pQuery) { sendRequest({ method : 'DELETE', - url : CloudFunc.FS + pUrl + (pQuery || ''), + url : CloudFunc.FS + url + (pQuery || ''), data : pData, callback : pCallBack, imgPosition : { top: !!pData } }); }; - this.save = function(pUrl, pData, pCallBack, pQuery) { + this.save = function(url, pData, pCallBack, pQuery) { sendRequest({ method : 'PUT', - url : CloudFunc.FS + pUrl + (pQuery || ''), + url : CloudFunc.FS + url + (pQuery || ''), data : pData, callback : pCallBack, imgPosition : { top: true } }); }; - this.read = function(pUrl, pCallBack, pQuery) { + this.read = function(url, pCallBack, pQuery) { sendRequest({ method : 'GET', - url : CloudFunc.FS + pUrl + (pQuery || ''), + url : CloudFunc.FS + url + (pQuery || ''), callback : pCallBack }); }; @@ -1037,9 +1037,9 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; * @pCallBack - function({data, name}) {} * @currentFile */ - this.saveCurrentData = function(pUrl, pData, pCallBack, pQuery) { - RESTful.save(pUrl, pData, function() { - DOM.saveDataToStorage(pUrl, pData); + this.saveCurrentData = function(url, pData, pCallBack, pQuery) { + RESTful.save(url, pData, function() { + DOM.saveDataToStorage(url, pData); }, pQuery); }; @@ -1191,11 +1191,11 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * setting history wrapper */ - this.setHistory = function(pData, pTitle, pUrl) { + this.setHistory = function(pData, pTitle, url) { var lRet = window.history; if (lRet) - history.pushState(pData, pTitle, pUrl); + history.pushState(pData, pTitle, url); return lRet; }; @@ -1521,9 +1521,9 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * open window with URL - * @param pUrl + * @param url */ - this.openWindow = function(pUrl) { + this.openWindow = function(url) { var left = 140, top = 187, width = 1000, @@ -1536,7 +1536,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; ',personalbar=0,toolbar=0' + ',scrollbars=1,resizable=1'; - var lWind = window.open(pUrl, 'Cloud Commander Auth', lOptions); + var lWind = window.open(url, 'Cloud Commander Auth', lOptions); if (!lWind) Dialog.alert("Please disable your popup blocker and try again."); }; From 67f4f3e38f5231d1933157d547cf69e5b6095d8f Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 12 Mar 2014 04:15:41 -0400 Subject: [PATCH 059/161] refactor(dom) pData -> data --- lib/client/dom.js | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/client/dom.js b/lib/client/dom.js index e7b6ebe4..e220ba88 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -133,21 +133,21 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; }, RESTfulProto = function() { - this.delete = function(url, pData, pCallBack, pQuery) { + this.delete = function(url, data, pCallBack, pQuery) { sendRequest({ method : 'DELETE', url : CloudFunc.FS + url + (pQuery || ''), - data : pData, + data : data, callback : pCallBack, - imgPosition : { top: !!pData } + imgPosition : { top: !!data } }); }; - this.save = function(url, pData, pCallBack, pQuery) { + this.save = function(url, data, pCallBack, pQuery) { sendRequest({ method : 'PUT', url : CloudFunc.FS + url + (pQuery || ''), - data : pData, + data : data, callback : pCallBack, imgPosition : { top: true } }); @@ -161,38 +161,38 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; }); }; - this.cp = function(pData, pCallBack) { + this.cp = function(data, pCallBack) { sendRequest({ method : 'PUT', url : '/cp', - data : pData, + data : data, callback : pCallBack }); }; - this.zip = function(pData, pCallBack) { + this.zip = function(data, pCallBack) { sendRequest({ method : 'PUT', url : '/zip', - data : pData, + data : data, callback : pCallBack }); }; - this.mv = function(pData, pCallBack) { + this.mv = function(data, pCallBack) { sendRequest({ method : 'PUT', url : '/mv', - data : pData, + data : data, callback : pCallBack }); }; - this.config = function(pData, pCallBack) { + this.config = function(data, pCallBack) { sendRequest({ method : 'PUT', url : '/config', - data : pData, + data : data, callback : pCallBack, imgPosition : { top: true } }); @@ -1037,9 +1037,9 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; * @pCallBack - function({data, name}) {} * @currentFile */ - this.saveCurrentData = function(url, pData, pCallBack, pQuery) { - RESTful.save(url, pData, function() { - DOM.saveDataToStorage(url, pData); + this.saveCurrentData = function(url, data, pCallBack, pQuery) { + RESTful.save(url, data, function() { + DOM.saveDataToStorage(url, data); }, pQuery); }; @@ -1191,11 +1191,11 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * setting history wrapper */ - this.setHistory = function(pData, pTitle, url) { + this.setHistory = function(data, pTitle, url) { var lRet = window.history; if (lRet) - history.pushState(pData, pTitle, url); + history.pushState(data, pTitle, url); return lRet; }; From 3deebd9d88248844b7474adf5168c63382512780 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 12 Mar 2014 04:17:28 -0400 Subject: [PATCH 060/161] refactor(dom) pCallBack -> callback --- lib/client/dom.js | 64 +++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/lib/client/dom.js b/lib/client/dom.js index e220ba88..2df9a9d2 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -133,67 +133,67 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; }, RESTfulProto = function() { - this.delete = function(url, data, pCallBack, pQuery) { + this.delete = function(url, data, callback, pQuery) { sendRequest({ method : 'DELETE', url : CloudFunc.FS + url + (pQuery || ''), data : data, - callback : pCallBack, + callback : callback, imgPosition : { top: !!data } }); }; - this.save = function(url, data, pCallBack, pQuery) { + this.save = function(url, data, callback, pQuery) { sendRequest({ method : 'PUT', url : CloudFunc.FS + url + (pQuery || ''), data : data, - callback : pCallBack, + callback : callback, imgPosition : { top: true } }); }; - this.read = function(url, pCallBack, pQuery) { + this.read = function(url, callback, pQuery) { sendRequest({ method : 'GET', url : CloudFunc.FS + url + (pQuery || ''), - callback : pCallBack + callback : callback }); }; - this.cp = function(data, pCallBack) { + this.cp = function(data, callback) { sendRequest({ method : 'PUT', url : '/cp', data : data, - callback : pCallBack + callback : callback }); }; - this.zip = function(data, pCallBack) { + this.zip = function(data, callback) { sendRequest({ method : 'PUT', url : '/zip', data : data, - callback : pCallBack + callback : callback }); }; - this.mv = function(data, pCallBack) { + this.mv = function(data, callback) { sendRequest({ method : 'PUT', url : '/mv', data : data, - callback : pCallBack + callback : callback }); }; - this.config = function(data, pCallBack) { + this.config = function(data, callback) { sendRequest({ method : 'PUT', url : '/config', data : data, - callback : pCallBack, + callback : callback, imgPosition : { top: true } }); }; @@ -622,22 +622,22 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * load jquery from google cdn or local copy - * @param pCallBack + * @param callback */ - this.jqueryLoad = function(pCallBack) { + this.jqueryLoad = function(callback) { CloudCmd.getConfig(function(config) { var online = config.online && navigator.onLine; Util.ifExec(!online, function() { DOM.jsload('/lib/client/jquery.js', { - onload: pCallBack + onload: callback }); }, - function(callback) { + function(func) { DOM.jquery({ - onload: pCallBack, - onerror: callback + onload: callback, + onerror: func }); }); }); @@ -870,7 +870,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; * get size * @currentFile */ - this.loadCurrentSize = function(pCallBack, currentFile) { + this.loadCurrentSize = function(callback, currentFile) { var lRet, lCurrent = currentFile || this.getCurrentFile(), lLink = this.getCurrentPath(lCurrent), @@ -879,7 +879,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; if (lName !== '..') RESTful.read(lLink, function(pSize) { DOM.setCurrentSize(pSize, lCurrent); - Util.exec(pCallBack, lCurrent); + Util.exec(callback, lCurrent); }, '?size'); return lRet; @@ -887,32 +887,32 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * load hash - * @pCallBack + * @callback * @currentFile */ - this.loadCurrentHash = function(pCallBack, currentFile) { + this.loadCurrentHash = function(callback, currentFile) { var lRet, lCurrent = currentFile || this.getCurrentFile(), lLink = this.getCurrentPath(lCurrent), lName = this.getCurrentName(lCurrent); - RESTful.read(lLink, pCallBack, '?hash'); + RESTful.read(lLink, callback, '?hash'); return lRet; }; /** * load current modification time of file - * @pCallBack + * @callback * @currentFile */ - this.loadCurrentTime = function(pCallBack, currentFile) { + this.loadCurrentTime = function(callback, currentFile) { var lRet, lCurrent = currentFile || this.getCurrentFile(), lLink = this.getCurrentPath(lCurrent), lName = this.getCurrentName(lCurrent); - RESTful.read(lLink, pCallBack, '?time'); + RESTful.read(lLink, callback, '?time'); return lRet; }; @@ -958,7 +958,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * unified way to get current file content * - * @pCallBack - callback function or data struct {sucess, error} + * @callback - callback function or data struct {sucess, error} * @currentFile */ this.getCurrentFileContent = function(pParams, currentFile) { @@ -994,7 +994,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * unified way to get current file content * - * @pCallBack - function({data, name}) {} + * @callback - function({data, name}) {} * @currentFile */ this.getCurrentData = function(callback, currentFile) { @@ -1034,10 +1034,10 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * unified way to save current file content * - * @pCallBack - function({data, name}) {} + * @callback - function({data, name}) {} * @currentFile */ - this.saveCurrentData = function(url, data, pCallBack, pQuery) { + this.saveCurrentData = function(url, data, callback, pQuery) { RESTful.save(url, data, function() { DOM.saveDataToStorage(url, data); }, pQuery); From 9c45ea053c63ea4930d4e5511f278fa58e82e4bd Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 12 Mar 2014 04:17:57 -0400 Subject: [PATCH 061/161] refactor(dom) pQuery -> query --- lib/client/dom.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/client/dom.js b/lib/client/dom.js index 2df9a9d2..db1bf733 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -133,30 +133,30 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; }, RESTfulProto = function() { - this.delete = function(url, data, callback, pQuery) { + this.delete = function(url, data, callback, query) { sendRequest({ method : 'DELETE', - url : CloudFunc.FS + url + (pQuery || ''), + url : CloudFunc.FS + url + (query || ''), data : data, callback : callback, imgPosition : { top: !!data } }); }; - this.save = function(url, data, callback, pQuery) { + this.save = function(url, data, callback, query) { sendRequest({ method : 'PUT', - url : CloudFunc.FS + url + (pQuery || ''), + url : CloudFunc.FS + url + (query || ''), data : data, callback : callback, imgPosition : { top: true } }); }; - this.read = function(url, callback, pQuery) { + this.read = function(url, callback, query) { sendRequest({ method : 'GET', - url : CloudFunc.FS + url + (pQuery || ''), + url : CloudFunc.FS + url + (query || ''), callback : callback }); }; @@ -1037,10 +1037,10 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; * @callback - function({data, name}) {} * @currentFile */ - this.saveCurrentData = function(url, data, callback, pQuery) { + this.saveCurrentData = function(url, data, callback, query) { RESTful.save(url, data, function() { DOM.saveDataToStorage(url, data); - }, pQuery); + }, query); }; /** From a0447cb849884cf6f678d1731e6da8133ce2b9e4 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 12 Mar 2014 04:21:34 -0400 Subject: [PATCH 062/161] refactor(dom) getCurrentSize --- lib/client/dom.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/client/dom.js b/lib/client/dom.js index db1bf733..0e661170 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -856,14 +856,15 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; * @currentFile */ this.getCurrentSize = function(currentFile) { - var lRet, - lCurrent = currentFile || Cmd.getCurrentFile(), - lSize = this.getByClass('size', lCurrent); - lSize = lSize.textContent; - /* если это папка - возвращаем слово dir вместо размера*/ - lRet = Util.removeStrOneTime(lSize, ['<', '>']); + var ret, + current = currentFile || Cmd.getCurrentFile(), + size = this.getByClass('size', current); - return lRet; + size = size.textContent; + /* если это папка - возвращаем слово dir вместо размера*/ + ret = Util.removeStrOneTime(size, ['<', '>']); + + return ret; }; /** From b5f7c7b414dd0212d86cb9c23d01de6eb6060504 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 12 Mar 2014 04:28:01 -0400 Subject: [PATCH 063/161] fix(style) fancybox html: overflow hidden --- css/style.css | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/css/style.css b/css/style.css index 163f2e22..3150bc0f 100644 --- a/css/style.css +++ b/css/style.css @@ -22,7 +22,9 @@ } html { - height: 94%; + height : 94%; + /* fix overflow change of fancybox */ + overflow : hidden; } body { From 6ddf62d2be05beaf63d20330414c5d68f077e473 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 12 Mar 2014 05:37:31 -0400 Subject: [PATCH 064/161] feature(util) rm convertArrToObj --- lib/util.js | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/lib/util.js b/lib/util.js index 017d3a31..091d68d2 100644 --- a/lib/util.js +++ b/lib/util.js @@ -185,19 +185,6 @@ return to; }; - this.convertArrToObj = function(pArrKeys, pArrVal) { - var i, n, lName, lRet; - - if (pArrKeys && pArrVal) { - for(i = 0, n = pArrKeys; i < n; i++) { - lName = pArrKeys[i]; - lRet[lName] = pArrVal[i]; - } - } - - return lRet; - }; - /** * copy pObj properties to pTargetObject * From 39d45c58946dd5deac15d79cfebbcfddbf998dbf Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 12 Mar 2014 05:39:14 -0400 Subject: [PATCH 065/161] refactor(util) loadOnLoad callback: rm pData --- lib/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/util.js b/lib/util.js index 091d68d2..40ed38ca 100644 --- a/lib/util.js +++ b/lib/util.js @@ -437,7 +437,7 @@ if (Util.isArray(funcs)) { func = funcs.shift(); - callback = function(pData) { + callback = function() { return Util.loadOnLoad(funcs); }; From fbe1bf7f51b0920f51d91858565a9a3e7760f541 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 12 Mar 2014 05:41:11 -0400 Subject: [PATCH 066/161] refactor(util) getExtension --- lib/util.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/util.js b/lib/util.js index 40ed38ca..1d27d92b 100644 --- a/lib/util.js +++ b/lib/util.js @@ -861,15 +861,16 @@ * @param pFileName * @return Ext */ - this.getExtension = function(pFileName) { - var lRet, lDot; + this.getExtension = function(name) { + var ret, dot, + isStr = Util.isString(name); - if ( Util.isString(pFileName) ) { - lDot = pFileName.lastIndexOf('.'); - lRet = pFileName.substr(lDot); + if (isStr) { + dot = name.lastIndexOf('.'); + ret = name.substr(dot); } - return lRet; + return ret; }; /** From 9e811db06f2efbe632265e7217f087cff9139441 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 12 Mar 2014 06:39:14 -0400 Subject: [PATCH 067/161] docs(help) iptables: path and sudo -> # --- HELP.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/HELP.md b/HELP.md index c3233ba5..7b793851 100644 --- a/HELP.md +++ b/HELP.md @@ -183,24 +183,24 @@ There is a couple easy and fast ways. One of them is port forwarding. Just run [shell/addtables.sh](shell/addtables.sh) for default options. ```sh -@:/tmp/cloudcmd (dev) $ sudo iptables -t nat -L # look rules before -@:/tmp/cloudcmd (dev) $ sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8000 -@:/tmp/cloudcmd (dev) $ sudo iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 4430 -@:/tmp/cloudcmd (dev) $ sudo iptables -t nat -L # look rules after +# iptables -t nat -L # look rules before +# iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8000 +# iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 4430 +# iptables -t nat -L # look rules after ``` You should see something like this ( **8000** and **4430** should be in config as **port** and **sslPort** ) - - target prot opt source destination - REDIRECT tcp -- anywhere anywhere tcp dpt:http redir ports 8000 - REDIRECT tcp -- anywhere anywhere tcp dpt:https redir ports 4430 - +``` +target prot opt source destination +REDIRECT tcp -- anywhere anywhere tcp dpt:http redir ports 8000 +REDIRECT tcp -- anywhere anywhere tcp dpt:https redir ports 4430 +``` If you would want to get things back just clear rules ( **1** and **2** it's rule numbers, in your list they could differ). ```sh -@:/tmp/cloudcmd (dev) $ sudo iptables -t nat -D PREROUTING 2 -@:/tmp/cloudcmd (dev) $ sudo iptables -t nat -D PREROUTING 1 +# iptables -t nat -D PREROUTING 2 +# iptables -t nat -D PREROUTING 1 ``` ###nginx From 351ceac00ef87dd137f33c4bb4093bf8dc1053c8 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 12 Mar 2014 07:41:16 -0400 Subject: [PATCH 068/161] feature(edit) set emmet only for html, not for css --- lib/client/edit.js | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/lib/client/edit.js b/lib/client/edit.js index 05493bda..aa1ad37f 100644 --- a/lib/client/edit.js +++ b/lib/client/edit.js @@ -13,6 +13,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch; Value, Edit = this, Diff, + Emmet, Ace, Session, Modelist, @@ -32,7 +33,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch; } this.show = function(pValue) { - var lMode, htmlMode, cssMode, + var lMode, htmlMode, cssMode, url, lName = Info.name, isDir = Info.isDir, lExt = Info.ext; @@ -64,13 +65,24 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch; Session.setMode(lMode); - if (lMode === htmlMode || lMode === cssMode) - DOM.jsload(DIR + 'emmet.js', function() { - var Emmet = ace.require("ace/ext/emmet"); + if (lMode === htmlMode) { + if (Emmet) + Ace.setOption('enableEmmet', true); + else { + url = CloudFunc.getJoinURL([ + DIR + 'emmet.js', + DIR + 'ext-emmet.js' + ]); - Emmet.setCore(window.emmet); - Ace.setOption("enableEmmet", true); - }); + DOM.jsload(url, function() { + Emmet = ace.require('ace/ext/emmet'); + Emmet.setCore(window.emmet); + Ace.setOption('enableEmmet', true); + }); + } + } else if (Emmet) { + Ace.setOption('enableEmmet', false); + } if (Util.isString(pValue)) { Ace.setValue(pValue); @@ -226,8 +238,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch; DIR + 'theme-tomorrow_night_blue.js', DIR + 'ext-language_tools.js', DIR + 'ext-searchbox.js', - DIR + 'ext-modelist.js', - DIR + 'ext-emmet.js' + DIR + 'ext-modelist.js' ], ace = DIR + 'ace.js', From 68757ec6fd0e2626b42ffd14d38c5b7e76fd2591 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 12 Mar 2014 08:05:20 -0400 Subject: [PATCH 069/161] feature(rest) add markdown --- lib/client/help.js | 18 ++++++++++-------- lib/server/rest.js | 21 ++++++++++++++++----- package.json | 3 ++- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/lib/client/help.js b/lib/client/help.js index 90262abd..5f1b6eb6 100644 --- a/lib/client/help.js +++ b/lib/client/help.js @@ -28,19 +28,21 @@ var CloudCmd, Util, DOM; '#help li {' + 'list-style-type' + ': disc;' + - '}' + '}' + + 'img {' + + 'max-width: 100%' + + '}' }); DOM.ajax({ url : '/HELP.md', - success : function (pData) { - var lData = {text: pData}; - + success : function (data) { DOM.ajax({ - method : 'post', - url : 'https://api.github.com/markdown', - data : Util.stringifyJSON(lData), - success : function(pResult){ + method : 'put', + url : '/api/v1/markdown', + data : data, + success : function(pResult) { + var div = DOM.anyload({ name : 'div', id : 'help', diff --git a/lib/server/rest.js b/lib/server/rest.js index c9f20d52..a0af8729 100644 --- a/lib/server/rest.js +++ b/lib/server/rest.js @@ -24,6 +24,7 @@ onFSGet = main.srvrequire('rest/fs/get').onGet, onFSPut = main.srvrequire('rest/fs/put').onPut, onDelete = main.srvrequire('rest/fs/delete').onDelete, + markdown = main.srvrequire('rest/markdown/put'), JSONDIR = main.JSONDIR, OK = 200, @@ -33,6 +34,8 @@ name:'api.json' }), + NOT_LOG = true, + fse = main.require('fs-extra') || { copy : function(from, to, callback) { pipe.create({ @@ -91,13 +94,22 @@ * @param pParams {command, method, body, requrest, response} */ function sendData(pParams) { - var p, ret = main.checkParams(pParams); + var p, isFS, isMD, + ret = main.checkParams(pParams); + if (ret) { p = pParams; - ret = Util.isContainStrAtBegin(p.name, CloudFunc.FS); + isFS = Util.isContainStrAtBegin(p.name, CloudFunc.FS), + isMD = Util.isContainStrAtBegin(p.name, '/markdown'); - if (ret) + if (isFS) onFS(pParams); + else if (isMD) + pipe.getBody(p.request, function(data) { + markdown.parse(data, function(data) { + sendResponse(p, data, NOT_LOG); + }); + }); else { if (p.name[0] === '/') p.command = Util.removeStrOneTime(p.name, '/'); @@ -131,8 +143,7 @@ switch (p.request.method) { case 'GET': onFSGet(query, p.name, function(error, data, isFile) { - var str, - NOT_LOG = true; + var str; if (error) sendError(params, error); diff --git a/package.json b/package.json index e711216f..67c474df 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,8 @@ "socket.io": "0.9.16", "express": "3.4.x", "http-auth": "2.1.x", - "fs-extra": "0.8.x" + "fs-extra": "0.8.x", + "marked": "~0.3.2" }, "license": "MIT", "engines": { From a05870e053a4fb54ef0919b71a272dee79ff5c21 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 12 Mar 2014 08:16:53 -0400 Subject: [PATCH 070/161] feature(help) mv css to file --- css/help.css | 12 ++++++++++++ html/fs/index.html | 2 +- lib/client/help.js | 33 +++++++++------------------------ 3 files changed, 22 insertions(+), 25 deletions(-) create mode 100644 css/help.css diff --git a/css/help.css b/css/help.css new file mode 100644 index 00000000..c54f7d80 --- /dev/null +++ b/css/help.css @@ -0,0 +1,12 @@ +.help { + white-space : normal; + margin : 25px; +} + +.help li { + list-style-type : disc; +} + +.help img { + max-width : 100% +} diff --git a/html/fs/index.html b/html/fs/index.html index 48034731..f4c4446d 100644 --- a/html/fs/index.html +++ b/html/fs/index.html @@ -10,7 +10,7 @@ {{ title }} - + From 10d6241c6aca5678ec898f305380ab869ab51d08 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 14 Mar 2014 10:26:39 -0400 Subject: [PATCH 099/161] fix(server) beforeJoin: funcs -> func = [] --- lib/server.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/server.js b/lib/server.js index 3160a997..50b4f02d 100644 --- a/lib/server.js +++ b/lib/server.js @@ -242,7 +242,8 @@ } function beforeJoin(names, callback) { - var i, name, check, minName, dir, funcs, + var i, name, check, minName, dir, + funcs = [], config = main.config, n = names.length; @@ -250,22 +251,22 @@ Util.exec(callback); else { for (i = 0; i < n; i++) { - name = Path.join(DIR, names[i]); - check = checkExtension(name); + name = Path.join(DIR, names[i]); + check = checkExtension(name); + + if (check) { + minName = Minify.getName(name); - if (check) { - minName = Minify.getName(name); - - if (name !== minName) { - names[i] = minName; - dir = ''; - } + if (name !== minName) { + names[i] = minName; + dir = ''; } - - funcs.push(Util.bind(minify, name)); } - Util.asyncCall(funcs, callback); + funcs.push(Util.bind(minify, name)); + } + + Util.asyncCall(funcs, callback); } } From b9611f93a41b21f61a1e0963f0ff83ddc4410438 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 14 Mar 2014 10:27:49 -0400 Subject: [PATCH 100/161] fix(join) readPipe: response -> res --- lib/server/join.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/server/join.js b/lib/server/join.js index bf0f0a06..3679c0b3 100644 --- a/lib/server/join.js +++ b/lib/server/join.js @@ -53,7 +53,7 @@ var errorStr; if (error) - if (!response.headersSent) + if (!res.headersSent) main.sendError({ request : req, response : res, From 4c561cd62882b2ae2360d6bf7f329bc728cb5f2f Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 14 Mar 2014 10:31:25 -0400 Subject: [PATCH 101/161] fix(join) readPipe: add path --- lib/server/join.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/server/join.js b/lib/server/join.js index 3679c0b3..dcafeac0 100644 --- a/lib/server/join.js +++ b/lib/server/join.js @@ -32,6 +32,7 @@ function readPipe(req, res, dir, names) { var stream, + path = main.getPathName(req), gzip = zlib.createGzip(), isGzip = main.isGZIP(req); From c10277480a6c993740840e1715d9ad451b184acf Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 14 Mar 2014 11:00:47 -0400 Subject: [PATCH 102/161] feature(files) rm dir --- lib/server.js | 35 +++++++++++++++++++++-------------- lib/server/files.js | 2 +- lib/server/fstream.js | 38 ++++++++++++++++++++++++++++++++++++++ lib/server/join.js | 9 +++------ 4 files changed, 63 insertions(+), 21 deletions(-) create mode 100644 lib/server/fstream.js diff --git a/lib/server.js b/lib/server.js index 50b4f02d..9b977dda 100644 --- a/lib/server.js +++ b/lib/server.js @@ -34,18 +34,20 @@ express = main.express, expressApp, files = main.files, + emptyHandler = function(req, res, next) { Util.exec(next) }, + Server, Rest, Route; - join = join && Util.bind(join, beforeJoin, DIR) || Util.exec.bind(Util); + join = join && Util.bind(join, beforeJoin) || emptyHandler; /* базовая инициализация */ function init(pAppCachProcessing) { var config = main.config; /* создаём файл app cache */ - if (config.appcache && AppCache && config.server ) - Util.exec( pAppCachProcessing ); + if (config.appcache && AppCache && config.server) + Util.exec( pAppCachProcessing); } @@ -242,32 +244,37 @@ } function beforeJoin(names, callback) { - var i, name, check, minName, dir, + var i, name, check, minName, + func, funcs = [], + dir = DIR, config = main.config, n = names.length; - if (!config.minify) - Util.exec(callback); - else { - for (i = 0; i < n; i++) { - name = Path.join(DIR, names[i]); + for (i = 0; i < n; i++) { + name = Path.join(dir, names[i]); + names[i] = name; + + if (config.minify) { check = checkExtension(name); if (check) { minName = Minify.getName(name); if (name !== minName) { - names[i] = minName; - dir = ''; + names[i] = minName; } } - + funcs.push(Util.bind(minify, name)); } - - Util.asyncCall(funcs, callback); } + + func = Util.exec(callback, names); + + Util.ifExec(!config.minify, func, function(callback) { + Util.asyncCall(funcs, callback); + }); } function checkExtension(name) { diff --git a/lib/server/files.js b/lib/server/files.js index b6eb089b..16c6b137 100644 --- a/lib/server/files.js +++ b/lib/server/files.js @@ -63,7 +63,7 @@ p.write.end(); Util.exec(p.callback); } else { - name = p.dir + names.shift(); + name = names.shift(); pipe.create({ from : name, diff --git a/lib/server/fstream.js b/lib/server/fstream.js new file mode 100644 index 00000000..5b47744f --- /dev/null +++ b/lib/server/fstream.js @@ -0,0 +1,38 @@ +(function () { + 'use strict'; + + if (!global.cloudcmd) + return console.log( + '# fstream.js' + '\n' + + '# -----------' + '\n' + + '# Module is part of Cloud Commander,' + '\n' + + '# used for work with files.' + '\n' + + '# http://cloudcmd.io' + '\n'); + + var main = global.cloudcmd.main, + fs = main.fs, + Util = main.util, + fstream = main.require('fstream'), + tar = main.require('tar'); + + + exports.pack = packDir; + + function packDir(path, stream) { + var dirStream, tarStream, ret; + + if (tar && fstream) { + dirStream = fstream.Reader({ + type: "Directory", + path: path + }); + + tarStream = tar.Pack({}); + + ret = dirStream.pipe(tarStream); + } + + return ret; + } + +})(); diff --git a/lib/server/join.js b/lib/server/join.js index dcafeac0..e1de458c 100644 --- a/lib/server/join.js +++ b/lib/server/join.js @@ -9,9 +9,9 @@ module.exports = join; - function join(before, dir, req, res, callback) { + function join(before, req, res, callback) { var names, - readFunc = Util.bind(readPipe, req, res, dir), + readFunc = Util.bind(readPipe, req, res), path = main.getPathName(req), isJoin = CloudFunc.isJoinURL(path); @@ -20,8 +20,6 @@ else { names = CloudFunc.getJoinArray(path); - readFunc = Util.bind(readFunc, names); - Util.ifExec(!before, readFunc, function(callback) { before(names, callback); }); @@ -30,7 +28,7 @@ return isJoin; } - function readPipe(req, res, dir, names) { + function readPipe(req, res, names) { var stream, path = main.getPathName(req), gzip = zlib.createGzip(), @@ -48,7 +46,6 @@ files.readPipe({ names : names, - dir : dir, write : stream, callback : function(error) { var errorStr; From f90f3cb047e58a4ca8e172f139f23c5aa257fd55 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 14 Mar 2014 18:17:08 +0200 Subject: [PATCH 103/161] docs(readme) fs?json -> img/txt.png --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 75660e5b..1b93beaa 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,9 @@ Cloud Commander v0.8.2 [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status] [IOURL]: http://io.cloudcmd.io "IO" [JitSuURL]: http://cloudcmd.jit.su "JitSu" [HerokuURL]: http://cloudcmd.herokuapp.com/ "Heroku" -[IO_LIVE_IMG]: http://status-ok.cloudcmd.io/host/io.cloudcmd.io/fs?json "IO" -[JitSu_LIVE_IMG]: http://status-ok.cloudcmd.io/host/cloudcmd.jit.su/fs?json "JitSu" -[HEROKU_LIVE_IMG]: http://status-ok.cloudcmd.io/host/cloudcmd.herokuapp.com/fs?json "Heroku" +[IO_LIVE_IMG]: http://status-ok.cloudcmd.io/host/io.cloudcmd.io/img/txt.png "IO" +[JitSu_LIVE_IMG]: http://status-ok.cloudcmd.io/host/cloudcmd.jit.su/img/txt.png "JitSu" +[HEROKU_LIVE_IMG]: http://status-ok.cloudcmd.io/host/cloudcmd.herokuapp.com/img/txt.png "Heroku" **Cloud Commander** - cloud file manager with console and editor. From d417f6630be041c2aa82ef233f77f9b52a993691 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sat, 15 Mar 2014 19:18:28 +0200 Subject: [PATCH 104/161] docs(help) change main description --- HELP.md | 49 ++++++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/HELP.md b/HELP.md index 375640cf..eefe0d83 100644 --- a/HELP.md +++ b/HELP.md @@ -11,10 +11,7 @@ Cloud Commander v0.8.2 [JitSu_LIVE_IMG]: https://status-ok.cloudcmd.io/host/cloudcmd.jit.su/img/txt.png "JitSu" [HEROKU_LIVE_IMG]: https://status-ok.cloudcmd.io/host/cloudcmd.herokuapp.com/img/txt.png "Heroku" -**Cloud Commander** - cloud file manager with console and editor. Will help you: **create**, **edit**, **move** and **delete files** and **folders** in your favorite browser from any computer. File manager has two parts: - -- **client** (with nice and simple interface) -- **server** (based on Node.js). +**Cloud Commander** web based orthodox file manager with console and editor. Will help you manage the server and work with files, folders and programs in browser from any computer, mobile or tablet device. ![Cloud Commander](/img/logo/cloudcmd.png "Cloud Commander") @@ -22,12 +19,15 @@ Benefits --------------- - Open Source (**MIT License**). -- Has 2 classic ortodox panels. -- Works on Windows, Linux and Mac OS. +- Has 2 classic panels. +- Optional **authorization**. +- Clien works in web browser. +- Server works on **Windows, Linux and Mac OS**. - Could be used local or remotly. -- Has nice console and editor. -- Written in JavaScript/Node.js. -- Works in browser. +- Adapting to screen size. +- **Editor** with suport of **syntax highlighting** for over 110 languages. +- **Console** with suport of default OS command line. +- Written in **JavaScript/Node.js**. Install --------------- @@ -39,6 +39,21 @@ The installation of file manager is very simple. ![NPM_INFO][NPM_INFO_IMG] +Start +--------------- +To start **Cloud Commander** only one command needed: + + node cloudcmd +or if you install with `-g` flag just type: + + cloudcmd + +After that Cloud Commander reads port information from config file [config.json](json/config.json#L17 "Config") and start server +on this port ( **8000** by default ), if none of port variables ( *cloud9*, *cloudfoundry* and *nodester* ) isn't exist. +Then type in browser + + http://127.0.0.1:8000 + Hot keys --------------- @@ -278,22 +293,6 @@ do something like this: nohup node cloudcmd -Start ---------------- -To start **Cloud Commander** only one command needed: - - node cloudcmd -or on win platform just - - cloudcmd -After that Cloud Commander reads port information from config file [config.json](json/config.json#L17 "Config") and start server -on this port ( **8000** by default ), if none of port variables ( *cloud9*, *cloudfoundry* and *nodester* ) isn't exist. -Then type in browser - - http://127.0.0.1:8000 -or - - http://localhost:8000 Update --------------- **Cloud Commander** is very often updates. From 9b0cdc640ec44dbe9a3684b0c6ccd715ff053a52 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sat, 15 Mar 2014 19:20:00 +0200 Subject: [PATCH 105/161] docs(readme) change description --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1b93beaa..b54e684e 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,6 @@ Cloud Commander v0.8.2 [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status] [JitSu_LIVE_IMG]: http://status-ok.cloudcmd.io/host/cloudcmd.jit.su/img/txt.png "JitSu" [HEROKU_LIVE_IMG]: http://status-ok.cloudcmd.io/host/cloudcmd.herokuapp.com/img/txt.png "Heroku" -**Cloud Commander** - cloud file manager with console and editor. +**Cloud Commander** web based orthodox file manager with console and editor. ![Cloud Commander](http://cloudcmd.io/img/logo/cloudcmd.png "Cloud Commander") From b9f8f9589d48a1a74676d89648e374c05b0fdf44 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sat, 15 Mar 2014 13:46:10 -0400 Subject: [PATCH 106/161] fix(server) beforeJoin: exec -> retExec --- lib/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/server.js b/lib/server.js index 9b977dda..22d129bf 100644 --- a/lib/server.js +++ b/lib/server.js @@ -270,7 +270,7 @@ } } - func = Util.exec(callback, names); + func = Util.retExec(callback, names); Util.ifExec(!config.minify, func, function(callback) { Util.asyncCall(funcs, callback); From 38934de406344baf0bac9002cc5ce76a5df74f16 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sat, 15 Mar 2014 13:46:45 -0400 Subject: [PATCH 107/161] feature(util) add execOnMatch --- lib/util.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/util.js b/lib/util.js index 1d27d92b..2904ee2e 100644 --- a/lib/util.js +++ b/lib/util.js @@ -823,6 +823,19 @@ return ret; }; + this.execOnMatch = function(exp, funcsObj) { + var name, func, match; + + if (funcsObj) + for (name in funcsObj) { + match = name.match(new RegExp(exp)); + func = funcsObj[name]; + + if (isMatch) + Util.exec(func, match); + } + }; + /** * exec function if it exist in object * @pArg From bc3e10b44d093504557bdf72b7a12dfb596f0494 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sat, 15 Mar 2014 16:57:50 -0400 Subject: [PATCH 108/161] refactor(ischanged) isFileChanged --- lib/server/ischanged.js | 26 +++++++++++++------------- lib/server/minify.js | 14 +++++++------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/server/ischanged.js b/lib/server/ischanged.js index 7da5abcc..d1f3af08 100644 --- a/lib/server/ischanged.js +++ b/lib/server/ischanged.js @@ -14,36 +14,36 @@ Times = main.require(CHANGESNAME) || []; - exports.isFileChanged = function(pFileName, pCallBack) { - var lReadedTime, lData, + exports.isFileChanged = function(name, callback) { + var readTime, data, i, n = Times.length; for (i = 0; i < n; i++) { - lData = Times[i]; - + data = Times[i]; /* if founded row with file name - save hash */ - if (lData.name === pFileName) { - lReadedTime = lData.time; + if (data.name === name) { + readTime = data.time; break; } } - time.get(pFileName, function(error, fileTime) { + time.get(name, function(error, fileTime) { var timeChanged; if (error) Util.log(error); - else if (lReadedTime !== fileTime) - timeChanged = Times[i] = { - name: pFileName, + else if (readTime !== fileTime) { + timeChanged = true; + + Times[i] = { + name: name, time: fileTime }; - - if (timeChanged) writeFile(CHANGES_JSON, Util.stringifyJSON(Times)); + } - Util.exec(pCallBack, timeChanged); + Util.exec(callback, timeChanged); }); }; diff --git a/lib/server/minify.js b/lib/server/minify.js index c1d4a90e..5fa578a3 100644 --- a/lib/server/minify.js +++ b/lib/server/minify.js @@ -29,21 +29,21 @@ /* pathes to directories */ INDEX : HTMLDIR + 'index.html', - optimize: function(pName, pParams) { + optimize: function(name, params) { if (!Minify) { Util.log(COULD_NOT_MINIFY); - Util.exec(pParams.callback); + Util.exec(params.callback); } else { - pParams.name = Minify.getName(pName); + params.name = Minify.getName(name); if (!this.MinFolder) this.MinFolder = Minify.MinFolder; - IsChanged.isFileChanged(pName, function(pChanged) { - if(pChanged) - Minify.optimize(pName, pParams); + IsChanged.isFileChanged(name, function(changed) { + if (changed) + Minify.optimize(name, params); else - Util.exec(pParams.callback, pParams); + Util.exec(params.callback, params); }); } }, From 8d8b5be1c6ad4da5a5b8160e92d0855c40f1ac3a Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sat, 15 Mar 2014 17:26:58 -0400 Subject: [PATCH 109/161] chore(server) rm {, } --- lib/server.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/server.js b/lib/server.js index 22d129bf..e71b8725 100644 --- a/lib/server.js +++ b/lib/server.js @@ -261,11 +261,10 @@ if (check) { minName = Minify.getName(name); - if (name !== minName) { + if (name !== minName) names[i] = minName; - } } - + funcs.push(Util.bind(minify, name)); } } From feca8bfe9a47b865dba33fc35646deeab8a911db Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sat, 15 Mar 2014 17:27:43 -0400 Subject: [PATCH 110/161] fix(ischanged) on asyncCall Times do not changed --- lib/server/ischanged.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/server/ischanged.js b/lib/server/ischanged.js index d1f3af08..7965b278 100644 --- a/lib/server/ischanged.js +++ b/lib/server/ischanged.js @@ -28,18 +28,22 @@ } time.get(name, function(error, fileTime) { - var timeChanged; + var timeChanged, data; if (error) Util.log(error); else if (readTime !== fileTime) { timeChanged = true; - - Times[i] = { + data = { name: name, time: fileTime }; + if (i >= n) + Times.push(data); + else + Times[i] = data; + writeFile(CHANGES_JSON, Util.stringifyJSON(Times)); } From 2c03fd02c678aa619f4de6013519d8a9e2b6d3cf Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sat, 15 Mar 2014 17:30:22 -0400 Subject: [PATCH 111/161] chore(ischanged) writeFile --- lib/server/ischanged.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/server/ischanged.js b/lib/server/ischanged.js index 7965b278..f59c774d 100644 --- a/lib/server/ischanged.js +++ b/lib/server/ischanged.js @@ -56,12 +56,12 @@ * и выводит ошибку или сообщает, * что файл успешно записан */ - function writeFile(pFileName, pData) { - fs.writeFile(pFileName, pData, function(pError) { - if (pError) - Util.log(pError); + function writeFile(name, data) { + fs.writeFile(name, data, function(error) { + if (error) + Util.log(error); else - Util.log('file ' + path.basename(pFileName) + ' writed...'); + Util.log('file ' + path.basename(name) + ' written...'); }); } -})(); \ No newline at end of file +})(); From d97b263ccf9707c5a8dc63e1e83a89fe44e9d4b6 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sun, 16 Mar 2014 16:29:19 +0200 Subject: [PATCH 112/161] feature(package) description: web based orthodox --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 67c474df..032945b6 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "cloudcmd", "version": "0.8.2", "author": "coderaiser (https://github.com/coderaiser)", - "description": "Cloud Commander - file manager with console and editor", + "description": "Cloud Commander web based orthodox file manager with console and editor", "homepage": "http://cloudcmd.io", "repository": { "type": "git", From ab55aada7b534b2d62c4bd89ab3609e46bab5d15 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sun, 16 Mar 2014 10:52:47 -0400 Subject: [PATCH 113/161] refactor(ischanged) [{name, time}] -> {name: time } --- lib/server/ischanged.js | 50 ++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 33 deletions(-) diff --git a/lib/server/ischanged.js b/lib/server/ischanged.js index f59c774d..f35f1138 100644 --- a/lib/server/ischanged.js +++ b/lib/server/ischanged.js @@ -9,42 +9,26 @@ Util = main.util, time = main.time, - CHANGESNAME = JSONDIR + 'changes', - CHANGES_JSON = CHANGESNAME + '.json', + CHANGES_NAME = JSONDIR + 'changes', + CHANGES_JSON = CHANGES_NAME + '.json', + + Times = main.require(CHANGES_NAME) || {}; - Times = main.require(CHANGESNAME) || []; - exports.isFileChanged = function(name, callback) { - var readTime, data, - i, n = Times.length; - - for (i = 0; i < n; i++) { - data = Times[i]; - /* if founded row with file name - save hash */ - if (data.name === name) { - readTime = data.time; - break; - } - } + var readTime = Times[name]; time.get(name, function(error, fileTime) { - var timeChanged, data; + var json, timeChanged; - if (error) + if (error) { Util.log(error); - else if (readTime !== fileTime) { - timeChanged = true; - data = { - name: name, - time: fileTime - }; + } else if (readTime !== fileTime) { + timeChanged = true; + Times[name] = fileTime; + json = Util.stringifyJSON(Times); - if (i >= n) - Times.push(data); - else - Times[i] = data; - - writeFile(CHANGES_JSON, Util.stringifyJSON(Times)); + console.log(json); + writeFile(CHANGES_JSON, json); } Util.exec(callback, timeChanged); @@ -58,10 +42,10 @@ */ function writeFile(name, data) { fs.writeFile(name, data, function(error) { - if (error) - Util.log(error); - else - Util.log('file ' + path.basename(name) + ' written...'); + var baseName = path.basename(name), + msg = 'file ' + baseName + ' written...'; + + Util.log(error || msg); }); } })(); From eba5b4d94679d0b58374c3c81269bd141f2ac029 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sun, 16 Mar 2014 10:56:55 -0400 Subject: [PATCH 114/161] chore(ischanged) rm console.log --- lib/server/ischanged.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/server/ischanged.js b/lib/server/ischanged.js index f35f1138..1c2007a8 100644 --- a/lib/server/ischanged.js +++ b/lib/server/ischanged.js @@ -27,7 +27,6 @@ Times[name] = fileTime; json = Util.stringifyJSON(Times); - console.log(json); writeFile(CHANGES_JSON, json); } From e6543f10c2231b1c5ca87935da02519bfa9b18e8 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 17 Mar 2014 10:29:51 +0200 Subject: [PATCH 115/161] docs(help) Clien -> Client --- HELP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HELP.md b/HELP.md index eefe0d83..74a76135 100644 --- a/HELP.md +++ b/HELP.md @@ -21,7 +21,7 @@ Benefits - Open Source (**MIT License**). - Has 2 classic panels. - Optional **authorization**. -- Clien works in web browser. +- Client works in web browser. - Server works on **Windows, Linux and Mac OS**. - Could be used local or remotly. - Adapting to screen size. From 2295b415a3f274879164fd339386492c1a75d096 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 17 Mar 2014 11:06:53 +0200 Subject: [PATCH 116/161] docs(help) `F8, Delete` -> `F8`, `Delete` --- HELP.md | 68 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/HELP.md b/HELP.md index 74a76135..26492dda 100644 --- a/HELP.md +++ b/HELP.md @@ -57,40 +57,40 @@ Then type in browser Hot keys --------------- -|Key |Operation -|:------------------|:-------------------------------------------- -| `F1` | help -| `F2` | rename -| `F3` | view -| `F4` | edit -| `F5` | copy -| `F6` | rename/move -| `F7` | new dir -| `Shift + F7` | new file -| `F8, Delete` | remove -| `Shift + Delete` | remove without prompt -| `F9` | menu -| `F10` | config -| `*` | select/unselect all -| `+` | expand selection -| `-` | shrink selection -| `Ctrl + r` | refresh -| `Ctrl + d` | clear local storage -| `Alt + q` | disable key bindings -| `Alt + s` | get all key bindings back -| `Ctrl + a` | select all files in a panel -| `Up, Down, Enter` | filesystem navigation -| `Ctrl + \` | go to the root directory -| `Tab` | move via panels -| `Page Up` | up on one page -| `Page Down` | down on one page -| `Home` | to begin of list -| `End` | to end of list -| `Space` | select current file (and get size of directory) -| `Insert` | select current file (and move to next) -| `Shift + F10` | context menu -| `~` | console -| `Ctrl + Click` | open file on new tab +|Key |Operation +|:----------------------|:-------------------------------------------- +| `F1` | help +| `F2` | rename +| `F3` | view +| `F4` | edit +| `F5` | copy +| `F6` | rename/move +| `F7` | new dir +| `Shift + F7` | new file +| `F8`, `Delete` | remove +| `Shift + Delete` | remove without prompt +| `F9` | menu +| `F10` | config +| `*` | select/unselect all +| `+` | expand selection +| `-` | shrink selection +| `Ctrl + r` | refresh +| `Ctrl + d` | clear local storage +| `Alt + q` | disable key bindings +| `Alt + s` | get all key bindings back +| `Ctrl + a` | select all files in a panel +| `Up`, `Down`, `Enter` | filesystem navigation +| `Ctrl + \` | go to the root directory +| `Tab` | move via panels +| `Page Up` | up on one page +| `Page Down` | down on one page +| `Home` | to begin of list +| `End` | to end of list +| `Space` | select current file (and get size of directory) +| `Insert` | select current file (and move to next) +| `Shift + F10` | context menu +| `~` | console +| `Ctrl + Click` | open file on new tab Edit --------------- From ffc65146bc308c1a8e60611bf4e58c8f9bbb7180 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 17 Mar 2014 05:09:40 -0400 Subject: [PATCH 117/161] feature(style) add fallback fonts --- css/style.css | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/css/style.css b/css/style.css index 3150bc0f..0ba345fe 100644 --- a/css/style.css +++ b/css/style.css @@ -28,10 +28,11 @@ html { } body { - width : 100%; - height : 95%; - font : 16px "Droid Sans Mono"; - background-color : white; + width : 100%; + height : 95%; + font-size : 16px; + font-family : "Droid Sans Mono", "Ubuntu Monospace", "Consolas", monospace; + background-color : white; } .hidden { From f01a4a07819d4879e2029f0937f3a78acbb7ee0f Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 17 Mar 2014 07:15:05 -0400 Subject: [PATCH 118/161] feature(css) Droid Sans Mono: add more formats --- css/style.css | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/css/style.css b/css/style.css index 0ba345fe..b546aa18 100644 --- a/css/style.css +++ b/css/style.css @@ -15,10 +15,16 @@ } @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'); + font-family : 'Droid Sans Mono'; + src : url(https://themes.googleusercontent.com/static/fonts/droidsansmono/v5/ns-m2xQYezAtqh7ai59hJTwtzT4qNq-faudv5qbO9-U.eot); + src : local('Droid Sans Mono'), + local('DroidSansMono'), + url(https://themes.googleusercontent.com/static/fonts/droidsansmono/v5/ns-m2xQYezAtqh7ai59hJTwtzT4qNq-faudv5qbO9-U.eot?#iefix) format('embedded-opentype'), + url(https://themes.googleusercontent.com/static/fonts/droidsansmono/v5/ns-m2xQYezAtqh7ai59hJTwtzT4qNq-faudv5qbO9-U.eot) format('embedded-opentype'), + url(https://themes.googleusercontent.com/static/fonts/droidsansmono/v5/ns-m2xQYezAtqh7ai59hJUYuTAAIFFn5GTWtryCmBQ4.woff) format('woff'), + local('Consolas'); + font-style : normal; + font-weight : 400; } html { @@ -31,7 +37,7 @@ body { width : 100%; height : 95%; font-size : 16px; - font-family : "Droid Sans Mono", "Ubuntu Monospace", "Consolas", monospace; + font-family : "Droid Sans Mono", "Ubuntu Mono", "Consolas", monospace; background-color : white; } From 4c05e0c2ce892de810b22465b2d7dc76e9c4f112 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 17 Mar 2014 07:15:22 -0400 Subject: [PATCH 119/161] refactor(index) createScript, load --- html/fs/index.html | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/html/fs/index.html b/html/fs/index.html index 010c512b..7bb59a55 100644 --- a/html/fs/index.html +++ b/html/fs/index.html @@ -51,18 +51,32 @@ lib + 'client.js', client + 'listeners.js', client + 'key.js' - ], - url = getJoinURL(files); + ]; - window.addEventListener('load', createScript); + window.addEventListener('load', load); - function createScript() { + function load() { + var urlFiles = getJoinURL(files); + + createScript(urlFiles, function() { + CloudCmd.init(); + }); + + window.removeEventListener('load', load); + } + + function createScript(url, callback) { script = document.createElement('script'); script.src = url; script.async = true; - script.addEventListener('load', scriptLoad); + + if (callback) + script.addEventListener('load', function(event) { + callback(event); + script.removeEventListener('load', callback); + }); + document.body.appendChild(script); - window.removeEventListener('load', createScript); } function getJoinURL(files) { @@ -73,11 +87,6 @@ return url; } - - function scriptLoad() { - CloudCmd.init(); - script.removeEventListener('load', scriptLoad); - } })(); From 3b1f1fec52722944533dc6cb18234b1d2f3a9c9f Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 17 Mar 2014 08:11:54 -0400 Subject: [PATCH 120/161] feature(font) Droid Sans: add eot --- css/style.css | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/css/style.css b/css/style.css index b546aa18..d5ab1350 100644 --- a/css/style.css +++ b/css/style.css @@ -15,16 +15,18 @@ } @font-face { - font-family : 'Droid Sans Mono'; - src : url(https://themes.googleusercontent.com/static/fonts/droidsansmono/v5/ns-m2xQYezAtqh7ai59hJTwtzT4qNq-faudv5qbO9-U.eot); - src : local('Droid Sans Mono'), - local('DroidSansMono'), - url(https://themes.googleusercontent.com/static/fonts/droidsansmono/v5/ns-m2xQYezAtqh7ai59hJTwtzT4qNq-faudv5qbO9-U.eot?#iefix) format('embedded-opentype'), - url(https://themes.googleusercontent.com/static/fonts/droidsansmono/v5/ns-m2xQYezAtqh7ai59hJTwtzT4qNq-faudv5qbO9-U.eot) format('embedded-opentype'), - url(https://themes.googleusercontent.com/static/fonts/droidsansmono/v5/ns-m2xQYezAtqh7ai59hJUYuTAAIFFn5GTWtryCmBQ4.woff) format('woff'), - local('Consolas'); - font-style : normal; - font-weight : 400; + font-family : 'Droid Sans Mono'; + src : url(https://themes.googleusercontent.com/static/fonts/droidsansmono/v5/ns-m2xQYezAtqh7ai59hJTwtzT4qNq-faudv5qbO9-U.eot); + src : local('Droid Sans Mono'), + local('DroidSansMono'), + url(https://themes.googleusercontent.com/static/fonts/droidsansmono/v5/ns-m2xQYezAtqh7ai59hJTwtzT4qNq-faudv5qbO9-U.eot?#iefix) format('embedded-opentype'), + url(https://themes.googleusercontent.com/static/fonts/droidsansmono/v5/ns-m2xQYezAtqh7ai59hJTwtzT4qNq-faudv5qbO9-U.eot) format('embedded-opentype'), + url(/font/DroidSansMono.eot) format('embedded-opentype'), + url(https://themes.googleusercontent.com/static/fonts/droidsansmono/v5/ns-m2xQYezAtqh7ai59hJUYuTAAIFFn5GTWtryCmBQ4.woff) format('woff'), + url(/font/DroidSansMono.woff) format('woff'), + local('Consolas'); + font-style : normal; + font-weight : 400; } html { From 95bba9325598f05cbe782d870505b930fcbf938c Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 17 Mar 2014 08:23:06 -0400 Subject: [PATCH 121/161] fix(css) fancybox: stop page jumping on modal window close --- css/style.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/css/style.css b/css/style.css index d5ab1350..532ae76a 100644 --- a/css/style.css +++ b/css/style.css @@ -31,8 +31,6 @@ html { height : 94%; - /* fix overflow change of fancybox */ - overflow : hidden; } body { @@ -41,6 +39,8 @@ body { font-size : 16px; font-family : "Droid Sans Mono", "Ubuntu Mono", "Consolas", monospace; background-color : white; + /* fix overflow change of fancybox */ + overflow : hidden; } .hidden { From d3a129063d2bc83843989f303003700f6b8fe4c2 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 17 Mar 2014 08:27:11 -0400 Subject: [PATCH 122/161] feature(style) Droid Sans Mono: speed up when minimize --- css/style.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/css/style.css b/css/style.css index 532ae76a..c1e7e758 100644 --- a/css/style.css +++ b/css/style.css @@ -19,11 +19,11 @@ src : url(https://themes.googleusercontent.com/static/fonts/droidsansmono/v5/ns-m2xQYezAtqh7ai59hJTwtzT4qNq-faudv5qbO9-U.eot); src : local('Droid Sans Mono'), local('DroidSansMono'), + url(/font/DroidSansMono.eot) format('embedded-opentype'), url(https://themes.googleusercontent.com/static/fonts/droidsansmono/v5/ns-m2xQYezAtqh7ai59hJTwtzT4qNq-faudv5qbO9-U.eot?#iefix) format('embedded-opentype'), url(https://themes.googleusercontent.com/static/fonts/droidsansmono/v5/ns-m2xQYezAtqh7ai59hJTwtzT4qNq-faudv5qbO9-U.eot) format('embedded-opentype'), - url(/font/DroidSansMono.eot) format('embedded-opentype'), - url(https://themes.googleusercontent.com/static/fonts/droidsansmono/v5/ns-m2xQYezAtqh7ai59hJUYuTAAIFFn5GTWtryCmBQ4.woff) format('woff'), url(/font/DroidSansMono.woff) format('woff'), + url(https://themes.googleusercontent.com/static/fonts/droidsansmono/v5/ns-m2xQYezAtqh7ai59hJUYuTAAIFFn5GTWtryCmBQ4.woff) format('woff'), local('Consolas'); font-style : normal; font-weight : 400; From dbb4bccc8704847542586dc4ee0492bd887277bb Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 17 Mar 2014 09:19:12 -0400 Subject: [PATCH 123/161] fix(index) meta: "/>" -> ">" --- html/fs/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html/fs/index.html b/html/fs/index.html index 7bb59a55..39dfa1db 100644 --- a/html/fs/index.html +++ b/html/fs/index.html @@ -4,9 +4,9 @@ - + - + {{ title }} From 911eceb3b04e9595edc509e1d1243511e5aab021 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 17 Mar 2014 09:26:43 -0400 Subject: [PATCH 124/161] chore(cloudfunc) rm " " --- lib/cloudfunc.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/cloudfunc.js b/lib/cloudfunc.js index 742220ed..79978c9b 100644 --- a/lib/cloudfunc.js +++ b/lib/cloudfunc.js @@ -25,7 +25,6 @@ var Util; module.exports = new CloudFuncProto(Util); } - function CloudFuncProto(Util) { var CloudFunc = this, FS, From 490764f3c29f85a722c4c3c9895878a23ae5ab1c Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 17 Mar 2014 09:49:16 -0400 Subject: [PATCH 125/161] refactor(link) target -> attribute --- html/fs/link.html | 2 +- lib/cloudfunc.js | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/html/fs/link.html b/html/fs/link.html index c06af763..42efb018 100644 --- a/html/fs/link.html +++ b/html/fs/link.html @@ -1 +1 @@ -{{ name }} \ No newline at end of file +{{ name }} \ No newline at end of file diff --git a/lib/cloudfunc.js b/lib/cloudfunc.js index 79978c9b..c7a7dcf8 100644 --- a/lib/cloudfunc.js +++ b/lib/cloudfunc.js @@ -364,7 +364,7 @@ var Util; * {name:'имя',size:'размер',mode:'права доступа'}] */ this.buildFromJSON = function(json, template, pathTemplate, linkTemplate) { - var file, i, n, type, target, size, owner, mode, + var file, i, n, type, attribute, size, owner, mode, /* ссылка на верхний каталог*/ dotDot, link, linkResult, @@ -420,8 +420,7 @@ var Util; linkResult = Util.render(linkTemplate, { link : link, - name : '..', - target : '' + name : '..' }); /* Сохраняем путь к каталогу верхнего уровня*/ @@ -444,11 +443,11 @@ var Util; if (file.size === 'dir') { type = 'directory'; - target = ''; + attribute = ''; size = '<dir>'; } else { type = 'text-file'; - target = '_blank'; + attribute = 'target="_blank"'; size = CloudFunc.getShortSize(file.size); } @@ -458,7 +457,7 @@ var Util; linkResult = Util.render(linkTemplate, { link : link, name : file.name, - target : target + attribute : attribute }); From dadda98fccc85daf47e58335d4ff6cc6f9de9c69 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 17 Mar 2014 09:53:11 -0400 Subject: [PATCH 126/161] fix(cloudfunc) "taget" -> "target " --- lib/cloudfunc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cloudfunc.js b/lib/cloudfunc.js index c7a7dcf8..10ac6ab0 100644 --- a/lib/cloudfunc.js +++ b/lib/cloudfunc.js @@ -447,7 +447,7 @@ var Util; size = '<dir>'; } else { type = 'text-file'; - attribute = 'target="_blank"'; + attribute = 'target="_blank" '; size = CloudFunc.getShortSize(file.size); } From 26ee5fb3a189575874b5e2ded1b047a45a28d332 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 17 Mar 2014 10:05:42 -0400 Subject: [PATCH 127/161] refactor(path) data -> data-name --- html/fs/path.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/fs/path.html b/html/fs/path.html index 98b853be..dd7e2758 100644 --- a/html/fs/path.html +++ b/html/fs/path.html @@ -1 +1 @@ -
    {{ path }}
    \ No newline at end of file +
    {{ path }}
    \ No newline at end of file From e98ac2f2139209acb7131f80f2773521be42bdc2 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 17 Mar 2014 10:05:56 -0400 Subject: [PATCH 128/161] refactor(dom) getByAttr -> getByDataName --- lib/client/dom.js | 8 ++++---- lib/client/listeners.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/client/dom.js b/lib/client/dom.js index 22b4e7d0..f4e545fc 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -210,16 +210,16 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; * @param pClass - className * @param pElement - element */ - this.getByClass = function(pClass, pElement) { + this.getByClass = function(pClass, pElement) { var element = pElement || document, ret = this.getByClassAll(pClass, element)[0]; return ret; }; - this.getByAttr = function(attribute, element) { + this.getByDataName = function(attribute, element) { var ret, - selector = '[' + 'data="' + attribute + '"]'; + selector = '[' + 'data-name="' + attribute + '"]'; if (!element) element = document; @@ -711,7 +711,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; if (!panel) panel = this.getPanel(); - path = this.getByAttr('js-path', panel); + path = this.getByDataName('js-path', panel); ret = path && path.textContent; return ret; diff --git a/lib/client/listeners.js b/lib/client/listeners.js index 3f40eac3..d229115d 100644 --- a/lib/client/listeners.js +++ b/lib/client/listeners.js @@ -80,13 +80,13 @@ var Util, DOM, CloudCmd; url = CloudCmd.HOST, loadDirOnce = CloudCmd.loadDir(), panel = DOM.getById(panelId), - pathElement = DOM.getByAttr('js-path', panel), + pathElement = DOM.getByDataName('js-path', panel), filesElement = DOM.getByClass('files', panel), files = filesElement.children, pathLinks = DOM.getByClass('links', pathElement).children, clearStorage = DOM.getByClass('clear-storage', pathElement), - refresh = DOM.getByAttr('js-refresh', pathElement), + refresh = DOM.getByDataName('js-refresh', pathElement), fileClick = function (event) { var ctrl = event.ctrlKey; From 13d11d79cfacb969f6933425c35a4e159ec21303 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 18 Mar 2014 08:48:24 +0200 Subject: [PATCH 129/161] docs(help) add alt to NPM_INFO --- HELP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HELP.md b/HELP.md index 26492dda..66679235 100644 --- a/HELP.md +++ b/HELP.md @@ -1,7 +1,7 @@ Cloud Commander v0.8.2 =============== ###[Main][MainURL] [Blog][BlogURL] Live(![IO][IO_LIVE_IMG] [IO][IOURL], ![JitSu][JitSu_LIVE_IMG] [JitSu][JitSuURL], ![Heroku][Heroku_LIVE_IMG] [Heroku][HerokuURL]) -[NPM_INFO_IMG]: https://nodei.co/npm/cloudcmd.png?downloads=true&&stars +[NPM_INFO_IMG]: https://nodei.co/npm/cloudcmd.png?downloads=true&&stars "npm install cloudcmd" [MainURL]: http://cloudcmd.io "Main" [BlogURL]: http://blog.cloudcmd.io "Blog" [IOURL]: http://io.cloudcmd.io "IO" From 7b2423fe3d70411281bfd31c9d01b7ffac3867ab Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 18 Mar 2014 05:07:05 -0400 Subject: [PATCH 130/161] fix(worker-html) addAttributesToElement: attributes could be undefined --- lib/client/edit/worker-html.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/client/edit/worker-html.js b/lib/client/edit/worker-html.js index 4ffca0fb..af9766ab 100644 --- a/lib/client/edit/worker-html.js +++ b/lib/client/edit/worker-html.js @@ -7644,8 +7644,9 @@ function getAttribute(node, name) { SAXTreeBuilder.prototype.addAttributesToElement = function(element, attributes) { for (var i = 0; i < attributes.length; i++) { var attribute = attributes[i]; - if (!getAttribute(element, attribute.nodeName)) - element.attributes.push(attribute); + if (element.attributes) + if (!getAttribute(element, attribute.nodeName)) + element.attributes.push(attribute); } }; From b6cf544f24ab209ab4d5ee802a27c825db210671 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 18 Mar 2014 05:07:26 -0400 Subject: [PATCH 131/161] refactor(edit) save: lValue -> value --- lib/client/edit.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/client/edit.js b/lib/client/edit.js index ab8f800a..c7169ffe 100644 --- a/lib/client/edit.js +++ b/lib/client/edit.js @@ -167,8 +167,8 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch; } function save () { - var lPath = Info.path, - lValue = Ace.getValue(); + var path = Info.path, + value = Ace.getValue(); CloudCmd.getConfig(function(config) { var isDiff = config.diff; @@ -177,27 +177,27 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch; var query, MAX_SIZE = CloudFunc.MAX_FILE_SIZE, - length = lValue.length, + length = value.length, isLength = length > MAX_SIZE, isAllowed = DOM.Storage.isAllowed(); - Value = lValue; + Value = value; Util.ifExec(isLength && !isAllowed, function() { if (!query) query = ''; - DOM.RESTful.write(lPath + query, lValue, onSave); + DOM.RESTful.write(path + query, value, onSave); }, function(callback) { - DOM.checkStorageHash(lPath, function(error, equal) { + DOM.checkStorageHash(path, function(error, equal) { var isString = Util.isString(patch), patchLength = patch.length, lessLength = patchLength < length; if (!error) { if (equal && isString && patchLength && lessLength) { - lValue = patch; + value = patch; query = '?patch'; } @@ -207,7 +207,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch; }); }, function(callback) { - diff(lValue, callback); + diff(value, callback); }); }); } From 7d664f9227ba4dc1139639281add03532703c925 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 18 Mar 2014 05:11:42 -0400 Subject: [PATCH 132/161] feature(edit) onSave: add setCurrentSize --- lib/client/edit.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/client/edit.js b/lib/client/edit.js index c7169ffe..2fa082f3 100644 --- a/lib/client/edit.js +++ b/lib/client/edit.js @@ -271,6 +271,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch; if (!isError) { Edit.showMessage(text); DOM.saveDataToStorage(path, Value); + DOM.setCurrentSize(Value.length); } else { ret = Dialog.confirm(text + msg); From cc2aab3b93722b469d098dd6b28cefbee8b5c62b Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 18 Mar 2014 05:20:52 -0400 Subject: [PATCH 133/161] refactor(pipe) lRead -> read --- lib/server/pipe.js | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/lib/server/pipe.js b/lib/server/pipe.js index 09908a07..d586d9ff 100644 --- a/lib/server/pipe.js +++ b/lib/server/pipe.js @@ -18,48 +18,48 @@ exports.getBody = getBody; - exports.create = function(pParams) { - var lZlib, lError, lMsg, lRead, lWrite, lIsFsWrite, - p = pParams; + exports.create = function(params) { + var gzip, onError, read, write, isFsWrite, + p = params; if (p) { - lRead = p.read || fs.createReadStream(p.from, { + read = p.read || fs.createReadStream(p.from, { bufferSize: 4 * 1024 }); if (p.write) - lWrite = p.write; + write = p.write; else { - lWrite = fs.createWriteStream(p.to); - lIsFsWrite = true; + write = fs.createWriteStream(p.to); + isFsWrite = true; } - lError = function(pError) { - Util.exec(p.callback, pError); + onError = function(error) { + Util.exec(p.callback, error); }; if (p.gzip) { - lZlib = zlib.createGzip(); - lRead.on('error', lError); - lRead = lRead.pipe(lZlib); + gzip = zlib.createGzip(); + read.on('error', onError); + read = read.pipe(gzip); } - lWrite.on('error', lError); - lRead.on('error', lError); + write.on('error', onError); + read.on('error', onError); - Util.ifExec(!lIsFsWrite, function() { - lRead.on('data', function(data) { - lWrite.write(data); + Util.ifExec(!isFsWrite, function() { + read.on('data', function(data) { + write.write(data); }); - lRead.on('end', function() { + read.on('end', function() { if (!p.notEnd) - lWrite.end(); + write.end(); Util.exec(p.callback); }); - }, function(pCallBack) { - lWrite.on('open', pCallBack); + }, function(callback) { + write.on('open', callback); }); } }; From 41420c08ecd27e9bfdd3a8c628784d34aac207ff Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 18 Mar 2014 05:22:56 -0400 Subject: [PATCH 134/161] chore(pipe) main.fs -> require('fs') --- lib/server/pipe.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/server/pipe.js b/lib/server/pipe.js index d586d9ff..92ee6547 100644 --- a/lib/server/pipe.js +++ b/lib/server/pipe.js @@ -8,13 +8,13 @@ '# Module is part of Cloud Commander,' + '\n' + '# used for work with stream.' + '\n' + '# If you wont to see at work call' + '\n' + - '# stream.createPipe' + '\n' + + '# pipe.createPipe' + '\n' + '# http://cloudcmd.io' + '\n'); var main = global.cloudcmd.main, - fs = main.fs, Util = main.util, - zlib = main.zlib; + fs = require('fs'), + zlib = require('zlib'); exports.getBody = getBody; From 4eddc74341d71b1fcdb582aedfe9dec4c90b61a3 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 18 Mar 2014 06:06:58 -0400 Subject: [PATCH 135/161] chore(pipe) createPipe -> create --- lib/server/pipe.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/server/pipe.js b/lib/server/pipe.js index 92ee6547..fcea2351 100644 --- a/lib/server/pipe.js +++ b/lib/server/pipe.js @@ -8,7 +8,7 @@ '# Module is part of Cloud Commander,' + '\n' + '# used for work with stream.' + '\n' + '# If you wont to see at work call' + '\n' + - '# pipe.createPipe' + '\n' + + '# pipe.create' + '\n' + '# http://cloudcmd.io' + '\n'); var main = global.cloudcmd.main, From 1e825698c3feb502d4638b0e2b4613447beac20a Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 18 Mar 2014 07:31:57 -0400 Subject: [PATCH 136/161] feature(pipe) getBody: add error handling --- lib/server/pipe.js | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/server/pipe.js b/lib/server/pipe.js index fcea2351..9af75266 100644 --- a/lib/server/pipe.js +++ b/lib/server/pipe.js @@ -12,13 +12,27 @@ '# http://cloudcmd.io' + '\n'); var main = global.cloudcmd.main, - Util = main.util, + Util = require('util.io'), fs = require('fs'), zlib = require('zlib'); + exports.create = create; exports.getBody = getBody; - exports.create = function(params) { + /** + * create pipe + * params: {callback, read or from, write or to, gzip} + * read - readable stream + * write - writable stream + * to - name of file to write + * from - name of file to read + * gzip - should gzip to be used + * callback - function(error) {} + * + * @param params + * @param callback + */ + function create(params) { var gzip, onError, read, write, isFsWrite, p = params; @@ -62,7 +76,7 @@ write.on('open', callback); }); } - }; + } /** * get body of readStream @@ -77,8 +91,12 @@ body += chunk; }); + readStream.on('error', function(error) { + Util.retExec(callback, error); + }); + readStream.on('end', function() { - Util.exec(callback, body); + Util.exec(callback, null, body); }); } })(); From e4d376c61c1c3f9caeec6f557d7e3cd8da6965f4 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 18 Mar 2014 07:41:45 -0400 Subject: [PATCH 137/161] feature(pipe) getBody: add error handling --- lib/server/auth.js | 19 ++++++++--- lib/server/pipe.js | 2 +- lib/server/rest.js | 63 +++++++++++++++++++++++-------------- lib/server/rest/fs/put.js | 7 +++-- lib/server/rest/markdown.js | 7 +++-- 5 files changed, 65 insertions(+), 33 deletions(-) diff --git a/lib/server/auth.js b/lib/server/auth.js index 1ab700e3..228c23bb 100644 --- a/lib/server/auth.js +++ b/lib/server/auth.js @@ -40,11 +40,11 @@ code = code.replace('code=', ''); Util.log(code); - authenticate(code, function(token) { + authenticate(code, function(error, token) { var result = { "token": token }; - Util.log(result); + Util.log(error || result); - Util.exec(callback, result); + Util.exec(callback, error, result); }); }; @@ -71,8 +71,17 @@ GithubAuth.headers = { 'content-length': data.length }; req = https.request(GithubAuth, function(res) { - pipe.getBody(res, function(body) { - Util.exec(callback, qs.parse(body).access_token); + pipe.getBody(res, function(error, body) { + var parsed, token; + + if (!error) { + parsed = qs.parse(body); + + if (parsed) + token = parsed.access_token; + } + + Util.exec(callback, error, token); }); }); diff --git a/lib/server/pipe.js b/lib/server/pipe.js index 9af75266..cdad9a66 100644 --- a/lib/server/pipe.js +++ b/lib/server/pipe.js @@ -12,7 +12,7 @@ '# http://cloudcmd.io' + '\n'); var main = global.cloudcmd.main, - Util = require('util.io'), + Util = main.util, fs = require('fs'), zlib = require('zlib'); diff --git a/lib/server/rest.js b/lib/server/rest.js index 485a227e..94d4ce05 100644 --- a/lib/server/rest.js +++ b/lib/server/rest.js @@ -93,17 +93,17 @@ * * @param pParams {command, method, body, requrest, response} */ - function sendData(pParams) { + function sendData(params) { var p, isFS, isMD, - ret = main.checkParams(pParams); + ret = main.checkParams(params); if (ret) { - p = pParams; + p = params; isFS = Util.isContainStrAtBegin(p.name, CloudFunc.FS), isMD = Util.isContainStrAtBegin(p.name, '/markdown'); if (isFS) - onFS(pParams); + onFS(params); else if (isMD) markdown.operate(p.name, p.request, function(error, data) { if (error) @@ -117,13 +117,17 @@ switch(p.request.method) { case 'GET': - ret = onGET(pParams); + ret = onGET(params); break; case 'PUT': - pipe.getBody(p.request, function(pBody) { - p.body = pBody; - onPUT(p); + pipe.getBody(p.request, function(error, body) { + if (error) + sendError(params, error); + else { + p.body = body; + onPUT(params); + } }); break; } @@ -169,19 +173,29 @@ break; case 'DELETE': - pipe.getBody(p.request, function(body) { - var files = Util.parseJSON(body); + pipe.getBody(p.request, function(error, body) { + var files; - onDelete(p.name, files, query, function(error, callback) { - checkSendError(error, params, function() { - var names = (files && files.length) ? files : p.name; + if (error) + sendError(p, error); + else { + files = Util.parseJSON(body); + + onDelete(p.name, files, query, function(error, callback) { + var names; - if (callback) - Util.exec(callback); - else - sendMsg(params, 'delete', names); + if (error) + sendError(params,error); + else { + names = (files && files.length) ? files : p.name; + + if (callback) + Util.exec(callback); + else + sendMsg(params, 'delete', names); + } }); - }); + } }); break; } @@ -238,11 +252,14 @@ switch(lCmd) { case 'auth': - main.auth(p.body, function(pTocken) { - send({ - response: p.response, - data: pTocken - }); + main.auth(p.body, function(error, token) { + if (error) + sendError(p, error); + else + send({ + response: p.response, + data: token + }); }); break; diff --git a/lib/server/rest/fs/put.js b/lib/server/rest/fs/put.js index 00128685..56ca4be3 100644 --- a/lib/server/rest/fs/put.js +++ b/lib/server/rest/fs/put.js @@ -52,8 +52,11 @@ if (!error) if (size < MAX_SIZE) - pipe.getBody(readStream, function(patch) { - patchFile(patch); + pipe.getBody(readStream, function(error, patch) { + if (error) + func(error); + else + patchFile(patch); }); else error = 'File is to big. ' + diff --git a/lib/server/rest/markdown.js b/lib/server/rest/markdown.js index f7fb8a69..26f20c23 100644 --- a/lib/server/rest/markdown.js +++ b/lib/server/rest/markdown.js @@ -32,8 +32,11 @@ case 'PUT': - pipe.getBody(request, function(data) { - parse(data, callback); + pipe.getBody(request, function(error, data) { + if (error) + Util.exec(callback, error); + else + parse(data, callback); }); break; } From bd94a5e2a580d64ccd99f8ca21aa85cadd430398 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 18 Mar 2014 07:55:05 -0400 Subject: [PATCH 138/161] chore(put) rm comment: "use strict" --- lib/server/rest/fs/put.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/server/rest/fs/put.js b/lib/server/rest/fs/put.js index 56ca4be3..c77a0671 100644 --- a/lib/server/rest/fs/put.js +++ b/lib/server/rest/fs/put.js @@ -1,5 +1,5 @@ (function() { -// 'use strict'; + 'use strict'; var main = global.cloudcmd.main, Util = main.util, From e8c9754f19c6ebca92a58753efba2880588c7cfd Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 18 Mar 2014 08:34:36 -0400 Subject: [PATCH 139/161] chore(get) add " " --- lib/server/rest/fs/get.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/server/rest/fs/get.js b/lib/server/rest/fs/get.js index 889acd85..14103de9 100644 --- a/lib/server/rest/fs/get.js +++ b/lib/server/rest/fs/get.js @@ -1,6 +1,6 @@ (function() { 'use strict'; - + var main = global.cloudcmd.main, Hash = main.hash, dir = main.dir, From bf283549dd1d91f65a26558a9bd7dd3b926b6268 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 18 Mar 2014 08:35:23 -0400 Subject: [PATCH 140/161] refactor(put) patchFile --- lib/server/rest/fs/put.js | 67 ++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/lib/server/rest/fs/put.js b/lib/server/rest/fs/put.js index c77a0671..146acbdb 100644 --- a/lib/server/rest/fs/put.js +++ b/lib/server/rest/fs/put.js @@ -56,7 +56,7 @@ if (error) func(error); else - patchFile(patch); + patchFile(name, patch, func); }); else error = 'File is to big. ' + @@ -66,39 +66,40 @@ if (error) func(error); }); - - function patchFile(patch) { - fs.readFile(name, 'utf8', read); - - function read(error, data) { - var diffResult; - - if (error) - func(error); - else { - error = Util.tryCatchLog(function() { - diffResult = diff.applyPatch(data, patch); - }); - - if (diffResult && !error) - fs.writeFile(name, diffResult, write); - else { - msg = CloudFunc.formatMsg('patch', baseName, 'fail'); - func(null, msg); - } - } - } - - function write(name, error) { - var msg; - - if (!error) - msg = CloudFunc.formatMsg('patch', baseName); - - func(error, msg); - } - } break; } } + + function patchFile(name, patch, func) { + fs.readFile(name, 'utf8', read); + + function read(error, data) { + var diffResult; + + if (error) + func(error); + else { + error = Util.tryCatchLog(function() { + diffResult = diff.applyPatch(data, patch); + }); + + if (diffResult && !error) + fs.writeFile(name, diffResult, write); + else { + msg = CloudFunc.formatMsg('patch', baseName, 'fail'); + func(null, msg); + } + } + } + + function write(name, error) { + var msg, + baseName = path.basename(name); + + if (!error) + msg = CloudFunc.formatMsg('patch', baseName); + + func(error, msg); + } + } })(); From 9d3e7a84f61949e58ac9789fbc12bdd5fe72c14d Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 18 Mar 2014 08:36:08 -0400 Subject: [PATCH 141/161] chore(server) add ";" --- lib/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/server.js b/lib/server.js index e71b8725..8191325a 100644 --- a/lib/server.js +++ b/lib/server.js @@ -34,7 +34,7 @@ express = main.express, expressApp, files = main.files, - emptyHandler = function(req, res, next) { Util.exec(next) }, + emptyHandler = function(req, res, next) { Util.exec(next); }, Server, Rest, Route; From d75fb18b6242f7fe81f4196cda5cc1ed8b72e1be Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 18 Mar 2014 08:41:05 -0400 Subject: [PATCH 142/161] fix(util) execOnMatch: isMatch -> match --- lib/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/util.js b/lib/util.js index 2904ee2e..f493c66d 100644 --- a/lib/util.js +++ b/lib/util.js @@ -831,7 +831,7 @@ match = name.match(new RegExp(exp)); func = funcsObj[name]; - if (isMatch) + if (match) Util.exec(func, match); } }; From 25ae0ed3ddd77696a39ecb10fca18198ac9482ef Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 18 Mar 2014 08:41:31 -0400 Subject: [PATCH 143/161] fix(put) patchFiles: write(name, error) -> onWrite(error) --- lib/server/rest/fs/put.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/server/rest/fs/put.js b/lib/server/rest/fs/put.js index 146acbdb..cd16c4b0 100644 --- a/lib/server/rest/fs/put.js +++ b/lib/server/rest/fs/put.js @@ -84,7 +84,7 @@ }); if (diffResult && !error) - fs.writeFile(name, diffResult, write); + fs.writeFile(name, diffResult, onWrite); else { msg = CloudFunc.formatMsg('patch', baseName, 'fail'); func(null, msg); @@ -92,7 +92,7 @@ } } - function write(name, error) { + function onWrite(error) { var msg, baseName = path.basename(name); From b48f708f919bc301278332478497ce2c48d2aeec Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 18 Mar 2014 08:42:08 -0400 Subject: [PATCH 144/161] fix(dom) loadCurrentTime: lCurrent -> current --- lib/client/dom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/client/dom.js b/lib/client/dom.js index f4e545fc..68034c82 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -833,7 +833,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; var RESTful = DOM.RESTful, current = currentFile || this.getCurrentFile(), query = '?time', - link = this.getCurrentPath(lCurrent); + link = this.getCurrentPath(current); RESTful.read(link + query, callback); }; From 593a4ee1281868da353dacd8552dc9a923ff762c Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 18 Mar 2014 08:46:30 -0400 Subject: [PATCH 145/161] feature(rest) add CloudFunc --- lib/client/rest.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/client/rest.js b/lib/client/rest.js index ebc06eae..982d482d 100644 --- a/lib/client/rest.js +++ b/lib/client/rest.js @@ -1,6 +1,6 @@ -var Util, DOM, CloudCmd; +var Util, DOM, CloudFunc, CloudCmd; -(function(Util, DOM) { +(function(Util, DOM, CloudFunc) { 'use strict'; var RESTful = Util.extendProto(RESTfulProto), @@ -141,4 +141,4 @@ var Util, DOM, CloudCmd; }); } } -})(Util, DOM); +})(Util, DOM, CloudFunc); From 700946b0666a5c706cbcf9efbcbc2596766f9f6e Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 18 Mar 2014 08:47:08 -0400 Subject: [PATCH 146/161] fix(join) response -> res --- lib/server/join.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/server/join.js b/lib/server/join.js index e1de458c..20156155 100644 --- a/lib/server/join.js +++ b/lib/server/join.js @@ -1,4 +1,5 @@ (function() { + 'use strict'; var main = global.cloudcmd.main, files = main.files, @@ -42,7 +43,7 @@ response : res }); - stream = isGzip ? gzip : response; + stream = isGzip ? gzip : res; files.readPipe({ names : names, From 4c4c7b5df3f3add42f7f215a14fe1c6b56f7f56a Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 18 Mar 2014 08:49:21 -0400 Subject: [PATCH 147/161] refactor(console) set correct order --- css/console.css | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/css/console.css b/css/console.css index 37641c63..2c95c89a 100644 --- a/css/console.css +++ b/css/console.css @@ -7,15 +7,15 @@ } .error-msg, .log-msg{ - background-color: #f5f5f5; - display: block; - font: 16px "Droid Sans Mono"; - margin: 10px; - padding: 10px; - background: beige; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; - border-radius: 5px; + display : block; + padding : 10px; + margin : 10px; + font : 16px "Droid Sans Mono"; + background : beige; + background-color : #f5f5f5; + -webkit-border-radius : 5px; + -moz-border-radius : 5px; + border-radius : 5px; } .jqconsole { From 714cbdbe822af71687910820c5f7db58196034cf Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 18 Mar 2014 08:49:57 -0400 Subject: [PATCH 148/161] refactor(console) jqconsole: set correct order --- css/console.css | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/css/console.css b/css/console.css index 2c95c89a..16420966 100644 --- a/css/console.css +++ b/css/console.css @@ -19,9 +19,9 @@ } .jqconsole { - background: #fffdf9; - padding: 10px; - padding-bottom: 10px; + padding : 10px; + padding-bottom : 10px; + background : #fffdf9; } .jqconsole-cursor { From 2fc392f9a036bc5fb9bdc26f04986b61695ecb19 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 18 Mar 2014 08:50:29 -0400 Subject: [PATCH 149/161] refactor(console) jqconsole-ol-prompt: set correct order --- css/console.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/css/console.css b/css/console.css index 16420966..b2a80f95 100644 --- a/css/console.css +++ b/css/console.css @@ -34,8 +34,8 @@ color: #4a473a } .jqconsole-old-prompt { - color: #b7b4a8; - font-weight: normal; + font-weight : normal; + color : #b7b4a8; } .brace { From 6f27ac208f0a4253547a92959012aed5fe0b823a Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 18 Mar 2014 08:51:20 -0400 Subject: [PATCH 150/161] refactor(help) set correct order --- css/help.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css/help.css b/css/help.css index c54f7d80..30e42cee 100644 --- a/css/help.css +++ b/css/help.css @@ -1,6 +1,6 @@ .help { - white-space : normal; margin : 25px; + white-space : normal; } .help li { From 7729a0bb28b7079e720a36930c90948a90f6789d Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 18 Mar 2014 08:52:56 -0400 Subject: [PATCH 151/161] refactor(style) body: set correct order --- css/style.css | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/css/style.css b/css/style.css index c1e7e758..1bce2a8f 100644 --- a/css/style.css +++ b/css/style.css @@ -36,11 +36,11 @@ html { body { width : 100%; height : 95%; - font-size : 16px; - font-family : "Droid Sans Mono", "Ubuntu Mono", "Consolas", monospace; - background-color : white; /* fix overflow change of fancybox */ - overflow : hidden; + overflow : hidden; + font-family : "Droid Sans Mono", "Ubuntu Mono", "Consolas", monospace; + font-size : 16px; + background-color : white; } .hidden { From 89b60e6c1843d338cea5e402110fc97a5f52aec8 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 18 Mar 2014 08:54:25 -0400 Subject: [PATCH 152/161] fix(test) data -> data-name --- test/expect.html | 4 ++-- test/test.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/expect.html b/test/expect.html index ceb2821f..9f6005e9 100644 --- a/test/expect.html +++ b/test/expect.html @@ -6,13 +6,13 @@ mode