You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
150 lines
5.5 KiB
150 lines
5.5 KiB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<link media="screen" type="text/css" href="css/jquery.flexigrid.css" rel="stylesheet" />
|
|
<link media="screen" type="text/css" href="css/base.css" rel="stylesheet" />
|
|
<script src="js/jquery-1.3.1.min.js" type="text/javascript"></script>
|
|
<script src="js/jquery.query.js" type="text/javascript""></script>
|
|
<script src="js/jquery.dimensions.min.js" type="text/javascript"></script>
|
|
<script src="js/jquery-faviconize-1.0.js" type="text/javascript"></script>
|
|
<script src="js/jquery-flexigrid.js" type="text/javascript"></script>
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
$(document).ready(function() {
|
|
|
|
var height = document.documentElement.clientHeight - 240;
|
|
var query = $.query.get('search');
|
|
if (query == '') query = $.query.get('query');
|
|
|
|
$(".yresult").flexigrid({
|
|
url: '/yacysearch.json',
|
|
dataType: 'json',
|
|
method: 'GET',
|
|
query: query,
|
|
colModel: [
|
|
{display: 'Hash', name : 'hash', width : 50, sortable : false, align: 'center', hide: true},
|
|
{display: '', name : 'public', width : 25, sortable : true, align: 'center'},
|
|
{display: 'Title', name : 'title', width : 550, sortable : true, align: 'left'},
|
|
{display: 'Date', name : 'date', width : 200, sortable : true, align: 'left'}
|
|
],
|
|
buttons: [
|
|
{name: 'Crawl', bclass: 'crawl', onpress: yaction},
|
|
{name: 'Open', bclass: 'pictures', onpress: yaction},
|
|
{separator: true},
|
|
{name: 'Bookmark', bclass: 'bookmark', onpress: yaction},
|
|
{name: 'Blacklist', bclass: 'blacklist', onpress: yaction},
|
|
{separator: true},
|
|
{name: 'Help', bclass: 'help', onpress:yaction},
|
|
],
|
|
useRp: true,
|
|
rp: 10,
|
|
usepager: true,
|
|
hideOnSubmit: false,
|
|
striped: true,
|
|
nowrap: false,
|
|
height: height,
|
|
autoload: true,
|
|
onSuccess: function() {
|
|
$("a.favicon").faviconize({
|
|
position: "before",
|
|
defaultImage: "img-2/article.png",
|
|
className: "favicon"
|
|
});
|
|
},
|
|
preProcess: function(data) {
|
|
var total = data.channels[0].totalResults.replace(/[,.]/,"");
|
|
var page = (data.channels[0].startIndex / data.channels[0].itemsPerPage) + 1;
|
|
var rows = {};
|
|
$.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 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, date]};
|
|
}
|
|
}
|
|
);
|
|
var pdata = {
|
|
page: page,
|
|
total: total,
|
|
rows: rows
|
|
};
|
|
return pdata;
|
|
},
|
|
onSubmit: function() {
|
|
var p = this;
|
|
var g = $(".yresult");
|
|
|
|
$('.pPageStat',this.pDiv).html(p.procmsg);
|
|
$('.pReload',this.pDiv).addClass('loading');
|
|
if (g.bDiv) $(g.block).css({top:g.bDiv.offsetTop});
|
|
if (p.hideOnSubmit) $(this.gDiv).prepend(g.block); //$(t).hide();
|
|
// if ($.browser.opera) $(t).css('visibility','hidden');
|
|
if (!p.newp) p.newp = 1;
|
|
if (p.page>p.pages) p.page = p.pages;
|
|
|
|
var offset = p.newp * p.rp -p.rp;
|
|
$.query.SET('startRecord', offset);
|
|
$.query.SET('maximumRecords', p.rp);
|
|
|
|
$.ajax({
|
|
type: p.method,
|
|
url: p.url + $.query.toString(),
|
|
dataType: p.dataType,
|
|
success: function(data){
|
|
/* yacy limits itemsPerPage for unauthenticated users */
|
|
p.rp = parseInt(data.channels[0].itemsPerPage);
|
|
g.flexAddData(data);
|
|
},
|
|
error: function(data) {
|
|
try { if (p.onError) p.onError(data); } catch (e) {}
|
|
}
|
|
});
|
|
}
|
|
});
|
|
});
|
|
function yaction(com, grid) {
|
|
if (com == 'Bookmark') {
|
|
confirm('Add ' + $('.trSelected',grid).length + ' search results to bookmark(s)?')
|
|
$('.trSelected',grid).each(function(){
|
|
var url = $(this).find('.url').text();
|
|
var title = $(this).find('.linktitle').text();
|
|
var desc = $(this).find('.desc').text();
|
|
var tags = $.query.get('query');
|
|
var path = "/searchResults";
|
|
var pub = "private";
|
|
var query = "&url="+url+"&title="+title+"&description="+desc+"&tags="+tags+"&path="+path+"&public="+pub+"&add=create";
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "/xml/bookmarks/posts/add_p.xml?login="+query,
|
|
dataType: "xml",
|
|
success: function(xml) {
|
|
alert("Debug: posted bookmark for: "+url);
|
|
}
|
|
});
|
|
});
|
|
} else if (com =='Open') {
|
|
$('.trSelected',grid).each(function(){
|
|
var url = $(this).find('.url').text();
|
|
window.open(url);
|
|
});
|
|
} else {
|
|
alert("Test!");
|
|
}
|
|
}
|
|
//]]>
|
|
</script>
|
|
<title>YaCy-UI Search</title>
|
|
</head>
|
|
<body>
|
|
<table class="yresult">
|
|
<tbody></tbody>
|
|
</table>
|
|
</body>
|
|
</html> |