home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2003 May
/
PCWorld_2003-05_cd.bin
/
Komunik
/
phoenix
/
chrome
/
browser.jar
/
content
/
browser
/
pageReport.js
< prev
next >
Wrap
Text File
|
2002-10-25
|
2KB
|
62 lines
var gSiteBox;
var gUnblockButton;
var gPageReport;
var gUPMsg;
var popupmanager =
Components.classes["@mozilla.org/PopupWindowManager;1"]
.getService(Components.interfaces.nsIPopupWindowManager);
function onLoad()
{
gSiteBox = document.getElementById("siteBox");
gUnblockButton = document.getElementById("unblockButton");
gPageReport = opener.gBrowser.pageReport;
gUPMsg = document.getElementById("unblockedPopupMsg");
buildSiteBox();
}
function buildSiteBox()
{
for (var i = 0; i < gPageReport.length; i++) {
var found = false;
for (var j = 0; j < gSiteBox.childNodes.length; j++) {
if (gSiteBox.childNodes[i].label == gPageReport[i]) {
found = true;
break;
}
}
if (found) continue;
var listitem = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"listitem");
listitem.setAttribute("label", gPageReport[i]);
gSiteBox.appendChild(listitem);
}
}
function siteSelected()
{
gUnblockButton.disabled = (gSiteBox.selectedItems.length == 0);
}
function whitelistSite()
{
var selectedItem = gSiteBox.selectedItems[0];
if (!selectedItem)
return;
// This is perverse and backwards. We have subverted Mozilla's blacklist implementation
// and made it into a whitelist. So we want to add this to the list of "blocked' popups.
var uri = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURI);
uri.spec = selectedItem.label;
popupmanager.add(uri, true);
gSiteBox.removeChild(selectedItem);
alert(uri.host + gUPMsg.value);
}