cd09872ff13512b65b7e9ae3cc41d62fefce8ca2
[cascardo/eventmanager.git] / media / tiny_mce / plugins / zoom / editor_plugin_src.js
1 /**\r
2  * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $\r
3  *\r
4  * @author Moxiecode\r
5  * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.\r
6  */\r
7 \r
8 var TinyMCE_ZoomPlugin = {\r
9         getInfo : function() {\r
10                 return {\r
11                         longname : 'Zoom',\r
12                         author : 'Moxiecode Systems AB',\r
13                         authorurl : 'http://tinymce.moxiecode.com',\r
14                         infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/zoom',\r
15                         version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion\r
16                 };\r
17         },\r
18 \r
19         /**\r
20          * Returns the HTML contents of the zoom control.\r
21          */\r
22         getControlHTML : function(control_name) {\r
23                 if (!tinyMCE.isMSIE || tinyMCE.isMSIE5_0 || tinyMCE.isOpera)\r
24                         return "";\r
25 \r
26                 switch (control_name) {\r
27                         case "zoom":\r
28                                 return '<select id="{$editor_id}_zoomSelect" name="{$editor_id}_zoomSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceZoom\',false,this.options[this.selectedIndex].value);" class="mceSelectList">' + \r
29                                                 '<option value="100%">+ 100%</option>' + \r
30                                                 '<option value="150%">+ 150%</option>' + \r
31                                                 '<option value="200%">+ 200%</option>' + \r
32                                                 '<option value="250%">+ 250%</option>' + \r
33                                                 '</select>';\r
34                 }\r
35 \r
36                 return "";\r
37         },\r
38 \r
39         /**\r
40          * Executes the mceZoom command.\r
41          */\r
42         execCommand : function(editor_id, element, command, user_interface, value) {\r
43                 // Handle commands\r
44                 switch (command) {\r
45                         case "mceZoom":\r
46                                 tinyMCE.getInstanceById(editor_id).contentDocument.body.style.zoom = value;\r
47                                 tinyMCE.getInstanceById(editor_id).contentDocument.body.style.mozZoom = value;\r
48                                 return true;\r
49                 }\r
50 \r
51                 // Pass to next handler in chain\r
52                 return false;\r
53         }\r
54 };\r
55 \r
56 tinyMCE.addPlugin("zoom", TinyMCE_ZoomPlugin);\r