1.Log in to your dashboard--> layout- -> Edit HTML
2.Scroll down to where you see </head> tag.
3.Now copy below code and paste it just before </head> tag.
<script type="text/javascript" src="http://yui.yahooapis.com/2.2.0/build/calendar/calendar-min.js"></script> <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.2.0/build/calendar/assets/calendar.css"/> <script type="text/javascript"> var _yourBlogUrl = "http://YOURBLOG.blogspot.com"; //edit this _yourBlogTimeZone = encodeURIComponent(_yourBlogTimeZone); var _dayTitles = new Array("","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""); YAHOO.namespace("example.calendar"); function cal1Init() { var myChangePageHandler = function(type,args,obj) { document.getElementById("cal1Titles").innerHTML = ""; checkPostsForMonth(month, year); function checkPostsForMonth(month,year) { var script = document.createElement("script"); function checkPostsCallback(json) { if (json.feed.entry) { if (day.substr(0,1) == "0") { document.getElementById("cal1Titles").innerHTML += "<li><a href='" + href + "'>" + title + "</a>"; YAHOO.example.calendar.cal1.addRenderer(date, myCustomRenderer); } document.getElementById("cal1loadimg").style.display = "none"; }; function showDayTitles(day) { var myCustomRenderer = function(workingDate, cell) { var day = workingDate.toString().substr(8,2); cell.innerHTML = '<div onmouseover="showDayTitles(' + day + ');"><a href="javascript:void(null);" >' + YAHOO.example.calendar.cal1.buildDayLabel(workingDate) + "</a></div>"; } var mySelectHandler = function(type,args,obj) { var element = YAHOO.util.Dom.getElementsByClassName("d" + day, "td", "cal1Container")[0]; if (day.toString().length == 1) { if (element.className.indexOf("highlight1") != -1) { }; var changeDate = function() { var syncMonthYear = function(type) { var fullYear = parseInt(YAHOO.example.calendar.cal1.cfg.getProperty("pagedate").getFullYear()); var isYearFound = false; YAHOO.util.Dom.get("cal1yearselect").value = fullYear; YAHOO.util.Event.addListener(window, "load", cal1Init); |
Important : You must need to edit the following 2 variables of above code.
(1)var _yourBlogUrl = "http://YOURBLOG.blogspot.com";
Remember to replace YOURBLOG with your real blog name.
(2)var _yourBlogTimeZone = "-08:00";
Remember to replace -08:00 with the timezone offset that your blog is set to.
(For this go to Dashboard-->Settings-->Formatting and select 'Time Zone')
4.Now save your template.
5.Go to Layout > Page Elements
6.Click on 'Add a Gadget'
7.Select 'HTML/Javascript' and add the code given below and click save.
<div id="cal1select"> <select name="cal1monthselect" id="cal1monthselect"> </div> <div id="cal1Container"><img src="http://img239.imageshack.us/img239/9057/40lf8.gif" style="vertical-align:middle;"/> Loading...</div> <div id="calbackloadimg"> </div> |
Now you are done.It will look like this.
Credit to purplemoggy
Implemented This gadget on my blog.
works perfectly! highly recommended!
A small tip:
This gadget displays the titles of the posts under the calendar.
In order to remove them, I looked for the lines:
document.getElementById("cal1Titles").innerHTML += "" + title + "";
and:
document.getElementById("cal1Titles").innerHTML = _dayTitles[day];
and commented them out.
enjoy this gadget!