root / drupal7 / sites / all / libraries / ckeditor-version / samples / sample.js @ 5a7e6170
1 |
/** |
---|---|
2 |
* Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
3 |
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
4 |
*/
|
5 |
|
6 |
// Tool scripts for the sample pages.
|
7 |
// This file can be ignored and is not required to make use of CKEditor.
|
8 |
|
9 |
(function() {
|
10 |
// Check for sample compliance.
|
11 |
CKEDITOR.on( 'instanceReady', function( ev ) { |
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( ',' ) : [], |
15 |
missing = []; |
16 |
|
17 |
if ( requires.length ) {
|
18 |
for ( var i = 0; i < requires.length; i++ ) { |
19 |
if ( !editor.plugins[ requires[ i ] ] )
|
20 |
missing.push( '<code>' + requires[ i ] + '</code>' ); |
21 |
} |
22 |
|
23 |
if ( missing.length ) {
|
24 |
var warn = CKEDITOR.dom.element.createFromHtml(
|
25 |
'<div class="warning">' +
|
26 |
'<span>To fully experience this demo, the ' + missing.join( ', ' ) + ' plugin' + ( missing.length > 1 ? 's are' : ' is' ) + ' required.</span>' + |
27 |
'</div>'
|
28 |
); |
29 |
warn.insertBefore( editor.container ); |
30 |
} |
31 |
} |
32 |
}); |
33 |
})(); |