source: sandbox/newExpressoMail/prototype/modules/newMail2/js/formatters.js @ 7210

Revision 7210, 1.1 KB checked in by gustavo, 12 years ago (diff)

Ticket #0000 - Criado novo modulo para o desenvolvimento do novo ExpressoMail?

  • Property svn:executable set to *
Line 
1bytes2Size = function(bytes) {
2        var sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
3        if (bytes == 0) return 'n/a';
4        var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
5        var size = (i<2) ? Math.round((bytes / Math.pow(1024, i))) : Math.round((bytes / Math.pow(1024, i)) * 100)/100;
6        return  size + ' ' + sizes[i];
7}
8
9numberMonths = function(months){
10        switch(months){
11                case 'Jan':
12                        return 1;
13                case 'Feb':
14                        return 2;
15                case 'Mar':
16                        return 3;
17                case 'Apr':
18                        return 4;
19                case 'May':
20                        return 5;
21                case 'June':
22                        return 6;
23                case 'July':
24                        return 7;
25                case 'Aug':
26                        return 8;
27                case 'Sept':
28                        return 9;
29                case 'Oct':
30                        return 10;
31                case 'Nov':
32                        return 11;
33                case 'Dec':
34                        return 12;
35        }       
36}
37
38date2Time = function (timestamp) {
39        date = new Date();
40        dat = new Date(timestamp);
41        if ((date.getTime() - timestamp) < (24*60*60*1000)) {
42                return '<span class="timable" title="'+dat.getTime()+'"></span>';
43        } else {
44                date = new Date(timestamp);
45                var b = date.toString().split("T")[0].split("-");
46                var c = b[2] + "/" + b[1] + "/" + b[0];
47                return '<span class="datable">' + c + '</span>';
48        }
49}
Note: See TracBrowser for help on using the repository browser.