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