home *** CD-ROM | disk | FTP | other *** search
Wrap
//************************************************************************************************** // // Netcaster 1.0 Copyright (c) 1997 Netcape Communications Corp. // titlebar.js // //************************************************************************************************** var gLayerName = null; var gLayerNum = 0; var theDesktopMgr = new WebtopManager(); var gAddObject = null; var gChannelURL = null; var finishedLoading = 0; var preview_chan = null; var default_chan = null; //************************************************************************************************** // This method is called from the applet after it has finished loading. This is done // to prevent JavaScript is selector.html from calling a null applet //************************************************************************************************** function setDefaultChannel(item) { default_chan = item; } function setAppletReady() { parent.genericcontrols.location = "gencon.htm"; parent.selectorTab.ShowSelector(); parent.selectorTab.removeSplash(); parent.selectorTab.setVersion(); setFinishedLoading(1); parent.selector.finishLoading(); compromisePrincipals(); // launch the default channel if (default_chan != null) { OpenSiteData(default_chan, false); } } function setFinishedLoading(inVal) { finishedLoading = inVal; } function getFinishedLoading() { return finishedLoading; } //************************************************************************************************** // This is the shutdown method. It calls into the applet requesting it // to clean up its resources, and save its state //************************************************************************************************** function closeNetCast() { var canClose = document.demo.close(); if (!canClose) { return; } if ((preview_chan != null) && (preview_chan.closed == false)) { preview_chan.close(); } parent.selectorTab.closeNetCast(); } //************************************************************************************************** // This method gets called if the Java applet throws a security exception // (usually due to Marimba issues). // FIXME: We should late-bind the Marimba startup so the user only gets a single exception //************************************************************************************************** function handleSecurityException() { alert(depth.getLocalString("Netcaster requires certain privileges in order to run. ") + depth.getLocalString("In order to use Netscape Netcaster, you must grant privileges for netcasting programs. ") + depth.getLocalString("To grant privileges and avoid this message in the future, check the \"Remember this decision ") + depth.getLocalString("each time I start Communicator\" box before clicking Grant.")); closeNetCast(); } function GetDesktopManager() { return theDesktopMgr; } function SetDesktopManager() { return theDesktopMgr; } function GetSelector() { return theSelector; } function contextSetChannelStatus(layer, statusCode) { // for pre-4.02 Communicators, we want to switch contexts first setTimeout(setChannelStatus, 10, layer, statusCode); } function setChannelStatus(layer, statusCode) { layer.channelSetStatus(statusCode); } function contextSetWebtopStatus(layer, statusCode) { // for pre-4.02 Communicators, we want to switch contexts first if(statusCode + "" == "true") { setTimeout(setWebtopStatus, 10, layer, true); } else { setTimeout(setWebtopStatus, 10, layer, false); } } function setWebtopStatus(layer, statusCode) { layer.channelSetWebtopStatus(statusCode); } function animateGo(layer) { layer.channelProgressAnimate(); } function animatePercent(layer, percent) { layer.channelProgressPercent(percent); } function animateStop(layer) { layer.channelProgressStop(); } function animateStop(layer) { layer.channelProgressStop(); } function confirmQuit(busy, confirmation) { return confirm("" + confirmation); } /* Preference callbacks */ function getPrefOnline() { return depth.GetNetscapePrefBool("network.online", true, false); } function getNavigatorPrefStr(prefKey) { return depth.GetNetscapePref(prefKey, null, false) } function getNavigatorBatchPrefs(keys, values) { return depth.batchNetscapePrefs(keys, values, false, false); } function setNavigatorPrefStr(prefKey, prefValue) { depth.SetNetscapePref(prefKey, prefValue) } function setNavigatorBatchPrefs(keys, values) { return depth.batchNetscapePrefs(keys, values, false, true); } function delNavigatorPref(prefKey) { netscape.security.PrivilegeManager.enablePrivilege("UniversalPreferencesWrite"); navigator.preference(prefKey, null); navigator.savePreferences(); } function handleProperties(dataItem) { parent.selector.handleProperties(dataItem); } function PropertiesCallback(propsWindow) { var general = propsWindow.document.layers['general'].document.scheduler; var cache = propsWindow.document.layers['cache'].document.cache; var display = propsWindow.document.layers['display']; propsWindow.selector = parent; propsWindow.container = depth.getDefaultContainer(); general.index.value = -1; general.name.value = gAddObject.name; general.url.value = gAddObject.url; general.type.value = gAddObject.type; general.freq.value = gAddObject.intervalTime; general.interval.value = gAddObject.intervalTime; propsWindow.parseTimeForFrontend(propsWindow.document.layers['general'], general, gAddObject.absoluteTime); //REMIND stupid code -- FIX ME if (gAddObject.type == "2") // castanet { cache.depth.value = 0; cache.size.value = " "; } else { cache.depth.value = gAddObject.depth; cache.size.value = Math.ceil(gAddObject.maxCacheSize / 1024); if (gAddObject.crawlExtLinks) { cache.external.value = "1"; } else { cache.external.value = "0"; } } var mode = gAddObject.mode; switch (mode) { case "webtop": display.document.forms["winType"].mode[1].checked = true; break; case "full": display.document.forms["winType"].mode[0].checked = true; break; case "window": display.document.forms["winType"].mode[0].checked = true; break; } display.ChangeThumbnail(); } function OpenSite(fullscreen, siteURL, hide) { netscape.security.PrivilegeManager.enablePrivilege("Netcaster"); document.demo.openAllCaches(); if (fullscreen) { var channelWindow = depth.SecureWindowOpen(window, siteURL, 'channel', "screenX=" + screen.availLeft + ",screenY=" + screen.availTop + ",outerWidth=" + screen.availWidth + ",outerHeight=" + screen.availHeight + ",titlebar=yes,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,alwaysLowered=no,z-lock=no,resizable=no,dependent=no"); channelWindow.focus(); channelWindow.opener = null; } else { var winHeight = screen.availHeight - 50; var channelWindow = depth.SecureWindowOpen(window, siteURL, 'channel', 'left=150,top=30,outerWidth=500,outerHeight=" + winHeight + ",titlebar=yes,toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,alwaysLowered=no,z-lock=no,resizable=yes,dependent=no'); channelWindow.focus(); channelWindow.opener = null; } if (hide) { AutoHide(); } } function OpenSiteData(siteData, hide) { var chanType = siteData.getType(); var chanMode = "" + siteData.getMode(); var chanURL = siteData.getURL(); if (!siteData.opening()) return; if (chanType == 2) { // document.demo.openCastanetURL(chanURL); siteData.openCastanetURL(chanURL); } else { if (chanMode == "webtop") { OpenWebtop(chanURL, siteData, hide); } else if (chanMode == "full") { OpenSite(true, chanURL, hide); } else { OpenSite(false, chanURL, hide); } } } function OpenWebtop(siteURL, dataItem, hide) { if (arguments.length < 3) { hide = true; } if (arguments.length < 2) { dataItem = null; } if (theDesktopMgr) { theDesktopMgr.setWebtop(siteURL); if (dataItem != null) { theDesktopMgr.setWebtopItem(dataItem); } theDesktopMgr.startLogoStatusTimer(theDesktopMgr, false); } else if (depth.debug) alert("theDesktopMgr is null"); if (hide) { AutoHide(); } } function AutoHide() { var autoHide = depth.GetNetscapePref("netcaster.drawer.autoHide", "true", false) if (autoHide == "true") { parent.selectorTab.HideSelector(); } } function ToggleWebtop() { if (theDesktopMgr) theDesktopMgr.toggle(); else if (depth.debug) alert(depth.getLocalString("theDeksktopMgr is null")); parent.opener.HideSelector(); } function ToggleFront() { if (theDesktopMgr) theDesktopMgr.toggleTop(); else if (depth.debug) alert(depth.getLocalString("theDeksktopMgr is null")); parent.opener.HideSelector(); } function AddChannel(chanObj) { if (chanObj.type == "2") { AddNewCastanetChannel(chanObj.url); return; } gAddObject=chanObj; var addWindow = depth.SecureWindowOpen(window, 'addc.htm', 'prefs', 'left=150,top=200,width=427,height=247,titlebar=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,modal=yes,alwaysRaised=yes,z-lock=no,dependent=yes,hotkeys=no'); addWindow.depth = depth; } function AddNewCastanetChannel(chanURL) { gChannelURL=chanURL; var addWindow = depth.SecureWindowOpen(window, 'quickAdd.htm', 'prefs', 'left=100,top=100,width=430,height=120,titlebar=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,modal=yes,alwaysRaised=yes,z-lock=no,dependent=yes,hotkeys=no'); addWindow.depth = depth; } function AddInfoblock(ibObj) { gChannelURL=ibObj; depth.SecureWindowOpen(window, 'quickAdd.htm', 'prefs', 'left=100,top=100,width=430,height=120,titlebar=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,modal=yes,alwaysRaised=yes,z-lock=no,dependent=yes,hotkeys=no'); } /***************** Selector Initialization Routines *******************/ function createContainerLayer(dataItem) { parent.selector.createCategoryLayer(dataItem); } function createItemLayer(dataItem) { // for pre-4.02 Communicators, we want to switch contexts on adds // parent.selector.contextCreateItemLayer(dataItem); parent.selector.createItemLayer(dataItem); } function createPageLayer(dataItem, url) { parent.selector.createPageLayer(dataItem, url); } function deleteItemLayer(dataItem, layer) { // for pre-4.02 Communicators, we want to switch contexts on deletes // parent.selector.contextDeleteItemLayer(dataItem, layer); parent.selector.deleteItemLayer(dataItem, layer); } function refreshItemLayer(dataItem, layer) { // for pre-4.02 Communicators, we want to switch contexts on deletes // parent.selector.contextRefreshItemLayer(dataItem, layer); parent.selector.refreshItemLayer(dataItem, layer); } function containerIsReady(expectedSize, layer) { // alert("Layer count is " + layer.container.itemCount + " expected is " + expectedSize); if (!layer.container || !layer.container.itemCount) { return true; // we seem to get into this state every so often } if (expectedSize <= layer.container.itemCount) return true; else return false; } /* Deletion callbacks */ function confirmDelete(name, item) { // FIXME: Need to int'l // depth.getLocalString("Are you sure you want to delete this item?") return confirm("Are you sure you want to delete " + name + "?"); } function cantDelete(name, item) { var addTail = depth.getLocalString("deleteBlocked"); alert(name + addTail); return; } function showError(error) { parent.selector.showError(error); } /* * This method will launch a new window with the url for the Netcaster start up channel */ function showAnimation(url) { var screenHeight = screen.availHeight - 30; finalURL = "file://" + url; preview_chan = window.open(finalURL,'NC_Preview','left='+screen.availLeft+',top='+screen.availTop+',titlebar=yes,scrollbars=no,width='+screen.availWidth+',height='+screenHeight+',hotkeys=no'); } function showSplashText(index) { parent.selectorTab.setSplashText(index); } function showExpiration() { alert(depth.getLocalString("This pre-release copy of Netscape Netcaster has expired.\rTo obtain a more recent version, go to http://home.netscape.com/")); closeNetCast(); } function whineExpiration(date) { alert(depth.getLocalString("This is a pre-release copy of Netscape Netcaster that will expire at ") + date + depth.getLocalString(". To obtain a newer pre-release version or the latest full release of Netscape Netcaster (which will not expire), go to http://home.netscape.com/")); } void(0);