X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=samples%2Fsample.js;h=b25482d3adf34fc9e5d4e6ff1c45d9057ff0c778;hb=75e266c2f692f8cd1b274249ad657e07bc9072aa;hp=621de3259d569c0b82e278bcc043b6017021e835;hpb=860af3c4bde9866c53d5123c57e3dc6166e0fe1e;p=ckeditor.git diff --git a/samples/sample.js b/samples/sample.js index 621de32..b25482d 100644 --- a/samples/sample.js +++ b/samples/sample.js @@ -1,5 +1,50 @@ -/* - Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - For licensing, see LICENSE.html or http://ckeditor.com/license -*/ -(function(){CKEDITOR.on("instanceReady",function(b){var b=b.editor,a=CKEDITOR.document.$.getElementsByName("ckeditor-sample-required-plugins"),a=a.length?CKEDITOR.dom.element.get(a[0]).getAttribute("content").split(","):[],c=[];if(a.length){for(var d=0;d"+a[d]+"");c.length&&CKEDITOR.dom.element.createFromHtml('
To fully experience this demo, the '+c.join(", ")+" plugin"+(1
").insertBefore(b.container)}})})(); \ No newline at end of file +/** + * Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md or http://ckeditor.com/license + */ + +// Tool scripts for the sample pages. +// This file can be ignored and is not required to make use of CKEditor. + +( function() { + CKEDITOR.on( 'instanceReady', function( ev ) { + // Check for sample compliance. + var editor = ev.editor, + meta = CKEDITOR.document.$.getElementsByName( 'ckeditor-sample-required-plugins' ), + requires = meta.length ? CKEDITOR.dom.element.get( meta[ 0 ] ).getAttribute( 'content' ).split( ',' ) : [], + missing = [], + i; + + if ( requires.length ) { + for ( i = 0; i < requires.length; i++ ) { + if ( !editor.plugins[ requires[ i ] ] ) + missing.push( '' + requires[ i ] + '' ); + } + + if ( missing.length ) { + var warn = CKEDITOR.dom.element.createFromHtml( + '
' + + 'To fully experience this demo, the ' + missing.join( ', ' ) + ' plugin' + ( missing.length > 1 ? 's are' : ' is' ) + ' required.' + + '
' + ); + warn.insertBefore( editor.container ); + } + } + + // Set icons. + var doc = new CKEDITOR.dom.document( document ), + icons = doc.find( '.button_icon' ); + + for ( i = 0; i < icons.count(); i++ ) { + var icon = icons.getItem( i ), + name = icon.getAttribute( 'data-icon' ), + style = CKEDITOR.skin.getIconStyle( name, ( CKEDITOR.lang.dir == 'rtl' ) ); + + icon.addClass( 'cke_button_icon' ); + icon.addClass( 'cke_button__' + name + '_icon' ); + icon.setAttribute( 'style', style ); + icon.setStyle( 'float', 'none' ); + + } + } ); +} )();