};
+ this.str_trunc = function(text,max) {
+ max = (typeof max === 'undefined') ? 30 : max;
+ if (text.length>max) text = text.substring(0,(max/2)+1) + '.. ' + text.substring(text.length-(max/2),text.length);
+ return text;
+ };
+
this.str2a = function(elems,compact,class_exp_file) {
compact = (typeof compact === 'undefined') ? true : compact;
class_exp_file = (typeof class_exp_file === 'undefined') ? 'doc|dir|path' : class_exp_file;
}
if (compact) {
- //text = text.replace(/^((?:\w+:\/+)?[^\/]+\/)(.*?)(\/?[^\/]+\/?)$/,'$1..$3');
- var max = 30;
- if (text.length>max) text = text.substring(0,(max/2)+1) + '.. ' + text.substring(text.length-(max/2),text.length);
- /*
- text = text.replace(/^((?:\w+:\/+)?[^\/]+\/)(.*?)(\/?[^\/]+\/?)$/,function(match,p1,p2,p3){
- if (p1.length>max) p1 = p1.substring(0,max);
- if (p3.length>max) p3 = p3.substring(p3.length-max,p3.length);
- return p1+' ..'+p3;
- console.log(p1+' | '+p2+' | '+p3);
- return match;
- return p1+p2.substring(0,10);
- });
- */
+ text = that.str_trunc(text);
}
//console.log(text);