mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
Added ability to change charset on terminal only if it's build in command on win32
This commit is contained in:
parent
2162ecd2e2
commit
86a1504cd9
4 changed files with 58 additions and 11 deletions
|
|
@ -11,6 +11,9 @@ file not just like Linux.
|
|||
|
||||
* Added ability to update thrue git.
|
||||
|
||||
* Added ability to change charset on terminal only if
|
||||
it's build in command on win32.
|
||||
|
||||
|
||||
2012.10.01, Version 0.1.7
|
||||
|
||||
|
|
|
|||
27
client.js
27
client.js
|
|
@ -350,9 +350,9 @@ CloudClient.Util = (function(){
|
|||
};*/ /* ie */
|
||||
|
||||
/* if object - then onload or onerror */
|
||||
}else if (typeof lFunc === 'object') {
|
||||
}else if ( this.isObject(lFunc) ) {
|
||||
if(lFunc.onload &&
|
||||
typeof lFunc.onload === 'function'){
|
||||
this.isFunction(lFunc.onload)){
|
||||
element.onload = lFunc.onload;
|
||||
/*
|
||||
element.onreadystatechange = function(){
|
||||
|
|
@ -403,9 +403,8 @@ CloudClient.Util = (function(){
|
|||
if(typeof lFunc === 'function')
|
||||
lFunc();
|
||||
|
||||
else if(typeof lFunc === 'object' &&
|
||||
typeof lFunc.onload === 'function')
|
||||
lFunc.onload();
|
||||
else if( this.isObject(lFunc) && this.isFunction(lFunc.onload) )
|
||||
lFunc.onload();
|
||||
|
||||
}
|
||||
return element;
|
||||
|
|
@ -728,6 +727,22 @@ CloudClient.Util = (function(){
|
|||
return ( lCurrentFileClass.indexOf(lCurrentClass) >= 0 );
|
||||
};
|
||||
|
||||
/**
|
||||
* functions check is pObject is object
|
||||
* @param pObject
|
||||
*/
|
||||
this.isObject = function(pObject){
|
||||
return typeof pObject === 'object';
|
||||
};
|
||||
|
||||
/**
|
||||
* functions check is pFunction is function
|
||||
* @param pFunction
|
||||
*/
|
||||
this.isFunction = function(pFunction){
|
||||
return typeof pFunction === 'function';
|
||||
};
|
||||
|
||||
this.getCurrentLink = function(pCurrentFile){
|
||||
var lLink;
|
||||
if(pCurrentFile)
|
||||
|
|
@ -1510,7 +1525,7 @@ CloudClient._getJSONfromFileTable=function()
|
|||
*/
|
||||
i=2; /* пропускам Path и Header*/
|
||||
|
||||
for(;i<lLI.length;i++)
|
||||
for(; i <lLI.length;i++)
|
||||
{
|
||||
var lChildren = lLI[i].children;
|
||||
|
||||
|
|
|
|||
|
|
@ -57,8 +57,13 @@ var CloudCommander, io;
|
|||
if(lStdout)
|
||||
lTerm.echo(lStdout);
|
||||
|
||||
if(lStderr)
|
||||
if(lStderr){
|
||||
/* if it's object - convert is to string' */
|
||||
if( Util.isObject(lStderr) )
|
||||
lStderr = JSON.Stringify(lStderr);
|
||||
|
||||
lTerm.error(lStderr);
|
||||
}
|
||||
}
|
||||
Messages = [];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,10 +60,16 @@ function onMessage(pConnNum, pSocket){
|
|||
}
|
||||
}
|
||||
|
||||
/* change code page to unicode */
|
||||
if(Win32_b)
|
||||
pCommand = 'chcp 65001 |' + pCommand;
|
||||
|
||||
/* if we on windows and command is build in
|
||||
* change code page to unicode becouse
|
||||
* windows use unicode on non English versions
|
||||
*/
|
||||
if(Win32_b){
|
||||
|
||||
var lWinCommand = pCommand.toUpperCase();
|
||||
if( Win32Commands.indexOf(lWinCommand) > 0 )
|
||||
pCommand = 'chcp 65001 |' + pCommand;
|
||||
}
|
||||
if(!ClientFuncs[pConnNum])
|
||||
ClientFuncs[pConnNum] = getExec(pSocket);
|
||||
|
||||
|
|
@ -95,3 +101,21 @@ function getExec(pSocket){
|
|||
console.log(lExec);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/* windows commands thet require
|
||||
* unicode charset on locales
|
||||
* different then English
|
||||
*/
|
||||
var Win32Commands = ['ASSOC', 'AT', 'ATTRIB', 'BREAK', 'CACLS', 'CALL',
|
||||
'CD', 'CHCP', 'CHDIR', 'CHKDSK', 'CHKNTFS', 'CLS',
|
||||
'CMD', 'COLOR', 'COMP', 'COMPACT', 'CONVERT', 'COPY',
|
||||
'DATE', 'DEL', 'DIR', 'DISKCOMP', 'DISKCOPY', 'DOSKEY',
|
||||
'ECHO', 'ENDLOCAL', 'ERASE', 'EXIT', 'FC', 'FIND',
|
||||
'FINDSTR', 'FOR', 'FORMAT', 'FTYPE', 'GOTO', 'GRAFTABL',
|
||||
'HELP', 'IF', 'LABEL', 'MD', 'MKDIR', 'MODE', 'MORE',
|
||||
'MOVE', 'PATH', 'PAUSE', 'POPD', 'PRINT', 'PROMPT',
|
||||
'PUSHD', 'RD', 'RECOVER', 'REM', 'REN', 'RENAME',
|
||||
'REPLACE', 'RMDIR', 'SET', 'SETLOCAL', 'SHIFT', 'SORT',
|
||||
'START', 'SUBST', 'TIME', 'TITLE', 'TREE', 'TYPE',
|
||||
'VER', 'VERIFY', 'VOL', 'XCOPY'];
|
||||
Loading…
Add table
Add a link
Reference in a new issue