General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
Center lone images by default?
Posted by: Steven
Date: November 12, 2002 08:51AM

When opening an image by itself, is there a way to convince KM to load them in the center of a blank window instead of the top left corner?

I'm just extremely anal.

Options: ReplyQuote
Re: Center lone images by default?
Posted by: Robert
Date: November 13, 2002 08:54AM

Yes, there is a way, but not very easy:

It is possible, with a macro, to open a local html-file with the image-url as a parameter:

showimg {
open("file:/// ... /showimg.htm ?".$ImageURL);
}

Now, you can create a html-file, which shows a image in the center and vertical in the middle. In this html-file you can read the image-url-parameter with java-script.

Options: ReplyQuote
Re: Center lone images by default?
Posted by: Steven
Date: November 13, 2002 09:21AM

That was my exact idea for a solution, but I don't know how to do any of the coding. My JS knowledge is very limited & the little bit I once learned I've long since forgotten. When you say "read the image-url-parameter," I know what you're talking about, but I forgot how to write a script to do that.

Thanks anyway, at least I know I was on the right track.

Options: ReplyQuote
Re: Center lone images by default?
Posted by: Robert
Date: November 13, 2002 11:23AM

The java-script part:

<script type="text/javascript">
<!--
var paramStr = unescape(location.search), isParam = true;
if (!paramStr.length)
isParam = false;
else
paramStr = paramStr.substring(1, paramStr.length);
if (isParam)
{
// Parameter "paramStr" exists
document.write("<img src=\"")
document.write(paramStr)
document.write("\"")
}
else
{
// No parameter
document.write("No Parameter.")
}
//-->
</script>

Options: ReplyQuote
Re: Center lone images by default?
Posted by: Steven
Date: November 13, 2002 11:26PM

You guys sure go above & beyond. Thanks a ton, I'll see if I can get this working.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.