You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.1 KiB

  1. /**
  2. * Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.html or http://ckeditor.com/license
  4. */
  5. // Tool scripts for the sample pages.
  6. // This file can be ignored and is not required to make use of CKEditor.
  7. (function() {
  8. // Check for sample compliance.
  9. CKEDITOR.on( 'instanceReady', function( ev ) {
  10. var editor = ev.editor,
  11. meta = CKEDITOR.document.$.getElementsByName( 'ckeditor-sample-required-plugins' ),
  12. requires = meta.length ? CKEDITOR.dom.element.get( meta[ 0 ] ).getAttribute( 'content' ).split( ',' ) : [],
  13. missing = [];
  14. if ( requires.length ) {
  15. for ( var i = 0; i < requires.length; i++ ) {
  16. if ( !editor.plugins[ requires[ i ] ] )
  17. missing.push( '<code>' + requires[ i ] + '</code>' );
  18. }
  19. if ( missing.length ) {
  20. var warn = CKEDITOR.dom.element.createFromHtml(
  21. '<div class="warning">' +
  22. '<span>To fully experience this demo, the ' + missing.join( ', ' ) + ' plugin' + ( missing.length > 1 ? 's are' : ' is' ) + ' required.</span>' +
  23. '</div>'
  24. );
  25. warn.insertBefore( editor.container );
  26. }
  27. }
  28. });
  29. })();