CKEDITOR.plugins.add( 'charcount', { init : function( editor ) { var defaultLimit = 'unlimited'; var defaultFormat = '%count% of %limit%'; var limit = defaultLimit; var format = defaultFormat; var intervalId; var lastCount = 0; var limitReachedNotified = false; var limitRestoredNotified = false; if ( true ) { function counterId( editor ) { return 'cke_charcount_' + editor.name; } function counterElement( editor ) { return document.getElementById( counterId(editor) ); } function updateCounter( editor ) { var count = editor.getData().length; if( count == lastCount ){ return true; } else { lastCount = count; } if( !limitReachedNotified && count > limit ){ limitReached( editor ); } else if( !limitRestoredNotified && count < limit ){ limitRestored( editor ); } var html = format.replace('%count%', count).replace('%limit%', limit); counterElement(editor).innerHTML = html; } function limitReached( editor ) { limitReachedNotified = true; limitRestoredNotified = false; editor.setUiColor( '#FFC4C4' ); } function limitRestored( editor ) { limitRestoredNotified = true; limitReachedNotified = false; editor.setUiColor( '#C4C4C4' ); } editor.on( 'themeSpace', function( event ) { if ( event.data.space == 'bottom' ) { event.data.html += '