- some smaller changes to search widget

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@8024 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
apfelmaennchen 13 years ago
parent a425fbd8d6
commit a90a72a76b

@ -1,7 +1,3 @@
body, table, textarea {
font-size: 12px;
}
.ui-dialog .ui-dialog-title {
font-size: 14px;
}
@ -21,6 +17,11 @@ body, table, textarea {
width: 150px;
margin-bottom: 10px;
}
.ui-autocomplete {
font-size: 12px;
}
.ynav {
font-size: 12px;
}
@ -102,6 +103,7 @@ body, table, textarea {
height: 16px;
vertical-align: middle;
margin-left: -24px;
float: left;
}
.classic {
font-size: 12px;
@ -115,6 +117,7 @@ body, table, textarea {
margin-bottom: 20px;
margin-left: -20px;
color:#239AFF;
font-size: 12px;
}
.ymsg img {
width: 50px;

@ -117,9 +117,6 @@ function yrun() {
title: yconf.title,
show: yconf.show,
hide: yconf.hide,
close: function(event, ui) {
$("#yquery").setValue('');
},
drag: function(event, ui) {
var position = $("#ypopup").parent(".ui-dialog").position();
var left = $("#ypopup").parent(".ui-dialog").width()+5+position.left;
@ -138,6 +135,7 @@ function yrun() {
$("#yside").dialog('option', 'position', [left,position.top+32]);
},
close: function(event, ui) {
$("#yquery").setValue('');
$("#yside").dialog('destroy');
$('#yside').remove();
},
@ -254,6 +252,11 @@ function yacysearch(global, clear) {
timeout: 10000,
error: function() {
if (clear) $('#ypopup').empty();
var favicon = "<img src='"+yconf.url+"/yacy/ui/img-2/stop.png' class='favicon'/>";
var title = "<h3 class='linktitle'>"+favicon+"Ajax Error!</h3>";
var url = "<p class='url'><a href=''>Current search terms: "+searchTerms+"</a></p>"
var desc = "<p class='desc'>Sorry, this should not have happened - please try again!</p>";
$(title+desc+url).appendTo("#ypopup");
}
});
@ -293,6 +296,16 @@ function yacysearch(global, clear) {
count++;
}
);
if(count == 0) {
if (clear) $('#ypopup').empty();
var favicon = "<img src='"+yconf.url+"/yacy/ui/img-2/stop.png' class='favicon'/>";
var title = "<h3 class='linktitle'>"+favicon+"No search results!</h3>";
var url = "<p class='url'><a href=''>Current search terms: "+searchTerms+"</a></p>"
var desc = "<p class='desc'>You could restate your search or release some navigators...</p>";
$(title+desc+url).appendTo("#ypopup");
}
if(clear) {
$('#yside').empty();
var query = unescape($("#yquery").getValue());
@ -326,6 +339,7 @@ function yacysearch(global, clear) {
selected: function(event, ui) {
var query = unescape($("#yquery").getValue() + " /language/" +ui.item.value);
$("#yquery").setValue(query);
ynavigators.push("/language/"+ui.item.value);
$("#yquery").trigger('keyup');
}
});
@ -348,8 +362,8 @@ function yacysearch(global, clear) {
selected: function(event, ui) {
var query = unescape($("#yquery").getValue() + " " +ui.item.value);
$("#yquery").setValue(query);
$("#yquery").trigger('keyup');
ynavigators.push(ui.item.value);
$("#yquery").trigger('keyup');
}
});
}
@ -371,31 +385,20 @@ function yacysearch(global, clear) {
} else if (this.id == "local") {
global = false;
}
yacysearch(global, true);
$("#yquery").trigger('keyup');
});
$('<hr />').appendTo("#yside");
var arLen=ynavigators.length;
for ( var i=0, len=arLen; i<len; ++i ){
$('<p><img src="/yacy/ui/img-2/cancel_round.png" class="ynav-cancel" /><span class="ytxt"> '+ynavigators[i]+'</span></p>').appendTo("#yside");
}
if(count>0) {
cancelNavigators(ynavigators, "#yside");
if(true) {
autoOpenSidebar();
if ($("#ypopup").dialog('isOpen')) {
if($("#ypopup h3 :last").position().top < $("#ypopup").dialog( "option", "height" )) {
if($("#ypopup h3 :last").position().top < $("#ypopup").dialog( "option", "height" ) && count == maximumRecords) {
startRecord = startRecord + maximumRecords;
yacysearch(submit, false);
}
}
$(".ynav-cancel").bind("click", function(event) {
var str = $(event.target).next().text().replace(/^[\s\xA0]+/, "").replace(/[\s\xA0]+$/, "");
var idx = ynavigators.indexOf(str);
if(idx!=-1) ynavigators.splice(idx, 1);
var regexp = new RegExp(str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"));
$("#yquery").setValue(query.replace(regexp,"").replace(/^[\s\xA0]+/, "").replace(/[\s\xA0]+$/, ""));
startRecord = 0;
yacysearch(submit, true);
});
}
}
}
@ -406,6 +409,22 @@ function yacysearch(global, clear) {
$("#yside").dialog('open');
$("#yquery").focus();
}
} , 1500);
} , 1200);
}
function cancelNavigators(ynavigators, appendTo) {
var arLen=ynavigators.length;
for ( var i=0, len=arLen; i<len; ++i ){
$('<p><img src="/yacy/ui/img-2/cancel_round.png" class="ynav-cancel" /><span class="ytxt"> '+ynavigators[i]+'</span></p>').appendTo(appendTo);
}
$(".ynav-cancel").bind("click", function(event) {
var query = $("#yquery").getValue();
var str = $(event.target).next().text().replace(/^[\s\xA0]+/, "").replace(/[\s\xA0]+$/, "");
var idx = ynavigators.indexOf(str);
if(idx!=-1) ynavigators.splice(idx, 1);
var regexp = new RegExp(str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"));
$("#yquery").setValue(query.replace(regexp,"").replace(/^[\s\xA0]+/, "").replace(/[\s\xA0]+$/, ""));
startRecord = 0;
$("#yquery").trigger('keyup');
});
}
}
Loading…
Cancel
Save