JavaScript Window Meta-object
Current version:
Next version: 1.1
1.1 Features and Bug Fixes
- Displaying debug window for locations not on same domain causes script error. This will be fixed.
- Vertical Align added to script and dev tool.
Development Roadmap
Although these items are grouped, they have not been developed in this order. The order of development can be viewed here. Each number represents one phase of development.
- Basic functionality such as a cross-platform maximize function and dumping window properties to a debugging window.
Specifically:
- Custom Methods: If you only care about writing code that runs on one flavor of Windows with one specific browser, then this code is NOT for you. You might find what you are looking for here, here or here.
On the other hand, if you would like to write code that functions exactly the same regardless of the browser, then keep reading...
maximize(): This is a custom method for opening a new window at the maximum width and height of the available area of the screen. It varies from the Windows maximize functionality in that the frame around the window is still completely visible and, if the title bar is showing, the user can click the Maximize button for that little extra "mmph" of real estate and added protection from inadvertantly dragging a window element and thus resizing the window. Regardless, I suspect many people will find this function useful. Try it for yourself.
align(): Used by the debugger, you can specify whether or not the new window should be aligned along the left, right or center of the screen. Currently, all windows are vertically aligned along the top of the screen.
popSized(): A shortcut for opening a new window with a specific size (rather than setting the width and height properties directly). Try it.
resize(): Uh, well, alter the values of the widht and height properties in one fell swoop.
- If you still think these custom methods aren't useful, maybe you should take a gander at this, and then keep reading.
- Custom Properties: In addition to a window's internal properties (such as height, width, scrollbars, etc.), the new window has it's own, internal, properties available for use in your own scripts. If the debugging window is still open, you can see them right there. If not, click here to see them again.
Otherwise, here are the most interesting:
nav: A browser sniffer used by the debugger, but whose values are available to your other scripts via references to the custom window object. This browser sniffer has been tested with a number of browsers, but there are no guarantees. Perhaps I'll offer one around version 3.
align: The current alignment of the new window.
- Debugging: The debugger prints properties of a meta-window in a separate window, generated using code in the same object. It prints the new window's property names and values. To see output for your browser and current window situation, click here.
- Modular Code Design: Because this code is an Object, maintenance and modifications are much more effective than in non-Object based approaches. As an added measure, all wmo functions start with wmo_ to keep my code separate from yours, but references to the objects you create with this code can have whatever name you want.
- Support for additional browsers of basic functionality with addition of remote, pop-under, and perhaps some other methods.
- Other Methods:
- verticalAlign(): This is the same as align, but with one obvious difference.
- Other Properties:
- width and height as percents: Specify the width or height of a window as a percent of the screen rather than in pixels.
- Addition of window "transitions", such as zooming in when opening, zooming closed, and maybe jiggling.
- Add esoteric and really annoying methods (windows that never let you leave a site... we all know that experience ;-)
- Non-traditional window objects such as <div> tags as containers and the Windows/IE-only popup window.
At this time, some of the basic work has already been started, but I hit a pretty serious roadblock when writing the debugging functions and until this particular roadblock is overcome, it's almost not worth continuing because having a good debugger is really important, possibly essential. To read all about this little problem, click here.
UPDATE: I've written some browser sniffing code that allows us to execute certain parts of the debugging code if the browser permits. Development can now continue.
Coding Conventions
I would like to say I write according to Hungarian Notation, but I don't know it well enough to be 100% compliant. Greg Legowski's guide to Hungarian Notation
If you'd like to help work on this project, send me an email.
Return to main page.