Difference between revisions of "Widget:Calendar"
m (fixed text escape + leading rubbish) |
(attempt to fix 'today' and added class for title highlighting) |
||
Line 81: | Line 81: | ||
this._tblCalendar = document.createElement( "table" ); | this._tblCalendar = document.createElement( "table" ); | ||
this._today = new Date( ); | this._today = new Date( ); | ||
+ | this._today.setHours( 0, 0, 0, 0 ); | ||
this._date = _date ? new Date( _date ): this._today; | this._date = _date ? new Date( _date ): this._today; | ||
this._date.setHours( 0, 0, 0, 0 ); | this._date.setHours( 0, 0, 0, 0 ); | ||
Line 141: | Line 142: | ||
td.className += " " + this.hl[ curDate.getTime() ]; | td.className += " " + this.hl[ curDate.getTime() ]; | ||
if ( curDate.getTime() in this.t ) | if ( curDate.getTime() in this.t ) | ||
+ | { | ||
td.title = this.t[ curDate.getTime() ]; | td.title = this.t[ curDate.getTime() ]; | ||
+ | td.className += " title"; | ||
+ | } | ||
row.appendChild( td ).appendChild( document.createTextNode( curDate.getDate( ) ) ); | row.appendChild( td ).appendChild( document.createTextNode( curDate.getDate( ) ) ); |
Revision as of 14:32, 11 March 2016
This widget allows you to display a calendar
Created by Xopr
Using this widget
To insert this widget, use the following code:
{{#widget:Calendar |date=february 26 2011 |hl.26 february 2011=blue |hl.1 march 2011=red }}
This will give the following result:
Note:
- all parameters are optional. If date is omitted, the current month will be displayed
- you can highlight dates by using the hl parameter, followed by a dot and the date you want to highlight. Available colors are: red, green, blue, yellow, cyan and purple
Copy to your site
To use this widget on your site, just install MediaWiki Widgets extension and copy full source code of this page to your wiki as Widget:Calendar article.