calendarxp Site Admin
Joined: 30 Jan 2005 Posts: 409
|
Posted: Tue Feb 15, 2005 7:45 pm Post subject: How to enable the user type-in box for the year in themes other than the contrast theme? |
|
|
Since version 9.2, a new feature has been added to the contrast theme that allows the user to type in the year quickly. You can easily apply it to other themes by appending the following code snippet to the plugins.js: (You may remove the previous definition of gsCalTitle, if any)
Code: | gsCalTitle="fGetCalTitle()";
function fGetCalTitle() {
return " <a class='PopAnchor' href='javascript:void(0);' onclick='if(this.blur)this.blur();fPopMenu(this,event);return false;'>"+gMonths[gCurMonth[1]-1]+(NN4?" ":"</a> <a id='yearAnchor' class='PopAnchor' href='javascript:void(0)' onclick='fToggleLayer(1,true);fGetById(document,\"yearInput\").focus();return false;'>")+gCurMonth[0]+"</a>";
}
if(NN4)_nn4_css.push("YearBox"); // work around NN4 bug
giFreeDiv=2;
function fInitLayer() { // gets called from within fOnload()
if (NN4) return;
var lyr=fGetById(document,"freeDiv1");
lyr.style.top=(SA?2:IE&&!MAC?0:6)+"px"; lyr.style.left=(SA?63:65)+"px"; lyr.style.border=0;
fDrawLayer(1,"<input class='YearBox' id='yearInput' value='' maxlength=4 size=4 onkeyup='if(this.value.length==4){if(!isNaN(this.value))fSetCal(this.value,gCurMonth[1],0,true,event);this.select();this.blur()}' onblur='fToggleLayer(1,false);if(SA)this.blur()' onfocus='this.value=gCurMonth[0];this.select()' onclick='this.select()' onselectstart='event.cancelBubble=true'>");
} |
Then append the following to the css file of the corresponding theme:
Code: | .YearBox {border:0px solid; height:12px; text-align:center; font:7.5pt verdana; color:black; background-color:white;} |
Finally, call the fInitLayer() from within the fOnload() event handler in plugins.js: (fOnload is available only after version 9.2)
Code: | function fOnload() {
fInitLayer();
} |
Of course you may change the size or color to match you local theme .
_________________ Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved. |
|