[ Index ]
 

Code source de WordPress 2.1.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/wp-includes/js/tinymce/plugins/inlinepopups/ -> editor_plugin.js (source)

   1  /**
   2   * $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $
   3   *
   4   * Moxiecode DHTML Windows script.
   5   *
   6   * @author Moxiecode
   7   * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
   8   */
   9  
  10  // Patch openWindow, closeWindow TinyMCE functions
  11  
  12  var TinyMCE_InlinePopupsPlugin = {
  13      getInfo : function() {
  14          return {
  15              longname : 'Inline Popups',
  16              author : 'Moxiecode Systems AB',
  17              authorurl : 'http://tinymce.moxiecode.com',
  18              infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_inlinepopups.html',
  19              version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
  20          };
  21      }
  22  };
  23  
  24  tinyMCE.addPlugin("inlinepopups", TinyMCE_InlinePopupsPlugin);
  25  
  26  // Patch openWindow, closeWindow TinyMCE functions
  27  
  28  TinyMCE_Engine.prototype.orgOpenWindow = TinyMCE_Engine.prototype.openWindow;
  29  
  30  TinyMCE_Engine.prototype.openWindow = function(template, args) {
  31      // Does the caller support inline
  32      if (args['inline'] != "yes" || tinyMCE.isOpera || tinyMCE.getParam("plugins").indexOf('inlinepopups') == -1) {
  33          mcWindows.selectedWindow = null;
  34          args['mce_inside_iframe'] = false;
  35          this.orgOpenWindow(template, args);
  36          return;
  37      }
  38  
  39      var url, resizable, scrollbars;
  40  
  41      args['mce_inside_iframe'] = true;
  42      tinyMCE.windowArgs = args;
  43  
  44      if (template['file'].charAt(0) != '/' && template['file'].indexOf('://') == -1)
  45          url = tinyMCE.baseURL + "/themes/" + tinyMCE.getParam("theme") + "/" + template['file'];
  46      else
  47          url = template['file'];
  48  
  49      if (!(width = parseInt(template['width'])))
  50          width = 320;
  51  
  52      if (!(height = parseInt(template['height'])))
  53          height = 200;
  54  
  55      resizable = (args && args['resizable']) ? args['resizable'] : "no";
  56      scrollbars = (args && args['scrollbars']) ? args['scrollbars'] : "no";
  57  
  58      height += 18;
  59  
  60      // Replace all args as variables in URL
  61      for (var name in args) {
  62          if (typeof(args[name]) == 'function')
  63              continue;
  64  
  65          url = tinyMCE.replaceVar(url, name, escape(args[name]));
  66      }
  67  
  68      var elm = document.getElementById(this.selectedInstance.editorId + '_parent');
  69      var pos = tinyMCE.getAbsPosition(elm);
  70  
  71      // Center div in editor area
  72      pos.absLeft += Math.round((elm.firstChild.clientWidth / 2) - (width / 2));
  73      pos.absTop += Math.round((elm.firstChild.clientHeight / 2) - (height / 2));
  74  
  75      url += tinyMCE.settings['imp_version'] ? (url.indexOf('?')==-1?'?':'&') + 'ver=' + tinyMCE.settings['imp_version'] : '';
  76  
  77      mcWindows.open(url, mcWindows.idCounter++, "modal=yes,width=" + width+ ",height=" + height + ",resizable=" + resizable + ",scrollbars=" + scrollbars + ",statusbar=" + resizable + ",left=" + pos.absLeft + ",top=" + pos.absTop);
  78  };
  79  
  80  TinyMCE_Engine.prototype.orgCloseWindow = TinyMCE_Engine.prototype.closeWindow;
  81  
  82  TinyMCE_Engine.prototype.closeWindow = function(win) {
  83      if (mcWindows.selectedWindow != null)
  84          mcWindows.selectedWindow.close();
  85      else
  86          this.orgCloseWindow(win);
  87  };
  88  
  89  TinyMCE_Engine.prototype.setWindowTitle = function(win_ref, title) {
  90      for (var n in mcWindows.windows) {
  91          var win = mcWindows.windows[n];
  92          if (typeof(win) == 'function')
  93              continue;
  94  
  95          if (win_ref.name == win.id + "_iframe")
  96              window.frames[win.id + "_iframe"].document.getElementById(win.id + '_title').innerHTML = title;
  97      }
  98  };
  99  
 100  // * * * * * TinyMCE_Windows classes below
 101  
 102  // Windows handler
 103  function TinyMCE_Windows() {
 104      this.settings = new Array();
 105      this.windows = new Array();
 106      this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
 107      this.isGecko = navigator.userAgent.indexOf('Gecko') != -1;
 108      this.isSafari = navigator.userAgent.indexOf('Safari') != -1;
 109      this.isMac = navigator.userAgent.indexOf('Mac') != -1;
 110      this.isMSIE5_0 = this.isMSIE && (navigator.userAgent.indexOf('MSIE 5.0') != -1);
 111      this.action = "none";
 112      this.selectedWindow = null;
 113      this.lastSelectedWindow = null;
 114      this.zindex = 100;
 115      this.mouseDownScreenX = 0;
 116      this.mouseDownScreenY = 0;
 117      this.mouseDownLayerX = 0;
 118      this.mouseDownLayerY = 0;
 119      this.mouseDownWidth = 0;
 120      this.mouseDownHeight = 0;
 121      this.idCounter = 0;
 122  };
 123  
 124  TinyMCE_Windows.prototype.init = function(settings) {
 125      this.settings = settings;
 126  
 127      if (this.isMSIE)
 128          this.addEvent(document, "mousemove", mcWindows.eventDispatcher);
 129      else
 130          this.addEvent(window, "mousemove", mcWindows.eventDispatcher);
 131  
 132      this.addEvent(document, "mouseup", mcWindows.eventDispatcher);
 133  
 134      this.doc = document;
 135  };
 136  
 137  TinyMCE_Windows.prototype.getParam = function(name, default_value) {
 138      var value = null;
 139  
 140      value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
 141  
 142      // Fix bool values
 143      if (value == "true" || value == "false")
 144          return (value == "true");
 145  
 146      return value;
 147  };
 148  
 149  TinyMCE_Windows.prototype.eventDispatcher = function(e) {
 150      e = typeof(e) == "undefined" ? window.event : e;
 151  
 152      if (mcWindows.selectedWindow == null)
 153          return;
 154  
 155      // Switch focus
 156      if (mcWindows.isGecko && e.type == "mousedown") {
 157          var elm = e.currentTarget;
 158  
 159          for (var n in mcWindows.windows) {
 160              var win = mcWindows.windows[n];
 161  
 162              if (win.headElement == elm || win.resizeElement == elm) {
 163                  win.focus();
 164                  break;
 165              }
 166          }
 167      }
 168  
 169      switch (e.type) {
 170          case "mousemove":
 171              mcWindows.selectedWindow.onMouseMove(e);
 172              break;
 173  
 174          case "mouseup":
 175              mcWindows.selectedWindow.onMouseUp(e);
 176              break;
 177  
 178          case "mousedown":
 179              mcWindows.selectedWindow.onMouseDown(e);
 180              break;
 181  
 182          case "focus":
 183              mcWindows.selectedWindow.onFocus(e);
 184              break;
 185      }
 186  };
 187  
 188  TinyMCE_Windows.prototype.addEvent = function(obj, name, handler) {
 189      if (this.isMSIE)
 190          obj.attachEvent("on" + name, handler);
 191      else
 192          obj.addEventListener(name, handler, true);
 193  };
 194  
 195  TinyMCE_Windows.prototype.cancelEvent = function(e) {
 196      if (this.isMSIE) {
 197          e.returnValue = false;
 198          e.cancelBubble = true;
 199      } else
 200          e.preventDefault();
 201  };
 202  
 203  TinyMCE_Windows.prototype.parseFeatures = function(opts) {
 204      // Cleanup the options
 205      opts = opts.toLowerCase();
 206      opts = opts.replace(/;/g, ",");
 207      opts = opts.replace(/[^0-9a-z=,]/g, "");
 208  
 209      var optionChunks = opts.split(',');
 210      var options = new Array();
 211  
 212      options['left'] = "10";
 213      options['top'] = "10";
 214      options['width'] = "300";
 215      options['height'] = "300";
 216      options['resizable'] = "yes";
 217      options['minimizable'] = "yes";
 218      options['maximizable'] = "yes";
 219      options['close'] = "yes";
 220      options['movable'] = "yes";
 221      options['statusbar'] = "yes";
 222      options['scrollbars'] = "auto";
 223      options['modal'] = "no";
 224  
 225      if (opts == "")
 226          return options;
 227  
 228      for (var i=0; i<optionChunks.length; i++) {
 229          var parts = optionChunks[i].split('=');
 230  
 231          if (parts.length == 2)
 232              options[parts[0]] = parts[1];
 233      }
 234  
 235      options['left'] = parseInt(options['left']);
 236      options['top'] = parseInt(options['top']);
 237      options['width'] = parseInt(options['width']);
 238      options['height'] = parseInt(options['height']);
 239  
 240      return options;
 241  };
 242  
 243  TinyMCE_Windows.prototype.open = function(url, name, features) {
 244      this.lastSelectedWindow = this.selectedWindow;
 245  
 246      var win = new TinyMCE_Window();
 247      var winDiv, html = "", id;
 248      var imgPath = this.getParam("images_path");
 249  
 250      features = this.parseFeatures(features);
 251  
 252      // Create div
 253      id = "mcWindow_" + name;
 254      win.deltaHeight = 18;
 255  
 256      if (features['statusbar'] == "yes") {
 257          win.deltaHeight += 13;
 258  
 259          if (this.isMSIE)
 260              win.deltaHeight += 1;
 261      }
 262  
 263      width = parseInt(features['width']);
 264      height = parseInt(features['height'])-win.deltaHeight;
 265  
 266      if (this.isMSIE)
 267          width -= 2;
 268  
 269      // Setup first part of window
 270      win.id = id;
 271      win.url = url;
 272      win.name = name;
 273      win.features = features;
 274      this.windows[name] = win;
 275  
 276      iframeWidth = width;
 277      iframeHeight = height;
 278  
 279      // Create inner content
 280      html += '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
 281      html += '<html>';
 282      html += '<head>';
 283      html += '<title>Wrapper iframe</title>';
 284      html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
 285      html += '<link href="' + this.getParam("css_file") + '" rel="stylesheet" type="text/css" />';
 286      if ( this.isMac ) html += '<style type="text/css">.mceWindowTitle{float:none;margin:0;text-align:center;}.mceWindowClose{float:none;position:absolute;left:0px;top:0px;}</style>';
 287      html += '</head>';
 288      html += '<body onload="parent.mcWindows.onLoad(\'' + name + '\');">';
 289  
 290      html += '<div id="' + id + '_container" class="mceWindow">';
 291      html += '<div id="' + id + '_head" class="mceWindowHead" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
 292      html += '  <div id="' + id + '_title" class="mceWindowTitle"';
 293      html += '  onselectstart="return false;" unselectable="on" style="-moz-user-select: none !important;"></div>';
 294      html += '    <div class="mceWindowHeadTools">';
 295      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>';
 296  //    html += '      <a href="javascript:mcWindows.windows[\'' + name + '\'].maximize();" target="_self" onmousedown="return false;" class="mceWindowMaximize"></a>';
 297  //    html += '      <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" target="_self" onmousedown="return false;" class="mceWindowMinimize"></a>';
 298      html += '    </div>';
 299      html += '</div><div id="' + id + '_body" class="mceWindowBody" style="width: ' + width + 'px; height: ' + height + 'px;">';
 300      html += '<iframe id="' + id + '_iframe" name="' + id + '_iframe" frameborder="0" width="' + iframeWidth + '" height="' + iframeHeight + '" src="' + url + '" class="mceWindowBodyIframe" scrolling="' + features['scrollbars'] + '"></iframe></div>';
 301  
 302      if (features['statusbar'] == "yes") {
 303          html += '<div id="' + id + '_statusbar" class="mceWindowStatusbar" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
 304  
 305          if (features['resizable'] == "yes") {
 306              if (this.isGecko)
 307                  html += '<div id="' + id + '_resize" class="mceWindowResize"><div style="background-image: url(\'' + imgPath + '/window_resize.gif\'); width: 12px; height: 12px;"></div></div>';
 308              else
 309                  html += '<div id="' + id + '_resize" class="mceWindowResize"><img onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();" border="0" src="' + imgPath + '/window_resize.gif" /></div>';
 310          }
 311  
 312          html += '</div>';
 313      }
 314  
 315      html += '</div>';
 316  
 317      html += '</body>';
 318      html += '</html>';
 319  
 320      // Create iframe
 321      this.createFloatingIFrame(id, features['left'], features['top'], features['width'], features['height'], html);
 322  };
 323  
 324  // Blocks the document events by placing a image over the whole document
 325  TinyMCE_Windows.prototype.setDocumentLock = function(state) {
 326      if (state) {
 327          var elm = document.getElementById('mcWindowEventBlocker');
 328          if (elm == null) {
 329              elm = document.createElement("div");
 330  
 331              elm.id = "mcWindowEventBlocker";
 332              elm.style.position = "absolute";
 333              elm.style.left = "0";
 334              elm.style.top = "0";
 335  
 336              document.body.appendChild(elm);
 337          }
 338  
 339          elm.style.display = "none";
 340  
 341          var imgPath = this.getParam("images_path");
 342          var width = document.body.clientWidth;
 343          var height = document.body.clientHeight;
 344  
 345          elm.style.width = width;
 346          elm.style.height = height;
 347          elm.innerHTML = '<img src="' + imgPath + '/spacer.gif" width="' + width + '" height="' + height + '" />';
 348  
 349          elm.style.zIndex = mcWindows.zindex-1;
 350          elm.style.display = "block";
 351      } else {
 352          var elm = document.getElementById('mcWindowEventBlocker');
 353  
 354          if (mcWindows.windows.length == 0)
 355              elm.parentNode.removeChild(elm);
 356          else
 357              elm.style.zIndex = mcWindows.zindex-1;
 358      }
 359  };
 360  
 361  // Gets called when wrapper iframe is initialized
 362  TinyMCE_Windows.prototype.onLoad = function(name) {
 363      var win = mcWindows.windows[name];
 364      var id = "mcWindow_" + name;
 365      var wrapperIframe = window.frames[id + "_iframe"].frames[0];
 366      var wrapperDoc = window.frames[id + "_iframe"].document;
 367      var doc = window.frames[id + "_iframe"].document;
 368      var winDiv = document.getElementById("mcWindow_" + name + "_div");
 369      var realIframe = window.frames[id + "_iframe"].frames[0];
 370  
 371      // Set window data
 372      win.id = "mcWindow_" + name;
 373      win.winElement = winDiv;
 374      win.bodyElement = doc.getElementById(id + '_body');
 375      win.iframeElement = doc.getElementById(id + '_iframe');
 376      win.headElement = doc.getElementById(id + '_head');
 377      win.titleElement = doc.getElementById(id + '_title');
 378      win.resizeElement = doc.getElementById(id + '_resize');
 379      win.containerElement = doc.getElementById(id + '_container');
 380      win.left = win.features['left'];
 381      win.top = win.features['top'];
 382      win.frame = window.frames[id + '_iframe'].frames[0];
 383      win.wrapperFrame = window.frames[id + '_iframe'];
 384      win.wrapperIFrameElement = document.getElementById(id + "_iframe");
 385  
 386      // Add event handlers
 387      mcWindows.addEvent(win.headElement, "mousedown", mcWindows.eventDispatcher);
 388  
 389      if (win.resizeElement != null)
 390          mcWindows.addEvent(win.resizeElement, "mousedown", mcWindows.eventDispatcher);
 391  
 392      if (mcWindows.isMSIE) {
 393          mcWindows.addEvent(realIframe.document, "mousemove", mcWindows.eventDispatcher);
 394          mcWindows.addEvent(realIframe.document, "mouseup", mcWindows.eventDispatcher);
 395      } else {
 396          mcWindows.addEvent(realIframe, "mousemove", mcWindows.eventDispatcher);
 397          mcWindows.addEvent(realIframe, "mouseup", mcWindows.eventDispatcher);
 398          mcWindows.addEvent(realIframe, "focus", mcWindows.eventDispatcher);
 399      }
 400  
 401      for (var i=0; i<window.frames.length; i++) {
 402          if (!window.frames[i]._hasMouseHandlers) {
 403              if (mcWindows.isMSIE) {
 404                  mcWindows.addEvent(window.frames[i].document, "mousemove", mcWindows.eventDispatcher);
 405                  mcWindows.addEvent(window.frames[i].document, "mouseup", mcWindows.eventDispatcher);
 406              } else {
 407                  mcWindows.addEvent(window.frames[i], "mousemove", mcWindows.eventDispatcher);
 408                  mcWindows.addEvent(window.frames[i], "mouseup", mcWindows.eventDispatcher);
 409              }
 410  
 411              window.frames[i]._hasMouseHandlers = true;
 412          }
 413      }
 414  
 415      if (mcWindows.isMSIE) {
 416          mcWindows.addEvent(win.frame.document, "mousemove", mcWindows.eventDispatcher);
 417          mcWindows.addEvent(win.frame.document, "mouseup", mcWindows.eventDispatcher);
 418      } else {
 419          mcWindows.addEvent(win.frame, "mousemove", mcWindows.eventDispatcher);
 420          mcWindows.addEvent(win.frame, "mouseup", mcWindows.eventDispatcher);
 421          mcWindows.addEvent(win.frame, "focus", mcWindows.eventDispatcher);
 422      }
 423  
 424      // Dispatch open window event
 425      var func = this.getParam("on_open_window", "");
 426      if (func != "")
 427          eval(func + "(win);");
 428  
 429      win.focus();
 430  
 431      if (win.features['modal'] == "yes")
 432          mcWindows.setDocumentLock(true);
 433  };
 434  
 435  TinyMCE_Windows.prototype.createFloatingIFrame = function(id_prefix, left, top, width, height, html) {
 436      var iframe = document.createElement("iframe");
 437      var div = document.createElement("div"), doc;
 438  
 439      width = parseInt(width);
 440      height = parseInt(height)+1;
 441  
 442      // Create wrapper div
 443      div.setAttribute("id", id_prefix + "_div");
 444      div.setAttribute("width", width);
 445      div.setAttribute("height", (height));
 446      div.style.position = "absolute";
 447      div.style.left = left + "px";
 448      div.style.top = top + "px";
 449      div.style.width = width + "px";
 450      div.style.height = (height) + "px";
 451      div.style.backgroundColor = "white";
 452      div.style.display = "none";
 453  
 454      if (this.isGecko) {
 455          iframeWidth = width + 2;
 456          iframeHeight = height + 2;
 457      } else {
 458          iframeWidth = width;
 459          iframeHeight = height + 1;
 460      }
 461  
 462      // Create iframe
 463      iframe.setAttribute("id", id_prefix + "_iframe");
 464      iframe.setAttribute("name", id_prefix + "_iframe");
 465      iframe.setAttribute("border", "0");
 466      iframe.setAttribute("frameBorder", "0");
 467      iframe.setAttribute("marginWidth", "0");
 468      iframe.setAttribute("marginHeight", "0");
 469      iframe.setAttribute("leftMargin", "0");
 470      iframe.setAttribute("topMargin", "0");
 471      iframe.setAttribute("width", iframeWidth);
 472      iframe.setAttribute("height", iframeHeight);
 473  //    iframe.setAttribute("src", "../jscripts/tiny_mce/blank.htm");
 474      // iframe.setAttribute("allowtransparency", "false");
 475      iframe.setAttribute("scrolling", "no");
 476      iframe.style.width = iframeWidth + "px";
 477      iframe.style.height = iframeHeight + "px";
 478      iframe.style.backgroundColor = "white";
 479      div.appendChild(iframe);
 480  
 481      document.body.appendChild(div);
 482  
 483      // Fixed MSIE 5.0 issue
 484      div.innerHTML = div.innerHTML;
 485  
 486      if (this.isSafari) {
 487          // Give Safari some time to setup
 488          window.setTimeout(function() {
 489              var doc = window.frames[id_prefix + '_iframe'].document;
 490              doc.open();
 491              doc.write(html);
 492              doc.close();
 493          }, 10);
 494      } else {
 495          doc = window.frames[id_prefix + '_iframe'].window.document;
 496          doc.open();
 497          doc.write(html);
 498          doc.close();
 499      }
 500  
 501      div.style.display = "block";
 502  
 503      return div;
 504  };
 505  
 506  // Window instance
 507  function TinyMCE_Window() {
 508  };
 509  
 510  TinyMCE_Window.prototype.focus = function() {
 511      if (this != mcWindows.selectedWindow) {
 512          this.winElement.style.zIndex = ++mcWindows.zindex;
 513          mcWindows.lastSelectedWindow = mcWindows.selectedWindow;
 514          mcWindows.selectedWindow = this;
 515      }
 516  };
 517  
 518  TinyMCE_Window.prototype.minimize = function() {
 519  };
 520  
 521  TinyMCE_Window.prototype.maximize = function() {
 522      
 523  };
 524  
 525  TinyMCE_Window.prototype.startResize = function() {
 526      mcWindows.action = "resize";
 527  };
 528  
 529  TinyMCE_Window.prototype.startMove = function(e) {
 530      mcWindows.action = "move";
 531  };
 532  
 533  TinyMCE_Window.prototype.close = function() {
 534      if (this.frame && this.frame['tinyMCEPopup'])
 535          this.frame['tinyMCEPopup'].restoreSelection();
 536  
 537      if (mcWindows.lastSelectedWindow != null)
 538          mcWindows.lastSelectedWindow.focus();
 539  
 540      var mcWindowsNew = new Array();
 541      for (var n in mcWindows.windows) {
 542          var win = mcWindows.windows[n];
 543          if (typeof(win) == 'function')
 544              continue;
 545  
 546          if (win.name != this.name)
 547              mcWindowsNew[n] = win;
 548      }
 549  
 550      mcWindows.windows = mcWindowsNew;
 551  
 552  //    alert(mcWindows.doc.getElementById(this.id + "_iframe"));
 553  
 554      var e = mcWindows.doc.getElementById(this.id + "_iframe");
 555      e.parentNode.removeChild(e);
 556  
 557      var e = mcWindows.doc.getElementById(this.id + "_div");
 558      e.parentNode.removeChild(e);
 559  
 560      mcWindows.setDocumentLock(false);
 561  
 562      tinyMCE.selectedInstance.getWin().focus();
 563  };
 564  
 565  TinyMCE_Window.prototype.onMouseMove = function(e) {
 566      var scrollX = 0;//this.doc.body.scrollLeft;
 567      var scrollY = 0;//this.doc.body.scrollTop;
 568  
 569      // Calculate real X, Y
 570      var dx = e.screenX - mcWindows.mouseDownScreenX;
 571      var dy = e.screenY - mcWindows.mouseDownScreenY;
 572  
 573      switch (mcWindows.action) {
 574          case "resize":
 575              width = mcWindows.mouseDownWidth + (e.screenX - mcWindows.mouseDownScreenX);
 576              height = mcWindows.mouseDownHeight + (e.screenY - mcWindows.mouseDownScreenY);
 577  
 578              width = width < 100 ? 100 : width;
 579              height = height < 100 ? 100 : height;
 580  
 581              this.wrapperIFrameElement.style.width = width+2;
 582              this.wrapperIFrameElement.style.height = height+2;
 583              this.wrapperIFrameElement.width = width+2;
 584              this.wrapperIFrameElement.height = height+2;
 585              this.winElement.style.width = width;
 586              this.winElement.style.height = height;
 587  
 588              height = height - this.deltaHeight;
 589  
 590              this.containerElement.style.width = width;
 591  
 592              this.iframeElement.style.width = width;
 593              this.iframeElement.style.height = height;
 594              this.bodyElement.style.width = width;
 595              this.bodyElement.style.height = height;
 596              this.headElement.style.width = width;
 597              //this.statusElement.style.width = width;
 598  
 599              mcWindows.cancelEvent(e);
 600              break;
 601  
 602          case "move":
 603              this.left = mcWindows.mouseDownLayerX + (e.screenX - mcWindows.mouseDownScreenX);
 604              this.top = mcWindows.mouseDownLayerY + (e.screenY - mcWindows.mouseDownScreenY);
 605              this.winElement.style.left = this.left + "px";
 606              this.winElement.style.top = this.top + "px";
 607  
 608              mcWindows.cancelEvent(e);
 609              break;
 610      }
 611  };
 612  
 613  function debug(msg) {
 614      document.getElementById('debug').value += msg + "\n";
 615  }
 616  
 617  TinyMCE_Window.prototype.onMouseUp = function(e) {
 618      mcWindows.action = "none";
 619  };
 620  
 621  TinyMCE_Window.prototype.onFocus = function(e) {
 622      // Gecko only handler
 623      var winRef = e.currentTarget;
 624  
 625      for (var n in mcWindows.windows) {
 626          var win = mcWindows.windows[n];
 627          if (typeof(win) == 'function')
 628              continue;
 629  
 630          if (winRef.name == win.id + "_iframe") {
 631              win.focus();
 632              return;
 633          }
 634      }
 635  };
 636  
 637  TinyMCE_Window.prototype.onMouseDown = function(e) {
 638      var elm = mcWindows.isMSIE ? this.wrapperFrame.event.srcElement : e.target;
 639  
 640      var scrollX = 0;//this.doc.body.scrollLeft;
 641      var scrollY = 0;//this.doc.body.scrollTop;
 642  
 643      mcWindows.mouseDownScreenX = e.screenX;
 644      mcWindows.mouseDownScreenY = e.screenY;
 645      mcWindows.mouseDownLayerX = this.left;
 646      mcWindows.mouseDownLayerY = this.top;
 647      mcWindows.mouseDownWidth = parseInt(this.winElement.style.width);
 648      mcWindows.mouseDownHeight = parseInt(this.winElement.style.height);
 649  
 650      if (this.resizeElement != null && elm == this.resizeElement.firstChild)
 651          this.startResize(e);
 652      else
 653          this.startMove(e);
 654  
 655      mcWindows.cancelEvent(e);
 656  };
 657  
 658  // Global instance
 659  var mcWindows = new TinyMCE_Windows();
 660  
 661  // Initialize windows
 662  mcWindows.init({
 663      images_path : tinyMCE.baseURL + "/plugins/inlinepopups/images",
 664      css_file : tinyMCE.baseURL + "/plugins/inlinepopups/css/inlinepopup.css"
 665  });


Généré le : Fri Mar 30 19:41:27 2007 par Balluche grâce à PHPXref 0.7