2 * $Id: editor_plugin_src.js 268 2007-04-28 15:52:59Z spocke $
4 * Moxiecode DHTML Windows script.
7 * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
10 // Patch openWindow, closeWindow TinyMCE functions
12 var TinyMCE_InlinePopupsPlugin = {
13 getInfo : function() {
15 longname : 'Inline Popups',
16 author : 'Moxiecode Systems AB',
17 authorurl : 'http://tinymce.moxiecode.com',
18 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups',
19 version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
24 tinyMCE.addPlugin("inlinepopups", TinyMCE_InlinePopupsPlugin);
26 // Patch openWindow, closeWindow TinyMCE functions
28 TinyMCE_Engine.prototype.orgOpenWindow = TinyMCE_Engine.prototype.openWindow;
29 TinyMCE_Engine.prototype.orgCloseWindow = TinyMCE_Engine.prototype.closeWindow;
31 TinyMCE_Engine.prototype.openWindow = function(template, args) {
32 // Does the caller support inline
33 if (args['inline'] != "yes" || tinyMCE.isOpera || tinyMCE.getParam("plugins").indexOf('inlinepopups') == -1) {
34 mcWindows.selectedWindow = null;
35 args['mce_inside_iframe'] = false;
36 this.orgOpenWindow(template, args);
40 var url, resizable, scrollbars;
42 args['mce_inside_iframe'] = true;
43 tinyMCE.windowArgs = args;
45 if (template['file'].charAt(0) != '/' && template['file'].indexOf('://') == -1)
46 url = tinyMCE.baseURL + "/themes/" + tinyMCE.getParam("theme") + "/" + template['file'];
48 url = template['file'];
50 if (!(width = parseInt(template['width'])))
53 if (!(height = parseInt(template['height'])))
56 if (!(minWidth = parseInt(template['minWidth'])))
59 if (!(minHeight = parseInt(template['minHeight'])))
62 resizable = (args && args['resizable']) ? args['resizable'] : "no";
63 scrollbars = (args && args['scrollbars']) ? args['scrollbars'] : "no";
67 // Replace all args as variables in URL
68 for (var name in args) {
69 if (typeof(args[name]) == 'function')
72 url = tinyMCE.replaceVar(url, name, escape(args[name]));
75 var elm = document.getElementById(this.selectedInstance.editorId + '_parent');
77 if (tinyMCE.hasPlugin('fullscreen') && this.selectedInstance.getData('fullscreen').enabled)
78 pos = { absLeft: 0, absTop: 0 };
80 pos = tinyMCE.getAbsPosition(elm);
82 // Center div in editor area
83 pos.absLeft += Math.round((elm.firstChild.clientWidth / 2) - (width / 2));
84 pos.absTop += Math.round((elm.firstChild.clientHeight / 2) - (height / 2));
86 // WordPress cache buster
87 url += tinyMCE.settings['imp_version'] ? (url.indexOf('?')==-1?'?':'&') + 'ver=' + tinyMCE.settings['imp_version'] : '';
89 mcWindows.open(url, mcWindows.idCounter++, "modal=yes,width=" + width+ ",height=" + height + ",resizable=" + resizable + ",scrollbars=" + scrollbars + ",statusbar=" + resizable + ",left=" + pos.absLeft + ",top=" + pos.absTop + ",minWidth=" + minWidth + ",minHeight=" + minHeight );
92 TinyMCE_Engine.prototype.closeWindow = function(win) {
93 var gotit = false, n, w;
95 for (n in mcWindows.windows) {
96 w = mcWindows.windows[n];
98 if (typeof(w) == 'function')
101 if (win.name == w.id + '_iframe') {
108 this.orgCloseWindow(win);
110 tinyMCE.selectedInstance.getWin().focus();
113 TinyMCE_Engine.prototype.setWindowTitle = function(win_ref, title) {
114 for (var n in mcWindows.windows) {
115 var win = mcWindows.windows[n];
116 if (typeof(win) == 'function')
119 if (win_ref.name == win.id + "_iframe")
120 window.frames[win.id + "_iframe"].document.getElementById(win.id + '_title').innerHTML = title;
124 // * * * * * TinyMCE_Windows classes below
127 function TinyMCE_Windows() {
128 this.settings = new Array();
129 this.windows = new Array();
130 this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
131 this.isGecko = navigator.userAgent.indexOf('Gecko') != -1;
132 this.isSafari = navigator.userAgent.indexOf('Safari') != -1;
133 this.isMac = navigator.userAgent.indexOf('Mac') != -1;
134 this.isMSIE5_0 = this.isMSIE && (navigator.userAgent.indexOf('MSIE 5.0') != -1);
135 this.action = "none";
136 this.selectedWindow = null;
137 this.lastSelectedWindow = null;
139 this.mouseDownScreenX = 0;
140 this.mouseDownScreenY = 0;
141 this.mouseDownLayerX = 0;
142 this.mouseDownLayerY = 0;
143 this.mouseDownWidth = 0;
144 this.mouseDownHeight = 0;
148 TinyMCE_Windows.prototype.init = function(settings) {
149 this.settings = settings;
152 this.addEvent(document, "mousemove", mcWindows.eventDispatcher);
154 this.addEvent(window, "mousemove", mcWindows.eventDispatcher);
156 this.addEvent(document, "mouseup", mcWindows.eventDispatcher);
158 this.addEvent(window, "resize", mcWindows.eventDispatcher);
159 this.addEvent(document, "scroll", mcWindows.eventDispatcher);
164 TinyMCE_Windows.prototype.getBounds = function() {
166 var vp = tinyMCE.getViewPort(window);
167 var top, left, bottom, right, docEl = this.doc.documentElement;
171 bottom = vp.height + top - 2;
172 right = vp.width + left - 22; // TODO this number is platform dependant
174 this.bounds = [left, top, right, bottom];
179 TinyMCE_Windows.prototype.clampBoxPosition = function(x, y, w, h, minW, minH) {
180 var bounds = this.getBounds();
182 x = Math.max(bounds[0], Math.min(bounds[2], x + w) - w);
183 y = Math.max(bounds[1], Math.min(bounds[3], y + h) - h);
185 return this.clampBoxSize(x, y, w, h, minW, minH);
188 TinyMCE_Windows.prototype.clampBoxSize = function(x, y, w, h, minW, minH) {
189 var bounds = this.getBounds();
193 Math.max(minW, Math.min(bounds[2], x + w) - x),
194 Math.max(minH, Math.min(bounds[3], y + h) - y)
198 TinyMCE_Windows.prototype.getParam = function(name, default_value) {
201 value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
204 if (value == "true" || value == "false")
205 return (value == "true");
210 TinyMCE_Windows.prototype.eventDispatcher = function(e) {
211 e = typeof(e) == "undefined" ? window.event : e;
213 if (mcWindows.selectedWindow == null)
217 if (mcWindows.isGecko && e.type == "mousedown") {
218 var elm = e.currentTarget;
220 for (var n in mcWindows.windows) {
221 var win = mcWindows.windows[n];
223 if (win.headElement == elm || win.resizeElement == elm) {
232 mcWindows.selectedWindow.onMouseMove(e);
236 mcWindows.selectedWindow.onMouseUp(e);
240 mcWindows.selectedWindow.onMouseDown(e);
244 mcWindows.selectedWindow.onFocus(e);
248 if (mcWindows.clampUpdateTimeout)
249 clearTimeout(mcWindows.clampUpdateTimeout);
250 mcWindows.clampEventType = e.type;
251 mcWindows.clampUpdateTimeout =
252 setTimeout(function () {mcWindows.updateClamping()}, 100);
257 TinyMCE_Windows.prototype.updateClamping = function () {
258 var clamp, oversize, etype = mcWindows.clampEventType;
260 this.bounds = null; // Recalc window bounds on resize/scroll
261 this.clampUpdateTimeout = null;
263 for (var n in this.windows) {
264 win = this.windows[n];
265 if (typeof(win) == 'function' || ! win.winElement) continue;
267 clamp = mcWindows.clampBoxPosition(
269 win.winElement.scrollWidth,
270 win.winElement.scrollHeight,
271 win.features.minWidth,
272 win.features.minHeight
275 clamp[2] != win.winElement.scrollWidth ||
276 clamp[3] != win.winElement.scrollHeight
279 if (!oversize || win.features.resizable == "yes" || etype != "scroll")
280 win.moveTo(clamp[0], clamp[1]);
281 if (oversize && win.features.resizable == "yes")
282 win.resizeTo(clamp[2], clamp[3]);
286 TinyMCE_Windows.prototype.addEvent = function(obj, name, handler) {
288 obj.attachEvent("on" + name, handler);
290 obj.addEventListener(name, handler, false);
293 TinyMCE_Windows.prototype.cancelEvent = function(e) {
295 e.returnValue = false;
296 e.cancelBubble = true;
301 TinyMCE_Windows.prototype.parseFeatures = function(opts) {
302 // Cleanup the options
303 opts = opts.toLowerCase();
304 opts = opts.replace(/;/g, ",");
305 opts = opts.replace(/[^0-9a-z=,]/g, "");
307 var optionChunks = opts.split(',');
308 var options = new Array();
310 options['left'] = "10";
311 options['top'] = "10";
312 options['width'] = "300";
313 options['height'] = "300";
314 options['minwidth'] = "100";
315 options['minheight'] = "100";
316 options['resizable'] = "yes";
317 options['minimizable'] = "yes";
318 options['maximizable'] = "yes";
319 options['close'] = "yes";
320 options['movable'] = "yes";
321 options['statusbar'] = "yes";
322 options['scrollbars'] = "auto";
323 options['modal'] = "no";
328 for (var i=0; i<optionChunks.length; i++) {
329 var parts = optionChunks[i].split('=');
331 if (parts.length == 2)
332 options[parts[0]] = parts[1];
335 options['left'] = parseInt(options['left']);
336 options['top'] = parseInt(options['top']);
337 options['width'] = parseInt(options['width']);
338 options['height'] = parseInt(options['height']);
339 options['minWidth'] = parseInt(options['minwidth']);
340 options['minHeight'] = parseInt(options['minheight']);
345 TinyMCE_Windows.prototype.open = function(url, name, features) {
346 this.lastSelectedWindow = this.selectedWindow;
348 var win = new TinyMCE_Window();
349 var winDiv, html = "", id;
350 var imgPath = this.getParam("images_path");
352 features = this.parseFeatures(features);
354 // Clamp specified dimensions
355 var clamp = mcWindows.clampBoxPosition(
356 features['left'], features['top'],
357 features['width'], features['height'],
358 features['minWidth'], features['minHeight']
361 features['left'] = clamp[0];
362 features['top'] = clamp[1];
364 if (features['resizable'] == "yes") {
365 features['width'] = clamp[2];
366 features['height'] = clamp[3];
370 id = "mcWindow_" + name;
371 win.deltaHeight = 18;
373 if (features['statusbar'] == "yes") {
374 win.deltaHeight += 13;
377 win.deltaHeight += 1;
380 width = parseInt(features['width']);
381 height = parseInt(features['height'])-win.deltaHeight;
386 // Setup first part of window
390 win.features = features;
391 this.windows[name] = win;
394 iframeHeight = height;
396 // Create inner content
397 html += '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
400 html += '<title>Wrapper iframe</title>';
402 // WordPress: put the window buttons on the left as in Macs
403 if (this.isMac) html += '<style type="text/css">.mceWindowTitle{float:none;margin:0;width:100%;text-align:center;}.mceWindowClose{float:none;position:absolute;left:0px;top:0px;}</style>';
405 html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
406 html += '<link href="' + this.getParam("css_file") + '" rel="stylesheet" type="text/css" />';
408 html += '<body onload="parent.mcWindows.onLoad(\'' + name + '\');">';
410 html += '<div id="' + id + '_container" class="mceWindow">';
411 html += '<div id="' + id + '_head" class="mceWindowHead" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
412 html += ' <div id="' + id + '_title" class="mceWindowTitle"';
413 html += ' onselectstart="return false;" unselectable="on" style="-moz-user-select: none !important;"></div>';
414 html += ' <div class="mceWindowHeadTools">';
415 html += ' <a href="javascript:parent.mcWindows.windows[\'' + name + '\'].close();" target="_self" onmousedown="return false;" class="mceWindowClose"><img border="0" src="' + imgPath + '/window_close.gif" /></a>';
416 if (features['resizable'] == "yes" && features['maximizable'] == "yes")
417 html += ' <a href="javascript:parent.mcWindows.windows[\'' + name + '\'].maximize();" target="_self" onmousedown="return false;" class="mceWindowMaximize"><img border="0" src="' + imgPath + '/window_maximize.gif" /></a>';
418 // html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" target="_self" onmousedown="return false;" class="mceWindowMinimize"></a>';
420 html += '</div><div id="' + id + '_body" class="mceWindowBody" style="width: ' + width + 'px; height: ' + height + 'px;">';
421 html += '<iframe id="' + id + '_iframe" name="' + id + '_iframe" frameborder="0" width="' + iframeWidth + '" height="' + iframeHeight + '" src="' + url + '" class="mceWindowBodyIframe" scrolling="' + features['scrollbars'] + '"></iframe></div>';
423 if (features['statusbar'] == "yes") {
424 html += '<div id="' + id + '_statusbar" class="mceWindowStatusbar" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
426 if (features['resizable'] == "yes") {
428 html += '<div id="' + id + '_resize" class="mceWindowResize"><div style="background-image: url(\'' + imgPath + '/window_resize.gif\'); width: 12px; height: 12px;"></div></div>';
430 html += '<div id="' + id + '_resize" class="mceWindowResize"><img onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();" border="0" src="' + imgPath + '/window_resize.gif" /></div>';
442 this.createFloatingIFrame(id, features['left'], features['top'], features['width'], features['height'], html);
445 // Blocks the document events by placing a image over the whole document
446 TinyMCE_Windows.prototype.setDocumentLock = function(state) {
447 var elm = document.getElementById('mcWindowEventBlocker');
451 elm = document.createElement("div");
453 elm.id = "mcWindowEventBlocker";
454 elm.style.position = "absolute";
455 elm.style.left = "0";
458 document.body.appendChild(elm);
461 elm.style.display = "none";
463 var imgPath = this.getParam("images_path");
464 var width = document.body.clientWidth;
465 var height = document.body.clientHeight;
467 elm.style.width = width;
468 elm.style.height = height;
469 elm.innerHTML = '<img src="' + imgPath + '/spacer.gif" width="' + width + '" height="' + height + '" />';
471 elm.style.zIndex = mcWindows.zindex-1;
472 elm.style.display = "block";
473 } else if (elm != null) {
474 if (mcWindows.windows.length == 0)
475 elm.parentNode.removeChild(elm);
477 elm.style.zIndex = mcWindows.zindex-1;
481 // Gets called when wrapper iframe is initialized
482 TinyMCE_Windows.prototype.onLoad = function(name) {
483 var win = mcWindows.windows[name];
484 var id = "mcWindow_" + name;
485 var wrapperIframe = window.frames[id + "_iframe"].frames[0];
486 var wrapperDoc = window.frames[id + "_iframe"].document;
487 var doc = window.frames[id + "_iframe"].document;
488 var winDiv = document.getElementById("mcWindow_" + name + "_div");
489 var realIframe = window.frames[id + "_iframe"].frames[0];
492 win.id = "mcWindow_" + name;
493 win.winElement = winDiv;
494 win.bodyElement = doc.getElementById(id + '_body');
495 win.iframeElement = doc.getElementById(id + '_iframe');
496 win.headElement = doc.getElementById(id + '_head');
497 win.titleElement = doc.getElementById(id + '_title');
498 win.resizeElement = doc.getElementById(id + '_resize');
499 win.containerElement = doc.getElementById(id + '_container');
500 win.left = win.features['left'];
501 win.top = win.features['top'];
502 win.frame = window.frames[id + '_iframe'].frames[0];
503 win.wrapperFrame = window.frames[id + '_iframe'];
504 win.wrapperIFrameElement = document.getElementById(id + "_iframe");
506 // Add event handlers
507 mcWindows.addEvent(win.headElement, "mousedown", mcWindows.eventDispatcher);
509 if (win.resizeElement != null)
510 mcWindows.addEvent(win.resizeElement, "mousedown", mcWindows.eventDispatcher);
512 if (mcWindows.isMSIE) {
513 mcWindows.addEvent(realIframe.document, "mousemove", mcWindows.eventDispatcher);
514 mcWindows.addEvent(realIframe.document, "mouseup", mcWindows.eventDispatcher);
516 mcWindows.addEvent(realIframe, "mousemove", mcWindows.eventDispatcher);
517 mcWindows.addEvent(realIframe, "mouseup", mcWindows.eventDispatcher);
518 mcWindows.addEvent(realIframe, "focus", mcWindows.eventDispatcher);
521 for (var i=0; i<window.frames.length; i++) {
522 if (!window.frames[i]._hasMouseHandlers) {
523 if (mcWindows.isMSIE) {
524 mcWindows.addEvent(window.frames[i].document, "mousemove", mcWindows.eventDispatcher);
525 mcWindows.addEvent(window.frames[i].document, "mouseup", mcWindows.eventDispatcher);
527 mcWindows.addEvent(window.frames[i], "mousemove", mcWindows.eventDispatcher);
528 mcWindows.addEvent(window.frames[i], "mouseup", mcWindows.eventDispatcher);
531 window.frames[i]._hasMouseHandlers = true;
535 if (mcWindows.isMSIE) {
536 mcWindows.addEvent(win.frame.document, "mousemove", mcWindows.eventDispatcher);
537 mcWindows.addEvent(win.frame.document, "mouseup", mcWindows.eventDispatcher);
539 mcWindows.addEvent(win.frame, "mousemove", mcWindows.eventDispatcher);
540 mcWindows.addEvent(win.frame, "mouseup", mcWindows.eventDispatcher);
541 mcWindows.addEvent(win.frame, "focus", mcWindows.eventDispatcher);
544 // Dispatch open window event
545 var func = this.getParam("on_open_window", "");
547 eval(func + "(win);");
551 if (win.features['modal'] == "yes")
552 mcWindows.setDocumentLock(true);
555 TinyMCE_Windows.prototype.createFloatingIFrame = function(id_prefix, left, top, width, height, html) {
556 var iframe = document.createElement("iframe");
557 var div = document.createElement("div"), doc;
559 width = parseInt(width);
560 height = parseInt(height)+1;
562 // Create wrapper div
563 div.setAttribute("id", id_prefix + "_div");
564 div.setAttribute("width", width);
565 div.setAttribute("height", (height));
566 div.style.position = "absolute";
568 div.style.left = left + "px";
569 div.style.top = top + "px";
570 div.style.width = width + "px";
571 div.style.height = (height) + "px";
572 div.style.backgroundColor = "white";
573 div.style.display = "none";
576 iframeWidth = width + 2;
577 iframeHeight = height + 2;
580 iframeHeight = height + 1;
584 iframe.setAttribute("id", id_prefix + "_iframe");
585 iframe.setAttribute("name", id_prefix + "_iframe");
586 iframe.setAttribute("border", "0");
587 iframe.setAttribute("frameBorder", "0");
588 iframe.setAttribute("marginWidth", "0");
589 iframe.setAttribute("marginHeight", "0");
590 iframe.setAttribute("leftMargin", "0");
591 iframe.setAttribute("topMargin", "0");
592 iframe.setAttribute("width", iframeWidth);
593 iframe.setAttribute("height", iframeHeight);
594 // iframe.setAttribute("src", "../jscripts/tiny_mce/blank.htm");
595 // iframe.setAttribute("allowtransparency", "false");
596 iframe.setAttribute("scrolling", "no");
597 iframe.style.width = iframeWidth + "px";
598 iframe.style.height = iframeHeight + "px";
599 iframe.style.backgroundColor = "white";
600 div.appendChild(iframe);
602 document.body.appendChild(div);
604 // Fixed MSIE 5.0 issue
605 div.innerHTML = div.innerHTML;
608 // Give Safari some time to setup
609 window.setTimeout(function() {
610 var doc = window.frames[id_prefix + '_iframe'].document;
616 doc = window.frames[id_prefix + '_iframe'].window.document;
622 div.style.display = "block";
628 function TinyMCE_Window() {
631 TinyMCE_Window.prototype.focus = function() {
632 if (this != mcWindows.selectedWindow) {
633 this.winElement.style.zIndex = ++mcWindows.zindex;
634 mcWindows.lastSelectedWindow = mcWindows.selectedWindow;
635 mcWindows.selectedWindow = this;
639 TinyMCE_Window.prototype.minimize = function() {
642 TinyMCE_Window.prototype.maximize = function() {
643 if (this.restoreSize) {
644 this.moveTo(this.restoreSize[0], this.restoreSize[1]);
645 this.resizeTo(this.restoreSize[2], this.restoreSize[3]);
646 this.updateClamping();
647 this.restoreSize = null;
649 var bounds = mcWindows.getBounds();
652 this.winElement.scrollWidth,
653 this.winElement.scrollHeight
655 this.moveTo(bounds[0], bounds[1]);
657 bounds[2] - bounds[0],
658 bounds[3] - bounds[1]
663 TinyMCE_Window.prototype.startResize = function() {
664 mcWindows.action = "resize";
667 TinyMCE_Window.prototype.startMove = function(e) {
668 mcWindows.action = "move";
671 TinyMCE_Window.prototype.close = function() {
672 if (this.frame && this.frame['tinyMCEPopup'])
673 this.frame['tinyMCEPopup'].restoreSelection();
675 if (mcWindows.lastSelectedWindow != null)
676 mcWindows.lastSelectedWindow.focus();
678 var mcWindowsNew = new Array();
679 for (var n in mcWindows.windows) {
680 var win = mcWindows.windows[n];
681 if (typeof(win) == 'function')
684 if (win.name != this.name)
685 mcWindowsNew[n] = win;
688 mcWindows.windows = mcWindowsNew;
690 // alert(mcWindows.doc.getElementById(this.id + "_iframe"));
692 var e = mcWindows.doc.getElementById(this.id + "_iframe");
693 e.parentNode.removeChild(e);
695 var e = mcWindows.doc.getElementById(this.id + "_div");
696 e.parentNode.removeChild(e);
698 mcWindows.setDocumentLock(false);
701 TinyMCE_Window.prototype.onMouseMove = function(e) {
703 // Calculate real X, Y
704 var dx = e.screenX - mcWindows.mouseDownScreenX;
705 var dy = e.screenY - mcWindows.mouseDownScreenY;
707 switch (mcWindows.action) {
709 clamp = mcWindows.clampBoxSize(
711 mcWindows.mouseDownWidth + (e.screenX - mcWindows.mouseDownScreenX),
712 mcWindows.mouseDownHeight + (e.screenY - mcWindows.mouseDownScreenY),
713 this.features.minWidth, this.features.minHeight
716 this.resizeTo(clamp[2], clamp[3]);
718 mcWindows.cancelEvent(e);
722 this.left = mcWindows.mouseDownLayerX + (e.screenX - mcWindows.mouseDownScreenX);
723 this.top = mcWindows.mouseDownLayerY + (e.screenY - mcWindows.mouseDownScreenY);
724 this.updateClamping();
726 mcWindows.cancelEvent(e);
731 TinyMCE_Window.prototype.moveTo = function (x, y) {
735 this.winElement.style.left = this.left + "px";
736 this.winElement.style.top = this.top + "px";
739 TinyMCE_Window.prototype.resizeTo = function (width, height) {
740 this.wrapperIFrameElement.style.width = (width+2) + 'px';
741 this.wrapperIFrameElement.style.height = (height+2) + 'px';
742 this.wrapperIFrameElement.width = width+2;
743 this.wrapperIFrameElement.height = height+2;
744 this.winElement.style.width = width + 'px';
745 this.winElement.style.height = height + 'px';
747 height = height - this.deltaHeight;
749 this.containerElement.style.width = width + 'px';
750 this.iframeElement.style.width = width + 'px';
751 this.iframeElement.style.height = height + 'px';
752 this.bodyElement.style.width = width + 'px';
753 this.bodyElement.style.height = height + 'px';
754 this.headElement.style.width = width + 'px';
755 //this.statusElement.style.width = width + 'px';
758 TinyMCE_Window.prototype.updateClamping = function () {
761 clamp = mcWindows.clampBoxPosition(
763 this.winElement.scrollWidth,
764 this.winElement.scrollHeight,
765 this.features.minWidth, this.features.minHeight
768 clamp[2] != this.winElement.scrollWidth ||
769 clamp[3] != this.winElement.scrollHeight
772 this.moveTo(clamp[0], clamp[1]);
773 if (this.features.resizable == "yes" && oversize)
774 this.resizeTo(clamp[2], clamp[3]);
777 function debug(msg) {
778 document.getElementById('debug').value += msg + "\n";
781 TinyMCE_Window.prototype.onMouseUp = function(e) {
782 mcWindows.action = "none";
785 TinyMCE_Window.prototype.onFocus = function(e) {
786 // Gecko only handler
787 var winRef = e.currentTarget;
789 for (var n in mcWindows.windows) {
790 var win = mcWindows.windows[n];
791 if (typeof(win) == 'function')
794 if (winRef.name == win.id + "_iframe") {
801 TinyMCE_Window.prototype.onMouseDown = function(e) {
802 var elm = mcWindows.isMSIE ? this.wrapperFrame.event.srcElement : e.target;
804 mcWindows.mouseDownScreenX = e.screenX;
805 mcWindows.mouseDownScreenY = e.screenY;
806 mcWindows.mouseDownLayerX = this.left;
807 mcWindows.mouseDownLayerY = this.top;
808 mcWindows.mouseDownWidth = parseInt(this.winElement.style.width);
809 mcWindows.mouseDownHeight = parseInt(this.winElement.style.height);
811 if (this.resizeElement != null && elm == this.resizeElement.firstChild)
816 mcWindows.cancelEvent(e);
820 var mcWindows = new TinyMCE_Windows();
822 // Initialize windows
824 images_path : tinyMCE.baseURL + "/plugins/inlinepopups/images",
825 css_file : tinyMCE.baseURL + "/plugins/inlinepopups/css/inlinepopup.css"