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