X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=samples%2Fsample.js;h=8827e789aef0e07574a0a56c0d9a1c442acb2224;hp=621de3259d569c0b82e278bcc043b6017021e835;hb=3ae1f974ffdf269f96455a39d8d6947e4d590b1b;hpb=70e367bc436565d37ed3e6704847a0a74242e5c8 diff --git a/samples/sample.js b/samples/sample.js index 621de32..8827e78 100644 --- a/samples/sample.js +++ b/samples/sample.js @@ -1,5 +1,33 @@ -/* - 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-2013, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html 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() { + // Check for sample compliance. + CKEDITOR.on( 'instanceReady', function( ev ) { + 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 = []; + + if ( requires.length ) { + for ( var 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 ); + } + } + }); +})();