Sha256: 1faca83c227190e002dbb2152d66a3bee2a9d3d5a4ed1c3f66f75e1ebaf963b6

Contents?: true

Size: 1.91 KB

Versions: 88

Compression:

Stored size: 1.91 KB

Contents

/*
Copyright (c) 2003-2011, 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.
	 * @param {String} options Popup window features.
	 */
	popup : function( url, width, height, options )
	{
		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 = ( options || 'location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes,scrollbars=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

88 entries across 85 versions & 9 rubygems

Version Path
classiccms-0.7.5 lib/classiccms/public/js/ckeditor/_source/plugins/popup/plugin.js
classiccms-0.7.4 lib/classiccms/public/js/ckeditor/_source/plugins/popup/plugin.js
classiccms-0.7.3 lib/classiccms/public/js/ckeditor/_source/plugins/popup/plugin.js
classiccms-0.7.2 lib/classiccms/public/js/ckeditor/_source/plugins/popup/plugin.js
classiccms-0.7.1 lib/classiccms/public/js/ckeditor/_source/plugins/popup/plugin.js
classiccms-0.7.0 lib/classiccms/public/js/ckeditor/_source/plugins/popup/plugin.js
classiccms-0.6.9 lib/classiccms/public/js/ckeditor/_source/plugins/popup/plugin.js
classiccms-0.6.8 lib/classiccms/public/js/ckeditor/_source/plugins/popup/plugin.js
classiccms-0.6.7 lib/classiccms/public/js/ckeditor/_source/plugins/popup/plugin.js
classiccms-0.6.6 lib/classiccms/public/js/ckeditor/_source/plugins/popup/plugin.js
classiccms-0.6.5 lib/classiccms/public/js/ckeditor/_source/plugins/popup/plugin.js
classiccms-0.6.4 lib/classiccms/public/js/ckeditor/_source/plugins/popup/plugin.js
classiccms-0.6.3 lib/classiccms/public/js/ckeditor/_source/plugins/popup/plugin.js
classiccms-0.6.2 lib/classiccms/public/js/ckeditor/_source/plugins/popup/plugin.js
classiccms-0.6.1 lib/classiccms/public/js/ckeditor/_source/plugins/popup/plugin.js
classiccms-0.6.0 lib/classiccms/public/js/ckeditor/_source/plugins/popup/plugin.js
classiccms-0.5.17 lib/classiccms/public/js/ckeditor/_source/plugins/popup/plugin.js
classiccms-0.5.16 lib/classiccms/public/js/ckeditor/_source/plugins/popup/plugin.js
classiccms-0.5.15 lib/classiccms/public/js/ckeditor/_source/plugins/popup/plugin.js
classiccms-0.5.14 lib/classiccms/public/js/ckeditor/_source/plugins/popup/plugin.js