Sha256: ffdedcab7116b8b21af6b6a9b784acbba585911c7cbff902bb574e47a8e00e10

Contents?: true

Size: 1.82 KB

Versions: 22

Compression:

Stored size: 1.82 KB

Contents

/*
Copyright (c) 2003-2009, 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

22 entries across 22 versions & 6 rubygems

Version Path
browsercms-3.3.4 public/bcms/ckeditor/plugins/popup/plugin.js
browsercms-3.4.0.rc2 vendor/assets/javascripts/bcms/ckeditor/plugins/popup/plugin.js
browsercms-3.4.0.rc1 vendor/assets/javascripts/bcms/ckeditor/plugins/popup/plugin.js
browsercms-3.3.3 public/bcms/ckeditor/plugins/popup/plugin.js
browsercms-3.1.5 public/bcms/ckeditor/plugins/popup/plugin.js
browsercms-3.1.4 public/bcms/ckeditor/plugins/popup/plugin.js
browsercms-3.3.2 public/bcms/ckeditor/plugins/popup/plugin.js
browsercms-3.3.1 public/bcms/ckeditor/plugins/popup/plugin.js
browsercms-3.3.0 public/bcms/ckeditor/plugins/popup/plugin.js
browsercms-3.1.3 public/bcms/ckeditor/plugins/popup/plugin.js
browsercms-3.3.0.beta public/bcms/ckeditor/plugins/popup/plugin.js
bcms_content_syncing-1.0.0 public/bcms/ckeditor/plugins/popup/plugin.js
drujensen-browsercms-3.2.0 public/bcms/ckeditor/plugins/popup/plugin.js
browsercmsi-3.1.2 public/bcms/ckeditor/plugins/popup/plugin.js
browsercms-3.1.2 public/bcms/ckeditor/plugins/popup/plugin.js
browsercms-3.1.1 public/bcms/ckeditor/plugins/popup/plugin.js
browsercmsi-3.1.1 public/bcms/ckeditor/plugins/popup/plugin.js
browsercmsi-3.1.0 public/bcms/ckeditor/plugins/popup/plugin.js
browsercms-3.1.0 public/bcms/ckeditor/plugins/popup/plugin.js
bcms_fckeditor-1.0.1 public/bcms/ckeditor/plugins/popup/plugin.js