1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/ckeditor/samples/old/sample.js Thu Dec 15 18:10:20 2016 +0300
1.3 @@ -0,0 +1,50 @@
1.4 +/**
1.5 + * Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
1.6 + * For licensing, see LICENSE.md or http://ckeditor.com/license
1.7 + */
1.8 +
1.9 +// Tool scripts for the sample pages.
1.10 +// This file can be ignored and is not required to make use of CKEditor.
1.11 +
1.12 +( function() {
1.13 + CKEDITOR.on( 'instanceReady', function( ev ) {
1.14 + // Check for sample compliance.
1.15 + var editor = ev.editor,
1.16 + meta = CKEDITOR.document.$.getElementsByName( 'ckeditor-sample-required-plugins' ),
1.17 + requires = meta.length ? CKEDITOR.dom.element.get( meta[ 0 ] ).getAttribute( 'content' ).split( ',' ) : [],
1.18 + missing = [],
1.19 + i;
1.20 +
1.21 + if ( requires.length ) {
1.22 + for ( i = 0; i < requires.length; i++ ) {
1.23 + if ( !editor.plugins[ requires[ i ] ] )
1.24 + missing.push( '<code>' + requires[ i ] + '</code>' );
1.25 + }
1.26 +
1.27 + if ( missing.length ) {
1.28 + var warn = CKEDITOR.dom.element.createFromHtml(
1.29 + '<div class="warning">' +
1.30 + '<span>To fully experience this demo, the ' + missing.join( ', ' ) + ' plugin' + ( missing.length > 1 ? 's are' : ' is' ) + ' required.</span>' +
1.31 + '</div>'
1.32 + );
1.33 + warn.insertBefore( editor.container );
1.34 + }
1.35 + }
1.36 +
1.37 + // Set icons.
1.38 + var doc = new CKEDITOR.dom.document( document ),
1.39 + icons = doc.find( '.button_icon' );
1.40 +
1.41 + for ( i = 0; i < icons.count(); i++ ) {
1.42 + var icon = icons.getItem( i ),
1.43 + name = icon.getAttribute( 'data-icon' ),
1.44 + style = CKEDITOR.skin.getIconStyle( name, ( CKEDITOR.lang.dir == 'rtl' ) );
1.45 +
1.46 + icon.addClass( 'cke_button_icon' );
1.47 + icon.addClass( 'cke_button__' + name + '_icon' );
1.48 + icon.setAttribute( 'style', style );
1.49 + icon.setStyle( 'float', 'none' );
1.50 +
1.51 + }
1.52 + } );
1.53 +} )();