diff --git a/htroot/yacy/ui/css/yacyui-portalsearch.css b/htroot/yacy/ui/css/yacyui-portalsearch.css index 395601cf6..a3e7bd8e9 100644 --- a/htroot/yacy/ui/css/yacyui-portalsearch.css +++ b/htroot/yacy/ui/css/yacyui-portalsearch.css @@ -72,20 +72,14 @@ .classic .linktitle, .classic .url, .classic .date, .classic .desc { margin-left: 40px; } -div .ybpane { - float: left; - font-size: 13px; - line-height: 1.2em; +.ymsg { + margin-left: -20px; color:#239AFF; - margin-top: 10px; - margin-left: 10px; } -.ybpane img { +.ymsg img { width: 50px; height: 32px; - vertical-align: middle; - padding-right: 15px; - padding-top: 3px; + vertical-align: middle; border: 0; } #ypopup .yloading { diff --git a/htroot/yacy/ui/js/yacyui-portalsearch.js b/htroot/yacy/ui/js/yacyui-portalsearch.js index 7e19f995e..7c6ab50f6 100644 --- a/htroot/yacy/ui/js/yacyui-portalsearch.js +++ b/htroot/yacy/ui/js/yacyui-portalsearch.js @@ -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 = "

Loading: "+yconf.url+"
"; - var loadimg = "

"; - $('#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 = "

Loading: "+yconf.url+"
"; + var loadimg = "

"; + $('#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 = "
"+yconf.logo+"
"; - var yresult = "
Displaying result "+start+" to "+end+"
of "+total+" "+result+" results.
"; - $('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'); - $('
').appendTo('#yside'); - var id = "#y"+facet.facetname; - $('

'+facet.displayname+'

').appendTo(acc); - $('
').appendTo(acc); - $("").appendTo(id); - $.each ( - facet.elements, - function(j,element) { - $("
  • "+element.name+" ("+element.count+")
  • ").appendTo(id+" .nav"); - } - ) - $(acc).accordion({}); - } - } ); - if(count>0) - autoOpenSidebar(); + if(clear) { + $('#yside').empty(); + var yglobal = "local"; + if(global) + yglobal = "global"; + $('').appendTo('#yside'); + $('

    '+yconf.title+'

    ').appendTo('#ylogo'); + var ylogo = ""+yconf.logo+""; + var ymsg= "Total "+yglobal+" results: "+total; + $("
    ').appendTo('#yside'); + var id = "#y"+facet.facetname; + $('

    '+facet.displayname+'

    ').appendTo(acc); + $('
    ').appendTo(acc); + $("").appendTo(id); + $.each ( + facet.elements, + function(j,element) { + $("
  • "+element.name+" ("+element.count+")
  • ").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); } -} +} \ No newline at end of file
    "+ylogo+""+ymsg+"