Add HTML banners if available.

This commit is contained in:
rjc%netscape.com 1999-08-21 09:26:10 +00:00
parent 3c777fd878
commit 7a1ee8255d
5 changed files with 39 additions and 34 deletions

View File

@ -3,8 +3,6 @@ var gEditorShell = null;
function doLoad()
{
dump("doLoad() entered.\n");
var editorShell = Components.classes["component://netscape/editor/editorshell"].createInstance();
if (editorShell) editorShell = editorShell.QueryInterface(Components.interfaces.nsIEditorShell);
if (editorShell)
@ -12,23 +10,20 @@ function doLoad()
window.editorShell = editorShell;
editorShell.Init();
dump("init\n");
// editorShell.SetWebShellWindow(window);
// dump("SetWebShellWindow\n");
// editorShell.SetToolbarWindow(window)
// dump("SetToolbarWindow\n");
editorShell.SetEditorType("html");
dump("SetEditorType\n");
editorShell.SetContentWindow(window.content);
// Get url for editor content and load it.
// the editor gets instantiated by the editor shell when the URL has finished loading.
// The editor gets instantiated by the editor shell when the URL has finished loading.
editorShell.LoadUrl("about:blank");
gEditorShell = editorShell;
dump("doLoad() succeeded.\n");
}
else dump("doLoad(): problem loading component://netscape/editor/editorshell \n");
}
function doClick(node)
@ -46,7 +41,13 @@ function doClick(node)
if (internetSearchStore)
{
var src = rdf.GetResource(theID, true);
var bannerProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#Banner", true);
var htmlProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#HTML", true);
var banner = internetSearchStore.GetTarget(src, bannerProperty, true);
if (banner) banner = banner.QueryInterface(Components.interfaces.nsIRDFLiteral);
if (banner) banner = banner.Value;
var target = internetSearchStore.GetTarget(src, htmlProperty, true);
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
if (target) target = target.Value;
@ -58,14 +59,17 @@ function doClick(node)
}
if (gEditorShell)
{
var text = target;
var text = "";
if (banner)
{
// add a </A> and a <BR> just in case
text += banner + "</A><BR>";
}
text += target;
gEditorShell.SelectAll();
gEditorShell.DeleteSelection(2);
// gEditorShell.SetTextProperty("font", "size", "-2");
gEditorShell.InsertSource(text);
// gEditorShell.SelectAll();
// gEditorShell.SetTextProperty("font", "size", "-2");
}
}
}

View File

@ -6,7 +6,6 @@
<!DOCTYPE window
[
<!ENTITY window.title.label "Search Internet Results">
<!ENTITY results.title.label "Results:">
<!ENTITY resultsites.title.label "Search Sites:">
@ -18,7 +17,7 @@
]>
<window title="&window.title.label;" style="width:100%; height:100%; background-color:white" align="vertical" onload="doLoad()"
<window style="width:100%; height:100%; background-color:white" align="vertical" onload="doLoad()"
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">
@ -67,7 +66,7 @@
</tree>
</box>
<tree id="internetresultstree" style="height: 65%; width: 100%;" flex="100%" datasources="rdf:internetsearch" ondblclick="return OpenURL(event, event.target.parentNode.parentNode);">
<tree id="internetresultstree" style="height: 70%; width: 100%;" flex="100%" datasources="rdf:internetsearch" ondblclick="return OpenURL(event, event.target.parentNode.parentNode);">
<treecol id="NameColumn" rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
<treecol id="RelevanceColumn" rdf:resource="http://home.netscape.com/NC-rdf#Relevance" sortActive="true" sortDirection="descending" />
<treecol id="SiteColumn" rdf:resource="http://home.netscape.com/NC-rdf#Site"/>
@ -136,5 +135,5 @@
</treehead>
</tree>
<html:iframe id="content" type="content-primary" width="100%" height="35%" flex="100%" src="about:blank" />
<html:iframe id="content" type="content-primary" style="height: 30%; width: 100%;" src="resource:/res/samples/default.htm" />
</window>

View File

