Changeset 1611 for trunk/template-common


Ignore:
Timestamp:
Nov 17, 2006, 5:20:07 AM (18 years ago)
Author:
rvelices
Message:

fix: phpWGOpenWindow was not working because of popup blocker in IE and FF if
the image was not in the cache

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/template-common/scripts.js

    r1505 r1611  
    11function SelectAll( formulaire )
    22{
    3 len = formulaire.elements.length;
     3var len = formulaire.elements.length;
    44var i=0;
    55for( i = 0; i < len; i++)
     
    1515function DeselectAll( formulaire )
    1616{
    17 len = formulaire.elements.length;
     17var len = formulaire.elements.length;
    1818var i=0;
    1919for( i = 0; i < len; i++)
     
    2929function Inverser( formulaire )
    3030{
    31 len = formulaire.elements.length;
     31var len = formulaire.elements.length;
    3232var i=0;
    3333for( i=0; i<len; i++)
     
    4141}
    4242
    43 function verifieAndOpen()
     43function phpWGOpenWindow(theURL,winName,features)
    4444{
    45   var ok=1;
    46   if (!img.complete)
     45  img = new Image();
     46  img.src = theURL;
     47  if (img.complete)
    4748  {
    48     // sometime the image loading is not complete
    49     // especially with KHTML and Opera
    50     setTimeout("verifieAndOpen()",200)
     49    var width=img.width +40;
     50    var height=img.height +40;
    5151  }
    5252  else
    5353  {
    54   /* give more space for scrollbars (10 for FF, 40 for IE) */
    55     width=img.width +40;
    56     height=img.height +40;
    57     window.open(owURL,owName,owFeatures  + ',width=' + width + ',height=' + height);
     54    var width=640;
     55    var height=480;
     56    img.onload = resizeWindowToFit;
    5857  }
     58  newWin = window.open(theURL,winName,features+',left=2,top=1,width=' + width + ',height=' + height);
    5959}
    6060
    61 function phpWGOpenWindow(theURL,winName,features)
     61function resizeWindowToFit()
    6262{
    63   img = new Image()
    64   img.src = theURL;
    65   owURL=theURL;
    66   owName=winName;
    67   owFeatures=features;
    68   verifieAndOpen();
     63  newWin.resizeTo( img.width+50, img.height+100);
    6964}
    7065
Note: See TracChangeset for help on using the changeset viewer.