]>
git.immae.eu Git - perso/Immae/Projets/packagist/piedsjaloux-ckeditor-component.git/blob - plugin.js
8f6bd5f8f3b4fe98b3a944d4709aa21ffe46d28e
2 * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
3 * For licensing, see LICENSE.md or http://ckeditor.com/license
6 CKEDITOR
.plugins
.add( 'popup' );
8 CKEDITOR
.tools
.extend( CKEDITOR
.editor
.prototype, {
10 * Opens Browser in a popup. The `width` and `height` parameters accept
11 * numbers (pixels) or percent (of screen size) values.
13 * @member CKEDITOR.editor
14 * @param {String} url The url of the external file browser.
15 * @param {Number/String} [width='80%'] Popup window width.
16 * @param {Number/String} [height='70%'] Popup window height.
17 * @param {String} [options='location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes,scrollbars=yes']
18 * Popup window features.
20 popup: function( url
, width
, height
, options
) {
21 width
= width
|| '80%';
22 height
= height
|| '70%';
24 if ( typeof width
== 'string' && width
.length
> 1 && width
.substr( width
.length
- 1, 1 ) == '%' )
25 width
= parseInt( window
.screen
.width
* parseInt( width
, 10 ) / 100, 10 );
27 if ( typeof height
== 'string' && height
.length
> 1 && height
.substr( height
.length
- 1, 1 ) == '%' )
28 height
= parseInt( window
.screen
.height
* parseInt( height
, 10 ) / 100, 10 );
36 var top
= parseInt( ( window
.screen
.height
- height
) / 2, 10 ),
37 left
= parseInt( ( window
.screen
.width
- width
) / 2, 10 );
39 options
= ( options
|| 'location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes,scrollbars=yes' ) + ',width=' + width
+
44 var popupWindow
= window
.open( '', null, options
, true );
46 // Blocked by a popup blocker.
51 // Chrome is problematic with moveTo/resizeTo, but it's not really needed here (#8855).
52 var ua
= navigator
.userAgent
.toLowerCase();
53 if ( ua
.indexOf( ' chrome/' ) == -1 ) {
54 popupWindow
.moveTo( left
, top
);
55 popupWindow
.resizeTo( width
, height
);
58 popupWindow
.location
.href
= url
;
60 popupWindow
= window
.open( url
, null, options
, true );