@ -5,7 +5,6 @@
<!DOCTYPE window
[
<!ENTITY window.title.label "Search Internet">
<!ENTITY words.label "Words: ">
<!ENTITY checkbox.column.label "On">
@ -17,7 +16,7 @@
]>
<window title="&window.title.label;" style="width:100%; height:100%; background-color:white" align="vertical"
<window style="width:100%; height:100%; background-color:white" align="vertical"
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" onload="loadPage()" onunload="unloadPage()">

View File

@ -3,8 +3,6 @@ var gEditorShell = null;
function doLoad()
{
dump("doLoad() entered.\n");
var editorShell = Components.classes["component://netscape/editor/editorshell"].createInstance();
if (editorShell) editorShell = editorShell.QueryInterface(Components.interfaces.nsIEditorShell);
if (editorShell)
@ -12,23 +10,20 @@ function doLoad()
window.editorShell = editorShell;
editorShell.Init();
dump("init\n");
// editorShell.SetWebShellWindow(window);
// dump("SetWebShellWindow\n");
// editorShell.SetToolbarWindow(window)
// dump("SetToolbarWindow\n");
editorShell.SetEditorType("html");
dump("SetEditorType\n");
editorShell.SetContentWindow(window.content);
// Get url for editor content and load it.
// the editor gets instantiated by the editor shell when the URL has finished loading.
// The editor gets instantiated by the editor shell when the URL has finished loading.
editorShell.LoadUrl("about:blank");
gEditorShell = editorShell;
dump("doLoad() succeeded.\n");
}
else dump("doLoad(): problem loading component://netscape/editor/editorshell \n");
}
function doClick(node)
@ -46,7 +41,13 @@ function doClick(node)
if (internetSearchStore)
{
var src = rdf.GetResource(theID, true);
var bannerProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#Banner", true);
var htmlProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#HTML", true);
var banner = internetSearchStore.GetTarget(src, bannerProperty, true);
if (banner) banner = banner.QueryInterface(Components.interfaces.nsIRDFLiteral);
if (banner) banner = banner.Value;
var target = internetSearchStore.GetTarget(src, htmlProperty, true);
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
if (target) target = target.Value;
@ -58,14 +59,17 @@ function doClick(node)
}
if (gEditorShell)
{
var text = target;
var text = "";
if (banner)
{
// add a </A> and a <BR> just in case
text += banner + "</A><BR>";
}
text += target;
gEditorShell.SelectAll();
gEditorShell.DeleteSelection(2);
// gEditorShell.SetTextProperty("font", "size", "-2");
gEditorShell.InsertSource(text);
// gEditorShell.SelectAll();
// gEditorShell.SetTextProperty("font", "size", "-2");
}
}
}

View File

@ -6,7 +6,6 @@
<!DOCTYPE window
[
<!ENTITY window.title.label "Search Internet Results">
<!ENTITY results.title.label "Results:">
<!ENTITY resultsites.title.label "Search Sites:">
@ -18,7 +17,7 @@
]>
<window title="&window.title.label;" style="width:100%; height:100%; background-color:white" align="vertical" onload="doLoad()"
<window style="width:100%; height:100%; background-color:white" align="vertical" onload="doLoad()"
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">
@ -67,7 +66,7 @@
</tree>
</box>
<tree id="internetresultstree" style="height: 65%; width: 100%;" flex="100%" datasources="rdf:internetsearch" ondblclick="return OpenURL(event, event.target.parentNode.parentNode);">
<tree id="internetresultstree" style="height: 70%; width: 100%;" flex="100%" datasources="rdf:internetsearch" ondblclick="return OpenURL(event, event.target.parentNode.parentNode);">
<treecol id="NameColumn" rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
<treecol id="RelevanceColumn" rdf:resource="http://home.netscape.com/NC-rdf#Relevance" sortActive="true" sortDirection="descending" />
<treecol id="SiteColumn" rdf:resource="http://home.netscape.com/NC-rdf#Site"/>
@ -136,5 +135,5 @@
</treehead>
</tree>
<html:iframe id="content" type="content-primary" width="100%" height="35%" flex="100%" src="about:blank" />
<html:iframe id="content" type="content-primary" style="height: 30%; width: 100%;" src="resource:/res/samples/default.htm" />
</window>