For a given node, try asking the grap for the URL before falling back to using the node's ID. They might be different. REALLY!

This commit is contained in:
rjc%netscape.com 1999-07-22 22:11:21 +00:00
parent 495d2575d3
commit e581724190
4 changed files with 98 additions and 2 deletions

View File

@ -415,7 +415,31 @@
if (node.getAttribute('container') == "true") { if (node.getAttribute('container') == "true") {
return false; return false;
} }
url = node.getAttribute('id');
var url = node.getAttribute('id');
try
{
// first try asking RDF's graph for the URL
var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
if (rdf)
{
var Bookmarks = rdf.GetDataSource("rdf:bookmarks");
if (Bookmarks)
{
var src = rdf.GetResource(url, true);
var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true);
var target = Bookmarks.GetTarget(src, prop, true);
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
if (target) target = target.Value;
if (target) url = target;
}
}
}
catch(ex)
{
}
// Ignore "NC:" urls. // Ignore "NC:" urls.
if (url.substring(0, 3) == "NC:") { if (url.substring(0, 3) == "NC:") {

View File

@ -56,6 +56,30 @@ function OpenURL(event, node)
var url = node.getAttribute('id'); var url = node.getAttribute('id');
try
{
// first try asking RDF's graph for the URL
var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
if (rdf)
{
var Bookmarks = rdf.GetDataSource("rdf:bookmarks");
if (Bookmarks)
{
var src = rdf.GetResource(url, true);
var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true);
var target = Bookmarks.GetTarget(src, prop, true);
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
if (target) target = target.Value;
if (target) url = target;
}
}
}
catch(ex)
{
}
// Ignore "NC:" urls. // Ignore "NC:" urls.
if (url.substring(0, 3) == "NC:") if (url.substring(0, 3) == "NC:")
{ {

View File

@ -415,7 +415,31 @@
if (node.getAttribute('container') == "true") { if (node.getAttribute('container') == "true") {
return false; return false;
} }
url = node.getAttribute('id');
var url = node.getAttribute('id');
try
{
// first try asking RDF's graph for the URL
var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
if (rdf)
{
var Bookmarks = rdf.GetDataSource("rdf:bookmarks");
if (Bookmarks)
{
var src = rdf.GetResource(url, true);
var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true);
var target = Bookmarks.GetTarget(src, prop, true);
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
if (target) target = target.Value;
if (target) url = target;
}
}
}
catch(ex)
{
}
// Ignore "NC:" urls. // Ignore "NC:" urls.
if (url.substring(0, 3) == "NC:") { if (url.substring(0, 3) == "NC:") {

View File

@ -56,6 +56,30 @@ function OpenURL(event, node)
var url = node.getAttribute('id'); var url = node.getAttribute('id');
try
{
// first try asking RDF's graph for the URL
var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
if (rdf)
{
var Bookmarks = rdf.GetDataSource("rdf:bookmarks");
if (Bookmarks)
{
var src = rdf.GetResource(url, true);
var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true);
var target = Bookmarks.GetTarget(src, prop, true);
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
if (target) target = target.Value;
if (target) url = target;
}
}
}
catch(ex)
{
}
// Ignore "NC:" urls. // Ignore "NC:" urls.
if (url.substring(0, 3) == "NC:") if (url.substring(0, 3) == "NC:")
{ {