[ Index ] |
|
Code source de Joomla 1.0.13 |
1 /** 2 * $Id: editor_plugin_src.js 128 2006-10-22 19:55:28Z spocke $ 3 * 4 * @author Moxiecode 5 * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved. 6 */ 7 8 /* Import plugin specific language pack */ 9 tinyMCE.importPluginLanguagePack('fullscreen'); 10 11 var TinyMCE_FullScreenPlugin = { 12 getInfo : function() { 13 return { 14 longname : 'Fullscreen', 15 author : 'Moxiecode Systems AB', 16 authorurl : 'http://tinymce.moxiecode.com', 17 infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_fullscreen.html', 18 version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion 19 }; 20 }, 21 22 initInstance : function(inst) { 23 if (!tinyMCE.settings['fullscreen_skip_plugin_css']) 24 tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/fullscreen/css/content.css"); 25 }, 26 27 getControlHTML : function(cn) { 28 switch (cn) { 29 case "fullscreen": 30 return tinyMCE.getButtonHTML(cn, 'lang_fullscreen_desc', '{$pluginurl}/images/fullscreen.gif', 'mceFullScreen'); 31 } 32 33 return ""; 34 }, 35 36 execCommand : function(editor_id, element, command, user_interface, value) { 37 // Handle commands 38 switch (command) { 39 case "mceFullScreen": 40 this._toggleFullscreen(tinyMCE.getInstanceById(editor_id)); 41 return true; 42 } 43 44 // Pass to next handler in chain 45 return false; 46 }, 47 48 _toggleFullscreen : function(inst) { 49 var ds = inst.getData('fullscreen'), editorContainer, tableElm, iframe, vp, cw, cd, re, w, h, si; 50 51 cw = inst.getContainerWin(); 52 cd = cw.document; 53 editorContainer = cd.getElementById(inst.editorId + '_parent'); 54 tableElm = editorContainer.firstChild; 55 iframe = inst.iframeElement; 56 re = cd.getElementById(inst.editorId + '_resize'); 57 58 if (!ds.enabled) { 59 ds.parents = []; 60 61 tinyMCE.getParentNode(tableElm.parentNode, function (n) { 62 var st = n.style; 63 64 if (n.nodeType == 1 && st) { 65 if (n.nodeName == 'BODY') 66 return true; 67 68 ds.parents.push({ 69 el : n, 70 position : st.position, 71 left : st.left, 72 top : st.top, 73 right : st.right, 74 bottom : st.bottom, 75 width : st.width, 76 height : st.height, 77 margin : st.margin, 78 padding : st.padding, 79 border : st.border 80 }); 81 82 st.position = 'static'; 83 st.left = st.top = st.margin = st.padding = st.border = '0'; 84 st.width = st.height = st.right = st.bottom = 'auto'; 85 } 86 87 return false; 88 }); 89 90 ds.oldOverflow = cd.body.style.overflow; 91 cd.body.style.overflow = 'hidden'; 92 93 if (re) 94 re.style.display = 'none'; 95 96 vp = tinyMCE.getViewPort(cw); 97 98 ds.oldWidth = iframe.style.width ? iframe.style.width : iframe.offsetWidth; 99 ds.oldHeight = iframe.style.height ? iframe.style.height : iframe.offsetHeight; 100 ds.oldTWidth = tableElm.style.width ? tableElm.style.width : tableElm.offsetWidth; 101 ds.oldTHeight = tableElm.style.height ? tableElm.style.height : tableElm.offsetHeight; 102 103 // Handle % width 104 if (ds.oldWidth && ds.oldWidth.indexOf) 105 ds.oldTWidth = ds.oldWidth.indexOf('%') != -1 ? ds.oldWidth : ds.oldTWidth; 106 107 tableElm.style.position = 'absolute'; 108 tableElm.style.zIndex = 1000; 109 tableElm.style.left = tableElm.style.top = '0'; 110 111 tableElm.style.width = vp.width + 'px'; 112 tableElm.style.height = vp.height + 'px'; 113 114 if (tinyMCE.isRealIE) { 115 iframe.style.width = vp.width + 'px'; 116 iframe.style.height = vp.height + 'px'; 117 118 // Calc new width/height based on overflow 119 w = iframe.parentNode.clientWidth - (tableElm.offsetWidth - vp.width); 120 h = iframe.parentNode.clientHeight - (tableElm.offsetHeight - vp.height); 121 } else { 122 w = iframe.parentNode.clientWidth; 123 h = iframe.parentNode.clientHeight; 124 } 125 126 iframe.style.width = w + "px"; 127 iframe.style.height = h + "px"; 128 129 tinyMCE.selectElements(cd, 'SELECT,INPUT,BUTTON,TEXTAREA', function (n) { 130 tinyMCE.addCSSClass(n, 'mceItemFullScreenHidden'); 131 132 return false; 133 }); 134 135 tinyMCE.switchClass(inst.editorId + '_fullscreen', 'mceButtonSelected'); 136 ds.enabled = true; 137 } else { 138 si = 0; 139 tinyMCE.getParentNode(tableElm.parentNode, function (n) { 140 var st = n.style, s = ds.parents[si++]; 141 142 if (n.nodeName == 'BODY') 143 return true; 144 145 if (st) { 146 st.position = s.position; 147 st.left = s.left; 148 st.top = s.top; 149 st.bottom = s.bottom; 150 st.right = s.right; 151 st.width = s.width; 152 st.height = s.height; 153 st.margin = s.margin; 154 st.padding = s.padding; 155 st.border = s.border; 156 } 157 }); 158 159 ds.parents = []; 160 161 cd.body.style.overflow = ds.oldOverflow ? ds.oldOverflow : ''; 162 163 if (re && tinyMCE.getParam("theme_advanced_resizing", false)) 164 re.style.display = 'block'; 165 166 tableElm.style.position = 'static'; 167 tableElm.style.zIndex = ''; 168 tableElm.style.width = ''; 169 tableElm.style.height = ''; 170 171 tableElm.style.width = ds.oldTWidth ? ds.oldTWidth : ''; 172 tableElm.style.height = ds.oldTHeight ? ds.oldTHeight : ''; 173 174 iframe.style.width = ds.oldWidth ? ds.oldWidth : ''; 175 iframe.style.height = ds.oldHeight ? ds.oldHeight : ''; 176 177 tinyMCE.selectElements(cd, 'SELECT,INPUT,BUTTON,TEXTAREA', function (n) { 178 tinyMCE.removeCSSClass(n, 'mceItemFullScreenHidden'); 179 180 return false; 181 }); 182 183 tinyMCE.switchClass(inst.editorId + '_fullscreen', 'mceButtonNormal'); 184 ds.enabled = false; 185 } 186 } 187 }; 188 189 tinyMCE.addPlugin("fullscreen", TinyMCE_FullScreenPlugin);
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 14:43:32 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |