coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: menachem on February 01, 2007, 10:42:25 PM

Title: Fullsize picture resizes Firefox window
Post by: menachem on February 01, 2007, 10:42:25 PM
Hello,

I did some searches on the forum but didn't find this issue, so here it goes.

I am running Coppermine 1.4.10.

I have firefox setup to open links and popups in new tabs, so when I click on the intermediate sized picture to get the full size picture it opens up in a new tab instead of in a popup window. When the fullsize picture is opened in a new tab, it resizes my whole Firefox window (the height is made smaller on the top and bottom of the window). If I click on a second image to see the fullsize picture, it once again gets smaller by the same amount.

[You can try it out here (http://www.shapiro-clan.com/album/displayimage.php?album=6&pos=43) if you need to see what I am talking about].

Is there a way to make the fullsize picture not resize the window when it is opened?

Thanks,
Menachem
Title: Re: Fullsize picture resizes Firefox window
Post by: Nibbler on February 01, 2007, 10:47:04 PM
Modify the adjust_popup() function in scripts.js. Either alter it to suit you or nullify it

function adjust_popup() {}
Title: Re: Fullsize picture resizes Firefox window
Post by: menachem on February 01, 2007, 11:31:06 PM
Quote from: Nibbler on February 01, 2007, 10:47:04 PM
Modify the adjust_popup() function in scripts.js. Either alter it to suit you or nullify it

function adjust_popup() {}

Thank you very much. I was able to get it to work by commenting out the following lines in adjust_popup():
window.resizeTo(fixedW, fixedH);
window.resizeTo(w,h);
window.moveTo((screen.availWidth-w)/2, (screen.availHeight-h)/2);

Is there a way to set it up so that the popup is still adjusted when the browser is Internet Explorer, but not when the browser is Firefox? I know enough javascript to be dangerous, but not enough to be useful.

Thanks,
Menachem
Title: Re: Fullsize picture resizes Firefox window
Post by: Nibbler on February 01, 2007, 11:45:23 PM
Search the web for some browser detection code and hack it in.
Title: Re: Fullsize picture resizes Firefox window
Post by: menachem on February 02, 2007, 12:45:14 AM
Thank you very much.

Should anyone need to know how I did it, I adapted what it said in this tutorial (http://www.echoecho.com/jsbrowserdetection02.htm) in order to detect whether I was using Internet Explorer or not.

The function now looks like this:
function adjust_popup()
{
browsername=navigator.appName;
        var w, h, fixedW, fixedH, diffW, diffH;
        if (document.documentElement && document.body.clientHeight==0) {     // Catches IE6 and FF in DOCMODE
                fixedW = document.documentElement.clientWidth;
                fixedH = document.documentElement.clientHeight;
if (browsername.indexOf("Microsoft")!= -1) {
                window.resizeTo(fixedW, fixedH);
}
//window.resizeTo(fixedW, fixedH);
                diffW = fixedW - document.documentElement.clientWidth;
                diffH = fixedH - document.documentElement.clientHeight;
                w = fixedW + diffW + 16; // Vert Scrollbar Always On in DOCMODE.
                h = fixedH + diffH;
                if (w >= screen.availWidth) h += 16;
        } else if (document.all) {
                fixedW = document.body.clientWidth;
                fixedH = document.body.clientHeight;
if (browsername.indexOf("Microsoft")!= -1) {
                window.resizeTo(fixedW, fixedH);
}
                //window.resizeTo(fixedW, fixedH);
                diffW = fixedW - document.body.clientWidth;
                diffH = fixedH - document.body.clientHeight;
                w = fixedW + diffW;
                h = fixedH + diffH;
                if (h >= screen.availHeight) w += 16;
                if (w >= screen.availWidth)  h += 16;
        } else {
                fixedW = window.innerWidth;
                fixedH = window.innerHeight;
if (browsername.indexOf("Microsoft")!= -1) {
                window.resizeTo(fixedW, fixedH);
}
                //window.resizeTo(fixedW, fixedH);
                diffW = fixedW - window.innerWidth;
                diffH = fixedH - window.innerHeight;
                w = fixedW + diffW;
                h = fixedH + diffH;
                if (w >= screen.availWidth)  h += 16;
                if (h >= screen.availHeight) w += 16;
        }
        w = Math.min(w,screen.availWidth);
        h = Math.min(h,screen.availHeight);
if (browsername.indexOf("Microsoft") != -1) {
        window.resizeTo(w,h);
        window.moveTo((screen.availWidth-w)/2, (screen.availHeight-h)/2);
}

}


Thanks again for all your help,
Menachem