1function FCKInsertSignature(p) { 2 3} 4 5FCKCommands.RegisterCommand( 'InsertSignature' , new FCKInsertSignature('insertDokuwikiSignature') ) ; 6 7// Create a toolbar button 8var oInsertSignature = new FCKToolbarButton( 'InsertSignature', FCKLang.DokuwikiSignature) ; 9oInsertSignature.IconPath = FCKConfig.PluginsPath + 'signature/sig.png' ; 10//oInsertSignature.IconPath = ""; 11FCKToolbarItems.RegisterItem( 'InsertSignature', oInsertSignature ) ; 12 13// put it into the contextmenu 14FCK.ContextMenu.RegisterListener( { 15 AddItems : function( menu, tag, tagName ) { 16 // when the option is displayed, show a separator then the command 17 menu.AddSeparator() ; 18 // the command needs the registered command name, the title for the context menu, and the icon path 19 menu.AddItem( 'InsertSignature', FCKLang.DokuwikiSignature, oInsertSignature.IconPath) ; 20 } 21} 22); 23 24FCKInsertSignature.numbersToTwoDigits = function(n) { 25 if(n < 10) n = '0' + n; 26 return(n); 27} 28FCKInsertSignature.prototype.Execute = function() { 29 var d = new Date(); 30 // var month = FCKInsertSignature.numbersToTwoDigits(d.getMonth() +1); 31 //if(month < 10) month = '0' + month; 32 var date_str = d.getFullYear() + '/' 33 + FCKInsertSignature.numbersToTwoDigits(d.getMonth() +1) + '/' 34 + FCKInsertSignature.numbersToTwoDigits(d.getDate()) 35 + ' ' + FCKInsertSignature.numbersToTwoDigits(d.getHours()) 36 + ':' + FCKInsertSignature.numbersToTwoDigits(d.getMinutes()); 37 var mail = '— <i><a href="mailto:' + FCKConfig.fckgUserMail+'">' + FCKConfig.fckgUserName +'</a> ' + date_str +' —</i>'; 38 FCK.InsertHtml(mail); 39 FCK.EditorWindow.parent.FCKUndo.SaveUndoStep(); 40 41}; 42 43FCKInsertSignature.prototype.GetState = function() 44{ 45 return FCK_TRISTATE_OFF; 46}; 47 48 49