mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-16 10:48:50 +00:00
Monotone-Parent: 66fe156475b1f789bc5d20c857350ca9afea9556
Monotone-Revision: 4f816dc3f00ef57497bb9cff9370cf0b8a272fc6 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2007-11-09T19:45:03 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1434,14 +1434,11 @@ function appendCalendar(folderName, folderPath) {
|
||||
else {
|
||||
var calendarList = $("calendarList");
|
||||
var lis = calendarList.childNodesWithTag("li");
|
||||
var color = indexColor(lis.length + 100);
|
||||
//log ("color: " + color);
|
||||
|
||||
var li = document.createElement("li");
|
||||
|
||||
// Add the calendar to the proper place
|
||||
var previousOwner = null;
|
||||
for (var i = 1; i < lis.length; i++) {
|
||||
for (var i = 0; i < lis.length; i++) {
|
||||
var currentFolderName = lis[i].lastChild.nodeValue.strip();
|
||||
var currentOwner = lis[i].readAttribute('owner');
|
||||
if (currentOwner == owner) {
|
||||
@@ -1461,6 +1458,29 @@ function appendCalendar(folderName, folderPath) {
|
||||
li.setAttribute("id", folderPath);
|
||||
li.setAttribute("owner", owner);
|
||||
|
||||
// Generate new color
|
||||
var colorTable = [1, 1, 1];
|
||||
var color;
|
||||
var currentValue = lis.length + 1;
|
||||
var index = 0;
|
||||
while (currentValue) {
|
||||
if (currentValue & 1)
|
||||
colorTable[index]++;
|
||||
if (index == 3)
|
||||
index = 0;
|
||||
currentValue >>= 1;
|
||||
index++;
|
||||
}
|
||||
colorTable[0] = parseInt(255 / colorTable[0]) - 1;
|
||||
colorTable[1] = parseInt(255 / colorTable[1]) - 1;
|
||||
colorTable[2] = parseInt(255 / colorTable[2]) - 1;
|
||||
|
||||
color = "#"
|
||||
+ colorTable[2].toString(16)
|
||||
+ colorTable[1].toString(16)
|
||||
+ colorTable[0].toString(16);
|
||||
//log ("color = " + color);
|
||||
|
||||
var checkBox = document.createElement("input");
|
||||
checkBox.setAttribute("type", "checkbox");
|
||||
li.appendChild(checkBox);
|
||||
|
||||
Reference in New Issue
Block a user