GCal Event Color Codes

By Matthew Jeffryes Last update Jan 16, 2010 — Installed 2,486 times. Daily Installs: 6, 5, 0, 0, 6, 4, 7, 11, 3, 5, 2, 2, 1, 1, 1, 5, 3, 1, 3, 2, 3, 5, 5, 1, 4, 1, 2, 2, 7, 1, 4

Archived Comments (locked)

Subscribe to Archived Comments 24 posts, 10 voices

Jesse Andrews Admin

The following is an archive of comments made before threaded discussions was implemented (November 16th, 2008)

 
Selma User

Hi, this is what I need! Show my appointments in one calendar in different colors. I installed this script yesterday but I couldn't seem to get it too work...

 
jackwest User

Hi I just discovered this mod and its exactly what I need.

does this nolonger work? (I installed greasemonkey + this script and nothing has changed)

 
Matthew Jeff... Script's Author

@jesa: month view uses a different page structure from daily and weekly views, so for now the script ignores month view. If it's something people would really like to see I could work on supporting it.

 
jesa User

This script is exactly what I was looking for - thanks. I'm wondering though if it should work for the month view - I can only get it to work for the weekly view. Thanks

 
Matthew Jeff... Script's Author

Thanks Dogwalker.

Sorry to anyone who was waiting for a long time for me to get in the change. Every time google updates their javascript, the funtion name changes, breaking the script.

@bobielawlintine: The recent security update for greasemonkey broke my system for storing your prefrences over a refresh. I'll try to get a fix in soon, but for now you can open about:config and change the value of the key with a name like this:
greasemonkey.scriptvals.http://www.hmc.edu/~mjeffryes/GCal Event Color Codes.is_on
to true to have the color codes stay on when you refresh the page

 
Dogwalker User

Update the Code urself:

Open the Code
1. Tools -> Greasemonkey -> Manage user Scripts...

2. Choose Gcal Event Color Codes
3. Click "Edit" Button
4. On the code search for:".gt"
5. Replace it for:".Ft"

It should be
unsafeWindow.gccc = new GCalColorCoder('gccc',unsafeWindow.Ft, rhook);
unsafeWindow.Ft = unsafeWindow.gccc.color_hook

 
bobielawlintine Scriptwright

#Using Bugmenot account!

Nice script, i wonder why its not keeping my preference to keep it always On!
Anything i can change in the code to get it Always ON?

 
CyberCPA Scriptwright

Nope, no luck. Changing the include pattern does not make it work for me. Bummer!

 
Matthew Jeff... Script's Author

@CyberCPA: you might double check that the @include patterns match the url for your google calendar. I may not have gotten them all.

 
Philip Stoever Scriptwright

thanks, works like a charme :)

 
CyberCPA Scriptwright

I have never been able to get this to work with any events, all day or otherwise. I have tried changing the # and ! characters without any results whatsoever. The calendar still shows events in the default calendar color. I run no other GreaseMonkey scripts with Calendar, so I know it's not a script conflict. I am using the secure connection w/ calendar.

 
Matthew Jeff... Script's Author

There, now all day events should color code just like regular events. Let me know how it works for you.

 
Matthew Jeff... Script's Author

I changed the script to support the new code again. All day events shouldn't be too hard to add, just need to search for a different set of divs.

 
Philip Stoever Scriptwright

i wonder if it's possible to get the coloring working on the "all day" events, too?

 
Philip Stoever Scriptwright

it's update time again, the function is called "fc" now

 
Philip Stoever Scriptwright

Thanks a lot, great work :)

Following your suggestion to crosslink I've uploaded a slightly modified version:

http://userscripts.org/scripts/show/13432

 
Matthew Jeff... Script's Author

Also, for those of you who want to know how to update the script yourself when google updates code, it's not too hard:

- Get a copy of the big Google calender js file with most of the application code using firebug of the like.

- Search the js file for '("eventowner")' space out the function containing the first hit. Looks something like this:

function Wb(a){
try{
if(!mm){
var b=n("eventowner");
if(b){
b.innerHTML=l
}
n("calowner").innerHTML=l;
if((z.V()&1)==0){
n("allDayGrid").style.display=B
}
hd();
eo()
}
if(!Wj){
Xb=[]
}
Yf();
RE();
YE();
ea("refreshMode = "+nm);
if(nm>=100){
WE()
}
if(!a)
VE();
UE();
OE()
}catch(c){
tc(c+"\n\n"+c.stack)
}
}

- Replace the old 2 letter function name with the new function name in the insert and uninsert functions in the color-coding script.

If that sounds like too much work, you can just wait until I post the fix, usually no longer than a few days.

 
Matthew Jeff... Script's Author

Posted a new version which works with the changes in google's code.

Unfortunately, every time google posts a change to their source, their compiler changes all the function names, breaking my hooks which call the coloring code. I love any suggestions for ways to overcome this weakness in the current design.

 
Philip Stoever Scriptwright

Script ceased to work a few days ago. Google must have changed something.
I think the color() function never gets called. Probably the line

Xb = function(a){oldXb(a); color();};

needs some tweaking but I can't get it to work :-/

 
janp Scriptwright

Hi Matthew, you can add a menu toggle as setting, so everybody can choose whether she prefers colored or uncolored view as default, and choose between # and !
http://wiki.greasespot.net/Code_snippets#Make_m...

 
Matthew Jeff... Script's Author

Thanks for the comments.
@Philip:
I personally prefer to us "!" but if there are several others who'd like it to be "#" I'll change the code. Since it's just a simple find/replace, it should be easy to use any flag you prefer. I also like to use the button, simply because I occasionally need to flip between comparing calendars and comparing the events in the calendar. Maybe you could post your variation on the script and we could just cross-link them for convenience.

 
janp Scriptwright

I really missed that in gCal! Great work!

 
Philip Stoever Scriptwright

Thanks, works great!

I adjusted the script to use "#" instead of "!" as some people tend to use "!" in their descriptions and set the default to show the colored version without having to click the button on every page refresh.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel