mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
added function getShortedName
This commit is contained in:
parent
9a480be0e0
commit
c439318c0a
1 changed files with 28 additions and 13 deletions
|
|
@ -5,21 +5,24 @@
|
|||
|
||||
var CloudFunc={
|
||||
/* Путь с которым мы сейчас работаем */
|
||||
Path :'',
|
||||
Path :'',
|
||||
/* КОНСТАНТЫ (общие для клиента и сервера)*/
|
||||
/* название программы */
|
||||
NAME :'Cloud Commander',
|
||||
NAME :'Cloud Commander',
|
||||
/* если в ссылке будет эта строка -
|
||||
* в браузере js отключен
|
||||
*/
|
||||
NOJS : '/no-js',
|
||||
FS : '/fs',
|
||||
NOJS : '/no-js',
|
||||
FS : '/fs',
|
||||
/* название css-класа кнопки обновления файловой структуры*/
|
||||
REFRESHICON : 'refresh-icon',
|
||||
REFRESHICON : 'refresh-icon',
|
||||
/* id панелей с файлами */
|
||||
LEFTPANEL : 'left',
|
||||
RIGHTPANEL : 'right'
|
||||
/* name of direcotory with libs */
|
||||
LEFTPANEL : 'left',
|
||||
RIGHTPANEL : 'right',
|
||||
/* length of longest
|
||||
* file name
|
||||
*/
|
||||
SHORTNAMELENGTH : 16
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -144,7 +147,7 @@ CloudFunc.convertPermissionsToNumberic= function(pPerm_s){
|
|||
* гигайбайты и терабайты
|
||||
* @pSize - размер в байтах
|
||||
*/
|
||||
CloudFunc.getShortedSize=function(pSize){
|
||||
CloudFunc.getShortedSize = function(pSize){
|
||||
/* if pSize=0 - return it */
|
||||
if (pSize != pSize-0) return pSize;
|
||||
|
||||
|
|
@ -167,6 +170,19 @@ CloudFunc.getShortedSize=function(pSize){
|
|||
return lShorted;
|
||||
};
|
||||
|
||||
/* Function gets file name and
|
||||
* if it's bigger the 16 chars
|
||||
* cut it and adds '..'
|
||||
* @pName - file name
|
||||
* @pPutInTegs - boolean says add some tegs or not
|
||||
*/
|
||||
CloudFunc.getShortedName = function(pName, pPutInTegs){
|
||||
return (pName.length > CloudFunc.SHORTNAMELENGTH ?
|
||||
(pName.substr(pName,16) + '..'):
|
||||
pName);
|
||||
};
|
||||
|
||||
|
||||
/* Функция парсит uid и имена пользователей
|
||||
* из переданного в строке вычитаного файла /etc/passwd
|
||||
* и возвращает массив обьектов имён и uid пользователей
|
||||
|
|
@ -404,10 +420,9 @@ CloudFunc.buildFromJSON=function(pJSON,pKeyBinded)
|
|||
* отрезаем лишнее, оставляя лишь 16,
|
||||
* и добавляем две точки и тайтл
|
||||
*/
|
||||
(files[i].name.length>16?
|
||||
' title="'+files[i].name+'">' +
|
||||
files[i].name.substr(
|
||||
files[i].name,16)+
|
||||
(files[i].name.length > CloudFunc.SHORTNAMELENGTH?
|
||||
' title="' + files[i].name + '">' +
|
||||
CloudFunc.getShortedName(files[i].name) +
|
||||
'..':'>'+files[i].name) +
|
||||
"</a>" +
|
||||
'</span>';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue