Code listing for w.js
- /*
- * file: w.js
- * date: 2002-09-28
- * info: http://inspire.server101.com/js/w/
- */
- // popup
- function wPop(u, n, w, h, l, t, f) {
- var p = window.open(u, n, 'width='+w+',height='+h+',resizable,'+f);
- if (!p.opener) p.opener = window;
- // setup
- p.resizeTo(w, h);
- if (l && t && screen) {
- if (l < 0) l += screen.availWidth - w;
- if (t < 0) t += screen.availHeight - h;
- p.moveTo(l, t);
- }
- p.focus();
- return p;
- }
- // media window
- function mPop(u, n, w, h, l, t) {
- return wPop(u, n, w + 12, h + 31, l, t);
- }
function wPop(u, n, w, h, l, t, f)
Opens a popup window.
If window already exists, will focus (bring to front) and resize as necessary.
- u
- String: url to open in window.
- n
- String: name of window (used in link targets).
- w
- Int: window witdh.
- h
- Int: window height.
- l
- Int: window position from left (negative, from right).
- t
- Int: window position from top (negative, from bottom).
- f
- String: window features (scrollbars, statusbar, titlebar, etc).
Resizable is always set for accessibility reasons.
function mPop(u, n, w, h, l, t)
Opens a media window.
Same as wPop(), but adjusts width (w) and height (h) to account
for window borders, title bar etc. This is ideal for media windows to redude cropping
of content inside the viewable area.
Media windows cannot set features as this will impact on the viewable area.