Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

- some improvements for: http://forum.yacy-websuche.de/viewtopic.php?f=9&t=1904#p15668 - portalsearch: introduced yconf.load_js and yconf.load_css - yacysearch.html still having problems with focus after sidebar is loaded - yacysearchtrailer.json seems not to be valid json for ?nav=all

apfelmaennchen5a7dec880e0a
diff --git a/htroot/env/templates/header.template b/htroot/env/templates/header.template
index a9eda61a6..7fbb165a3 100644
--- a/htroot/env/templates/header.template
+++ b/htroot/env/templates/header.template
@@ -1,16 +1,30 @@
-<script src="/yacy/ui/js/jquery-1.3.1.min.js" type="text/javascript"></script>
+<link media="screen" type="text/css" href="/yacy/ui/css/themes/start/ui.base.css" rel="stylesheet" />
+<link media="screen" type="text/css" href="/yacy/ui/css/themes/start/ui.theme.css" rel="stylesheet" />
+<link media="screen" type="text/css" href="/yacy/ui/css/yacyui-portalsearch.css" rel="stylesheet" />
+
+<script src="/yacy/ui/js/jquery-1.3.1.min.js" type="text/javascript"></script>
+<script src="/yacy/ui/js/jquery.ui.all.min.js" type="text/javascript"></script>
+<script src="/yacy/ui/js/jquery.dimensions.min.js"></script>
+<script src="/yacy/ui/js/jquery.query.js"></script>
+<script src="/yacy/ui/js/jquery.form.js"></script>
+<script src="/yacy/ui/js/jquery.field.min.js"></script>
+<script src="/yacy/ui/js/jquery-faviconize-1.0.js"></script>
+
<script>
$(document).ready(function() {
yconf = {
- url : '',
- global: true,
- width : 500,
- theme : 'start',
- title : 'YaCy P2P Search'
+ url : '',
+ global : true,
+ width : 500,
+ theme : 'start',
+ title : 'YaCy P2P Search',
+ load_js : false,
+ load_css : false,
};
$.getScript(yconf.url+'/yacy/ui/js/yacyui-portalsearch.js', function(){});
});
</script>
+
<div class="head">
<h1>YaCy - Distributed Search Engine</h1>
<div id="yacylivesearch" style="float: right; margin-right: 90px; margin-top: -27px;">
diff --git a/htroot/yacy/ui/js/yacyui-portalsearch.js b/htroot/yacy/ui/js/yacyui-portalsearch.js
index c32ba8c86..5eef154f3 100644
--- a/htroot/yacy/ui/js/yacyui-portalsearch.js
+++ b/htroot/yacy/ui/js/yacyui-portalsearch.js
@@ -20,140 +20,143 @@ $(document).ready(function() {
modal : false,
resizable: true,
show : '',
- hide : ''
+ hide : '',
+ load_js : true,
+ load_css : true
}, yconf);
$('<div id="ypopup" class="classic"></div>').appendTo("#yacylivesearch");
-
- var style1 = yconf.url + '/yacy/ui/css/yacyui-portalsearch.css';
- var style2 = yconf.url + '/yacy/ui/css/themes/'+yconf.theme+'/ui.core.css';
- var style3 = yconf.url + '/yacy/ui/css/themes/'+yconf.theme+'/ui.dialog.css';
- var style4 = yconf.url + '/yacy/ui/css/themes/'+yconf.theme+'/ui.theme.css';
- var style5 = yconf.url + '/yacy/ui/css/themes/'+yconf.theme+'/ui.resizable.css';
- var style6 = yconf.url + '/yacy/ui/css/themes/'+yconf.theme+'/ui.accordion.css';
-
- var head = document.getElementsByTagName('head')[0];
-
- $(document.createElement('link'))
- .attr({type:'text/css', href: style1, rel:'stylesheet', media:'screen'})
- .appendTo(head);
- $(document.createElement('link'))
- .attr({type:'text/css', href: style2, rel:'stylesheet', media:'screen'})
- .appendTo(head);
- $(document.createElement('link'))
- .attr({type:'text/css', href: style3, rel:'stylesheet', media:'screen'})
- .appendTo(head);
- $(document.createElement('link'))
- .attr({type:'text/css', href: style4, rel:'stylesheet', media:'screen'})
- .appendTo(head);
- $(document.createElement('link'))
- .attr({type:'text/css', href: style5, rel:'stylesheet', media:'screen'})
- .appendTo(head);
- $(document.createElement('link'))
- .attr({type:'text/css', href: style6, rel:'stylesheet', media:'screen'})
- .appendTo(head);
-
- var script0 = yconf.url + '/yacy/ui/js/jquery.dimensions.min.js';
- var script1 = yconf.url + '/yacy/ui/js/jquery.query.js';
- var script2 = yconf.url + '/yacy/ui/js/jquery.form.js';
- var script3 = yconf.url + '/yacy/ui/js/jquery.field.min.js';
- var script4 = yconf.url + '/yacy/ui/js/jquery-faviconize-1.0.js';
- var script5 = yconf.url + '/yacy/ui/js/jquery.ui.all.min.js';
- $.getScript(script0, function(){});
- $.getScript(script1, function(){});
- $.getScript(script2, function(){});
- $.getScript(script3, function(){});
- $.getScript(script4, function(){});
+ if(yconf.load_css) {
+ var style1 = yconf.url + '/yacy/ui/css/yacyui-portalsearch.css';
+ var style2 = yconf.url + '/yacy/ui/css/themes/'+yconf.theme+'/ui.core.css';
+ var style3 = yconf.url + '/yacy/ui/css/themes/'+yconf.theme+'/ui.dialog.css';
+ var style4 = yconf.url + '/yacy/ui/css/themes/'+yconf.theme+'/ui.theme.css';
+ var style5 = yconf.url + '/yacy/ui/css/themes/'+yconf.theme+'/ui.resizable.css';
+ var style6 = yconf.url + '/yacy/ui/css/themes/'+yconf.theme+'/ui.accordion.css';
- $.getScript(script5, function(){
-
- maximumRecords = parseInt($("#ysearch input[name='maximumRecords']").getValue());
+ var head = document.getElementsByTagName('head')[0];
- $("#ypopup").dialog({
- autoOpen: false,
- height: yconf.height,
- width: yconf.width,
- minWidth: yconf.width,
- position: yconf.position,
- modal: yconf.modal,
- resizable: yconf.resizable,
- title: yconf.title,
- show: yconf.show,
- hide: yconf.hide,
- close: function(event, ui) {
- $("#yquery").setValue('');
- },
- buttons: {
- '@': function() {
- if ($("#yside").dialog('isOpen')) {
- $("#yside").dialog('close');
- } else {
- $("#yside").dialog('open');
- }
- },
- Next: function() {
- startRecord = startRecord + maximumRecords;
- $('#ysearch').trigger('submit');
- },
- Prev: function() {
- startRecord = startRecord - maximumRecords;
- if(startRecord < 0) startRecord = 0;
- $('#ysearch').trigger('submit');
- }
- },
- drag: function(event, ui) {
- var position = $(".ui-dialog").position();
- var left = $(".ui-dialog").width()+5+position.left;
- $("#yside").dialog('option', 'position', [left,position.top+32]);
- },
- dragStop: function(event, ui) {
- var position = $(".ui-dialog").position();
- var left = $(".ui-dialog").width()+5+position.left;
- $("#yside").dialog('option', 'position', [left,position.top+32]);
- },
- resizeStop: function(event, ui) {
- var position = $(".ui-dialog").position();
- var height = $(".ui-dialog").height()-85;
- var left = $(".ui-dialog").width()+5+position.left;
- $("#yside").dialog('option', 'height', height);
- $("#yside").dialog('option', 'position', [left,position.top+32]);
- },
- close: function(event, ui) {
- $("#yside").dialog('destroy');
- $('#yside').remove();
+ $(document.createElement('link'))
+ .attr({type:'text/css', href: style1, rel:'stylesheet', media:'screen'})
+ .appendTo(head);
+ $(document.createElement('link'))
+ .attr({type:'text/css', href: style2, rel:'stylesheet', media:'screen'})
+ .appendTo(head);
+ $(document.createElement('link'))
+ .attr({type:'text/css', href: style3, rel:'stylesheet', media:'screen'})
+ .appendTo(head);
+ $(document.createElement('link'))
+ .attr({type:'text/css', href: style4, rel:'stylesheet', media:'screen'})
+ .appendTo(head);
+ $(document.createElement('link'))
+ .attr({type:'text/css', href: style5, rel:'stylesheet', media:'screen'})
+ .appendTo(head);
+ $(document.createElement('link'))
+ .attr({type:'text/css', href: style6, rel:'stylesheet', media:'screen'})
+ .appendTo(head);
+ }
+
+ if(yconf.load_js) {
+ var script0 = yconf.url + '/yacy/ui/js/jquery.dimensions.min.js';
+ var script1 = yconf.url + '/yacy/ui/js/jquery.query.js';
+ var script2 = yconf.url + '/yacy/ui/js/jquery.form.js';
+ var script3 = yconf.url + '/yacy/ui/js/jquery.field.min.js';
+ var script4 = yconf.url + '/yacy/ui/js/jquery-faviconize-1.0.js';
+ var script5 = yconf.url + '/yacy/ui/js/jquery.ui.all.min.js';
+
+ $.getScript(script0, function(){});
+ $.getScript(script1, function(){});
+ $.getScript(script2, function(){});
+ $.getScript(script3, function(){});
+ $.getScript(script4, function(){});
+ $.getScript(script5, function(){
+ yrun();
+ });
+ } else {
+ yrun();
+ }
+});
+
+function yrun() {
+ maximumRecords = parseInt($("#ysearch input[name='maximumRecords']").getValue());
+
+ $("#ypopup").dialog({
+ autoOpen: false,
+ height: yconf.height,
+ width: yconf.width,
+ minWidth: yconf.width,
+ position: yconf.position,
+ modal: yconf.modal,
+ resizable: yconf.resizable,
+ title: yconf.title,
+ show: yconf.show,
+ hide: yconf.hide,
+ close: function(event, ui) {
+ $("#yquery").setValue('');
+ },
+ buttons: {
+ '@': function() {
+ if ($("#yside").dialog('isOpen')) {
+ $("#yside").dialog('close');
+ } else {
+ $("#yside").dialog('open');
+ }
+ },
+ Next: function() {
+ startRecord = startRecord + maximumRecords;
+ $('#ysearch').trigger('submit');
},
- open: function(event, ui) {
- $('<div id="yside" style="padding:0px;"></div>').insertAfter(".ui-dialog-content");
- $('<div id="ynav" style="margin0px; padding:0px;"></div>').appendTo('#yside');
- $('<h3 style="padding-left:25px;">Topics</h3><div id="ytop"></div>').appendTo('#ynav');
- $('<h3 style="padding-left:25px;">Domains</h3><div id="ydom"></div>').appendTo('#ynav');
- var position = $(".ui-dialog").position();
- $("#yside").dialog({
- title: 'Navigation',
- autoOpen: false,
- draggable: false,
- resizable: false,
- width: 220,
- height: yconf.height-85,
- minHeight: yconf.height-85,
- show: 'slide',
- hide: 'slide',
- position : [position.left+yconf.width+5,position.top+32],
- open: function(event, ui) {
- $('div.ui-widget-shadow').remove();
- $('ypopup').dialog( 'moveToTop' );
- }
- });
- $('.ui-widget-shadow').remove();
- $('div[aria-labelledby="ui-dialog-title-yside"] div.ui-dialog-titlebar').remove();
- $("#ynav").accordion({
- autoHeight: false,
- clearStyle: true,
- header: "h3"
- });
- }
- });
+ Prev: function() {
+ startRecord = startRecord - maximumRecords;
+ if(startRecord < 0) startRecord = 0;
+ $('#ysearch').trigger('submit');
+ }
+ },
+ drag: function(event, ui) {
+ var position = $(".ui-dialog").position();
+ var left = $(".ui-dialog").width()+5+position.left;
+ $("#yside").dialog('option', 'position', [left,position.top+32]);
+ },
+ dragStop: function(event, ui) {
+ var position = $(".ui-dialog").position();
+ var left = $(".ui-dialog").width()+5+position.left;
+ $("#yside").dialog('option', 'position', [left,position.top+32]);
+ },
+ resizeStop: function(event, ui) {
+ var position = $(".ui-dialog").position();
+ var height = $(".ui-dialog").height()-85;
+ var left = $(".ui-dialog").width()+5+position.left;
+ $("#yside").dialog('option', 'height', height);
+ $("#yside").dialog('option', 'position', [left,position.top+32]);
+ },
+ close: function(event, ui) {
+ $("#yside").dialog('destroy');
+ $('#yside').remove();
+ },
+ open: function(event, ui) {
+ $('<div id="yside" style="padding:0px;"></div>').insertAfter(".ui-dialog-content");
+ $('<div id="ynav" style="margin0px; padding:0px;"></div>').appendTo('#yside');
+ var position = $(".ui-dialog").position();
+ $("#yside").dialog({
+ title: 'Navigation',
+ autoOpen: false,
+ draggable: false,
+ resizable: false,
+ width: 220,
+ height: yconf.height-85,
+ minHeight: yconf.height-85,
+ show: 'slide',
+ hide: 'slide',
+ position : [position.left+yconf.width+5,position.top+32],
+ open: function(event, ui) {
+ $('div.ui-widget-shadow').remove();
+ $('ypopup').dialog( 'moveToTop' );
+ }
+ });
+ $('.ui-widget-shadow').remove();
+ $('div[aria-labelledby="ui-dialog-title-yside"] div.ui-dialog-titlebar').remove();
+ }
});
$('#ysearch').keyup(function(e) {
@@ -175,12 +178,14 @@ $(document).ready(function() {
}
return false;
});
+
$('#ysearch').submit(function() {
submit = true;
yacysearch(yconf.global);
return false;
- });
-});
+ });
+}
+
function yacysearch(global) {
var url = yconf.url + '/yacysearch.json?callback=?'
$('#ypopup').empty();
@@ -235,31 +240,31 @@ function yacysearch(global) {
className: "favicon"
});
- $("#ytop").empty();
- var bhtml = "<ul style='padding-left: 0px;'>";
+ $('#ynav').empty();
$.each (
- data.channels[0].topwords,
- function(i,topword) {
- if (topword) {
- bhtml = bhtml + "<li>"+topword.word+"</li>";
+ data.channels[0].navigation,
+ function(i,facet) {
+ if (facet) {
+ var id = "#y"+facet.facetname;
+ $('<h3 style="padding-left:25px;">'+facet.displayname+'</h3>').appendTo('#ynav');
+ $('<div id="y'+facet.facetname+'"></div>').appendTo('#ynav');
+ $("<ul style='padding-left: 0px;'>").appendTo(id);
+ $.each (
+ facet.elements,
+ function(j,element) {
+ $("<li><a href='"+element.url+"'>"+element.name+" ("+element.count+")</a></li>").appendTo(id);
+ }
+ )
+ $("</ul>").appendTo(id);
}
}
);
- bhtml = bhtml + "</ul>";
- $(bhtml).appendTo("#ytop");
-
- $("#ydom").empty();
- var bhtml = "<ul style='padding-left: 0px;'>";
- $.each (
- data.channels[0].domains,
- function(i,dom) {
- if (dom) {
- bhtml = bhtml + "<li>"+dom.domain+"</li>";
- }
- }
- );
- bhtml = bhtml + "</ul>";
- $(bhtml).appendTo("#ydom");
+ $("#ynav").accordion({
+ autoHeight: false,
+ clearStyle: true,
+ collapsible: true,
+ header: "h3"
+ });
}
);
}
\ No newline at end of file
diff --git a/htroot/yacysearch.html b/htroot/yacysearch.html
index 01611fb4c..504b3e48c 100644
--- a/htroot/yacysearch.html
+++ b/htroot/yacysearch.html
@@ -5,35 +5,21 @@
#%env/templates/metas.template%#
<link rel="alternate" type="application/rss+xml" title="Search for #[former]#" href="yacysearch.rss?search=#[former]#" />
<link rel="search" type="application/opensearchdescription+xml" title="YaCy Search on '#[clientname]#'" href="opensearchdescription.xml" />
+ <link rel="stylesheet" type="text/css" media="screen" href="/env/highslide.css" />
<script type="text/javascript" src="/js/ajax.js"></script>
<script type="text/javascript" src="/js/xml.js"></script>
<script type="text/javascript" src="/js/yacysearch.js"></script>
<script type="text/javascript" src="/js/highslide/highslide.js"></script>
- <link rel="stylesheet" type="text/css" media="screen" href="/env/highslide.css" />
<script type="text/javascript">hs.outlineType = 'rounded-white';</script>
-
-<!-- Styles and Scripts for yacysearchtrailer.html -->
- <link media="screen" type="text/css" href="/yacy/ui/css/themes/start/ui.base.css" rel="stylesheet" />
- <link media="screen" type="text/css" href="/yacy/ui/css/themes/start/ui.theme.css" rel="stylesheet" />
- <script src="/yacy/ui/js/jquery-1.3.1.min.js" type="text/javascript"></script>
- <script src="/yacy/ui/js/jquery.ui.all.min.js" type="text/javascript"></script>
- <script>
- //<![CDATA[
- $(function() {
- $("#sidebar").accordion({
- autoHeight: false,
- clearStyle: true,
- header: "h3"
- });
- });
- //]]>
- </script>
-
</head>
<body id="yacysearch">
#(display)#
#%env/templates/simpleheader.template%#
+ <script src="/yacy/ui/js/jquery-1.3.1.min.js" type="text/javascript"></script>
+ <script src="/yacy/ui/js/jquery.ui.all.min.js" type="text/javascript"></script>
+ <link media="screen" type="text/css" href="/yacy/ui/css/themes/start/ui.base.css" rel="stylesheet" />
+ <link media="screen" type="text/css" href="/yacy/ui/css/themes/start/ui.theme.css" rel="stylesheet" />
::
<div id="api">
<script type="text/javascript">
@@ -50,8 +36,29 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de
#%env/templates/header.template%#
::
#%env/templates/embeddedheader.template%#
+ <script src="/yacy/ui/js/jquery-1.3.1.min.js" type="text/javascript"></script>
+ <script src="/yacy/ui/js/jquery.ui.all.min.js" type="text/javascript"></script>
+ <link media="screen" type="text/css" href="/yacy/ui/css/themes/start/ui.base.css" rel="stylesheet" />
+ <link media="screen" type="text/css" href="/yacy/ui/css/themes/start/ui.theme.css" rel="stylesheet" />
#(/display)#
+<script>
+//<![CDATA[
+$(function() {
+ $.extend($.ui.accordion.defaults, {
+ autoHeight: false,
+ clearStyle: true,
+ collapsible: true,
+ header: "h3"
+ });
+ $("#sidebar1").accordion({});
+ $("#sidebar2").accordion({});
+ $("#sidebar2").accordion('activate', 1);
+ $("#search").focus();
+});
+//]]>
+</script>
+
<form class="search small" action="yacysearch.html" method="get" accept-charset="UTF-8">
<h2>#[promoteSearchPageGreeting]#</h2>
<div class="yacylogo"><a href="#[promoteSearchPageGreeting.homepage]#" class="yacylogo"><img src="#[promoteSearchPageGreeting.smallImage]#" alt="yacysearch" /></a></div>
@@ -128,9 +135,7 @@ var progressbar = new Progressbar(#[results]#, document.getElementById("results"
<!-- linklist end -->
<!-- attach the bottomline -->
</div>
-<div id="sidebar" style="position:fixed; right:8px; margin-top:5px; width: 220px;">
<!--#include virtual="yacysearchtrailer.html?eventID=#[eventID]#&display=#[display]#" -->
</div>
-</div>
</body>
</html>
\ No newline at end of file
diff --git a/htroot/yacysearchtrailer.html b/htroot/yacysearchtrailer.html
index c6f458d1b..a44484545 100644
--- a/htroot/yacysearchtrailer.html
+++ b/htroot/yacysearchtrailer.html
@@ -1,46 +1,25 @@
+<div id="sidebar1" style="float: right; margin-top:5px; width: 220px;">
#(nav-domains)#::
<h3 style="padding-left:25px;">Domains</h3>
<div><ul style="padding-left: 0px;">#{element}#
<li>#[url]#</li>
#{/element}#</ul></div>
#(/nav-domains)#
-
+</div>
+<div id="sidebar2" style="float: right; margin-top:5px; width: 220px;">
#(nav-authors)#::
<h3 style="padding-left:25px;">Authors</h3>
<div><ul style="padding-left: 0px;">#{element}#
<li>#[url]#</li>
#{/element}#</ul></div>
#(/nav-authors)#
-
#(nav-topics)#::
<h3 style="padding-left:25px;">Topics</h3>
<div><ul style="padding-left: 0px;">#{element}#
<li>#[url]#</li>
#{/element}#</ul></div>
#(/nav-topics)#
-
-<h3 style="padding-left:25px;">Timeline</h3>
-<div>
-<p>
-<input type="text" id="min" size="7" style="text-align:left; border:0; color:#f6931f; font-weight:bold;" />
-&nbsp;
-<input type="text" id="max" size="7" style="text-align:right; border:0; color:#f6931f; font-weight:bold;" />
-</p>
-<p>
-<div id="slider-range" style="margin-left:-10px;"></div>
-</p>
</div>
-<script>
-$("#slider-range").slider({
- range: true,
- min: 1999,
- max: 2009,
- values: [2001, 2005],
- slide: function(event, ui) {
- $("#min").val($("#slider-range").slider("values", 0));
- $("#max").val($("#slider-range").slider("values", 1));
- }
-});
-$("#min").val($("#slider-range").slider("values", 0));
-$("#max").val($("#slider-range").slider("values", 1));
-</script>
+
+
+