2  * Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
\r 
   3  * For licensing, see LICENSE.md or http://ckeditor.com/license
\r 
   6 // Tool scripts for the sample pages.
\r 
   7 // This file can be ignored and is not required to make use of CKEditor.
\r 
  10         CKEDITOR.on( 'instanceReady', function( ev ) {
\r 
  11                 // Check for sample compliance.
\r 
  12                 var editor = ev.editor,
\r 
  13                         meta = CKEDITOR.document.$.getElementsByName( 'ckeditor-sample-required-plugins' ),
\r 
  14                         requires = meta.length ? CKEDITOR.dom.element.get( meta[ 0 ] ).getAttribute( 'content' ).split( ',' ) : [],
\r 
  18                 if ( requires.length ) {
\r 
  19                         for ( i = 0; i < requires.length; i++ ) {
\r 
  20                                 if ( !editor.plugins[ requires[ i ] ] )
\r 
  21                                         missing.push( '<code>' + requires[ i ] + '</code>' );
\r 
  24                         if ( missing.length ) {
\r 
  25                                 var warn = CKEDITOR.dom.element.createFromHtml(
\r 
  26                                         '<div class="warning">' +
\r 
  27                                                 '<span>To fully experience this demo, the ' + missing.join( ', ' ) + ' plugin' + ( missing.length > 1 ? 's are' : ' is' ) + ' required.</span>' +
\r 
  30                                 warn.insertBefore( editor.container );
\r 
  35                 var doc = new CKEDITOR.dom.document( document ),
\r 
  36                         icons = doc.find( '.button_icon' );
\r 
  38                 for ( i = 0; i < icons.count(); i++ ) {
\r 
  39                         var icon = icons.getItem( i ),
\r 
  40                                 name = icon.getAttribute( 'data-icon' ),
\r 
  41                                 style = CKEDITOR.skin.getIconStyle( name, ( CKEDITOR.lang.dir == 'rtl' ) );
\r 
  43                         icon.addClass( 'cke_button_icon' );
\r 
  44                         icon.addClass( 'cke_button__' + name + '_icon' );
\r 
  45                         icon.setAttribute( 'style', style );
\r 
  46                         icon.setStyle( 'float', 'none' );
\r