зеркало из https://github.com/mozilla/pjs.git
Add a sidebar panel for Search results instead of having them mixed in with Related Links data.
This commit is contained in:
Родитель
e4d36a4fca
Коммит
f99fd26bce
|
@ -42,18 +42,14 @@ Handler = Handler.QueryInterface(Components.interfaces.nsIRelatedLinksHandler);
|
|||
// Our observer object
|
||||
var Observer = {
|
||||
Observe: function(subject, topic, data) {
|
||||
// debug("Observer.Observe(" + subject + ", " + topic + ", " + data + ")\n");
|
||||
debug("Observer.Observe(" + subject + ", " + topic + ", " + data + ")\n");
|
||||
|
||||
if (subject != ContentWindow)
|
||||
return;
|
||||
|
||||
// Okay, it's a hit. Before we go out and fetch RL data, make sure that
|
||||
// the RelatedLinks folder is open.
|
||||
var root = document.getElementById('NC:RelatedLinks');
|
||||
|
||||
if (root.getAttribute('open') == 'true')
|
||||
{
|
||||
refetchRelatedLinks(Handler, data);
|
||||
debug("subject was not content window, ignoring\n");
|
||||
return;
|
||||
}
|
||||
refetchRelatedLinks(Handler, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184,65 +180,45 @@ function refetchRelatedLinks(Handler, data)
|
|||
|
||||
function Init()
|
||||
{
|
||||
// Initialize the Related Links panel
|
||||
// Initialize the Related Links panel
|
||||
|
||||
// Create a Related Links handler, and install it in the tree
|
||||
var Tree = document.getElementById("Tree");
|
||||
Tree.database.AddDataSource(Handler.QueryInterface(Components.interfaces.nsIRDFDataSource));
|
||||
// Create a Related Links handler, and install it in the tree
|
||||
var Tree = document.getElementById("Tree");
|
||||
Tree.database.AddDataSource(Handler.QueryInterface(Components.interfaces.nsIRDFDataSource));
|
||||
|
||||
// Install the observer so we'll be notified when new content is loaded.
|
||||
var ObserverService = Components.classes["component://netscape/observer-service"].getService();
|
||||
ObserverService = ObserverService.QueryInterface(Components.interfaces.nsIObserverService);
|
||||
debug("got observer service\n");
|
||||
// Install the observer so we'll be notified when new content is loaded.
|
||||
var ObserverService = Components.classes["component://netscape/observer-service"].getService();
|
||||
ObserverService = ObserverService.QueryInterface(Components.interfaces.nsIObserverService);
|
||||
if (ObserverService)
|
||||
{
|
||||
ObserverService.AddObserver(Observer, "StartDocumentLoad");
|
||||
ObserverService.AddObserver(Observer, "EndDocumentLoad");
|
||||
ObserverService.AddObserver(Observer, "FailDocumentLoad");
|
||||
debug("added observer\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
debug("FAILURE to get observer service\n");
|
||||
}
|
||||
|
||||
ObserverService.AddObserver(Observer, "EndDocumentLoad");
|
||||
debug("added observer\n");
|
||||
}
|
||||
|
||||
function clicked(event, target) {
|
||||
if (target.getAttribute('container') == 'true') {
|
||||
if (target.getAttribute('open') == 'true') {
|
||||
target.removeAttribute('open');
|
||||
} else {
|
||||
target.setAttribute('open','true');
|
||||
// First, see if they're opening the related links node. If so,
|
||||
// we'll need to go out and fetch related links _now_.
|
||||
if (target.getAttribute('id') == 'NC:RelatedLinks') {
|
||||
refetchRelatedLinks(Handler, ContentWindow.location);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (event.clickCount == 2) {
|
||||
openURL(target, 'Tree');
|
||||
}
|
||||
}
|
||||
refetchRelatedLinks(Handler, ContentWindow.location);
|
||||
}
|
||||
|
||||
|
||||
function openURL(treeitem, root)
|
||||
|
||||
function openURL(event, treeitem, root)
|
||||
{
|
||||
if ((event.button != 1) || (event.clickCount != 2))
|
||||
return(false);
|
||||
|
||||
// Next, check to see if it's a container. If so, then just let
|
||||
// the tree do its open and close stuff.
|
||||
if (treeitem.getAttribute('container') == 'true') {
|
||||
if (treeitem.getAttribute('container') == 'true')
|
||||
return(false);
|
||||
|
||||
// if (treeitem.getAttribute('open') == 'true') {
|
||||
// treeitem.setAttribute('open','')
|
||||
// } else {
|
||||
// treeitem.setAttribute('open','true')
|
||||
// }
|
||||
if (treeitem.getAttribute("type") == "http://home.netscape.com/NC-rdf#BookmarkSeparator")
|
||||
return(false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (treeitem.getAttribute('type') == 'http://home.netscape.com/NC-rdf#BookmarkSeparator') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Okay, it's not a container. See if it has a URL, and if so, open it.
|
||||
var id = treeitem.getAttribute('id');
|
||||
if (!id) return(false);
|
||||
var id = treeitem.getAttribute('id');
|
||||
if (!id) return(false);
|
||||
|
||||
// rjc: add support for anonymous resources; if the node has
|
||||
// a "#URL" property, use it, otherwise default to using the id
|
||||
|
@ -272,5 +248,6 @@ function openURL(treeitem, root)
|
|||
catch(ex)
|
||||
{
|
||||
}
|
||||
ContentWindow.location = id;
|
||||
|
||||
ContentWindow.location = id;
|
||||
}
|
||||
|
|
|
@ -40,11 +40,11 @@
|
|||
though there is no datasource from which to build content yet.
|
||||
-->
|
||||
|
||||
<html:div style="width:100px; height:100px" flex="1">
|
||||
<tree id="Tree"
|
||||
<html:div style="width:100%; height:100%" flex="1">
|
||||
<tree id="Tree" ref="NC:RelatedLinks" container="true"
|
||||
style="width: 100%; height: 100%"
|
||||
datasources="rdf:internetsearch"
|
||||
onclick="clicked(event,event.target.parentNode.parentNode)">
|
||||
datasources="rdf:null"
|
||||
onclick="openURL(event, event.target.parentNode.parentNode, 'Tree')">
|
||||
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
|
@ -52,7 +52,7 @@
|
|||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<html:hr width="75%" align="center" size="1" />
|
||||
<html:hr width="100%" size="1" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
|
@ -61,7 +61,7 @@
|
|||
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="..." persist="open"
|
||||
<treeitem uri="..."
|
||||
loading="rdf:http://home.netscape.com/NC-rdf#loading"
|
||||
type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type">
|
||||
<treerow>
|
||||
|
@ -75,26 +75,6 @@
|
|||
|
||||
<treecol rdf:resource="http://home.netscape.com/NC-rdf#Name" />
|
||||
|
||||
<treechildren>
|
||||
<treeitem id="NC:RelatedLinks" container="true">
|
||||
<treerow>
|
||||
<treecell value="&related.row.label;" indent="true" />
|
||||
</treerow>
|
||||
</treeitem>
|
||||
|
||||
<treeitem id="NC:LastSearchRoot" container="true">
|
||||
<treerow>
|
||||
<treecell value="&lastsearch.row.label;" indent="true" />
|
||||
</treerow>
|
||||
</treeitem>
|
||||
|
||||
<treeitem id="NC:SiteMapRoot" container="true">
|
||||
<treerow>
|
||||
<treecell value="&sitemap.row.label;" indent="true" />
|
||||
</treerow>
|
||||
</treeitem>
|
||||
|
||||
</treechildren>
|
||||
</tree>
|
||||
</html:div>
|
||||
</window>
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Code for the Search Sidebar Panel
|
||||
|
||||
*/
|
||||
|
||||
function debug(msg)
|
||||
{
|
||||
// uncomment for noise
|
||||
// dump(msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Init()
|
||||
{
|
||||
// Initialize the Search panel
|
||||
}
|
||||
|
||||
|
||||
|
||||
function openURL(event, treeitem, root)
|
||||
{
|
||||
if ((event.button != 1) || (event.clickCount != 2))
|
||||
return(false);
|
||||
|
||||
if (treeitem.getAttribute("container") == "true")
|
||||
return(false);
|
||||
|
||||
if (treeitem.getAttribute("type") == "http://home.netscape.com/NC-rdf#BookmarkSeparator")
|
||||
return(false);
|
||||
|
||||
var id = treeitem.getAttribute('id');
|
||||
if (!id)
|
||||
return(false);
|
||||
|
||||
// rjc: add support for anonymous resources; if the node has
|
||||
// a "#URL" property, use it, otherwise default to using the id
|
||||
try
|
||||
{
|
||||
var rootNode = document.getElementById(root);
|
||||
var ds = null;
|
||||
if (rootNode)
|
||||
{
|
||||
ds = rootNode.database;
|
||||
}
|
||||
var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
|
||||
if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
if (rdf)
|
||||
{
|
||||
if (ds)
|
||||
{
|
||||
var src = rdf.GetResource(id, 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) id = target;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
}
|
||||
|
||||
window.content.location = id;
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0"?> <!-- -*- Mode: SGML; indent-tabs-mode: nil; -*- -->
|
||||
<!--
|
||||
|
||||
The contents of this file are subject to the Netscape Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/NPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is mozilla.org code.
|
||||
|
||||
The Initial Developer of the Original Code is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://search/skin/" type="text/css"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://searcg/locale/search-panel.dtd" >
|
||||
<window
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
align="vertical"
|
||||
onload="Init();">
|
||||
|
||||
<html:script src="chrome://search/content/search-panel.js" />
|
||||
|
||||
<html:div style="width:100px; height:100px" flex="1">
|
||||
<tree id="Tree" ref="NC:LastSearchRoot"
|
||||
style="width: 100%; height: 100%"
|
||||
datasources="rdf:internetsearch"
|
||||
onclick="openURL(event, event.target.parentNode.parentNode, 'Tree')">
|
||||
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<html:hr width="100%" size="1" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="..." persist="open"
|
||||
loading="rdf:http://home.netscape.com/NC-rdf#loading"
|
||||
type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type">
|
||||
<treerow>
|
||||
<treecell value="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
src="rdf:http://home.netscape.com/NC-rdf#Icon" />
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
<treecol rdf:resource="http://home.netscape.com/NC-rdf#Name" />
|
||||
|
||||
</tree>
|
||||
</html:div>
|
||||
</window>
|
|
@ -32,6 +32,12 @@
|
|||
<NC:content>chrome://related/content/related-panel.xul</NC:content>
|
||||
</RDF:Description>
|
||||
</RDF:li>
|
||||
<RDF:li>
|
||||
<RDF:Description about="urn:sidebar:panel:search">
|
||||
<NC:title>&sidebar.search.label;</NC:title>
|
||||
<NC:content>chrome://search/content/search-panel.xul</NC:content>
|
||||
</RDF:Description>
|
||||
</RDF:li>
|
||||
<RDF:li>
|
||||
<RDF:Description about="urn:sidebar:panel:bookmarks">
|
||||
<NC:title>&sidebar.bookmarks.label;</NC:title>
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<!--
|
||||
- The contents of this file are subject to the Mozilla Public
|
||||
- License Version 1.1 (the "License"); you may not use this file
|
||||
- except in compliance with the License. You may obtain a copy of
|
||||
- the License at http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS
|
||||
- IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
- implied. See the License for the specific language governing
|
||||
- rights and limitations under the License.
|
||||
-
|
||||
- The Original Code is Mozilla Communicator.
|
||||
-
|
||||
- The Initial Developer of the Original Code is Netscape
|
||||
- Communications Corp. Portions created by Netscape Communications
|
||||
- Corp. are Copyright (C) 1999 Netscape Communications Corp. All
|
||||
- Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
-->
|
||||
|
|
@ -42,18 +42,14 @@ Handler = Handler.QueryInterface(Components.interfaces.nsIRelatedLinksHandler);
|
|||
// Our observer object
|
||||
var Observer = {
|
||||
Observe: function(subject, topic, data) {
|
||||
// debug("Observer.Observe(" + subject + ", " + topic + ", " + data + ")\n");
|
||||
debug("Observer.Observe(" + subject + ", " + topic + ", " + data + ")\n");
|
||||
|
||||
if (subject != ContentWindow)
|
||||
return;
|
||||
|
||||
// Okay, it's a hit. Before we go out and fetch RL data, make sure that
|
||||
// the RelatedLinks folder is open.
|
||||
var root = document.getElementById('NC:RelatedLinks');
|
||||
|
||||
if (root.getAttribute('open') == 'true')
|
||||
{
|
||||
refetchRelatedLinks(Handler, data);
|
||||
debug("subject was not content window, ignoring\n");
|
||||
return;
|
||||
}
|
||||
refetchRelatedLinks(Handler, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184,65 +180,45 @@ function refetchRelatedLinks(Handler, data)
|
|||
|
||||
function Init()
|
||||
{
|
||||
// Initialize the Related Links panel
|
||||
// Initialize the Related Links panel
|
||||
|
||||
// Create a Related Links handler, and install it in the tree
|
||||
var Tree = document.getElementById("Tree");
|
||||
Tree.database.AddDataSource(Handler.QueryInterface(Components.interfaces.nsIRDFDataSource));
|
||||
// Create a Related Links handler, and install it in the tree
|
||||
var Tree = document.getElementById("Tree");
|
||||
Tree.database.AddDataSource(Handler.QueryInterface(Components.interfaces.nsIRDFDataSource));
|
||||
|
||||
// Install the observer so we'll be notified when new content is loaded.
|
||||
var ObserverService = Components.classes["component://netscape/observer-service"].getService();
|
||||
ObserverService = ObserverService.QueryInterface(Components.interfaces.nsIObserverService);
|
||||
debug("got observer service\n");
|
||||
// Install the observer so we'll be notified when new content is loaded.
|
||||
var ObserverService = Components.classes["component://netscape/observer-service"].getService();
|
||||
ObserverService = ObserverService.QueryInterface(Components.interfaces.nsIObserverService);
|
||||
if (ObserverService)
|
||||
{
|
||||
ObserverService.AddObserver(Observer, "StartDocumentLoad");
|
||||
ObserverService.AddObserver(Observer, "EndDocumentLoad");
|
||||
ObserverService.AddObserver(Observer, "FailDocumentLoad");
|
||||
debug("added observer\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
debug("FAILURE to get observer service\n");
|
||||
}
|
||||
|
||||
ObserverService.AddObserver(Observer, "EndDocumentLoad");
|
||||
debug("added observer\n");
|
||||
}
|
||||
|
||||
function clicked(event, target) {
|
||||
if (target.getAttribute('container') == 'true') {
|
||||
if (target.getAttribute('open') == 'true') {
|
||||
target.removeAttribute('open');
|
||||
} else {
|
||||
target.setAttribute('open','true');
|
||||
// First, see if they're opening the related links node. If so,
|
||||
// we'll need to go out and fetch related links _now_.
|
||||
if (target.getAttribute('id') == 'NC:RelatedLinks') {
|
||||
refetchRelatedLinks(Handler, ContentWindow.location);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (event.clickCount == 2) {
|
||||
openURL(target, 'Tree');
|
||||
}
|
||||
}
|
||||
refetchRelatedLinks(Handler, ContentWindow.location);
|
||||
}
|
||||
|
||||
|
||||
function openURL(treeitem, root)
|
||||
|
||||
function openURL(event, treeitem, root)
|
||||
{
|
||||
if ((event.button != 1) || (event.clickCount != 2))
|
||||
return(false);
|
||||
|
||||
// Next, check to see if it's a container. If so, then just let
|
||||
// the tree do its open and close stuff.
|
||||
if (treeitem.getAttribute('container') == 'true') {
|
||||
if (treeitem.getAttribute('container') == 'true')
|
||||
return(false);
|
||||
|
||||
// if (treeitem.getAttribute('open') == 'true') {
|
||||
// treeitem.setAttribute('open','')
|
||||
// } else {
|
||||
// treeitem.setAttribute('open','true')
|
||||
// }
|
||||
if (treeitem.getAttribute("type") == "http://home.netscape.com/NC-rdf#BookmarkSeparator")
|
||||
return(false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (treeitem.getAttribute('type') == 'http://home.netscape.com/NC-rdf#BookmarkSeparator') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Okay, it's not a container. See if it has a URL, and if so, open it.
|
||||
var id = treeitem.getAttribute('id');
|
||||
if (!id) return(false);
|
||||
var id = treeitem.getAttribute('id');
|
||||
if (!id) return(false);
|
||||
|
||||
// rjc: add support for anonymous resources; if the node has
|
||||
// a "#URL" property, use it, otherwise default to using the id
|
||||
|
@ -272,5 +248,6 @@ function openURL(treeitem, root)
|
|||
catch(ex)
|
||||
{
|
||||
}
|
||||
ContentWindow.location = id;
|
||||
|
||||
ContentWindow.location = id;
|
||||
}
|
||||
|
|
|
@ -40,11 +40,11 @@
|
|||
though there is no datasource from which to build content yet.
|
||||
-->
|
||||
|
||||
<html:div style="width:100px; height:100px" flex="1">
|
||||
<tree id="Tree"
|
||||
<html:div style="width:100%; height:100%" flex="1">
|
||||
<tree id="Tree" ref="NC:RelatedLinks" container="true"
|
||||
style="width: 100%; height: 100%"
|
||||
datasources="rdf:internetsearch"
|
||||
onclick="clicked(event,event.target.parentNode.parentNode)">
|
||||
datasources="rdf:null"
|
||||
onclick="openURL(event, event.target.parentNode.parentNode, 'Tree')">
|
||||
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
|
@ -52,7 +52,7 @@
|
|||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<html:hr width="75%" align="center" size="1" />
|
||||
<html:hr width="100%" size="1" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
|
@ -61,7 +61,7 @@
|
|||
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="..." persist="open"
|
||||
<treeitem uri="..."
|
||||
loading="rdf:http://home.netscape.com/NC-rdf#loading"
|
||||
type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type">
|
||||
<treerow>
|
||||
|
@ -75,26 +75,6 @@
|
|||
|
||||
<treecol rdf:resource="http://home.netscape.com/NC-rdf#Name" />
|
||||
|
||||
<treechildren>
|
||||
<treeitem id="NC:RelatedLinks" container="true">
|
||||
<treerow>
|
||||
<treecell value="&related.row.label;" indent="true" />
|
||||
</treerow>
|
||||
</treeitem>
|
||||
|
||||
<treeitem id="NC:LastSearchRoot" container="true">
|
||||
<treerow>
|
||||
<treecell value="&lastsearch.row.label;" indent="true" />
|
||||
</treerow>
|
||||
</treeitem>
|
||||
|
||||
<treeitem id="NC:SiteMapRoot" container="true">
|
||||
<treerow>
|
||||
<treecell value="&sitemap.row.label;" indent="true" />
|
||||
</treerow>
|
||||
</treeitem>
|
||||
|
||||
</treechildren>
|
||||
</tree>
|
||||
</html:div>
|
||||
</window>
|
||||
|
|
|
@ -2,6 +2,8 @@ default.htm
|
|||
search.css
|
||||
search.js
|
||||
search.xul
|
||||
search-panel.js
|
||||
search-panel.xul
|
||||
shared.js
|
||||
find.js
|
||||
find.xul
|
||||
|
|
|
@ -8,4 +8,6 @@ internetresults.js
|
|||
internetresults.xul
|
||||
search.js
|
||||
search.xul
|
||||
search-panel.js
|
||||
search-panel.xul
|
||||
shared.js
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
en-US:search.dtd
|
||||
en-US:search-panel.dtd
|
||||
en-US:find.dtd
|
||||
en-US:findresults.dtd
|
||||
en-US:internet.dtd
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<!--
|
||||
- The contents of this file are subject to the Mozilla Public
|
||||
- License Version 1.1 (the "License"); you may not use this file
|
||||
- except in compliance with the License. You may obtain a copy of
|
||||
- the License at http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS
|
||||
- IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
- implied. See the License for the specific language governing
|
||||
- rights and limitations under the License.
|
||||
-
|
||||
- The Original Code is Mozilla Communicator.
|
||||
-
|
||||
- The Initial Developer of the Original Code is Netscape
|
||||
- Communications Corp. Portions created by Netscape Communications
|
||||
- Corp. are Copyright (C) 1999 Netscape Communications Corp. All
|
||||
- Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
-->
|
||||
|
|
@ -32,6 +32,8 @@ CHROME_CONTENT = \
|
|||
.\default.htm \
|
||||
.\search.js \
|
||||
.\search.xul \
|
||||
.\search-panel.js \
|
||||
.\search-panel.xul \
|
||||
.\shared.js \
|
||||
.\find.js \
|
||||
.\find.xul \
|
||||
|
@ -56,6 +58,7 @@ CHROME_L10N = \
|
|||
.\locale\en-US\internet.dtd \
|
||||
.\locale\en-US\internetresults.dtd \
|
||||
.\locale\en-US\search.dtd \
|
||||
.\locale\en-US\search-panel.dtd \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Code for the Search Sidebar Panel
|
||||
|
||||
*/
|
||||
|
||||
function debug(msg)
|
||||
{
|
||||
// uncomment for noise
|
||||
// dump(msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Init()
|
||||
{
|
||||
// Initialize the Search panel
|
||||
}
|
||||
|
||||
|
||||
|
||||
function openURL(event, treeitem, root)
|
||||
{
|
||||
if ((event.button != 1) || (event.clickCount != 2))
|
||||
return(false);
|
||||
|
||||
if (treeitem.getAttribute("container") == "true")
|
||||
return(false);
|
||||
|
||||
if (treeitem.getAttribute("type") == "http://home.netscape.com/NC-rdf#BookmarkSeparator")
|
||||
return(false);
|
||||
|
||||
var id = treeitem.getAttribute('id');
|
||||
if (!id)
|
||||
return(false);
|
||||
|
||||
// rjc: add support for anonymous resources; if the node has
|
||||
// a "#URL" property, use it, otherwise default to using the id
|
||||
try
|
||||
{
|
||||
var rootNode = document.getElementById(root);
|
||||
var ds = null;
|
||||
if (rootNode)
|
||||
{
|
||||
ds = rootNode.database;
|
||||
}
|
||||
var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
|
||||
if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
if (rdf)
|
||||
{
|
||||
if (ds)
|
||||
{
|
||||
var src = rdf.GetResource(id, 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) id = target;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
}
|
||||
|
||||
window.content.location = id;
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0"?> <!-- -*- Mode: SGML; indent-tabs-mode: nil; -*- -->
|
||||
<!--
|
||||
|
||||
The contents of this file are subject to the Netscape Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/NPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is mozilla.org code.
|
||||
|
||||
The Initial Developer of the Original Code is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://search/skin/" type="text/css"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://searcg/locale/search-panel.dtd" >
|
||||
<window
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
align="vertical"
|
||||
onload="Init();">
|
||||
|
||||
<html:script src="chrome://search/content/search-panel.js" />
|
||||
|
||||
<html:div style="width:100px; height:100px" flex="1">
|
||||
<tree id="Tree" ref="NC:LastSearchRoot"
|
||||
style="width: 100%; height: 100%"
|
||||
datasources="rdf:internetsearch"
|
||||
onclick="openURL(event, event.target.parentNode.parentNode, 'Tree')">
|
||||
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<html:hr width="100%" size="1" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="..." persist="open"
|
||||
loading="rdf:http://home.netscape.com/NC-rdf#loading"
|
||||
type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type">
|
||||
<treerow>
|
||||
<treecell value="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
src="rdf:http://home.netscape.com/NC-rdf#Icon" />
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
<treecol rdf:resource="http://home.netscape.com/NC-rdf#Name" />
|
||||
|
||||
</tree>
|
||||
</html:div>
|
||||
</window>
|
|
@ -32,6 +32,12 @@
|
|||
<NC:content>chrome://related/content/related-panel.xul</NC:content>
|
||||
</RDF:Description>
|
||||
</RDF:li>
|
||||
<RDF:li>
|
||||
<RDF:Description about="urn:sidebar:panel:search">
|
||||
<NC:title>&sidebar.search.label;</NC:title>
|
||||
<NC:content>chrome://search/content/search-panel.xul</NC:content>
|
||||
</RDF:Description>
|
||||
</RDF:li>
|
||||
<RDF:li>
|
||||
<RDF:Description about="urn:sidebar:panel:bookmarks">
|
||||
<NC:title>&sidebar.bookmarks.label;</NC:title>
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
<!-- extracted from ./sidebar.rdf -->
|
||||
|
||||
<!ENTITY sidebar.whats-related.label "What's Related">
|
||||
<!ENTITY sidebar.search.label "Search Results">
|
||||
<!ENTITY sidebar.alerts.label "Alerts">
|
||||
<!-- LOCALIZATION NOTE sidebar.tinderbox.label: DONT_TRANSLATE -->
|
||||
<!ENTITY sidebar.tinderbox.label "Tinderbox">
|
||||
|
|
Загрузка…
Ссылка в новой задаче