2 Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
\r
3 For licensing, see LICENSE.html or http://ckeditor.com/license
\r
6 CKEDITOR.plugins.add( 'popup');
\r
8 CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
\r
11 * Opens Browser in a popup. The "width" and "height" parameters accept
\r
12 * numbers (pixels) or percent (of screen size) values.
\r
13 * @param {String} url The url of the external file browser.
\r
14 * @param {String} width Popup window width.
\r
15 * @param {String} height Popup window height.
\r
17 popup : function( url, width, height )
\r
19 width = width || '80%';
\r
20 height = height || '70%';
\r
22 if ( typeof width == 'string' && width.length > 1 && width.substr( width.length - 1, 1 ) == '%' )
\r
23 width = parseInt( window.screen.width * parseInt( width, 10 ) / 100, 10 );
\r
25 if ( typeof height == 'string' && height.length > 1 && height.substr( height.length - 1, 1 ) == '%' )
\r
26 height = parseInt( window.screen.height * parseInt( height, 10 ) / 100, 10 );
\r
34 var top = parseInt( ( window.screen.height - height ) / 2, 10 ),
\r
35 left = parseInt( ( window.screen.width - width ) / 2, 10 ),
\r
36 options = 'location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes' +
\r
38 ',height=' + height +
\r
42 var popupWindow = window.open( '', null, options, true );
\r
44 // Blocked by a popup blocker.
\r
50 popupWindow.moveTo( left, top );
\r
51 popupWindow.resizeTo( width, height );
\r
52 popupWindow.focus();
\r
53 popupWindow.location.href = url;
\r
57 popupWindow = window.open( url, null, options, true );
\r