Skip to content

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

Added YaCy portal search: http://localhost:8080/yacy/ui/yacyui-portaltest.html

apfelmaennchena975ae4a7efc
diff --git a/htroot/yacy/ui/css/base.css b/htroot/yacy/ui/css/base.css
index 8d779b298..53fc9f286 100644
--- a/htroot/yacy/ui/css/base.css
+++ b/htroot/yacy/ui/css/base.css
@@ -193,6 +193,11 @@ p.url a {
color:#20A020;
text-decoration:none;
}
+.tag {
+ font-size: 1.1em;
+ line-height: 1.3em;
+ color:#20A020;
+}
.desc {
font-style:italic;
font-size: 0.9em;
diff --git a/htroot/yacy/ui/css/yacyui-portalsearch.css b/htroot/yacy/ui/css/yacyui-portalsearch.css
new file mode 100644
index 000000000..da12e5df6
--- /dev/null
+++ b/htroot/yacy/ui/css/yacyui-portalsearch.css
@@ -0,0 +1,72 @@
+.ui-dialog .ui-dialog-title {
+ font-size: 14px;
+}
+.ui-dialog .ui-dialog-buttonpane button {
+ font-size: 14px;
+}
+#ypopup .url {
+ padding-top: 1px;
+ font-size: 0.9em;
+ line-height: 1.2em;
+ margin-bottom:0.6em;
+}
+#ypopup .date {
+ font-size: 0.9em;
+ line-height: 1.2em;
+ margin-top:-0.6em;
+}
+#ypopup .url a {
+ color:#20A020;
+ text-decoration:none;
+}
+#ypopup h3.linktitle {
+ margin-top: 2px;
+ margin-bottom: -0.5em;
+ font-size: 1.0em;
+ line-height: 1.2em;
+ color:#239AFF;
+}
+#ypopup h3.linktitle a {
+ text-decoration:none;
+ color:#239AFF;
+}
+#ypopup .desc {
+ font-style:italic;
+ font-size: 0.9em;
+ color: #808080;
+ line-height: 1.2em;
+ margin-bottom:-1em;
+}
+#ypopup .favicon {
+ width: 16px;
+ height: 16px;
+ vertical-align: middle;
+ margin-left: -20px;
+}
+.classic {
+ font-size: 75%;
+}
+.classic .linktitle, .classic .url, .classic .date, .classic .desc {
+ margin-left: 20px;
+}
+div .ybpane {
+ float: left;
+ font-size: 0.8em;
+ line-height: 1.2em;
+ color:#239AFF;
+ margin-top: 10px;
+ margin-left: 10px;
+}
+.ybpane img {
+ width: 50px;
+ height: 32px;
+ vertical-align: middle;
+ padding-right: 15px;
+ padding-top: 3px;
+ border: 0;
+}
+#ypopup .yloading {
+ margin-top: 150px;
+ margin-left: -10px;
+ text-align: center;
+}
\ No newline at end of file
diff --git a/htroot/yacy/ui/js/yacyui-portalsearch.js b/htroot/yacy/ui/js/yacyui-portalsearch.js
new file mode 100644
index 000000000..e4b04b807
--- /dev/null
+++ b/htroot/yacy/ui/js/yacyui-portalsearch.js
@@ -0,0 +1,130 @@
+$(document).ready(function() {
+
+ $.ajaxSetup({
+ timeout: 10000,
+ cache: false
+ })
+
+ $('<div id="ypopup" class="classic"></div>').appendTo("#yacy");
+
+ startRecord = 0;
+
+ var style1 = yurl + '/yacy/ui/css/yacyui-portalsearch.css';
+ var style2 = yurl + '/yacy/ui/css/themes/'+ytheme+'/ui.base.css';
+ var style3 = yurl + '/yacy/ui/css/themes/'+ytheme+'/ui.theme.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);
+
+ var script1 = yurl + '/yacy/ui/js/jquery.query.js';
+ var script2 = yurl + '/yacy/ui/js/jquery.form.js';
+ var script3 = yurl + '/yacy/ui/js/jquery.field.min.js';
+ var script4 = yurl + '/yacy/ui/js/jquery-faviconize-1.0.js';
+ var script5 = yurl + '/yacy/ui/js/jquery.ui.all.min.js';
+
+ $.getScript(script1, function(){});
+ $.getScript(script2, function(){});
+ $.getScript(script3, function(){});
+ $.getScript(script4, function(){});
+ $.getScript(script5, function(){
+ $("#ypopup").dialog({
+ autoOpen: false,
+ height: 500,
+ width: 420,
+ minWidth: 420,
+ position: ['top',50],
+ modal: false,
+ resizable: true,
+ title: "YaCy P2P Web Search",
+ buttons: {
+ Next: function() {
+ startRecord = startRecord + 10;
+ $('#ysearch').trigger('submit');
+ },
+ Prev: function() {
+ startRecord = startRecord - 10;
+ if(startRecord < 0) startRecord = 0;
+ $('#ysearch').trigger('submit');
+ }
+ }
+ });
+ });
+
+ $('#ysearch').keyup(function() {
+ startRecord = 0;
+ $('#ysearch').trigger('submit');
+ return false;
+ });
+
+ $('#ysearch').submit(function() {
+
+ var query = $('#yquery').getValue();
+ var url = yurl + '/yacysearch.json?callback=?'
+
+ $('#ypopup').empty();
+ $('#ypopup').append("<div class='yloading'><h3 class='linktitle'><em>Loading: "+yurl+"</em><br/><img src='"+yurl+"/yacy/ui/img/loading2.gif' align='absmiddle'/></h3></div>");
+
+ if (!$("#ypopup").dialog('isOpen')) {
+ $("#ypopup").dialog('open');
+ }
+ $("#yquery").focus();
+
+ var param = [
+ { name : 'startRecord', value : startRecord }
+ ,{ name : 'maximumRecords', value : 10 }
+ ,{ name : 'query', value : query}
+ ];
+
+ if (yparam) {
+ for (var pi = 0; pi < yparam.length; pi++) param[param.length] = yparam[pi];
+ }
+
+ $.getJSON(url, param,
+ function(json, status){
+ if (json[0]) data = json[0];
+ else data = json;
+
+ $('#ypopup').empty();
+
+ var total = data.channels[0].totalResults.replace(/[,.]/,"");
+ var page = (data.channels[0].startIndex / data.channels[0].itemsPerPage) + 1;
+ var start = startRecord + 1;
+ var end = startRecord + 10;
+
+ $("div .ybpane").remove();
+ var ylogo = "<div class='ybpane'><a href='http://www.yacy.net' target='_blank'><img src='"+yurl+"/yacy/ui/img/yacy-logo.png' alt='www.yacy.net' title='www.yacy.net' /></a></div>";
+ var yresult = "<div class='ybpane'><em>Displaying result "+start+" to "+end+"<br/> of "+total+" total results.</em></div>";
+ $("div .ui-dialog-buttonpane").prepend(ylogo+yresult);
+
+ $.each (
+ data.channels[0].items,
+ function(i,item) {
+ if (item) {
+ var title = "<h3 class='linktitle'><a href='"+item.link+"' target='_blank'>"+item.title+"</a></h3>";
+ var url = "<p class='url'><a href='"+item.link+"' target='_blank'>"+item.link+"</a></p>"
+ var desc = "<p class='desc'>"+item.description+"</p>";
+ var date = "<p class='date'>"+item.pubDate.substring(0,16);
+ var size = " | "+item.sizename+"</p>";
+ $(title+desc+url+date+size).appendTo("#ypopup");
+ }
+ }
+ );
+ $(".linktitle a").faviconize({
+ position: "before",
+ defaultImage: yurl + "/yacy/ui/img-2/article.png",
+ className: "favicon"
+ });
+ }
+ );
+ return false;
+ });
+});
\ No newline at end of file
diff --git a/htroot/yacy/ui/yacyui-portaltest.html b/htroot/yacy/ui/yacyui-portaltest.html
new file mode 100644
index 000000000..d73a71d77
--- /dev/null
+++ b/htroot/yacy/ui/yacyui-portaltest.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ </head>
+ <body>
+ <script src="http://localhost:8080/yacy/ui/js/jquery-1.3.1.min.js" type="text/javascript"></script>
+ <script>
+ $(document).ready(function() {
+ yurl = 'http://localhost:8080/';
+ ytheme = 'base';
+ yparam = [
+ { name : 'verify', value : 'true'}
+ ,{ name : 'resource', value : 'local'}
+ ,{ name : 'urlmaskfilter', value : '.*'}
+ ,{ name : 'prefermaskfilter', value : ''}
+ ];
+ $.getScript(yurl+'/yacy/ui/js/yacyui-portalsearch.js', function(){});
+ });
+ </script>
+<h3>YaCy Portal Search:</h3>
+ <div id="yacy">
+ <form id="ysearch" method="get" accept-charset="UTF-8" action="">
+ <input id="yquery" type="text" size="15" maxlength="80" value=""/>
+ </form>
+ </div>
+<h4>Code Snippet:</h4>
+<pre>
+&lt;script src="http://localhost:8080/yacy/ui/js/jquery-1.3.1.min.js" type="text/javascript">&lt;/script>
+&lt;script>
+ $(document).ready(function() {
+ yurl = 'http://localhost:8080/';
+ ytheme = 'base';
+ yparam = [
+ { name : 'verify', value : 'true'}
+ ,{ name : 'resource', value : 'local'}
+ ,{ name : 'urlmaskfilter', value : '.*'}
+ ,{ name : 'prefermaskfilter', value : ''}
+ ];
+ $.getScript(yurl+'/yacy/ui/js/yacyui-portalsearch.js', function(){});
+ });
+&lt;/script>
+&lt;div id="yacy">
+ &lt;form id="ysearch" method="get" accept-charset="UTF-8" action="">
+ &lt;input id="yquery" type="text" size="15" maxlength="80" value=""/>
+ &lt;/form>
+&lt;/div&gt;
+</pre>
+ </body>
+</html>
+
diff --git a/htroot/yacy/ui/yacyui-search.html b/htroot/yacy/ui/yacyui-search.html
index 7c755cbc9..e30e1c86b 100644
--- a/htroot/yacy/ui/yacyui-search.html
+++ b/htroot/yacy/ui/yacyui-search.html
@@ -31,6 +31,7 @@
],
useRp: true,
rp: 10,
+ hideOnSubmit: false,
usepager: true,
striped: true,
nowrap: false,
@@ -59,7 +60,9 @@
var desc = "<p class='desc'>"+item.description+"</p>";
var fav = "<a class='favicon' href='"+item.link+"'></a>";
var date = item.pubDate.substring(0,16);
- rows[i] = {id: item.guid, cell: [item.guid, fav, title+desc+url, "Tags", "Folders", date]};
+ var tags = "<p id='tags-"+i+"' class='tag'></p>";
+ getTags(item.link, i);
+ rows[i] = {id: item.guid, cell: [item.guid, fav, title+desc+url, tags, "Folders", date]};
}
}
);
@@ -154,6 +157,21 @@
} else {
alert("Test!");
}
+ }
+ function getTags(url, i) {
+ $.ajax({
+ type: "GET",
+ url: "/api/util/getpageinfo_p.xml?url="+url,
+ dataType: "xml",
+ success: function(xml) {
+ tags = "";
+ $(xml).find('tag').each(function(){
+ tags = tags + $(this).attr('name') + "<img src='img/tags/tag_blue.png' />";
+ });
+ var id = "#tags-"+i;
+ $(id).append(tags);
+ }
+ });
}
//]]>
</script>
diff --git a/htroot/yacy/ui/yacyuisearch.html b/htroot/yacy/ui/yacyuisearch.html
index 0bad66d8a..350de6913 100644
--- a/htroot/yacy/ui/yacyuisearch.html
+++ b/htroot/yacy/ui/yacyuisearch.html
@@ -40,7 +40,8 @@
],
useRp: true,
rp: 10,
- usepager: true,
+ usepager: true,
+ hideOnSubmit: false,
striped: true,
nowrap: false,
height: height,
@@ -65,7 +66,7 @@
var desc = "<p class='desc'>"+item.description+"</p>";
var fav = "<a class='favicon' href='"+item.link+"'></a>";
var date = item.pubDate.substring(0,16);
- rows[i] = {id: item.guid, cell: [item.guid, fav, title+desc+url, "Tags", "Folders", date]};
+ rows[i] = {id: item.guid, cell: [item.guid, fav, title+desc+url, date]};
}
}
);