70% OFF : CLICK HERE TO BUY IT TODAY FOR ONLY $44.70 OR GET IT FREE VIA TRIALPAY  

PHP Demo Application - Source Code

/Framework/Model/Vendor/CkEditor/_source/plugins/preview/plugin.js



/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
 * @file Preview plugin.
 */
(function()
{
	    var previewCmd =
	    {
		        modes : { wysiwyg:1source:1
			},
		        canUndo false,
		        exec : function( editor )
		        {
			            var sHTML,
			                config editor.config,
			                baseTag config.baseHref '<base href="' config.baseHref '"/>' '',
			                isCustomDomain CKEDITOR.env.isCustomDomain();
			            if ( config.fullPage )
			            {
				                sHTML editor.getData()
				                        .replace( /<head>/, '$&' baseTag )
				                        .replace( /[^>]*(?=<\/title>)/, editor.lang.preview );
				            }
			            else
			            {
				                var bodyHtml '<body ',
				                        body editor.document && editor.document.getBody();
				                if ( body )
				                {
					                    if ( body.getAttribute'id' ) )
					                        bodyHtml += 'id="' body.getAttribute'id' ) + '" ';
					                    if ( body.getAttribute'class' ) )
					                        bodyHtml += 'class="' body.getAttribute'class' ) + '" ';
					                }
				                bodyHtml += '>';
				                sHTML =
				                    editor.config.docType +
				                    '<html dir="' editor.config.contentsLangDirection '">' +
				                    '<head>' +
				                    baseTag +
				                    '<title>' editor.lang.preview '</title>' +
				                    CKEDITOR.tools.buildStyleHtmleditor.config.contentsCss ) +
				                    '</head>' bodyHtml +
				                    editor.getData() +
				                    '</body></html>';
				            }
			            var iWidth    640,    // 800 * 0.8,
			                iHeight    420,    // 600 * 0.7,
			                iLeft    80;
			    // (800 - 0.8 * 800) /2 = 800 * 0.1.
			            try
			            {
				                var screen window.screen;
				                iWidth Math.roundscreen.width 0.8 );
				                iHeight Math.roundscreen.height 0.7 );
				                iLeft Math.roundscreen.width 0.1 );
				            }
			            catch ( ){}
			            var sOpenUrl '';
			            if ( isCustomDomain )
			            {
				                window._cke_htmlToLoad sHTML;
				                sOpenUrl 'javascript:void( (function(){' +
					                    'document.open();
					' +
					                    'document.domain="' document.domain '";
					' +
					                    'document.write( window.opener._cke_htmlToLoad );
					' +
					                    'document.close();
					' +
					                    'window.opener._cke_htmlToLoad = null;
					' +
					                    '})() )';
				            }
			            var oWindow window.opensOpenUrlnull'toolbar=yes,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=' +
			                iWidth ',height=' iHeight ',left=' iLeft );
			            if ( !isCustomDomain )
			            {
				                oWindow.document.open();
				                oWindow.document.writesHTML );
				                oWindow.document.close();
				            }
			        }
		    };
	    var pluginName 'preview';
	    // Register a plugin named "preview".
	    CKEDITOR.plugins.addpluginName,
	    {
		        init : function( editor )
		        {
			            editor.addCommandpluginNamepreviewCmd );
			            editor.ui.addButton'Preview',
			                {
				                    label editor.lang.preview,
				                    command pluginName
				                });
			        }
		    });
	})();





PHP Demo Source Code Index