JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
8f43faac0419307fd0b65c07803adb2c92bf21c0
[ckeditor.git] / _source / skins / v2 / skin.js
1 /*\r
2 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
3 For licensing, see LICENSE.html or http://ckeditor.com/license\r
4 */\r
5 \r
6 CKEDITOR.skins.add( 'v2', (function()\r
7 {\r
8         return {\r
9                 editor          : { css : [ 'editor.css' ] },\r
10                 dialog          : { css : [ 'dialog.css' ] },\r
11                 templates       : { css : [ 'templates.css' ] },\r
12                 margins         : [ 0, 14, 18, 14 ]\r
13         };\r
14 })() );\r
15 \r
16 (function()\r
17 {\r
18         CKEDITOR.dialog ? dialogSetup() : CKEDITOR.on( 'dialogPluginReady', dialogSetup );\r
19 \r
20         function dialogSetup()\r
21         {\r
22                 CKEDITOR.dialog.on( 'resize', function( evt )\r
23                         {\r
24                                 var data = evt.data,\r
25                                         width = data.width,\r
26                                         height = data.height,\r
27                                         dialog = data.dialog,\r
28                                         contents = dialog.parts.contents;\r
29 \r
30                                 if ( data.skin != 'v2' )\r
31                                         return;\r
32 \r
33                                 contents.setStyles(\r
34                                         {\r
35                                                 width : width + 'px',\r
36                                                 height : height + 'px'\r
37                                         });\r
38 \r
39                                 if ( !CKEDITOR.env.ie || CKEDITOR.env.ie9Compat )\r
40                                         return;\r
41 \r
42                                 // Fix the size of the elements which have flexible lengths.\r
43                                 setTimeout( function()\r
44                                         {\r
45                                                 var innerDialog = dialog.parts.dialog.getChild( [ 0, 0, 0 ] ),\r
46                                                         body = innerDialog.getChild( 0 ),\r
47                                                         bodyWidth = body.getSize( 'width' );\r
48                                                 height += body.getChild( 0 ).getSize( 'height' ) + 1;\r
49 \r
50                                                 // tc\r
51                                                 var el = innerDialog.getChild( 2 );\r
52                                                 el.setSize( 'width', bodyWidth );\r
53 \r
54                                                 // bc\r
55                                                 el = innerDialog.getChild( 7 );\r
56                                                 el.setSize( 'width', bodyWidth - 28 );\r
57 \r
58                                                 // ml\r
59                                                 el = innerDialog.getChild( 4 );\r
60                                                 el.setSize( 'height', height );\r
61 \r
62                                                 // mr\r
63                                                 el = innerDialog.getChild( 5 );\r
64                                                 el.setSize( 'height', height );\r
65                                         },\r
66                                         100 );\r
67                         });\r
68         }\r
69 })();\r