Added YaCy portal search: http://localhost:8080/yacy/ui/yacyui-portaltest.html
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5739 6c8d7289-2bf4-0310-a012-ef5d649a1542pull/1/head
parent
b57a1820bd
commit
a975ae4a7e
@ -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;
|
||||||
|
}
|
@ -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;
|
||||||
|
});
|
||||||
|
});
|
@ -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>
|
||||||
|
<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>
|
||||||
|
</pre>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
Loading…
Reference in new issue