|
|
|
<script type="application/javascript">
|
|
|
|
//<![CDATA[
|
|
|
|
$(document).ready(function() {
|
|
|
|
$("#side3").accordion("activate", 0);
|
|
|
|
$.ajax({
|
|
|
|
type: "GET",
|
|
|
|
url: query,
|
|
|
|
async: false,
|
|
|
|
dataType: "xml",
|
|
|
|
success: function(xml) {
|
|
|
|
if (($.browser.mozilla && (parseInt($.browser.version.replace(".","","g")) > 1800))) {
|
|
|
|
var totalResults = parseInt($(xml).find('opensearch\\:totalResults').text().replace(",","","g"));
|
|
|
|
var startIndex = parseInt($(xml).find('opensearch\\:startIndex').text());
|
|
|
|
var itemsPerPage = parseInt($(xml).find('opensearch\\:itemsPerPage').text());
|
|
|
|
var query = $(xml).find('opensearch\\:Query').attr('searchTerms');
|
|
|
|
} else {
|
|
|
|
var totalResults = parseInt($(xml).find('totalResults').text().replace(",","","g"));
|
|
|
|
var startIndex = parseInt($(xml).find('startIndex').text());
|
|
|
|
var itemsPerPage = parseInt($(xml).find('itemsPerPage').text());
|
|
|
|
var query = $(xml).find('Query').attr('searchTerms');
|
|
|
|
}
|
|
|
|
$(xml).find('item').each(function(){
|
|
|
|
var title = $(this).find('title').text();
|
|
|
|
var link = $(this).find('link').text();
|
|
|
|
var desc = $(this).find('description').text();
|
|
|
|
var hash = $(this).find('guid').text();
|
|
|
|
var date = $(this).find('pubDate').text();
|
|
|
|
var tags = "";
|
|
|
|
$('<tr></tr')
|
|
|
|
.html('<td>' +hash+ '</td><td>' +''+ '</td><td><h3 class="linktitle">' +HTMLenc(title)+ '</h3><p class="desc">' +HTMLenc(desc)+ '</p><p class="url"><a href="' +link+ '">' +link+ '</a></p><td>' +HTMLenc(tags)+ ' </td><td>' +date+ '</td>')
|
|
|
|
.appendTo(tabid+" .yresult tbody");
|
|
|
|
}); //close each(
|
|
|
|
var height=document.documentElement.clientHeight - 205;
|
|
|
|
var page = " " + (startIndex+1) + "-" + (startIndex+itemsPerPage) + " of " + totalResults;
|
|
|
|
$(tabid+" .yresult").flexigrid({
|
|
|
|
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 : 450, sortable : true, align: 'left'},
|
|
|
|
{display: 'Tags', name : 'tags', width : 240, sortable : false, align: 'left'},
|
|
|
|
{display: 'Date', name : 'date', width : 130, 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},
|
|
|
|
{separator: true},
|
|
|
|
{name: 'Blacklist', bclass: 'blacklist', onpress: yaction},
|
|
|
|
{separator: true},
|
|
|
|
{name: 'Refresh', bclass: 'load', onpress: yload},
|
|
|
|
{name: 'RSS', bclass: 'rss', onpress: yaction},
|
|
|
|
{separator: true},
|
|
|
|
{name: page, bclass: 'prev', onpress: yload},
|
|
|
|
{name: ' ', bclass: 'next', onpress: yload},
|
|
|
|
{separator: true},
|
|
|
|
{name: 'Help', bclass: 'help', onpress:yaction},
|
|
|
|
],
|
|
|
|
striped: true,
|
|
|
|
nowrap: false,
|
|
|
|
height: height,
|
|
|
|
title: 'YaCy P2P Web Search: '+query
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}); //close $.ajax(
|
|
|
|
|
|
|
|
/*
|
|
|
|
$(".linktitle a").faviconize({
|
|
|
|
position: "before",
|
|
|
|
defaultImage: "img-2/article.png",
|
|
|
|
className: "favicon"
|
|
|
|
});
|
|
|
|
*/
|
|
|
|
|
|
|
|
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 = $(tabid).attr('search');
|
|
|
|
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!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function yload(com, grid) {
|
|
|
|
var $tabs = $('#container ul');
|
|
|
|
var count = parseInt($(tabid).attr('count'));
|
|
|
|
var offset = parseInt($(tabid).attr('offset'));
|
|
|
|
if (com == ' ') {
|
|
|
|
offset = offset+count;
|
|
|
|
}
|
|
|
|
else if (com == 'Refresh') {
|
|
|
|
offset = 0;
|
|
|
|
}
|
|
|
|
else if (offset > count) {
|
|
|
|
offset = offset-count;
|
|
|
|
}
|
|
|
|
$(tabid).attr('offset', offset);
|
|
|
|
query = $(tabid).attr('resource')
|
|
|
|
+"&search="+$(tabid).attr('search')
|
|
|
|
+"&contentdom="+$(tabid).attr('contentdom')
|
|
|
|
+"&count="+$(tabid).attr('count')
|
|
|
|
+"&offset="+$(tabid).attr('offset')
|
|
|
|
+"&constraint="+$(tabid).attr('constraint')
|
|
|
|
+"&prefermaskfilter="+$(tabid).attr('prefermaskfilter')
|
|
|
|
+"&urlmaskfilter="+$(tabid).attr('urlmaskfilter');
|
|
|
|
|
|
|
|
var selected = $tabs.data('selected.tabs');
|
|
|
|
$tabs.tabs("load", selected);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}); //close $(
|
|
|
|
//]]>
|
|
|
|
</script>
|
|
|
|
<table class="yresult">
|
|
|
|
<tbody></tbody>
|
|
|
|
</table>
|
|
|
|
|