From d0df1268550b339972ef31d18d6bd8aaf25fc0c3 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sun, 4 Nov 2012 04:45:31 -0500 Subject: [PATCH] rewrited sizing of names if they are to long thrue css, from JavaScript --- ChangeLog | 3 +++ css/style.css | 11 +++++++++-- lib/cloudfunc.js | 25 +++---------------------- 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 22c37a6c..ea04d92d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -59,6 +59,9 @@ server.js to cloudcmd.js. * Added ability of authorithation in GitHub. +* Rewrited sizing of names if they are to +long thrue css, from JavaScript. + 2012.10.01, Version 0.1.7 diff --git a/css/style.css b/css/style.css index 4afca18b..f3cc05fb 100644 --- a/css/style.css +++ b/css/style.css @@ -186,8 +186,15 @@ background:url(/img/panel_refresh.png) 0 -15px no-repeat; } /* информация о файлах и папках*/ .name{ - float: left; - width: 37%; + float: left; + width: 37%; + /* если длина имени файла больше 16 символов + * отрезаем лишнее, оставляя лишь 16, + * и добавляем две точки и тайтл + */ + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } .size{ float:left; diff --git a/lib/cloudfunc.js b/lib/cloudfunc.js index 049c7442..afdf633e 100644 --- a/lib/cloudfunc.js +++ b/lib/cloudfunc.js @@ -183,20 +183,7 @@ var CloudFunc, exports; return lShorted; }; - - /** Function gets file name and - * if it's bigger the 16 chars - * cut it and adds '..' - * @pName - file name - */ - CloudFunc.getShortedName = function(pName){ - return (pName.length > CloudFunc.SHORTNAMELENGTH ? - (pName.substr(pName, - CloudFunc.SHORTNAMELENGTH) + '..'): - pName); - }; - - + /** Функция парсит uid и имена пользователей * из переданного в строке вычитаного файла /etc/passwd * и возвращает массив обьектов имён и uid пользователей @@ -442,14 +429,8 @@ var CloudFunc, exports; (files[i].size === 'dir' ? '' : ' target="_blank"') + - /* если длина имени файла больше 16 символов - * отрезаем лишнее, оставляя лишь 16, - * и добавляем две точки и тайтл - */ - (files[i].name.length > CloudFunc.SHORTNAMELENGTH ? - ' title="' + files[i].name + '">' + - CloudFunc.getShortedName(files[i].name) - : 'draggable=true>' + files[i].name) + + ' title="' + files[i].name +'"' + + 'draggable=true>' + files[i].name + "" + ''; /* если папка - не выводим размер */