mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-24 04:45:24 +00:00
Monotone-Parent: d945e377de4cef58cd3319068ed383074d42b243
Monotone-Revision: 02b28f2db3113bf19ebb8c67799e466346406b49 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-11-01T20:28:35 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
String.prototype.trim = function() {
|
||||
return this.replace(/(^\s+|\s+$)/g, '');
|
||||
}
|
||||
|
||||
String.prototype.capitalize = function() {
|
||||
return this.replace(/\w+/g,
|
||||
function(a) {
|
||||
return ( a.charAt(0).toUpperCase()
|
||||
+ a.substr(1).toLowerCase() );
|
||||
});
|
||||
}
|
||||
|
||||
String.prototype.decodeEntities = function() {
|
||||
return this.replace(/&#(\d+);/g,
|
||||
function(wholematch, parenmatch1) {
|
||||
return String.fromCharCode(+parenmatch1);
|
||||
});
|
||||
}
|
||||
|
||||
Date.prototype.sogoDayName = function() {
|
||||
var dayName = "";
|
||||
|
||||
var day = this.getDay();
|
||||
if (day == 0) {
|
||||
dayName = labels['a2_Sunday'];
|
||||
} else if (day == 1) {
|
||||
dayName = labels['a2_Monday'];
|
||||
} else if (day == 2) {
|
||||
dayName = labels['a2_Tuesday'];
|
||||
} else if (day == 3) {
|
||||
dayName = labels['a2_Wednesday'];
|
||||
} else if (day == 4) {
|
||||
dayName = labels['a2_Thursday'];
|
||||
} else if (day == 5) {
|
||||
dayName = labels['a2_Friday'];
|
||||
} else if (day == 6) {
|
||||
dayName = labels['a2_Saturday'];
|
||||
}
|
||||
|
||||
return dayName;
|
||||
}
|
||||
|
||||
Date.prototype.daysUpTo = function(otherDate) {
|
||||
var days = new Array();
|
||||
var day1 = this.getTime();
|
||||
var day2 = otherDate.getTime();
|
||||
|
||||
var nbrDays = Math.floor((day2 - day1) / 86400000) + 1;
|
||||
for (var i = 0; i < nbrDays; i++) {
|
||||
var newDate = new Date();
|
||||
newDate.setTime(day1 + (i * 86400000));
|
||||
days.push(newDate);
|
||||
}
|
||||
|
||||
return days;
|
||||
}
|
||||
|
||||
Date.prototype.sogoFreeBusyStringWithSeparator = function(separator) {
|
||||
var str = this.sogoDayName() + ", ";
|
||||
if (separator == '-')
|
||||
str += (this.getYear() + 1900) + '-' + (this.getMonth() + 1) + '-' + this.getDate();
|
||||
else
|
||||
str += this.getDate() + '/' + (this.getMonth() + 1) + '/' + (this.getYear() + 1900);
|
||||
|
||||
return str;
|
||||
}
|
||||
Reference in New Issue
Block a user