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 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 );
89 TinyMCE_Engine.prototype.closeWindow = function(win) {
90 var gotit = false, n, w;
92 for (n in mcWindows.windows) {
93 w = mcWindows.windows[n];
95 if (typeof(w) == 'function')
98 if (win.name == w.id + '_iframe') {
105 this.orgCloseWindow(win);
107 tinyMCE.selectedInstance.getWin().focus();
110 TinyMCE_Engine.prototype.setWindowTitle = function(win_ref, title) {
111 for (var n in mcWindows.windows) {
112 var win = mcWindows.windows[n];
113 if (typeof(win) == 'function')
116 if (win_ref.name == win.id + "_iframe")
117 window.frames[win.id + "_iframe"].document.getElementById(win.id + '_title').innerHTML = title;
121 // * * * * * TinyMCE_Windows classes below
124 function TinyMCE_Windows() {
125 this.settings = new Array();
126 this.windows = new Array();
127 this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
128 this.isGecko = navigator.userAgent.indexOf('Gecko') != -1;
129 this.isSafari = navigator.userAgent.indexOf('Safari') != -1;
130 this.isMac = navigator.userAgent.indexOf('Mac') != -1;
131 this.isMSIE5_0 = this.isMSIE && (navigator.userAgent.indexOf('MSIE 5.0') != -1);
132 this.action = "none";
133 this.selectedWindow = null;
134 this.lastSelectedWindow = null;
136 this.mouseDownScreenX = 0;
137 this.mouseDownScreenY = 0;
138 this.mouseDownLayerX = 0;
139 this.mouseDownLayerY = 0;
140 this.mouseDownWidth = 0;
141 this.mouseDownHeight = 0;
145 TinyMCE_Windows.prototype.init = function(settings) {
146 this.settings = settings;
149 this.addEvent(document, "mousemove", mcWindows.eventDispatcher);
151 this.addEvent(window, "mousemove", mcWindows.eventDispatcher);
153 this.addEvent(document, "mouseup", mcWindows.eventDispatcher);
155 this.addEvent(window, "resize", mcWindows.eventDispatcher);
156 this.addEvent(document, "scroll", mcWindows.eventDispatcher);
161 TinyMCE_Windows.prototype.getBounds = function() {
163 var vp = tinyMCE.getViewPort(window);
164 var top, left, bottom, right, docEl = this.doc.documentElement;
168 bottom = vp.height + top - 2;
169 right = vp.width + left - 22; // TODO this number is platform dependant
171 this.bounds = [left, top, right, bottom];
176 TinyMCE_Windows.prototype.clampBoxPosition = function(x, y, w, h, minW, minH) {
177 var bounds = this.getBounds();
179 x = Math.max(bounds[0], Math.min(bounds[2], x + w) - w);
180 y = Math.max(bounds[1], Math.min(bounds[3], y + h) - h);
182 return this.clampBoxSize(x, y, w, h, minW, minH);
185 TinyMCE_Windows.prototype.clampBoxSize = function(x, y, w, h, minW, minH) {
186 var bounds = this.getBounds();
190 Math.max(minW, Math.min(bounds[2], x + w) - x),
191 Math.max(minH, Math.min(bounds[3], y + h) - y)
195 TinyMCE_Windows.prototype.getParam = function(name, default_value) {
198 value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
201 if (value == "true" || value == "false")
202 return (value == "true");
207 TinyMCE_Windows.prototype.eventDispatcher = function(e) {
208 e = typeof(e) == "undefined" ? window.event : e;
210 if (mcWindows.selectedWindow == null)
214 if (mcWindows.isGecko && e.type == "mousedown") {
215 var elm = e.currentTarget;
217 for (var n in mcWindows.windows) {
218 var win = mcWindows.windows[n];
220 if (win.headElement == elm || win.resizeElement == elm) {
229 mcWindows.selectedWindow.onMouseMove(e);
233 mcWindows.selectedWindow.onMouseUp(e);
237 mcWindows.selectedWindow.onMouseDown(e);
241 mcWindows.selectedWindow.onFocus(e);
245 if (mcWindows.clampUpdateTimeout)
246 clearTimeout(mcWindows.clampUpdateTimeout);
247 mcWindows.clampEventType = e.type;
248 mcWindows.clampUpdateTimeout =
249 setTimeout(function () {mcWindows.updateClamping()}, 100);
254 TinyMCE_Windows.prototype.updateClamping = function () {
255 var clamp, oversize, etype = mcWindows.clampEventType;
257 this.bounds = null; // Recalc window bounds on resize/scroll
258 this.clampUpdateTimeout = null;
260 for (var n in this.windows) {
261 win = this.windows[n];
262 if (typeof(win) == 'function' || ! win.winElement) continue;
264 clamp = mcWindows.clampBoxPosition(
266 win.winElement.scrollWidth,
267 win.winElement.scrollHeight,
268 win.features.minWidth,
269 win.features.minHeight
272 clamp[2] != win.winElement.scrollWidth ||
273 clamp[3] != win.winElement.scrollHeight
276 if (!oversize || win.features.resizable == "yes" || etype != "scroll")
277 win.moveTo(clamp[0], clamp[1]);
278 if (oversize && win.features.resizable == "yes")
279 win.resizeTo(clamp[2], clamp[3]);
283 TinyMCE_Windows.prototype.addEvent = function(obj, name, handler) {
285 obj.attachEvent("on" + name, handler);
287 obj.addEventListener(name, handler, false);
290 TinyMCE_Windows.prototype.cancelEvent = function(e) {
292 e.returnValue = false;
293 e.cancelBubble = true;
298 TinyMCE_Windows.prototype.parseFeatures = function(opts) {
299 // Cleanup the options
300 opts = opts.toLowerCase();
301 opts = opts.replace(/;/g, ",");
302 opts = opts.replace(/[^0-9a-z=,]/g, "");
304 var optionChunks = opts.split(',');
305 var options = new Array();
307 options['left'] = "10";
308 options['top'] = "10";
309 options['width'] = "300";
310 options['height'] = "300";
311 options['minwidth'] = "100";
312 options['minheight'] = "100";
313 options['resizable'] = "yes";
314 options['minimizable'] = "yes";
315 options['maximizable'] = "yes";
316 options['close'] = "yes";
317 options['movable'] = "yes";
318 options['statusbar'] = "yes";
319 options['scrollbars'] = "auto";
320 options['modal'] = "no";
325 for (var i=0; i<optionChunks.length; i++) {
326 var parts = optionChunks[i].split('=');
328 if (parts.length == 2)
329 options[parts[0]] = parts[1];
332 options['left'] = parseInt(options['left']);
333 options['top'] = parseInt(options['top']);
334 options['width'] = parseInt(options['width']);
335 options['height'] = parseInt(options['height']);
336 options['minWidth'] = parseInt(options['minwidth']);
337 options['minHeight'] = parseInt(options['minheight']);
342 TinyMCE_Windows.prototype.open = function(url, name, features) {
343 this.lastSelectedWindow = this.selectedWindow;
345 var win = new TinyMCE_Window();
346 var winDiv, html = "", id;
347 var imgPath = this.getParam("images_path");
349 features = this.parseFeatures(features);
351 // Clamp specified dimensions
352 var clamp = mcWindows.clampBoxPosition(
353 features['left'], features['top'],
354 features['width'], features['height'],
355 features['minWidth'], features['minHeight']
358 features['left'] = clamp[0];
359 features['top'] = clamp[1];
361 if (features['resizable'] == "yes") {
362 features['width'] = clamp[2];
363 features['height'] = clamp[3];
367 id = "mcWindow_" + name;
368 win.deltaHeight = 18;
370 if (features['statusbar'] == "yes") {
371 win.deltaHeight += 13;
374 win.deltaHeight += 1;
377 width = parseInt(features['width']);
378 height = parseInt(features['height'])-win.deltaHeight;
383 // Setup first part of window
387 win.features = features;
388 this.windows[name] = win;
391 iframeHeight = height;
393 // Create inner content
394 html += '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
397 html += '<title>Wrapper iframe</title>';
398 html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
399 html += '<link href="' + this.getParam("css_file") + '" rel="stylesheet" type="text/css" />';
401 html += '<body onload="parent.mcWindows.onLoad(\'' + name + '\');">';
403 html += '<div id="' + id + '_container" class="mceWindow">';
404 html += '<div id="' + id + '_head" class="mceWindowHead" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
405 html += ' <div id="' + id + '_title" class="mceWindowTitle"';
406 html += ' onselectstart="return false;" unselectable="on" style="-moz-user-select: none !important;"></div>';
407 html += ' <div class="mceWindowHeadTools">';
408 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>';
409 if (features['resizable'] == "yes" && features['maximizable'] == "yes")
410 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>';
411 // html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" target="_self" onmousedown="return false;" class="mceWindowMinimize"></a>';
413 html += '</div><div id="' + id + '_body" class="mceWindowBody" style="width: ' + width + 'px; height: ' + height + 'px;">';
414 html += '<iframe id="' + id + '_iframe" name="' + id + '_iframe" frameborder="0" width="' + iframeWidth + '" height="' + iframeHeight + '" src="' + url + '" class="mceWindowBodyIframe" scrolling="' + features['scrollbars'] + '"></iframe></div>';
416 if (features['statusbar'] == "yes") {
417 html += '<div id="' + id + '_statusbar" class="mceWindowStatusbar" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
419 if (features['resizable'] == "yes") {
421 html += '<div id="' + id + '_resize" class="mceWindowResize"><div style="background-image: url(\'' + imgPath + '/window_resize.gif\'); width: 12px; height: 12px;"></div></div>';
423 html += '<div id="' + id + '_resize" class="mceWindowResize"><img onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();" border="0" src="' + imgPath + '/window_resize.gif" /></div>';
435 this.createFloatingIFrame(id, features['left'], features['top'], features['width'], features['height'], html);
438 // Blocks the document events by placing a image over the whole document
439 TinyMCE_Windows.prototype.setDocumentLock = function(state) {
440 var elm = document.getElementById('mcWindowEventBlocker');
444 elm = document.createElement("div");
446 elm.id = "mcWindowEventBlocker";
447 elm.style.position = "absolute";
448 elm.style.left = "0";
451 document.body.appendChild(elm);
454 elm.style.display = "none";
456 var imgPath = this.getParam("images_path");
457 var width = document.body.clientWidth;
458 var height = document.body.clientHeight;
460 elm.style.width = width;
461 elm.style.height = height;
462 elm.innerHTML = '<img src="' + imgPath + '/spacer.gif" width="' + width + '" height="' + height + '" />';
464 elm.style.zIndex = mcWindows.zindex-1;
465 elm.style.display = "block";
466 } else if (elm != null) {
467 if (mcWindows.windows.length == 0)
468 elm.parentNode.removeChild(elm);
470 elm.style.zIndex = mcWindows.zindex-1;
474 // Gets called when wrapper iframe is initialized
475 TinyMCE_Windows.prototype.onLoad = function(name) {
476 var win = mcWindows.windows[name];
477 var id = "mcWindow_" + name;
478 var wrapperIframe = window.frames[id + "_iframe"].frames[0];
479 var wrapperDoc = window.frames[id + "_iframe"].document;
480 var doc = window.frames[id + "_iframe"].document;
481 var winDiv = document.getElementById("mcWindow_" + name + "_div");
482 var realIframe = window.frames[id + "_iframe"].frames[0];
485 win.id = "mcWindow_" + name;
486 win.winElement = winDiv;
487 win.bodyElement = doc.getElementById(id + '_body');
488 win.iframeElement = doc.getElementById(id + '_iframe');
489 win.headElement = doc.getElementById(id + '_head');
490 win.titleElement = doc.getElementById(id + '_title');
491 win.resizeElement = doc.getElementById(id + '_resize');
492 win.containerElement = doc.getElementById(id + '_container');
493 win.left = win.features['left'];
494 win.top = win.features['top'];
495 win.frame = window.frames[id + '_iframe'].frames[0];
496 win.wrapperFrame = window.frames[id + '_iframe'];
497 win.wrapperIFrameElement = document.getElementById(id + "_iframe");
499 // Add event handlers
500 mcWindows.addEvent(win.headElement, "mousedown", mcWindows.eventDispatcher);
502 if (win.resizeElement != null)
503 mcWindows.addEvent(win.resizeElement, "mousedown", mcWindows.eventDispatcher);
505 if (mcWindows.isMSIE) {
506 mcWindows.addEvent(realIframe.document, "mousemove", mcWindows.eventDispatcher);
507 mcWindows.addEvent(realIframe.document, "mouseup", mcWindows.eventDispatcher);
509 mcWindows.addEvent(realIframe, "mousemove", mcWindows.eventDispatcher);
510 mcWindows.addEvent(realIframe, "mouseup", mcWindows.eventDispatcher);
511 mcWindows.addEvent(realIframe, "focus", mcWindows.eventDispatcher);
514 for (var i=0; i<window.frames.length; i++) {
515 if (!window.frames[i]._hasMouseHandlers) {
516 if (mcWindows.isMSIE) {
517 mcWindows.addEvent(window.frames[i].document, "mousemove", mcWindows.eventDispatcher);
518 mcWindows.addEvent(window.frames[i].document, "mouseup", mcWindows.eventDispatcher);
520 mcWindows.addEvent(window.frames[i], "mousemove", mcWindows.eventDispatcher);
521 mcWindows.addEvent(window.frames[i], "mouseup", mcWindows.eventDispatcher);
524 window.frames[i]._hasMouseHandlers = true;
528 if (mcWindows.isMSIE) {
529 mcWindows.addEvent(win.frame.document, "mousemove", mcWindows.eventDispatcher);
530 mcWindows.addEvent(win.frame.document, "mouseup", mcWindows.eventDispatcher);
532 mcWindows.addEvent(win.frame, "mousemove", mcWindows.eventDispatcher);
533 mcWindows.addEvent(win.frame, "mouseup", mcWindows.eventDispatcher);
534 mcWindows.addEvent(win.frame, "focus", mcWindows.eventDispatcher);
537 // Dispatch open window event
538 var func = this.getParam("on_open_window", "");
540 eval(func + "(win);");
544 if (win.features['modal'] == "yes")
545 mcWindows.setDocumentLock(true);
548 TinyMCE_Windows.prototype.createFloatingIFrame = function(id_prefix, left, top, width, height, html) {
549 var iframe = document.createElement("iframe");
550 var div = document.createElement("div"), doc;
552 width = parseInt(width);
553 height = parseInt(height)+1;
555 // Create wrapper div
556 div.setAttribute("id", id_prefix + "_div");
557 div.setAttribute("width", width);
558 div.setAttribute("height", (height));
559 div.style.position = "absolute";
561 div.style.left = left + "px";
562 div.style.top = top + "px";
563 div.style.width = width + "px";
564 div.style.height = (height) + "px";
565 div.style.backgroundColor = "white";
566 div.style.display = "none";
569 iframeWidth = width + 2;
570 iframeHeight = height + 2;
573 iframeHeight = height + 1;
577 iframe.setAttribute("id", id_prefix + "_iframe");
578 iframe.setAttribute("name", id_prefix + "_iframe");
579 iframe.setAttribute("border", "0");
580 iframe.setAttribute("frameBorder", "0");
581 iframe.setAttribute("marginWidth", "0");
582 iframe.setAttribute("marginHeight", "0");
583 iframe.setAttribute("leftMargin", "0");
584 iframe.setAttribute("topMargin", "0");
585 iframe.setAttribute("width", iframeWidth);
586 iframe.setAttribute("height", iframeHeight);
587 // iframe.setAttribute("src", "../jscripts/tiny_mce/blank.htm");
588 // iframe.setAttribute("allowtransparency", "false");
589 iframe.setAttribute("scrolling", "no");
590 iframe.style.width = iframeWidth + "px";
591 iframe.style.height = iframeHeight + "px";
592 iframe.style.backgroundColor = "white";
593 div.appendChild(iframe);
595 document.body.appendChild(div);
597 // Fixed MSIE 5.0 issue
598 div.innerHTML = div.innerHTML;
601 // Give Safari some time to setup
602 window.setTimeout(function() {
603 var doc = window.frames[id_prefix + '_iframe'].document;
609 doc = window.frames[id_prefix + '_iframe'].window.document;
615 div.style.display = "block";
621 function TinyMCE_Window() {
624 TinyMCE_Window.prototype.focus = function() {
625 if (this != mcWindows.selectedWindow) {
626 this.winElement.style.zIndex = ++mcWindows.zindex;
627 mcWindows.lastSelectedWindow = mcWindows.selectedWindow;
628 mcWindows.selectedWindow = this;
632 TinyMCE_Window.prototype.minimize = function() {
635 TinyMCE_Window.prototype.maximize = function() {
636 if (this.restoreSize) {
637 this.moveTo(this.restoreSize[0], this.restoreSize[1]);
638 this.resizeTo(this.restoreSize[2], this.restoreSize[3]);
639 this.updateClamping();
640 this.restoreSize = null;
642 var bounds = mcWindows.getBounds();
645 this.winElement.scrollWidth,
646 this.winElement.scrollHeight
648 this.moveTo(bounds[0], bounds[1]);
650 bounds[2] - bounds[0],
651 bounds[3] - bounds[1]
656 TinyMCE_Window.prototype.startResize = function() {
657 mcWindows.action = "resize";
660 TinyMCE_Window.prototype.startMove = function(e) {
661 mcWindows.action = "move";
664 TinyMCE_Window.prototype.close = function() {
665 if (this.frame && this.frame['tinyMCEPopup'])
666 this.frame['tinyMCEPopup'].restoreSelection();
668 if (mcWindows.lastSelectedWindow != null)
669 mcWindows.lastSelectedWindow.focus();
671 var mcWindowsNew = new Array();
672 for (var n in mcWindows.windows) {
673 var win = mcWindows.windows[n];
674 if (typeof(win) == 'function')
677 if (win.name != this.name)
678 mcWindowsNew[n] = win;
681 mcWindows.windows = mcWindowsNew;
683 // alert(mcWindows.doc.getElementById(this.id + "_iframe"));
685 var e = mcWindows.doc.getElementById(this.id + "_iframe");
686 e.parentNode.removeChild(e);
688 var e = mcWindows.doc.getElementById(this.id + "_div");
689 e.parentNode.removeChild(e);
691 mcWindows.setDocumentLock(false);
694 TinyMCE_Window.prototype.onMouseMove = function(e) {
696 // Calculate real X, Y
697 var dx = e.screenX - mcWindows.mouseDownScreenX;
698 var dy = e.screenY - mcWindows.mouseDownScreenY;
700 switch (mcWindows.action) {
702 clamp = mcWindows.clampBoxSize(
704 mcWindows.mouseDownWidth + (e.screenX - mcWindows.mouseDownScreenX),
705 mcWindows.mouseDownHeight + (e.screenY - mcWindows.mouseDownScreenY),
706 this.features.minWidth, this.features.minHeight
709 this.resizeTo(clamp[2], clamp[3]);
711 mcWindows.cancelEvent(e);
715 this.left = mcWindows.mouseDownLayerX + (e.screenX - mcWindows.mouseDownScreenX);
716 this.top = mcWindows.mouseDownLayerY + (e.screenY - mcWindows.mouseDownScreenY);
717 this.updateClamping();
719 mcWindows.cancelEvent(e);
724 TinyMCE_Window.prototype.moveTo = function (x, y) {
728 this.winElement.style.left = this.left + "px";
729 this.winElement.style.top = this.top + "px";
732 TinyMCE_Window.prototype.resizeTo = function (width, height) {
733 this.wrapperIFrameElement.style.width = (width+2) + 'px';
734 this.wrapperIFrameElement.style.height = (height+2) + 'px';
735 this.wrapperIFrameElement.width = width+2;
736 this.wrapperIFrameElement.height = height+2;
737 this.winElement.style.width = width + 'px';
738 this.winElement.style.height = height + 'px';
740 height = height - this.deltaHeight;
742 this.containerElement.style.width = width + 'px';
743 this.iframeElement.style.width = width + 'px';
744 this.iframeElement.style.height = height + 'px';
745 this.bodyElement.style.width = width + 'px';
746 this.bodyElement.style.height = height + 'px';
747 this.headElement.style.width = width + 'px';
748 //this.statusElement.style.width = width + 'px';
751 TinyMCE_Window.prototype.updateClamping = function () {
754 clamp = mcWindows.clampBoxPosition(
756 this.winElement.scrollWidth,
757 this.winElement.scrollHeight,
758 this.features.minWidth, this.features.minHeight
761 clamp[2] != this.winElement.scrollWidth ||
762 clamp[3] != this.winElement.scrollHeight
765 this.moveTo(clamp[0], clamp[1]);
766 if (this.features.resizable == "yes" && oversize)
767 this.resizeTo(clamp[2], clamp[3]);
770 function debug(msg) {
771 document.getElementById('debug').value += msg + "\n";
774 TinyMCE_Window.prototype.onMouseUp = function(e) {
775 mcWindows.action = "none";
778 TinyMCE_Window.prototype.onFocus = function(e) {
779 // Gecko only handler
780 var winRef = e.currentTarget;
782 for (var n in mcWindows.windows) {
783 var win = mcWindows.windows[n];
784 if (typeof(win) == 'function')
787 if (winRef.name == win.id + "_iframe") {
794 TinyMCE_Window.prototype.onMouseDown = function(e) {
795 var elm = mcWindows.isMSIE ? this.wrapperFrame.event.srcElement : e.target;
797 mcWindows.mouseDownScreenX = e.screenX;
798 mcWindows.mouseDownScreenY = e.screenY;
799 mcWindows.mouseDownLayerX = this.left;
800 mcWindows.mouseDownLayerY = this.top;
801 mcWindows.mouseDownWidth = parseInt(this.winElement.style.width);
802 mcWindows.mouseDownHeight = parseInt(this.winElement.style.height);
804 if (this.resizeElement != null && elm == this.resizeElement.firstChild)
809 mcWindows.cancelEvent(e);
813 var mcWindows = new TinyMCE_Windows();
815 // Initialize windows
817 images_path : tinyMCE.baseURL + "/plugins/inlinepopups/images",
818 css_file : tinyMCE.baseURL + "/plugins/inlinepopups/css/inlinepopup.css"