diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-02-19 23:38:52 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-02-19 23:38:52 +0100 |
commit | 3332bebe4da6dfa0fe3e4b2abddc84b1cc62f8f5 (patch) | |
tree | a4f77655fe55b79606e7d3416504686a1ab8b058 /release/samples/old/sample.js | |
download | piedsjaloux-ckeditor-component-3332bebe4da6dfa0fe3e4b2abddc84b1cc62f8f5.tar.gz piedsjaloux-ckeditor-component-3332bebe4da6dfa0fe3e4b2abddc84b1cc62f8f5.tar.zst piedsjaloux-ckeditor-component-3332bebe4da6dfa0fe3e4b2abddc84b1cc62f8f5.zip |
Initial commit4.5.7
Diffstat (limited to 'release/samples/old/sample.js')
-rw-r--r-- | release/samples/old/sample.js | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/release/samples/old/sample.js b/release/samples/old/sample.js new file mode 100644 index 0000000..ebc077f --- /dev/null +++ b/release/samples/old/sample.js | |||
@@ -0,0 +1,50 @@ | |||
1 | /** | ||
2 | * Copyright (c) 2003-2016, 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 | 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( ',' ) : [], | ||
15 | missing = [], | ||
16 | i; | ||
17 | |||
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>' ); | ||
22 | } | ||
23 | |||
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>' + | ||
28 | '</div>' | ||
29 | ); | ||
30 | warn.insertBefore( editor.container ); | ||
31 | } | ||
32 | } | ||
33 | |||
34 | // Set icons. | ||
35 | var doc = new CKEDITOR.dom.document( document ), | ||
36 | icons = doc.find( '.button_icon' ); | ||
37 | |||
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' ) ); | ||
42 | |||
43 | icon.addClass( 'cke_button_icon' ); | ||
44 | icon.addClass( 'cke_button__' + name + '_icon' ); | ||
45 | icon.setAttribute( 'style', style ); | ||
46 | icon.setStyle( 'float', 'none' ); | ||
47 | |||
48 | } | ||
49 | } ); | ||
50 | } )(); | ||