|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
function status() {
|
|
|
|
|
if(load_status < 5) {
|
|
|
|
|
if(load_status < 4) {
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
window.clearInterval(loading);
|
|
|
|
@ -28,9 +28,9 @@ $(document).ready(function() {
|
|
|
|
|
title : 'YaCy P2P Web Search',
|
|
|
|
|
logo : yconf.url + '/yacy/ui/img/yacy-logo.png',
|
|
|
|
|
link : 'http://yacy.net',
|
|
|
|
|
width : 420,
|
|
|
|
|
width : 640,
|
|
|
|
|
height : 640,
|
|
|
|
|
position : ['top',50],
|
|
|
|
|
position : [150,50],
|
|
|
|
|
modal : false,
|
|
|
|
|
resizable: true,
|
|
|
|
|
show : '',
|
|
|
|
@ -74,13 +74,11 @@ $(document).ready(function() {
|
|
|
|
|
load_status = 0;
|
|
|
|
|
loading = window.setInterval("status()", 200);
|
|
|
|
|
if(yconf.load_js) {
|
|
|
|
|
var script0 = yconf.url + '/yacy/ui/js/jquery.dimensions.min.js';
|
|
|
|
|
var script1 = yconf.url + '/yacy/ui/js/jquery.query.js';
|
|
|
|
|
var script2 = yconf.url + '/yacy/ui/js/jquery.form.js';
|
|
|
|
|
var script3 = yconf.url + '/yacy/ui/js/jquery.field.min.js';
|
|
|
|
|
var script4 = yconf.url + '/yacy/ui/js/jquery-ui-1.7.2.min.js';
|
|
|
|
|
|
|
|
|
|
$.getScript(script0, function(){ load_status++; });
|
|
|
|
|
$.getScript(script1, function(){ load_status++; });
|
|
|
|
|
$.getScript(script2, function(){ load_status++; });
|
|
|
|
|
$.getScript(script3, function(){ load_status++; });
|
|
|
|
@ -113,24 +111,6 @@ function yrun() {
|
|
|
|
|
hide: yconf.hide,
|
|
|
|
|
close: function(event, ui) {
|
|
|
|
|
$("#yquery").setValue('');
|
|
|
|
|
},
|
|
|
|
|
buttons: {
|
|
|
|
|
'@': function() {
|
|
|
|
|
if ($("#yside").dialog('isOpen')) {
|
|
|
|
|
$("#yside").dialog('close');
|
|
|
|
|
} else {
|
|
|
|
|
$("#yside").dialog('open');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
Next: function() {
|
|
|
|
|
startRecord = startRecord + maximumRecords;
|
|
|
|
|
$('#ysearch').trigger('submit');
|
|
|
|
|
},
|
|
|
|
|
Prev: function() {
|
|
|
|
|
startRecord = startRecord - maximumRecords;
|
|
|
|
|
if(startRecord < 0) startRecord = 0;
|
|
|
|
|
$('#ysearch').trigger('submit');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
drag: function(event, ui) {
|
|
|
|
|
var position = $(".ui-dialog").position();
|
|
|
|
@ -144,7 +124,7 @@ function yrun() {
|
|
|
|
|
},
|
|
|
|
|
resizeStop: function(event, ui) {
|
|
|
|
|
var position = $(".ui-dialog").position();
|
|
|
|
|
var height = $(".ui-dialog").height()-85;
|
|
|
|
|
var height = $(".ui-dialog").height()-55;
|
|
|
|
|
var left = $(".ui-dialog").width()+5+position.left;
|
|
|
|
|
$("#yside").dialog('option', 'height', height);
|
|
|
|
|
$("#yside").dialog('option', 'position', [left,position.top+32]);
|
|
|
|
@ -162,11 +142,11 @@ function yrun() {
|
|
|
|
|
draggable: false,
|
|
|
|
|
resizable: false,
|
|
|
|
|
width: 220,
|
|
|
|
|
height: yconf.height-85,
|
|
|
|
|
minHeight: yconf.height-85,
|
|
|
|
|
height: $(".ui-dialog").height()-55,
|
|
|
|
|
minHeight: $(".ui-dialog").height()-55,
|
|
|
|
|
show: 'slide',
|
|
|
|
|
hide: 'slide',
|
|
|
|
|
position : [position.left+yconf.width+5,position.top+32],
|
|
|
|
|
position : [position.left+$(".ui-dialog").width()+5,position.top+32],
|
|
|
|
|
open: function(event, ui) {
|
|
|
|
|
$('div.ui-widget-shadow').remove();
|
|
|
|
|
$('ypopup').dialog( 'moveToTop' );
|
|
|
|
@ -174,6 +154,16 @@ function yrun() {
|
|
|
|
|
});
|
|
|
|
|
$('.ui-widget-shadow').remove();
|
|
|
|
|
$('div[aria-labelledby="ui-dialog-title-yside"] div.ui-dialog-titlebar').remove();
|
|
|
|
|
|
|
|
|
|
$("#ypopup").bind("scroll", function(e){
|
|
|
|
|
p1 = $("#ypopup h3 :last").position().top;
|
|
|
|
|
if(p1-yconf.height < 0) {
|
|
|
|
|
startRecord = startRecord + maximumRecords;
|
|
|
|
|
yacysearch(submit, false);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -196,7 +186,7 @@ function yrun() {
|
|
|
|
|
$("#ypopup").dialog('close');
|
|
|
|
|
} else {
|
|
|
|
|
ycurr = $("#yquery").getValue();
|
|
|
|
|
if(!submit) yacysearch(false);
|
|
|
|
|
if(!submit) yacysearch(false, true);
|
|
|
|
|
else submit = false;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
@ -204,29 +194,41 @@ function yrun() {
|
|
|
|
|
|
|
|
|
|
$('#ysearch').submit(function() {
|
|
|
|
|
submit = true;
|
|
|
|
|
ycurr = $("#yquery").getValue();
|
|
|
|
|
yacysearch(yconf.global);
|
|
|
|
|
ycurr = $("#yquery").getValue();
|
|
|
|
|
|
|
|
|
|
if (!$("#ypopup").dialog('isOpen'))
|
|
|
|
|
$("#ypopup").dialog('open');
|
|
|
|
|
else
|
|
|
|
|
if ($("#yside").dialog('isOpen'))
|
|
|
|
|
$("#yside").dialog('close');
|
|
|
|
|
|
|
|
|
|
$("#yquery").focus();
|
|
|
|
|
|
|
|
|
|
yacysearch(yconf.global, true);
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function yacysearch(global) {
|
|
|
|
|
function yacysearch(global, clear) {
|
|
|
|
|
var url = yconf.url + '/yacysearch.json?callback=?'
|
|
|
|
|
|
|
|
|
|
$('#ypopup').empty();
|
|
|
|
|
|
|
|
|
|
var loading = "<div class='yloading'><h3 class='linktitle'><em>Loading: "+yconf.url+"</em><br/>";
|
|
|
|
|
var loadimg = "<img src='"+yconf.url+"/yacy/ui/img/loading2.gif' align='absmiddle'/></h3></div>";
|
|
|
|
|
$('#ypopup').append(loading+loadimg);
|
|
|
|
|
|
|
|
|
|
if (!$("#ypopup").dialog('isOpen'))
|
|
|
|
|
$("#ypopup").dialog('open');
|
|
|
|
|
else
|
|
|
|
|
if ($("#yside").dialog('isOpen'))
|
|
|
|
|
$("#yside").dialog('close');
|
|
|
|
|
|
|
|
|
|
$("#yquery").focus();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(clear) {
|
|
|
|
|
$('#ypopup').empty();
|
|
|
|
|
|
|
|
|
|
var loading = "<div class='yloading'><h3 class='linktitle'><em>Loading: "+yconf.url+"</em><br/>";
|
|
|
|
|
var loadimg = "<img src='"+yconf.url+"/yacy/ui/img/loading2.gif' align='absmiddle'/></h3></div>";
|
|
|
|
|
$('#ypopup').append(loading+loadimg);
|
|
|
|
|
|
|
|
|
|
if (!$("#ypopup").dialog('isOpen'))
|
|
|
|
|
$("#ypopup").dialog('open');
|
|
|
|
|
else
|
|
|
|
|
if ($("#yside").dialog('isOpen'))
|
|
|
|
|
$("#yside").dialog('close');
|
|
|
|
|
|
|
|
|
|
$("#yquery").focus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var param = [];
|
|
|
|
|
$("#ysearch input").each(function(i){
|
|
|
|
|
var item = { name : $(this).attr('name'), value : $(this).attr('value') };
|
|
|
|
@ -247,18 +249,13 @@ function yacysearch(global) {
|
|
|
|
|
else data = json;
|
|
|
|
|
var searchTerms = data.channels[0].searchTerms.replace(/\+/g," ");
|
|
|
|
|
if(ycurr != searchTerms)
|
|
|
|
|
return false;
|
|
|
|
|
$('#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 + data.channels[0].items.length;
|
|
|
|
|
$("div .ybpane").remove();
|
|
|
|
|
return false;
|
|
|
|
|
if(clear)
|
|
|
|
|
$('#ypopup').empty();
|
|
|
|
|
var total = data.channels[0].totalResults.replace(/[,.]/,"");
|
|
|
|
|
if(global) var result = 'global';
|
|
|
|
|
else var result = 'local';
|
|
|
|
|
var ylogo = "<div class='ybpane'><a href='"+yconf.link+"' target='_blank'><img src='"+yconf.logo+"' alt='"+yconf.logo+"' title='"+yconf.logo+"' /></a></div>";
|
|
|
|
|
var yresult = "<div class='ybpane'><em>Displaying result "+start+" to "+end+"<br/> of "+total+" "+result+" results.</em></div>";
|
|
|
|
|
$('div[aria-labelledby="ui-dialog-title-ypopup"] div.ui-dialog-buttonpane').prepend(ylogo+yresult);
|
|
|
|
|
|
|
|
|
|
var count = 0;
|
|
|
|
|
$.each (
|
|
|
|
|
data.channels[0].items,
|
|
|
|
@ -274,31 +271,44 @@ function yacysearch(global) {
|
|
|
|
|
}
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
$('#yside').empty();
|
|
|
|
|
$.each (
|
|
|
|
|
data.channels[0].navigation,
|
|
|
|
|
function(i,facet) {
|
|
|
|
|
if (facet) {
|
|
|
|
|
var acc = '#ynav'+i;
|
|
|
|
|
$(acc).accordion('destroy');
|
|
|
|
|
$('<div id="ynav'+i+'" style="margin0px; padding:0px;"></div>').appendTo('#yside');
|
|
|
|
|
var id = "#y"+facet.facetname;
|
|
|
|
|
$('<h3 style="padding-left:25px;">'+facet.displayname+'</h3>').appendTo(acc);
|
|
|
|
|
$('<div id="y'+facet.facetname+'"></div>').appendTo(acc);
|
|
|
|
|
$("<ul class='nav'></ul>").appendTo(id);
|
|
|
|
|
$.each (
|
|
|
|
|
facet.elements,
|
|
|
|
|
function(j,element) {
|
|
|
|
|
$("<li><a href='javascript:openNavigator(\""+element.modifier+"\")'>"+element.name+" ("+element.count+")</a></li>").appendTo(id+" .nav");
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
$(acc).accordion({});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
if(count>0)
|
|
|
|
|
autoOpenSidebar();
|
|
|
|
|
if(clear) {
|
|
|
|
|
$('#yside').empty();
|
|
|
|
|
var yglobal = "local";
|
|
|
|
|
if(global)
|
|
|
|
|
yglobal = "global";
|
|
|
|
|
$('<div id="ylogo" style="margin0px; padding:0px;"></div>').appendTo('#yside');
|
|
|
|
|
$('<h3 style="padding-left:25px;">'+yconf.title+'</h3>').appendTo('#ylogo');
|
|
|
|
|
var ylogo = "<a href='"+yconf.link+"' target='_blank'><img src='"+yconf.logo+"' alt='"+yconf.logo+"' title='"+yconf.logo+"' /></a>";
|
|
|
|
|
var ymsg= "Total "+yglobal+" results: "+total;
|
|
|
|
|
$("<div class='ymsg'><table><tr><td width='55px'>"+ylogo+"</td><td id='yresult'>"+ymsg+"</td></tr></div").appendTo('#ylogo');
|
|
|
|
|
$('#ylogo').accordion({
|
|
|
|
|
collapsible: false
|
|
|
|
|
});
|
|
|
|
|
$.each (
|
|
|
|
|
data.channels[0].navigation,
|
|
|
|
|
function(i,facet) {
|
|
|
|
|
if (facet) {
|
|
|
|
|
var acc = '#ynav'+i;
|
|
|
|
|
$(acc).accordion('destroy');
|
|
|
|
|
$('<div id="ynav'+i+'" style="margin0px; padding:0px;"></div>').appendTo('#yside');
|
|
|
|
|
var id = "#y"+facet.facetname;
|
|
|
|
|
$('<h3 style="padding-left:25px;">'+facet.displayname+'</h3>').appendTo(acc);
|
|
|
|
|
$('<div id="y'+facet.facetname+'"></div>').appendTo(acc);
|
|
|
|
|
$("<ul class='nav'></ul>").appendTo(id);
|
|
|
|
|
$.each (
|
|
|
|
|
facet.elements,
|
|
|
|
|
function(j,element) {
|
|
|
|
|
$("<li><a href='javascript:openNavigator(\""+element.modifier+"\")'>"+element.name+" ("+element.count+")</a></li>").appendTo(id+" .nav");
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
$(acc).accordion({});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
if(count>0)
|
|
|
|
|
autoOpenSidebar();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
function autoOpenSidebar() {
|
|
|
|
@ -308,6 +318,6 @@ function yacysearch(global) {
|
|
|
|
|
$('#ynav1').accordion('activate', false);
|
|
|
|
|
$("#yquery").focus();
|
|
|
|
|
}
|
|
|
|
|
} , 3000);
|
|
|
|
|
} , 1500);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|