* [[TiddlyWiki|http://www.tiddlywiki.com/]] update to <<version>>\n* Update [[Calendar Plugin]] plugin to 1.1.0
\n// //''Name:'' Calendar Plugin\n// //''Version:'' <<getversion calendar>> (<<getversiondate calendar "DD MMM YYYY">>)\n// //''Author:'' Tiago Dionízio\n\n// //''Syntax:'' \n// //{{{<<calendar [year [month [day]]]>>}}} or {{{<<calendar 'thismonth'>>}}}\n// //Parameters between [] are optional.\n\n// //''Description:'' \n// // Create a calendar view for a specific month.\n// // * {{{<<calendar>>}}} creates a calendar displaying the current month and current day selected.\n// // * {{{<<calendar 'thismonth'>>}}} creates a calendar displaying the current month.\n// // * {{{<<calendar year month>>}}} creates a calendar displaying a specific month.\n// // * {{{<<calendar year month day>>}}} creates a calendar displaying a specific month with the day highlighted.\n// // All calendars will also show associated tiddlers with a different color (configurable in CSS).\n\n// //''Code section:''\n// (you should not need to alter anything below here)//\n\n{{{\nversion.extensions.calendar = { major: 1, minor: 1, revision: 0, date: new Date(2005, 10, 02)};\n\n// --------------------------------------------------------------------\n// Calendar\n// --------------------------------------------------------------------\nconfig.messages.dates.days_short = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];\n\nconfig.macros.calendar = {\n\n // months as they appear in the calendar's title\n /*\n calendarMonths: [\n "January", "February", "March", "April", "May", "June",\n "July", "August", "September", "October", "November", "December"\n ],\n // week day titles as they appear on the calendar\n calendarWeekDays: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],\n */\n\n // override\n calendarMonths: config.messages.dates.months,\n calendarWeekDays: config.messages.dates.days_short,\n\n // day week starts from (normally 0-Su or 1-Mo)\n calendarWeekStart: 1\n};\n\nconfig.macros.calendar.createLink = function(theParent,theText,theAction) {\n var link = createTiddlyElement(theParent,"span",null,"calendarCell",theText);\n if (theAction != null) {\n link.onclick = theAction;\n }\n return link;\n}\n\n/***************************************************************************\n** Internal functions\n***************************************************************************/\n\nconfig.macros.calendar.findCalendar = function(child) {\n var parent;\n while (child && child.parentNode) {\n parent = child.parentNode;\n if (parent.id == "calendarWrapper") {\n return parent;\n }\n child = parent;\n }\n return null;\n}\n\nconfig.macros.calendar.selectDate = function(e) {\n if (!e) var e = window.event;\n var cm = config.macros.calendar;\n\n var calendar = cm.findCalendar(this);\n if (calendar) {\n var d = this.getAttribute("date");\n if (d != null) {\n cm.makeCalendar(calendar, new Date(new Number(d)));\n }\n }\n\n e.cancelBubble = true;\n if (e.stopPropagation) e.stopPropagation();\n return false;\n}\n\nconfig.macros.calendar.dateTiddler = function(date) {\n var cm = config.macros.calendar;\n var y = date.getFullYear();\n var m = date.getMonth()+1;\n var d = date.getDate();\n var title = y + "/" + (m < 10 ? "0" : "") + m + "/" + (d < 10 ? "0" : "") + d;\n return title;\n}\n\nconfig.macros.calendar.makeCalendar = function(calendar, dt_current) {\n var cm = config.macros.calendar;\n var dt_today = new Date(new Number(calendar.getAttribute("today")));\n var select_today = calendar.getAttribute("selectToday") == "yes";\n calendar.setAttribute("date", dt_current.valueOf());\n\n while (calendar.hasChildNodes())\n calendar.removeChild(calendar.firstChild);\n\n // get same date in the previous year\n var dt_prev_year = new Date(dt_current);\n dt_prev_year.setFullYear(dt_prev_year.getFullYear() - 1);\n if (dt_prev_year.getDate() != dt_current.getDate())\n dt_prev_year.setDate(0);\n\n // get same date in the next year\n var dt_next_year = new Date(dt_current);\n dt_next_year.setFullYear(dt_next_year.getFullYear() + 1);\n if (dt_next_year.getDate() != dt_current.getDate())\n dt_next_year.setDate(0);\n\n // get same date in the previous month\n var dt_prev_month = new Date(dt_current);\n dt_prev_month.setMonth(dt_prev_month.getMonth() - 1);\n if (dt_prev_month.getDate() != dt_current.getDate())\n dt_prev_month.setDate(0);\n\n // get same date in the next month\n var dt_next_month = new Date(dt_current);\n dt_next_month.setMonth(dt_next_month.getMonth() + 1);\n if (dt_next_month.getDate() != dt_current.getDate())\n dt_next_month.setDate(0);\n\n // get first day to display in the grid for current month\n var dt_firstday = new Date(dt_current);\n dt_firstday.setDate(1);\n dt_firstday.setDate(1 - (7 + dt_firstday.getDay() - cm.calendarWeekStart) % 7);\n\n var area, header, table;\n var line, cell, i;\n\n // 1 - calendar header table\n // 2 - calendar days table\n area = createTiddlyElement(calendar, "table", "calendarArea");\n area.cellPadding = 0;\n area.cellSpacing = 0;\n area = createTiddlyElement(area, "tbody");\n\n // 1 - calendar header table\n header = createTiddlyElement(\n createTiddlyElement(\n createTiddlyElement(\n area,\n "tr"\n ),\n "td"\n ),\n "table",\n "calendarHeader"\n );\n header.cellPadding = 0;\n header.cellSpacing = 0;\n header = createTiddlyElement(header, "tbody");\n line = createTiddlyElement(header, "tr", null, null, null);\n\n var headerValues = [\n [ "<<", "selectYear", dt_prev_year.valueOf() ],\n [ "<", "selectMonth", dt_prev_month.valueOf() ],\n [ cm.calendarMonths[dt_current.getMonth()] + ' ' + dt_current.getFullYear(),\n "selectToday", dt_today.valueOf() ],\n [ ">", "selectMonth", dt_next_month.valueOf() ],\n [ ">>", "selectYear", dt_next_year.valueOf() ]\n ];\n\n for (i = 0; i < headerValues.length; ++i) {\n cm.createLink(\n createTiddlyElement(\n line,\n "td",\n null,\n headerValues[i][1]\n ),\n headerValues[i][0],\n cm.selectDate\n ).setAttribute("date", headerValues[i][2]);\n }\n\n // 2 - calendar days table\n table = createTiddlyElement(\n createTiddlyElement(\n createTiddlyElement(\n area,\n "tr"\n ),\n "td"\n ),\n "table",\n "calendarTable"\n );\n table.cellPadding = 0;\n table.cellSpacing = 0;\n table = createTiddlyElement(table, "tbody");\n\n // print weekdays titles\n line = createTiddlyElement(table, "tr", "calendarLine", "weekNames", null);\n for (var n = 0; n < 7; ++n) {\n createTiddlyElement(line, "td", null, null, cm.calendarWeekDays[(cm.calendarWeekStart + n)%7]);\n }\n\n // print calendar table\n var dt_current_day = new Date(dt_firstday);\n var day_class;\n var title;\n while (dt_current_day.getMonth() == dt_current.getMonth() ||\n dt_current_day.getMonth() == dt_firstday.getMonth()) {\n\n // print row heder\n line = createTiddlyElement(table, "tr", "calendarLine", null, null);\n for (var n_current_wday = 0; n_current_wday < 7; ++n_current_wday) {\n title = cm.dateTiddler(dt_current_day);\n if (store.tiddlerExists(title)) {\n // day has a tiddler associated with it\n day_class = "scheduledDay";\n } else if (select_today && dt_current_day.valueOf() == dt_today.valueOf()) {\n // print current date\n day_class = "currentDay";\n } else if (dt_current_day.getDay() == 0 || dt_current_day.getDay() == 6) {\n // weekend days\n day_class = "weekDay";\n } else {\n // print working days of current month\n day_class = "workingDay";\n }\n\n // extra formatting for days of previous or next month\n if (dt_current_day.getMonth() != dt_current.getMonth()) {\n day_class += " otherMonthDay";\n }\n\n var text = dt_current_day.getDate();\n var cell = createTiddlyElement(line, "td", null, day_class, null);\n\n var link = cm.createLink(cell, text, onClickTiddlerLink);\n link.setAttribute("date", dt_current_day.valueOf());\n link.setAttribute("tiddlyLink", title);\n\n dt_current_day.setDate(dt_current_day.getDate()+1);\n }\n }\n}\n\nconfig.macros.calendar.handler = function(place, macroName, params) {\n var date = null;\n var sel = "yes";\n if (params.length == 2) {\n date = new Date(\n params[0],\n params[1]-1,\n 1\n );\n sel = "no";\n }\n else if (params.length == 3) {\n date = new Date(\n params[0],\n params[1]-1,\n params[2]\n );\n }\n else if (params.length == 1 && params[0] == "thismonth") {\n date = new Date();\n date = new Date(date.getFullYear(), date.getMonth(), 1);\n sel = "no";\n }\n else {\n date = new Date();\n // filter time values off\n date = new Date(date.getFullYear(), date.getMonth(), date.getDate());\n }\n\n var cm = config.macros.calendar;\n calendar = createTiddlyElement(place, "span", "calendarWrapper");\n calendar.setAttribute("name", "calendarWrapper");\n calendar.setAttribute("today", date.valueOf());\n calendar.setAttribute("selectToday", sel);\n\n cm.makeCalendar(calendar, date);\n}\n\n\nfunction refreshCalendars(hint) {\n var calendars = document.getElementsByName("calendarWrapper");\n var cm = config.macros.calendar;\n var i, c;\n for (i = 0; i < calendars.length; ++i) {\n c = calendars.item(i);\n if (c.id == "calendarWrapper") {\n cm.makeCalendar(c, new Date(new Number(c.getAttribute("date"))));\n }\n }\n}\n\nstore.addNotification(null, refreshCalendars);\n\n}}}
!!! Start Calendar CSS\n{{{\n\n#mainMenu #calendarWrapper {\n display: block;\n}\n\n.viewer #calendarWrapper #calendarArea {\n width: 220px;\n}\n\n#calendarWrapper {\n background-color: #4682B4;\n border: none;\n font-size: 8pt;\n cursor: pointer;\n}\n\n#calendarWrapper table {\n width: 100%;\n background-color: #4682B4;\n border: none;\n margin: 0px;\n padding: 0px;\n border-collapse: separate;\n}\n\n#calendarWrapper td, #calendarWrapper td {\n border: none;\n padding: 0px;\n margin: 0px;\n}\n\n#calendarWrapper #calendarTable {\n border: 1px solid #4682b4;\n}\n\n#calendarWrapper #calendarTable .calendarCell {\n display: block;\n width: 100%;\n text-align: inherit;\n}\n\n#calendarWrapper #calendarHeader {\n font-weight: normal;\n width: 100%;\n text-align: center;\n font-size: 8pt;\n color: #ffffff;\n}\n\n#calendarWrapper #calendarHeader .selectYear {\n padding: 1px 2px 1px 2px;\n}\n\n#calendarWrapper #calendarHeader .selectMonth {\n padding: 1px 2px 1px 2px;\n}\n\n#calendarWrapper #calendarHeader .selectToday {\n width: 100%;\n}\n\n#calendarWrapper #calendarTable {\n width: 100%;\n text-align: center;\n color: #000000;\n background-color: #ffffff;\n font-size: 8pt;\n}\n\n#calendarWrapper #calendarTable td {\n width: 14%;\n}\n\n#calendarWrapper #calendarTable .weekNames {\n color: #ffffff;\n background-color: #87cefa;\n}\n\n#calendarWrapper #calendarTable .weekDay {\n background-color: #dbeaf5;\n}\n\n#calendarWrapper #calendarTable .currentDay {\n background-color: #ffb6c1;\n}\n\n#calendarWrapper #calendarTable .workingDay {\n background-color: #ffffff;\n}\n\n#calendarWrapper #calendarTable .scheduledDay {\n background-color: #444444;\n color: #ffffff;\n}\n\n#calendarWrapper #calendarTable .otherMonthDay {\n color: #999999;\n}\n\n}}}\n!!! End Calendar CSS
[[Plugins]]
!!! Today\n<<calendar>>\n!!! This month - do not highlight current day\n<<calendar thismonth>>\n!!! Specific month - January 2003\n<<calendar 2003 01>>\n!!! Specific day - 15 October 1981\n<<calendar 1981 10 15>>
<<quote 'Plugins' 'Plugins'>>\n<<quote 'Another quote' 'Example Quote 2'>>
<<quote 'Example Quote' 'Example Quote' open>>
config.macros.getversion = {}\nconfig.macros.getversion.handler = function(place,macroName,params)\n{\nvar versionData = version.extensions[params].major + "." + version.extensions[params].minor + "." + version.extensions[params].revision;\ncreateTiddlyElement(place,"span",null,null,versionData);\n}\n\nconfig.macros.getversiondate = {}\nconfig.macros.getversiondate.handler = function(place,macroName,params)\n{\nvar versionDate = version.extensions[params[0]].date.formatString(params[1].trim());\ncreateTiddlyElement(place,"span",null,null,versionDate);\n}\n
<<calendar>>\n[[Plugins]]\n----\n[[TiddlyWiki|http://www.tiddlywiki.com/]] <<version>>
!!! Plugins\n* [[Quote Plugin]] <<getversion quote>>\n* [[Calendar Plugin]] <<getversion calendar>> (''uses stylesheet rules in StyleSheet'')\n!!! Examples\n* [[Example Quote]]\n* [[Example Calendar]]\n!!! ~StyleSheets\n* [[Calendar StyleSheet]]
\n// //''Name:'' Quote Plugin\n// //''Version:'' <<getversion quote>> (<<getversiondate quote "DD MMM YYYY">>)\n// //''Author:'' Tiago Dionízio\n\n// //''Syntax:'' \n// //{{{<<quote 'Text to display' 'Tiddler name' [open]>>}}}\n\n// //''Description:'' \n// // Create a direct link to a tiddler using a normal button and a button that expands the specified tiddler inside the current tiddler.\n// // To display the included tiddler initially visible just pass ''open'' in the third parameter (not actually the only possible value but you can interpret it like that).\n// // The expand button can also collapse the included tiddler, this will actually remove the included contents. If the included tiddler is changed you can simply expand it again.\n\n// //''Code section:''\n// (you should not need to alter anything below here)//\n\n{{{\nversion.extensions.quote = { major: 1, minor: 0, revision: 0, date: new Date(2005, 07, 15)};\n\n\nconfig.macros.quote = {};\nconfig.macros.quote.onClick = function(e) {\n if (!e) var e = window.event;\n var container = this.nextSibling;\n var isOpen = container.style.display == "block";\n\n var tick;\n this.removeChild(this.firstChild);\n if (isOpen) {\n container.style.display = "none";\n tick = "+";\n removeChildren(container);\n }\n else {\n tick = "-";\n var title = container.getAttribute("tiddlyLink");\n var text = store.getTiddlerText(title);\n removeChildren(container);\n if(text)\n wikify(text,container,null,null);\n container.style.display = "block";\n }\n this.appendChild(document.createTextNode(tick));\n}\nconfig.macros.quote.handler = function(place,macroName,params) {\n // param 0: text button\n // param 1: tiddler name to display\n // param 2: initial display by default\n var label = params[0];\n var title = params[1];\n var isOpen = params[2] != null;\n var link = createTiddlyLink(place,title,false);\n link.appendChild(document.createTextNode(label));\n var btn = createTiddlyButton(place, isOpen ? "-" : "+", "expand tiddler " + title, this.onClick);\n var container = createTiddlyElement(place, "blockquote");\n container.setAttribute("tiddlyLink", title);\n container.style.display = isOpen ? "block" : "none";\n if (isOpen) {\n var text = store.getTiddlerText(title);\n if(text)\n wikify(text,container,null,null);\n }\n}\n\n}}}
Personal Plugins
T's Wiki
http://mega.ist.utl.pt/~tngd/twiki/twiki.cgi/TWPlugins.html
/*\n!!! Start Calendar CSS\n{{{\n*/\n\n#mainMenu #calendarWrapper {\n display: block;\n}\n\n.viewer #calendarWrapper #calendarArea {\n width: 220px;\n}\n\n#calendarWrapper {\n background-color: #4682B4;\n border: none;\n font-size: 8pt;\n cursor: pointer;\n}\n\n#calendarWrapper table {\n width: 100%;\n background-color: #4682B4;\n border: none;\n margin: 0px;\n padding: 0px;\n border-collapse: separate;\n}\n\n#calendarWrapper td, #calendarWrapper td {\n border: none;\n padding: 0px;\n margin: 0px;\n}\n\n#calendarWrapper #calendarTable {\n border: 1px solid #4682b4;\n}\n\n#calendarWrapper #calendarTable .calendarCell {\n display: block;\n width: 100%;\n text-align: inherit;\n}\n\n#calendarWrapper #calendarHeader {\n font-weight: normal;\n width: 100%;\n text-align: center;\n font-size: 8pt;\n color: #ffffff;\n}\n\n#calendarWrapper #calendarHeader .selectYear {\n padding: 1px 2px 1px 2px;\n}\n\n#calendarWrapper #calendarHeader .selectMonth {\n padding: 1px 2px 1px 2px;\n}\n\n#calendarWrapper #calendarHeader .selectToday {\n width: 100%;\n}\n\n#calendarWrapper #calendarTable {\n width: 100%;\n text-align: center;\n color: #000000;\n background-color: #ffffff;\n font-size: 8pt;\n}\n\n#calendarWrapper #calendarTable td {\n width: 14%;\n}\n\n#calendarWrapper #calendarTable .weekNames {\n color: #ffffff;\n background-color: #87cefa;\n}\n\n#calendarWrapper #calendarTable .weekDay {\n background-color: #dbeaf5;\n}\n\n#calendarWrapper #calendarTable .currentDay {\n background-color: #ffb6c1;\n}\n\n#calendarWrapper #calendarTable .workingDay {\n background-color: #ffffff;\n}\n\n#calendarWrapper #calendarTable .scheduledDay {\n background-color: #444444;\n color: #ffffff;\n}\n\n#calendarWrapper #calendarTable .otherMonthDay {\n color: #999999;\n}\n\n/*\n}}}\n!!! End Calendar CSS */