JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-4.0.2_full
[ckeditor.git] / samples / sample.js
index 621de32..8827e78 100644 (file)
@@ -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.length;d++)b.plugins[a[d]]||c.push("<code>"+a[d]+"</code>");c.length&&CKEDITOR.dom.element.createFromHtml('<div class="warning"><span>To fully experience this demo, the '+c.join(", ")+" plugin"+(1<c.length?"s are":" is")+" required.</span></div>").insertBefore(b.container)}})})();
\ No newline at end of file
+/**\r
+ * Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.\r
+ * For licensing, see LICENSE.html or http://ckeditor.com/license\r
+ */\r
+\r
+// Tool scripts for the sample pages.\r
+// This file can be ignored and is not required to make use of CKEditor.\r
+\r
+(function() {\r
+       // Check for sample compliance.\r
+       CKEDITOR.on( 'instanceReady', function( ev ) {\r
+               var editor = ev.editor,\r
+                       meta = CKEDITOR.document.$.getElementsByName( 'ckeditor-sample-required-plugins' ),\r
+                       requires = meta.length ? CKEDITOR.dom.element.get( meta[ 0 ] ).getAttribute( 'content' ).split( ',' ) : [],\r
+                       missing = [];\r
+\r
+               if ( requires.length ) {\r
+                       for ( var i = 0; i < requires.length; i++ ) {\r
+                               if ( !editor.plugins[ requires[ i ] ] )\r
+                                       missing.push( '<code>' + requires[ i ] + '</code>' );\r
+                       }\r
+\r
+                       if ( missing.length ) {\r
+                               var warn = CKEDITOR.dom.element.createFromHtml(\r
+                                       '<div class="warning">' +\r
+                                               '<span>To fully experience this demo, the ' + missing.join( ', ' ) + ' plugin' + ( missing.length > 1 ? 's are' : ' is' ) + ' required.</span>' +\r
+                                       '</div>'\r
+                               );\r
+                               warn.insertBefore( editor.container );\r
+                       }\r
+               }\r
+       });\r
+})();\r