Sha256: 6a8dbf8feb1c5b2c27d8d60f0dcf158fdaf4750577237cd2282219ed06e531f8

Contents?: true

Size: 1.82 KB

Versions: 10

Compression:

Stored size: 1.82 KB

Contents

/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/

CKEDITOR.plugins.add( 'popup');

CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
{
	/**
	 * Opens Browser in a popup. The "width" and "height" parameters accept
	 * numbers (pixels) or percent (of screen size) values.
	 * @param {String} url The url of the external file browser.
	 * @param {String} width Popup window width.
	 * @param {String} height Popup window height.
	 */
	popup : function( url, width, height )
	{
		width = width || '80%';
		height = height || '70%';

		if ( typeof width == 'string' && width.length > 1 && width.substr( width.length - 1, 1 ) == '%' )
			width = parseInt( window.screen.width * parseInt( width, 10 ) / 100, 10 );

		if ( typeof height == 'string' && height.length > 1 && height.substr( height.length - 1, 1 ) == '%' )
			height = parseInt( window.screen.height * parseInt( height, 10 ) / 100, 10 );

		if ( width < 640 )
			width = 640;

		if ( height < 420 )
			height = 420;

		var top = parseInt( ( window.screen.height - height ) / 2, 10 ),
			left = parseInt( ( window.screen.width  - width ) / 2, 10 ),
			options = 'location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes' +
			',width='  + width +
			',height=' + height +
			',top='  + top +
			',left=' + left;

		var popupWindow = window.open( '', null, options, true );

		// Blocked by a popup blocker.
		if ( !popupWindow )
			return false;

		try
		{
			popupWindow.moveTo( left, top );
			popupWindow.resizeTo( width, height );
			popupWindow.focus();
			popupWindow.location.href = url;
		}
		catch (e)
		{
			popupWindow = window.open( url, null, options, true );
		}

		return true ;
	}
});

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
radiant-ck_editor_filter-extension-0.2.0 public/javascripts/extensions/ck_editor_filter/ckeditor/_source/plugins/popup/plugin.js
radiant-ck_editor_filter-extension-0.1.1 public/javascripts/extensions/ck_editor_filter/ckeditor/_source/plugins/popup/plugin.js
ckeditor-3.4.1.pre lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/popup/plugin.js
ckeditor-3.4.1 generators/ckeditor_install/templates/ckeditor/_source/plugins/popup/plugin.js
ckeditor-3.4.0 generators/ckeditor_install/templates/ckeditor/_source/plugins/popup/plugin.js
ckeditor-3.4.0.pre lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/popup/plugin.js
ckeditor-3.3.2 generators/ckeditor_install/templates/ckeditor/_source/plugins/popup/plugin.js
ckeditor-3.2.4 lib/generators/templates/ckeditor/_source/plugins/popup/plugin.js
ckeditor-3.2.3 lib/generators/templates/ckeditor/_source/plugins/popup/plugin.js
ckeditor-3.2.1 lib/generators/templates/ckeditor/_source/plugins/popup/plugin.js