home *** CD-ROM | disk | FTP | other *** search
- /*
- * webbar.js
- *
- * Copyright (c) 1997 Netscape Communications Corporation, All Rights Reserved
- *
- * Webtop manager
- */
- /* ValidateWebtop should be called before any function
- in this library. If there is no current webtop
- (i.e., the webtopWindow is non-null and not marked
- as closed), it returns the webtop window. Otherwise,
- it returns null. */
-
- function ValidateWebtop()
- {
- if (this.webtopWindow && (this.webtopWindow.closed == false))
- {
- return this.webtopWindow;
- }
- else
- {
- this.webtopWindow = null;
- this.webtopHidden = true;
- this.webtopTopped = false;
- return null;
- }
- }
-
- function WebtopFixButtons()
- {
- var webtop = this.validateWebtop();
-
- if (this.webtopControls && !this.webtopControls.loading)
- {
- this.webtopControls.fixButtons(webtop);
- }
-
- if (this.webtopSelectorControls && !this.webtopSelectorControls.loading)
- {
- this.webtopSelectorControls.fixButtons(webtop);
- }
- }
-
- function WebtopBack()
- {
- var webtop = this.validateWebtop();
-
- if (webtop && !this.webtopHidden)
- {
- webtop.back();
- this.fixButtons();
- }
- }
-
- function WebtopForward()
- {
- var webtop = this.validateWebtop();
-
- if (webtop && !this.webtopHidden)
- {
- webtop.forward();
- this.fixButtons();
- }
- }
-
- function WebtopUpdate()
- {
- // hmmm. This isnt' really correct, since we want to actually do an update
- var webtop = this.validateWebtop();
-
- if (webtop)
- {
- webtop.reload();
- }
- }
-
- function WebtopPrint()
- {
- var webtop = this.validateWebtop();
-
- if (webtop)
- {
- webtop.print();
- }
- }
-
- function WebtopClose()
- {
- var webtop = this.validateWebtop();
-
- if (webtop)
- {
- clearTimeout(this.logoStatusID);
- webtop.close();
- this.webtopWindow = null;
- this.webtopControls.close();
- this.webtopControls = null;
- this.webtopWatermark.close();
- this.webtopWatermark = null;
- this.webtopSite = "";
- this.webtopItem.setWebtopStatus(false);
- this.webtopItem.closing();
- this.webtopItem = null;
- this.fixButtons();
-
- this.webtopHidden = true;
- this.webtopTopped = false;
- }
- }
-
- function WebtopToggle()
- {
- if (this.webtopHidden)
- {
- this.show();
- this.front();
- }
- else
- {
- this.hide();
- }
- }
-
- function WebtopToggleTop()
- {
- if (this.webtopHidden)
- this.show();
-
- if (this.webtopTopped)
- this.behind();
- else
- this.front();
- }
-
-
- function WebtopHide()
- {
- var webtop = this.validateWebtop();
-
- if (webtop && !this.webtopHidden)
- {
- depth.SecureMoveWindow(webtop, -30000, -30000);
- // depth.SecureMoveWindow(this.webtopControls, -30000, -30000);
- // depth.SecureMoveWindow(this.webtopWatermark, -30000, -30000);
- this.webtopHidden = true;
- this.fixButtons();
- }
- }
-
- function WebtopShow()
- {
- var webtop = this.validateWebtop();
- var webtopAnchor = depth.GetNetscapePref("netcaster.webtopDock", "left", false)
-
- if (webtop && this.webtopHidden)
- {
- if (webtopAnchor == "right")
- depth.SecureMoveWindow(webtop, screen.availWidth - webtop.outerWidth,screen.availTop);
- else
- depth.SecureMoveWindow(webtop, screen.availLeft,screen.availTop);
-
- // SecureMoveWindow(this.webtopControls, screen.availWidth - 199, screen.availHeight - 25);
- // SecureMoveWindow(this.webtopWatermark, screen.availWidth - 50, screen.availHeight - 75);
-
- this.webtopHidden = false;
- this.fixButtons();
- }
- else
- {
- // this.setWebtop('http://netcaster.netscape.com/channel/index.html');
- this.setWebtop('http://netcaster.netscape.com/channel/beta13.html');
- }
-
- }
-
- function WebtopFront()
- {
- var webtop = this.validateWebtop();
-
- if (webtop)
- {
- netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite");
-
- webtop.setZOptions("");
- webtop.focus();
- webtop.setZOptions("z-lock=1");
-
- this.webtopControls.setZOptions("");
- this.webtopControls.focus();
- this.webtopControls.setZOptions("z-lock=1");
-
- this.webtopWatermark.setZOptions("");
- this.webtopWatermark.focus();
- this.webtopWatermark.setZOptions("z-lock=1");
-
- this.webtopTopped = true;
- }
- }
-
-
- function WebtopBehind()
- {
- var webtop = this.validateWebtop();
-
- if (webtop)
- {
- netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite");
-
- // This deals with a Windows only bug in setZOptions
- if (depth.isWindows()) {
- webtop.setZOptions("");
- webtop.blur();
- webtop.setZOptions("z-lock=1");
- webtop.setZOptions("alwaysLowered=1");
-
- this.webtopControls.setZOptions("");
- this.webtopControls.blur();
- this.webtopControls.setZOptions("z-lock=1");
- this.webtopControls.setZOptions("alwaysLowered=1");
-
- this.webtopWatermark.setZOptions("");
- this.webtopWatermark.blur();
- this.webtopWatermark.setZOptions("z-lock=1");
- this.webtopWatermark.setZOptions("alwaysLowered=1");
- }
- else {
- this.webtopWatermark.setZOptions("alwaysLowered=1");
- this.webtopControls.setZOptions("alwaysLowered=1");
- webtop.setZOptions("alwaysLowered=1");
- }
-
- this.webtopTopped = false;
- }
- }
-
-
- function OpenNewNavigator()
- {
- var winHeight = screen.availHeight - 10;
- newWindow = window.open("about:blank",
- '',
- 'left=10,top=5,outerWidth=625,outerHeight=" + winHeight + ",toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,dependent=no');
-
- newWindow.home();
- }
-
- function WebtopSet(siteurl)
- {
- sitename = "" + siteurl;
-
- if (sitename == this.webtopSite)
- return;
-
- netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite");
-
- this.closeWebtop();
-
- // the Webtop must be opened first so that they lock bottom before the webtop does
-
- var wcLeft = screen.availLeft + screen.availWidth - 199;
- var wcBottom = screen.availTop + screen.availHeight - 25;
-
- this.webtopControls = depth.SecureWindowOpen(self,"webctrl.htm", "NC_webtop_controls",
- "toolbar=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,outerWidth=200,outerHeight=25,screenX=" +
- wcLeft + ",screenY=" +
- wcBottom +
- ",alwaysLowered=1,z-lock=1,dependent=1,titlebar=0,hotkeys=0");
-
- var branding = depth.GetNetscapePref("netcaster.branding.image", null, false);
-
- var wcLeft = screen.availLeft + screen.availWidth - (branding==null?50:92);
- var wcBottom = screen.availTop + screen.availHeight - 75;
-
- this.webtopWatermark = depth.SecureWindowOpen(self,"logo.htm", "NC_webtop_watermark",
- "toolbar=0, directories=0, status=0, menubar=0, scrollbars=0,resizable=0,outerWidth="+(branding==null?42:84)+",outerHeight=42,screenX=" +
- wcLeft + ",screenY=" +
- wcBottom +
- ",alwaysLowered=1,z-lock=1,dependent=1,titlebar=0,hotkeys=0");
-
- this.webtopWindow = depth.SecureWindowOpen(self, sitename, "NC_webtop_win",
- "toolbar=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,outerWidth=" +
- screen.availWidth + ",outerHeight=" +
- screen.availHeight + ",screenX=" +
- screen.availLeft + ",screenY=" +
- screen.availTop +
- ",alwaysLowered=1,z-lock=1,dependent=1,titlebar=0,hotkeys=0");
-
- this.webtopHidden = false;
-
- var autoFront = depth.GetNetscapePrefBool("netcaster.webtopFrontmost", false, false);
-
- if (autoFront) {
- this.front();
- }
-
- this.fixButtons();
- }
-
- function WebtopSetLocation(pageUrl)
- {
- var webtop = this.validateWebtop();
- if (!webtop || webtop == null)
- return;
-
- netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite");
- webtop.location = pageUrl;
- }
-
- function WebtopSetItem(dataItem)
- {
- var webtop = this.validateWebtop();
- if (!webtop || webtop == null)
- return;
-
- this.webtopItem = dataItem;
- dataItem.setWebtopStatus(true);
- }
-
- function StartLogoStatusTimer(which, isAnimated)
- {
- var webtop = which.validateWebtop();
-
- if (webtop && !which.webtopWatermark.loading) {
- if (webtop.loading) {
- // only load if it is different
- if (!isAnimated)
- which.webtopWatermark.document.layers[0].document.images[0].src = 'images/logoanim.gif';
- isAnimated = true;
- }
- else {
- if (isAnimated) {
- which.webtopWatermark.document.layers[0].document.images[0].src = 'images/logo.gif';
- which.fixButtons();
- }
- isAnimated = false;
- }
- }
-
- this.logoStatusID = setTimeout(StartLogoStatusTimer, 1500, which, isAnimated);
- }
-
- function WebtopManager()
- {
- this.webtopWindow = null;
- this.webtopHidden = true;
- this.webtopTopped = false;
- this.webtopSite = "";
- this.webtopItem = null;
-
- this.webtopControls = null;
- this.webtopSelectorControls = depth.webcontrols;
- this.webtopWatermark = null;
- this.logoStatusID = 0;
-
- this.validateWebtop = ValidateWebtop;
-
- this.back = WebtopBack;
- this.forward = WebtopForward;
- this.update = WebtopUpdate;
- this.print = WebtopPrint;
- this.closeWebtop = WebtopClose;
- this.toggle = WebtopToggle;
- this.toggleTop = WebtopToggleTop;
- this.hide = WebtopHide;
- this.show = WebtopShow;
- this.front = WebtopFront;
- this.behind = WebtopBehind;
- this.fixButtons = WebtopFixButtons;
- this.openNavigator = OpenNewNavigator;
-
- this.setWebtop = WebtopSet;
- this.setWebtopLocation = WebtopSetLocation;
- this.setWebtopItem = WebtopSetItem;
- this.startLogoStatusTimer = StartLogoStatusTimer;
- }
-
- void(0);
-