pjs/suite/common/search/internetresults.js

57 строки
1.7 KiB
JavaScript
Исходник Обычный вид История

1999-08-21 05:09:30 +04:00
function doClick(node)
{
1999-08-21 05:09:30 +04:00
var theID = node.getAttribute("id");
if (!theID) return(false);
try
{
var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
if (rdf)
{
var internetSearchStore = rdf.GetDataSource("rdf:internetsearch");
if (internetSearchStore)
{
var src = rdf.GetResource(theID, true);
// var urlProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true);
1999-08-21 13:26:10 +04:00
var bannerProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#Banner", true);
1999-08-21 05:09:30 +04:00
var htmlProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#HTML", true);
/*
var url = internetSearchStore.GetTarget(src, urlProperty, true);
if (url) url = url.QueryInterface(Components.interfaces.nsIRDFLiteral);
if (url) url = url.Value;
*/
1999-08-21 13:26:10 +04:00
var banner = internetSearchStore.GetTarget(src, bannerProperty, true);
if (banner) banner = banner.QueryInterface(Components.interfaces.nsIRDFLiteral);
if (banner) banner = banner.Value;
1999-08-21 05:09:30 +04:00
var target = internetSearchStore.GetTarget(src, htmlProperty, true);
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
if (target) target = target.Value;
if (target)
{
var text = "<HTML><HEAD><BASE TARGET='_NEW'></HEAD><BODY><FONT POINT-SIZE='9'>";
1999-08-21 23:58:19 +04:00
if (banner)
1999-08-21 05:09:30 +04:00
{
1999-08-21 23:58:19 +04:00
// add a </A> and a <BR> just in case
text += banner + "</A><BR>";
1999-08-21 05:09:30 +04:00
}
1999-08-21 23:58:19 +04:00
text += target;
text += "</FONT></BODY></HTML>"
1999-08-21 23:58:19 +04:00
var doc = window.frames[0].document;
doc.open("text/html", "replace");
doc.writeln(text);
doc.close();
1999-08-21 05:09:30 +04:00
}
}
}
}
catch(ex)
{
}
return(true);
}