pumpknhd
11-01-2012, 06:35 AM
I am trying to write an appointment program with a day view. Sometimes there are multiple appointments that span the same hour. I am able to create the calendar and place the appointment entries at the appropriate hour.
My problem is that I am stumped on how to have Javascript figure out the width of the entry when there are multiple appointments.
The best example I have is from a screenshot of Apple's web-based iCloud calendar. I've tried to understand their code (snippet below) but still can't figure out logic behind how to get something like this to work. Any help would be very much appreciated.
if(c){
var o=f.totalSubCols,q=f.subColStart,B=f.subColEnd;
if (!f.isMulti) {
b.push("proxy")
}
C=[];
if(o>6){
m=[];
if(l||q===1){
C.push("col-start1")
} else {
m.push("left:"+(((q-1)/o)*100)+"%")
}
if(l){
m.push("right:"+((100-((B-q+1)/o)*100))+"%")
} else {
if(B===o){
m.push("right:0px")
} else {
m.push("right:"+(100-(B/o)*100)+"%")
}
}
}else{
C.push("total-cols"+o);
if(l){
C.push("col-start1","col-end"+(B-q+1))
} else {
C.push("col-start"+q,"col-end"+B)
}
}
}
My problem is that I am stumped on how to have Javascript figure out the width of the entry when there are multiple appointments.
The best example I have is from a screenshot of Apple's web-based iCloud calendar. I've tried to understand their code (snippet below) but still can't figure out logic behind how to get something like this to work. Any help would be very much appreciated.
if(c){
var o=f.totalSubCols,q=f.subColStart,B=f.subColEnd;
if (!f.isMulti) {
b.push("proxy")
}
C=[];
if(o>6){
m=[];
if(l||q===1){
C.push("col-start1")
} else {
m.push("left:"+(((q-1)/o)*100)+"%")
}
if(l){
m.push("right:"+((100-((B-q+1)/o)*100))+"%")
} else {
if(B===o){
m.push("right:0px")
} else {
m.push("right:"+(100-(B/o)*100)+"%")
}
}
}else{
C.push("total-cols"+o);
if(l){
C.push("col-start1","col-end"+(B-q+1))
} else {
C.push("col-start"+q,"col-end"+B)
}
}
}