зеркало из https://github.com/mozilla/pjs.git
Try resolving URL property before opening a bookmark, in case its a IE favorite (under Windows, or BeOS) or a internet search result.
This commit is contained in:
Родитель
f5a996562f
Коммит
e37a52545a
|
@ -451,7 +451,7 @@ function UpdateBookmarksLastVisitiedDate(event)
|
|||
RefreshUrlbar();
|
||||
}
|
||||
|
||||
function OpenBookmarkURL(node)
|
||||
function OpenBookmarkURL(node, root)
|
||||
{
|
||||
if (node.getAttribute('container') == "true") {
|
||||
return false;
|
||||
|
@ -460,24 +460,26 @@ function UpdateBookmarksLastVisitiedDate(event)
|
|||
var url = node.getAttribute('id');
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -346,7 +346,7 @@ Contributor(s): ______________________________________. -->
|
|||
</menupopup>
|
||||
</menu>
|
||||
<menu accesskey="b" value="&bookmarksMenu.label;"
|
||||
datasources="rdf:bookmarks rdf:files rdf:find rdf:internetsearch" id="NC:BookmarksRoot">
|
||||
datasources="rdf:bookmarks rdf:files rdf:find rdf:internetsearch" id="BookmarksMenu" ref="NC:BookmarksRoot">
|
||||
<template>
|
||||
<rule iscontainer="true">
|
||||
<menupopup>
|
||||
|
@ -360,7 +360,7 @@ Contributor(s): ______________________________________. -->
|
|||
</rule>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem uri="..." value="rdf:http://home.netscape.com/NC-rdf#Name" oncommand="OpenBookmarkURL(event.target)" />
|
||||
<menuitem uri="..." value="rdf:http://home.netscape.com/NC-rdf#Name" oncommand="OpenBookmarkURL(event.target, 'BookmarksMenu')" />
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
|
@ -514,14 +514,14 @@ Contributor(s): ______________________________________. -->
|
|||
</titledbutton>
|
||||
</toolbar>
|
||||
|
||||
<toolbar class="main-bar" chromeclass="toolbar" datasources="rdf:bookmarks" ref="NC:PersonalToolbarFolder">
|
||||
<toolbar class="main-bar" chromeclass="toolbar" datasources="rdf:bookmarks" id="PersonalToolbar" ref="NC:PersonalToolbarFolder">
|
||||
<template>
|
||||
<rule iscontainer="true">
|
||||
<titledbutton uri="..." src="resource:/res/rdf/folder-closed.gif" value="rdf:http://home.netscape.com/NC-rdf#Name" align="left" popup="bookmark-popup" />
|
||||
</rule>
|
||||
|
||||
<rule>
|
||||
<titledbutton uri="..." src="resource:/res/toolbar/TB_Location.gif" value="rdf:http://home.netscape.com/NC-rdf#Name" align="left" onclick="OpenBookmarkURL(event.target)" />
|
||||
<titledbutton uri="..." src="resource:/res/toolbar/TB_Location.gif" value="rdf:http://home.netscape.com/NC-rdf#Name" align="left" onclick="OpenBookmarkURL(event.target, 'PersonalToolbar')" />
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -451,7 +451,7 @@ function UpdateBookmarksLastVisitiedDate(event)
|
|||
RefreshUrlbar();
|
||||
}
|
||||
|
||||
function OpenBookmarkURL(node)
|
||||
function OpenBookmarkURL(node, root)
|
||||
{
|
||||
if (node.getAttribute('container') == "true") {
|
||||
return false;
|
||||
|
@ -460,24 +460,26 @@ function UpdateBookmarksLastVisitiedDate(event)
|
|||
var url = node.getAttribute('id');
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -346,7 +346,7 @@ Contributor(s): ______________________________________. -->
|
|||
</menupopup>
|
||||
</menu>
|
||||
<menu accesskey="b" value="&bookmarksMenu.label;"
|
||||
datasources="rdf:bookmarks rdf:files rdf:find rdf:internetsearch" id="NC:BookmarksRoot">
|
||||
datasources="rdf:bookmarks rdf:files rdf:find rdf:internetsearch" id="BookmarksMenu" ref="NC:BookmarksRoot">
|
||||
<template>
|
||||
<rule iscontainer="true">
|
||||
<menupopup>
|
||||
|
@ -360,7 +360,7 @@ Contributor(s): ______________________________________. -->
|
|||
</rule>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem uri="..." value="rdf:http://home.netscape.com/NC-rdf#Name" oncommand="OpenBookmarkURL(event.target)" />
|
||||
<menuitem uri="..." value="rdf:http://home.netscape.com/NC-rdf#Name" oncommand="OpenBookmarkURL(event.target, 'BookmarksMenu')" />
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
|
@ -514,14 +514,14 @@ Contributor(s): ______________________________________. -->
|
|||
</titledbutton>
|
||||
</toolbar>
|
||||
|
||||
<toolbar class="main-bar" chromeclass="toolbar" datasources="rdf:bookmarks" ref="NC:PersonalToolbarFolder">
|
||||
<toolbar class="main-bar" chromeclass="toolbar" datasources="rdf:bookmarks" id="PersonalToolbar" ref="NC:PersonalToolbarFolder">
|
||||
<template>
|
||||
<rule iscontainer="true">
|
||||
<titledbutton uri="..." src="resource:/res/rdf/folder-closed.gif" value="rdf:http://home.netscape.com/NC-rdf#Name" align="left" popup="bookmark-popup" />
|
||||
</rule>
|
||||
|
||||
<rule>
|
||||
<titledbutton uri="..." src="resource:/res/toolbar/TB_Location.gif" value="rdf:http://home.netscape.com/NC-rdf#Name" align="left" onclick="OpenBookmarkURL(event.target)" />
|
||||
<titledbutton uri="..." src="resource:/res/toolbar/TB_Location.gif" value="rdf:http://home.netscape.com/NC-rdf#Name" align="left" onclick="OpenBookmarkURL(event.target, 'PersonalToolbar')" />
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче