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 + }) + + $('
').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("

Loading: "+yurl+"

"); + + 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 = "
www.yacy.net
"; + var yresult = "
Displaying result "+start+" to "+end+"
of "+total+" total results.
"; + $("div .ui-dialog-buttonpane").prepend(ylogo+yresult); + + $.each ( + data.channels[0].items, + function(i,item) { + if (item) { + var title = "

"+item.title+"

"; + var url = "

"+item.link+"

" + var desc = "

"+item.description+"

"; + var date = "

"+item.pubDate.substring(0,16); + var size = " | "+item.sizename+"

"; + $(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 @@ + + + + + + + + +

YaCy Portal Search:

+
+
+ +
+
+

Code Snippet:

+
+<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> 			
+<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>
+
+ + + 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 = "

"+item.description+"

"; var fav = ""; var date = item.pubDate.substring(0,16); - rows[i] = {id: item.guid, cell: [item.guid, fav, title+desc+url, "Tags", "Folders", date]}; + var tags = "

"; + 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') + ""; + }); + var id = "#tags-"+i; + $(id).append(tags); + } + }); } //]]> 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 = "

"+item.description+"

"; var fav = ""; 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]}; } } );