зеркало из https://github.com/mozilla/pjs.git
Modify OpenURL() call to try to resolve #URL attribute before opening URL.
This commit is contained in:
Родитель
15bfdfefb6
Коммит
0fd5dafcbb
|
@ -36,7 +36,7 @@
|
|||
<tree id="bookmarksTree" context="contextual" ref="NC:BookmarksRoot"
|
||||
flex="100%" style="height: 100%"
|
||||
datasources="rdf:bookmarks rdf:files rdf:ftp rdf:find rdf:internetsearch"
|
||||
ondblclick="return OpenURL(event, event.target.parentNode.parentNode);">
|
||||
ondblclick="return OpenURL(event, event.target.parentNode.parentNode, 'bookmarksTree');">
|
||||
|
||||
<!-- Commented out until new tree content model and template builder can play nice -->
|
||||
<template>
|
||||
|
|
|
@ -51,16 +51,8 @@ function OpenSearch(tabName)
|
|||
|
||||
|
||||
|
||||
function OpenURL(event, node)
|
||||
function OpenURL(event, node, root)
|
||||
{
|
||||
// clear any single-click/edit timeouts
|
||||
if (timerID != null)
|
||||
{
|
||||
gEditNode = null;
|
||||
clearTimeout(timerID);
|
||||
timerID = null;
|
||||
}
|
||||
|
||||
if (node.getAttribute('container') == "true")
|
||||
{
|
||||
return(false);
|
||||
|
@ -76,24 +68,26 @@ function OpenURL(event, node)
|
|||
|
||||
try
|
||||
{
|
||||
// add support for IE favorites under Win32, and NetPositive URLs under BeOS
|
||||
if (url.indexOf("file://") == 0)
|
||||
var rootNode = document.getElementById(root);
|
||||
var ds = null;
|
||||
if (rootNode)
|
||||
{
|
||||
var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
|
||||
if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
if (rdf)
|
||||
ds = rootNode.database;
|
||||
}
|
||||
// add support for IE favorites under Win32, and NetPositive URLs under BeOS
|
||||
var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
|
||||
if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
if (rdf)
|
||||
{
|
||||
if (ds)
|
||||
{
|
||||
var fileSys = rdf.GetDataSource("rdf:files");
|
||||
if (fileSys)
|
||||
{
|
||||
var src = rdf.GetResource(url, true);
|
||||
var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true);
|
||||
var target = fileSys.GetTarget(src, prop, true);
|
||||
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||
if (target) target = target.Value;
|
||||
if (target) url = target;
|
||||
|
||||
}
|
||||
var src = rdf.GetResource(url, true);
|
||||
var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true);
|
||||
var target = ds.GetTarget(src, prop, true);
|
||||
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||
if (target) target = target.Value;
|
||||
if (target) url = target;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<tree id="bookmarksTree" context="contextual" ref="NC:BookmarksRoot"
|
||||
flex="100%" style="height: 100%"
|
||||
datasources="rdf:bookmarks rdf:files rdf:ftp rdf:find rdf:internetsearch"
|
||||
ondblclick="return OpenURL(event, event.target.parentNode.parentNode);">
|
||||
ondblclick="return OpenURL(event, event.target.parentNode.parentNode, 'bookmarksTree');">
|
||||
|
||||
<!-- Commented out until new tree content model and template builder can play nice -->
|
||||
<template>
|
||||
|
|
|
@ -51,16 +51,8 @@ function OpenSearch(tabName)
|
|||
|
||||
|
||||
|
||||
function OpenURL(event, node)
|
||||
function OpenURL(event, node, root)
|
||||
{
|
||||
// clear any single-click/edit timeouts
|
||||
if (timerID != null)
|
||||
{
|
||||
gEditNode = null;
|
||||
clearTimeout(timerID);
|
||||
timerID = null;
|
||||
}
|
||||
|
||||
if (node.getAttribute('container') == "true")
|
||||
{
|
||||
return(false);
|
||||
|
@ -76,24 +68,26 @@ function OpenURL(event, node)
|
|||
|
||||
try
|
||||
{
|
||||
// add support for IE favorites under Win32, and NetPositive URLs under BeOS
|
||||
if (url.indexOf("file://") == 0)
|
||||
var rootNode = document.getElementById(root);
|
||||
var ds = null;
|
||||
if (rootNode)
|
||||
{
|
||||
var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
|
||||
if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
if (rdf)
|
||||
ds = rootNode.database;
|
||||
}
|
||||
// add support for IE favorites under Win32, and NetPositive URLs under BeOS
|
||||
var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
|
||||
if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
if (rdf)
|
||||
{
|
||||
if (ds)
|
||||
{
|
||||
var fileSys = rdf.GetDataSource("rdf:files");
|
||||
if (fileSys)
|
||||
{
|
||||
var src = rdf.GetResource(url, true);
|
||||
var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true);
|
||||
var target = fileSys.GetTarget(src, prop, true);
|
||||
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||
if (target) target = target.Value;
|
||||
if (target) url = target;
|
||||
|
||||
}
|
||||
var src = rdf.GetResource(url, true);
|
||||
var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true);
|
||||
var target = ds.GetTarget(src, prop, true);
|
||||
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||
if (target) target = target.Value;
|
||||
if (target) url = target;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
|
||||
<tree id="bookmarksTree" ref="NC:BookmarksRoot" context="contextual"
|
||||
datasources="rdf:bookmarks rdf:files rdf:ftp rdf:find rdf:internetsearch"
|
||||
ondblclick="return OpenURL(event,event.target.parentNode.parentNode);"
|
||||
ondblclick="return OpenURL(event, event.target.parentNode.parentNode, 'bookmarksTree');"
|
||||
flex="1">
|
||||
|
||||
<template>
|
||||
|
|
Загрузка…
Ссылка в новой задаче