diff options
author | rvelices <rv-github@modusoptimus.com> | 2006-11-17 04:20:07 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2006-11-17 04:20:07 +0000 |
commit | 57ee203e29d521931a152b413ad3acc0db555197 (patch) | |
tree | e9d55df8938f3c3603273ba377bf125fb6c0755a | |
parent | 31e312028ca8a8a546558e21a2aa899f708386f5 (diff) |
fix: phpWGOpenWindow was not working because of popup blocker in IE and FF if
the image was not in the cache
git-svn-id: http://piwigo.org/svn/trunk@1611 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | template-common/scripts.js | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/template-common/scripts.js b/template-common/scripts.js index a96775ce4..83f4815e7 100644 --- a/template-common/scripts.js +++ b/template-common/scripts.js @@ -1,6 +1,6 @@ function SelectAll( formulaire ) { -len = formulaire.elements.length; +var len = formulaire.elements.length; var i=0; for( i = 0; i < len; i++) { @@ -14,7 +14,7 @@ for( i = 0; i < len; i++) function DeselectAll( formulaire ) { -len = formulaire.elements.length; +var len = formulaire.elements.length; var i=0; for( i = 0; i < len; i++) { @@ -28,7 +28,7 @@ for( i = 0; i < len; i++) function Inverser( formulaire ) { -len = formulaire.elements.length; +var len = formulaire.elements.length; var i=0; for( i=0; i<len; i++) { @@ -40,32 +40,27 @@ for( i=0; i<len; i++) } } -function verifieAndOpen() +function phpWGOpenWindow(theURL,winName,features) { - var ok=1; - if (!img.complete) + img = new Image(); + img.src = theURL; + if (img.complete) { - // sometime the image loading is not complete - // especially with KHTML and Opera - setTimeout("verifieAndOpen()",200) + var width=img.width +40; + var height=img.height +40; } else { - /* give more space for scrollbars (10 for FF, 40 for IE) */ - width=img.width +40; - height=img.height +40; - window.open(owURL,owName,owFeatures + ',width=' + width + ',height=' + height); + var width=640; + var height=480; + img.onload = resizeWindowToFit; } + newWin = window.open(theURL,winName,features+',left=2,top=1,width=' + width + ',height=' + height); } -function phpWGOpenWindow(theURL,winName,features) +function resizeWindowToFit() { - img = new Image() - img.src = theURL; - owURL=theURL; - owName=winName; - owFeatures=features; - verifieAndOpen(); + newWin.resizeTo( img.width+50, img.height+100); } function popuphelp(url) |