Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

- removed unused code from search widget - added more comments for documentation - ALT key now submits global search - various smaller bug fixes

apfelmaennchen1e55e50c4958
diff --git a/htroot/portalsearch/portalsearch-dev.js b/htroot/portalsearch/portalsearch-dev.js
index b2c49e937..fceb932ac 100644
--- a/htroot/portalsearch/portalsearch-dev.js
+++ b/htroot/portalsearch/portalsearch-dev.js
@@ -90,15 +90,8 @@ $(document).ready(function() {
});
function yrun() {
-
- $.extend($.ui.accordion.defaults, {
- autoHeight: false,
- clearStyle: true,
- collapsible: true,
- header: "h3"
- });
-
maximumRecords = parseInt($("#ysearch input[name='maximumRecords']").getValue());
+ global = yconf.global;
$("#ypopup").dialog({
autoOpen: false,
@@ -159,7 +152,7 @@ function yrun() {
p1 = $("#ypopup h3 :last").position().top;
if(p1-$("#ypopup").dialog( "option", "height" ) < 0) {
startRecord = startRecord + maximumRecords;
- yacysearch(submit, false);
+ yacysearch(false);
}
});
@@ -167,32 +160,36 @@ function yrun() {
}
});
- $('#ysearch').keyup(function(e) {
+ $('#ysearch').keyup(function(e) { // React to keyboard input
- if(e.which == 27) { // ESC
+ if(e.which == 27) { // Close popup on ESC
$("#ypopup").dialog('close');
$("#yquery").setValue("");
- } else if(e.which == 39) { // Right
- startRecord = startRecord + maximumRecords;
- yacysearch(submit, false);
}
- if(ycurr == $("#yquery").getValue()) {
+
+ if(e.which == 18) { // Global search on ALT
+ global = true;
+ ycurr = $("#yquery").getValue();
+ yacysearch(true);
+ }
+
+ if(ycurr == $("#yquery").getValue()) { // Do nothing if search term hasn't changed
return false;
- }
+ }
- if ($("#yquery").getValue() == '') {
+ global = yconf.global; // As this is a new search, revert to default resource
+
+ if ($("#yquery").getValue() == '') { // If search term is empty reset to default resource and close popup
if($("#ypopup").dialog('isOpen'))
$("#ypopup").dialog('close');
- } else {
- ycurr = $("#yquery").getValue();
- if(!submit) yacysearch(false, true);
- else submit = false;
+ } else { // Else fire up a search request and remeber the current search term
+ ycurr = $("#yquery").getValue();
+ yacysearch(true);
}
return false;
});
- $('#ysearch').submit(function() {
- submit = true;
+ $('#ysearch').submit(function() { // Submit a search request
ycurr = $("#yquery").getValue();
if (!$("#ypopup").dialog('isOpen'))
@@ -202,14 +199,14 @@ function yrun() {
$("#yside").dialog('close');
$("#yquery").focus();
-
- yacysearch(yconf.global, true);
+
+ yacysearch(true);
return false;
});
}
-function yacysearch(global, clear) {
- var url = yconf.url + '/yacysearch.json?callback=?'
+function yacysearch(clear) {
+ var url = yconf.url + '/yacysearch.json?callback=?' // JSONP (cross domain) request URL
if(clear) {
$('#ypopup').empty();
@@ -226,16 +223,19 @@ function yacysearch(global, clear) {
$("#yquery").focus();
}
- var param = [];
+ var param = []; // Generate search request parameters from HTML form
$("#ysearch input").each(function(i){
var item = { name : $(this).attr('name'), value : $(this).attr('value') };
- if(item.name == 'resource') {
- if(item.value == 'global') global = true;
- if(global) item.value = 'global';
+ if(item.name == 'resource') { // Set parameter for resource according to global
+ if(global)
+ item.value = 'global';
+ else {
+ item.value = 'local'
+ }
}
if(item.name == 'query' || item.name == 'search') {
- item.value = $.trim(item.value);
- if(item.value != ycurr)
+ item.value = $.trim(item.value); // remove heading and trailing white spaces from querey
+ if(item.value != ycurr) // in case of fast typing ycurr needs to be updated
ycurr = item.value;
}
param[i] = item;
@@ -248,7 +248,7 @@ function yacysearch(global, clear) {
var err = 'Unknow Error: '+x.responseText;
if(x.status==0) {
err = 'Unknown Network Error! I try to reload...';
- yacysearch(global, true);
+ yacysearch(true);
} else if(x.status==404) {
err = x.status + ' - Requested URL not found.';
} else if(x.status==500) {
@@ -315,26 +315,9 @@ function yacysearch(global, clear) {
if(clear) {
$('#yside').empty();
- var query = unescape($("#yquery").getValue());
- var yglobal = "local";
- var sel_date = "";
- var sel_relev = "";
- var sel_local = "";
- var sel_global = "";
- if(query.indexOf("/date") != -1)
- sel_date = 'checked="checked"';
- else
- sel_relev = 'checked="checked"';
-
- if(global) {
- sel_global = 'checked="checked"';
- yglobal = "global";
- }
- else
- sel_local = 'checked="checked"';
var ylogo = "<a href='"+yconf.link+"' target='_blank'><img style='padding-left: 24px;' src='"+yconf.logo+"' alt='"+yconf.logo+"' title='"+yconf.logo+"' /></a>";
- var ymsg= "Total "+yglobal+" results: "+total;
+ var ymsg= "Total "+result+" results: "+total;
$("<div class='ymsg'><table><tr><td width='55px'>"+ylogo+"</td><td id='yresult'>"+ymsg+"</td></tr></div").appendTo('#yside');
$('<hr />').appendTo("#yside");
@@ -357,7 +340,7 @@ function yacysearch(global, clear) {
} else {
global = false;
}
- yacysearch(global, true);
+ yacysearch(true);
}
});
@@ -383,9 +366,6 @@ function yacysearch(global, clear) {
$("#yquery").trigger('keyup');
}
});
-
-
-
$('<hr />').appendTo("#yside");
$("<p class='ytxt'>You can narrow down your search by selecting one of the below navigators:</p>").appendTo('#yside');
@@ -404,7 +384,7 @@ function yacysearch(global, clear) {
});
*/
- $.each (
+ $.each ( // Loop through all available navigators and include comboboxes in sidebar
data.channels[0].navigation,
function(i,facet) {
if (facet) {
@@ -444,34 +424,39 @@ function yacysearch(global, clear) {
var str = $(event.target).val();
var idx = ynavigators.indexOf($.trim(str));
if(idx!=-1) ynavigators.splice(idx, 1);
- var regexp = new RegExp(' '+str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"));
+ var regexp = new RegExp(' '+str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")); // properly escape string for regexp
$("#yquery").setValue($.trim(query.replace(regexp,"")));
startRecord = 0;
$("#yquery").trigger('keyup');
});
autoOpenSidebar();
if ($("#ypopup").dialog('isOpen')) {
- if($("#ypopup h3 :last").position().top < $("#ypopup").dialog( "option", "height" ) && count == maximumRecords) {
+ // If you got maximumRecords results, but still have display space, load more results
+ if($("#ypopup h3 :last").position().top < $("#ypopup").dialog( "option", "height" ) && count == maximumRecords) {
startRecord = startRecord + maximumRecords;
- yacysearch(submit, false);
+ yacysearch(false);
}
}
}
}
}
);
- function autoOpenSidebar() {
- window.setTimeout(function() {
- if( $("#yquery").getValue() == ycurr) {
+ function autoOpenSidebar() {
+ window.setTimeout(function() { // The delay prevents the sidebar to open on every intermediate search results
+ if( $("#yquery").getValue() == ycurr) { // Open side bar only if result matches current search term
$("#yside").dialog('open');
$("#yquery").focus();
}
} , 1000);
}
- function cancelNavigators(ynavigators, appendTo) {
+ function cancelNavigators(ynavigators, appendTo) { // Include checkboxes to release navigators
var arLen=ynavigators.length;
+ var query = $("#yquery").getValue();
for ( var i=0, len=arLen; i<len; ++i ){
- $(' <input type="checkbox" checked="checked" class="ynav-cancel" name="ynav'+i+'" value="'+ynavigators[i]+'"> '+ynavigators[i]+'<br>').appendTo(appendTo);
+ if(query.indexOf(ynavigators[i]) != -1) // Check wether search term still contains the navigator
+ $(' <input type="checkbox" checked="checked" class="ynav-cancel" name="ynav'+i+'" value="'+ynavigators[i]+'"> '+ynavigators[i]+'<br>').appendTo(appendTo);
+ else
+ ynavigators.splice(i, 1); // Remove navigator from array as it has been removed manually from search term
}
}
}
\ No newline at end of file
diff --git a/htroot/portalsearch/yacy-portalsearch.js b/htroot/portalsearch/yacy-portalsearch.js
index 2954fffd3..2179613e1 100644
--- a/htroot/portalsearch/yacy-portalsearch.js
+++ b/htroot/portalsearch/yacy-portalsearch.js
@@ -1 +1 @@
-function yacysearch(a,b){function h(a,b){var c=a.length;for(var d=0,e=c;d<e;++d){$(' <input type="checkbox" checked="checked" class="ynav-cancel" name="ynav'+d+'" value="'+a[d]+'"> '+a[d]+"<br>").appendTo(b)}}function g(){window.setTimeout(function(){if($("#yquery").getValue()==ycurr){$("#yside").dialog("open");$("#yquery").focus()}},1e3)}var c=yconf.url+"/yacysearch.json?callback=?";if(b){$("#ypopup").empty();var d="<div class='yloading'><h3 class='linktitle'><em>Loading: "+yconf.url+"</em><br/>";var e="<img src='"+yconf.url+"/yacy/ui/img/loading2.gif' align='absmiddle'/></h3></div>";$("#ypopup").append(d+e);if(!$("#ypopup").dialog("isOpen"))$("#ypopup").dialog("open");else if($("#yside").dialog("isOpen"))$("#yside").dialog("close");$("#yquery").focus()}var f=[];$("#ysearch input").each(function(b){var c={name:$(this).attr("name"),value:$(this).attr("value")};if(c.name=="resource"){if(c.value=="global")a=true;if(a)c.value="global"}if(c.name=="query"||c.name=="search"){c.value=$.trim(c.value);if(c.value!=ycurr)ycurr=c.value}f[b]=c});f[f.length]={name:"startRecord",value:startRecord};$.ajaxSetup({timeout:1e4,error:function(c,d){var e="Unknow Error: "+c.responseText;if(c.status==0){e="Unknown Network Error! I try to reload...";yacysearch(a,true)}else if(c.status==404){e=c.status+" - Requested URL not found."}else if(c.status==500){e=c.status+" - Internel Server Error."}else if(d=="parsererror"){e="Parsing JSON Request failed."}else if(d=="timeout"){e="Request Time out."}if(b)$("#ypopup").empty();var f="<img src='"+yconf.url+"/yacy/ui/img-2/stop.png' class='favicon'/>";var g="<h3 class='linktitle'>"+f+" "+e+"</h3>";var h="<p class='url'><a href=''>Current search terms: "+ycurr+"</a></p>";$(g+h).appendTo("#ypopup")}});$.getJSON(c,f,function(c,d){if(c[0])data=c[0];else data=c;var e="";e=data.channels[0].searchTerms;if($.trim(ycurr.replace(/ /g,"+"))!=e){return false}if(b){$("#ypopup").empty()}var f=data.channels[0].totalResults;if(a)var i="global";else var i="local";var j=0;$.each(data.channels[0].items,function(a,b){if(b){var c="<img src='"+yconf.url+"/ViewImage.png?width=16&height=16&code="+b.faviconCode+"' class='favicon'/>";var d="<h3 class='linktitle'>"+c+"<a href='"+b.link+"' target='_blank'>"+b.title+"</a></h3>";var e="<p class='url'><a href='"+b.link+"' target='_blank'>"+b.link+"</a></p>";var f="<p class='desc'>"+b.description+"</p>";var g="<p class='date'>"+b.pubDate.substring(0,16);var h=" | "+b.sizename+"</p>";$(d+f+e+g+h).appendTo("#ypopup")}j++});if(j==0){if(b)$("#ypopup").empty();var k="<img src='"+yconf.url+"/yacy/ui/img-2/stop.png' class='favicon'/>";var l="<h3 class='linktitle'>"+k+"No search results!</h3>";var m="<p class='url'><a href=''>Current search terms: "+e+"</a></p>";var n="<p class='desc'>You could restate your search, release some navigators or switch to global search...</p>";$(l+n+m).appendTo("#ypopup")}if(b){$("#yside").empty();var o=unescape($("#yquery").getValue());var p="local";var q="";var r="";var s="";var t="";if(o.indexOf("/date")!=-1)q='checked="checked"';else r='checked="checked"';if(a){t='checked="checked"';p="global"}else s='checked="checked"';var u="<a href='"+yconf.link+"' target='_blank'><img style='padding-left: 24px;' src='"+yconf.logo+"' alt='"+yconf.logo+"' title='"+yconf.logo+"' /></a>";var v="Total "+p+" results: "+f;$("<div class='ymsg'><table><tr><td width='55px'>"+u+"</td><td id='yresult'>"+v+"</td></tr></div").appendTo("#yside");$("<hr />").appendTo("#yside");var w='selected="selected">';var x='<select class="selector" id="yglobal"><option value="local"';var y='local</option><option value="global"';var z="global</option></select>";if(a){select=x+">"+y+w+z}else{select=x+w+y+">"+z}$('<div class="ui-widget ynav"><label for="yglobal">Get local/global results:</label><br />'+select+"</div>").appendTo("#yside");$("#yglobal").combobox({selected:function(b,c){if(c.item.value=="global"){a=true}else{a=false}yacysearch(a,true)}});x='<select class="selector" id="yrecent"><option value="relevance"';y='Relevance</option><option value="date"';z="Date</option></select>";var o=unescape($("#yquery").getValue());if(o.indexOf("/date")!=-1){select=x+">"+y+w+z}else{select=x+w+y+">"+z}$('<div class="ui-widget ynav"><label for="yrecent">Sort result by:</label><br />'+select+"</div>").appendTo("#yside");$("#yrecent").combobox({selected:function(a,b){if(b.item.value=="date"){o=o+" /date"}else{o=o.replace(/\s\/date/g,"")}$("#yquery").setValue($.trim(o));$("#yquery").trigger("keyup")}});$("<hr />").appendTo("#yside");$("<p class='ytxt'>You can narrow down your search by selecting one of the below navigators:</p>").appendTo("#yside");$.each(data.channels[0].navigation,function(a,b){if(b){var c="#y"+b.facetname;var d='<label for="y'+b.facetname+'">'+b.displayname+": </label><br />";var e='<select id="y'+b.facetname+'"><option value="">Select one...</option></select>';$('<div class="ui-widget ynav">'+d+e+"</div>").appendTo("#yside");$.each(b.elements,function(a,b){var d='<option value="'+b.modifier+'">'+b.name+" ("+b.count+")</option>";$(d).appendTo(c)});$(c).combobox({selected:function(a,b){var c=unescape($("#yquery").getValue()+" "+b.item.value);$("#yquery").setValue(c);ynavigators.push(b.item.value);$("#yquery").trigger("keyup")}})}});$("<hr />").appendTo("#yside");if(ynavigators.length>0){$("<p class='ytxt'>Uncheck to release navigators:</p>").appendTo("#yside")}h(ynavigators,"#yside");if($("#ypopup .yloading").length==0){$(".ynav-cancel").bind("change",function(a){var b=$("#yquery").getValue();var c=$(a.target).val();var d=ynavigators.indexOf($.trim(c));if(d!=-1)ynavigators.splice(d,1);var e=new RegExp(" "+c.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"));$("#yquery").setValue($.trim(b.replace(e,"")));startRecord=0;$("#yquery").trigger("keyup")});g();if($("#ypopup").dialog("isOpen")){if($("#ypopup h3 :last").position().top<$("#ypopup").dialog("option","height")&&j==maximumRecords){startRecord=startRecord+maximumRecords;yacysearch(submit,false)}}}}})}function yrun(){$.extend($.ui.accordion.defaults,{autoHeight:false,clearStyle:true,collapsible:true,header:"h3"});maximumRecords=parseInt($("#ysearch input[name='maximumRecords']").getValue());$("#ypopup").dialog({autoOpen:false,height:yconf.height,width:yconf.width,minWidth:yconf.width,position:yconf.position,modal:yconf.modal,resizable:yconf.resizable,title:yconf.title,show:yconf.show,hide:yconf.hide,drag:function(a,b){var c=$("#ypopup").parent(".ui-dialog").position();var d=$("#ypopup").parent(".ui-dialog").width()+5+c.left;$("#yside").dialog("option","position",[d,c.top+32])},dragStop:function(a,b){var c=$("#ypopup").parent(".ui-dialog").position();var d=$("#ypopup").parent(".ui-dialog").width()+5+c.left;$("#yside").dialog("option","position",[d,c.top+32])},resizeStop:function(a,b){var c=$("#ypopup").parent(".ui-dialog").position();var d=$("#ypopup").parent(".ui-dialog").height()-55;var e=$("#ypopup").parent(".ui-dialog").width()+5+c.left;$("#yside").dialog("option","height",d);$("#yside").dialog("option","position",[e,c.top+32])},close:function(a,b){$("#yquery").setValue("");$("#yside").dialog("destroy");$("#yside").remove()},open:function(a,b){$('<div id="yside" style="padding:0px;"></div>').insertAfter("#ypopup").parent(".ui-dialog-content");var c=$("#ypopup").parent(".ui-dialog").position();$("#yside").dialog({title:"Navigation",autoOpen:false,draggable:false,resizable:false,width:220,height:$("#ypopup").parent(".ui-dialog").height()-55,minHeight:$("#ypopup").parent(".ui-dialog").height()-55,show:"slide",hide:"slide",position:[c.left+$("#ypopup").parent(".ui-dialog").width()+5,c.top+32],open:function(a,b){$("div.ui-widget-shadow").remove();$("#ypopup").dialog("moveToTop")}});$(".ui-widget-shadow").remove();$('div[aria-labelledby="ui-dialog-title-yside"] div.ui-dialog-titlebar').remove();$("#ypopup").bind("scroll",function(a){p1=$("#ypopup h3 :last").position().top;if(p1-$("#ypopup").dialog("option","height")<0){startRecord=startRecord+maximumRecords;yacysearch(submit,false)}})}});$("#ysearch").keyup(function(a){if(a.which==27){$("#ypopup").dialog("close");$("#yquery").setValue("")}else if(a.which==39){startRecord=startRecord+maximumRecords;yacysearch(submit,false)}if(ycurr==$("#yquery").getValue()){return false}if($("#yquery").getValue()==""){if($("#ypopup").dialog("isOpen"))$("#ypopup").dialog("close")}else{ycurr=$("#yquery").getValue();if(!submit)yacysearch(false,true);else submit=false}return false});$("#ysearch").submit(function(){submit=true;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 statuscheck(){if(load_status<5){return}else{window.clearInterval(loading);yrun()}}$(document).ready(function(){ynavigators=new Array;$.ajaxSetup({timeout:5e3,cache:true});ycurr="";startRecord=0;maximumRecords=10;submit=false;yconf=$.extend({url:"",global:false,theme:"start",title:"YaCy Search Widget",logo:yconf.url+"/yacy/ui/img/yacy-logo.png",link:"http://yacy.net",width:640,height:640,position:[150,50],modal:false,resizable:true,show:"",hide:"",load_js:true,load_css:true},yconf);$('<div id="ypopup" class="classic"></div>').appendTo("#yacylivesearch");if(yconf.load_css){var a=yconf.url+"/portalsearch/yacy-portalsearch.css";var b=yconf.url+"/jquery/themes/"+yconf.theme+"/jquery-ui-1.8.16.custom.css";var c=yconf.url+"/jquery/css/jquery-ui-combobox.css";var d=document.getElementsByTagName("head")[0];$(document.createElement("link")).attr({type:"text/css",href:a,rel:"stylesheet",media:"screen"}).appendTo(d);$(document.createElement("link")).attr({type:"text/css",href:b,rel:"stylesheet",media:"screen"}).appendTo(d);$(document.createElement("link")).attr({type:"text/css",href:c,rel:"stylesheet",media:"screen"}).appendTo(d)}load_status=0;loading=window.setInterval("statuscheck()",200);if(yconf.load_js){var e=yconf.url+"/jquery/js/jquery.query-2.1.7.js";var f=yconf.url+"/jquery/js/jquery.form-2.73.js";var g=yconf.url+"/jquery/js/jquery.field-0.9.2.min.js";var h=yconf.url+"/jquery/js/jquery-ui-1.8.16.custom.min.js";var i=yconf.url+"/jquery/js/jquery-ui-combobox.js";$.getScript(e,function(){load_status++});$.getScript(f,function(){load_status++});$.getScript(g,function(){load_status++});$.getScript(h,function(){load_status++});$.getScript(i,function(){load_status++})}else{yrun()}})
\ No newline at end of file
+function yacysearch(a){function g(a,b){var c=a.length;var d=$("#yquery").getValue();for(var e=0,f=c;e<f;++e){if(d.indexOf(a[e])!=-1)$(' <input type="checkbox" checked="checked" class="ynav-cancel" name="ynav'+e+'" value="'+a[e]+'"> '+a[e]+"<br>").appendTo(b);else a.splice(e,1)}}function f(){window.setTimeout(function(){if($("#yquery").getValue()==ycurr){$("#yside").dialog("open");$("#yquery").focus()}},1e3)}var b=yconf.url+"/yacysearch.json?callback=?";if(a){$("#ypopup").empty();var c="<div class='yloading'><h3 class='linktitle'><em>Loading: "+yconf.url+"</em><br/>";var d="<img src='"+yconf.url+"/yacy/ui/img/loading2.gif' align='absmiddle'/></h3></div>";$("#ypopup").append(c+d);if(!$("#ypopup").dialog("isOpen"))$("#ypopup").dialog("open");else if($("#yside").dialog("isOpen"))$("#yside").dialog("close");$("#yquery").focus()}var e=[];$("#ysearch input").each(function(a){var b={name:$(this).attr("name"),value:$(this).attr("value")};if(b.name=="resource"){if(global)b.value="global";else{b.value="local"}}if(b.name=="query"||b.name=="search"){b.value=$.trim(b.value);if(b.value!=ycurr)ycurr=b.value}e[a]=b});e[e.length]={name:"startRecord",value:startRecord};$.ajaxSetup({timeout:1e4,error:function(b,c){var d="Unknow Error: "+b.responseText;if(b.status==0){d="Unknown Network Error! I try to reload...";yacysearch(true)}else if(b.status==404){d=b.status+" - Requested URL not found."}else if(b.status==500){d=b.status+" - Internel Server Error."}else if(c=="parsererror"){d="Parsing JSON Request failed."}else if(c=="timeout"){d="Request Time out."}if(a)$("#ypopup").empty();var e="<img src='"+yconf.url+"/yacy/ui/img-2/stop.png' class='favicon'/>";var f="<h3 class='linktitle'>"+e+" "+d+"</h3>";var g="<p class='url'><a href=''>Current search terms: "+ycurr+"</a></p>";$(f+g).appendTo("#ypopup")}});$.getJSON(b,e,function(b,c){if(b[0])data=b[0];else data=b;var d="";d=data.channels[0].searchTerms;if($.trim(ycurr.replace(/ /g,"+"))!=d){return false}if(a){$("#ypopup").empty()}var e=data.channels[0].totalResults;if(global)var h="global";else var h="local";var i=0;$.each(data.channels[0].items,function(a,b){if(b){var c="<img src='"+yconf.url+"/ViewImage.png?width=16&height=16&code="+b.faviconCode+"' class='favicon'/>";var d="<h3 class='linktitle'>"+c+"<a href='"+b.link+"' target='_blank'>"+b.title+"</a></h3>";var e="<p class='url'><a href='"+b.link+"' target='_blank'>"+b.link+"</a></p>";var f="<p class='desc'>"+b.description+"</p>";var g="<p class='date'>"+b.pubDate.substring(0,16);var h=" | "+b.sizename+"</p>";$(d+f+e+g+h).appendTo("#ypopup")}i++});if(i==0){if(a)$("#ypopup").empty();var j="<img src='"+yconf.url+"/yacy/ui/img-2/stop.png' class='favicon'/>";var k="<h3 class='linktitle'>"+j+"No search results!</h3>";var l="<p class='url'><a href=''>Current search terms: "+d+"</a></p>";var m="<p class='desc'>You could restate your search, release some navigators or switch to global search...</p>";$(k+m+l).appendTo("#ypopup")}if(a){$("#yside").empty();var n="<a href='"+yconf.link+"' target='_blank'><img style='padding-left: 24px;' src='"+yconf.logo+"' alt='"+yconf.logo+"' title='"+yconf.logo+"' /></a>";var o="Total "+h+" results: "+e;$("<div class='ymsg'><table><tr><td width='55px'>"+n+"</td><td id='yresult'>"+o+"</td></tr></div").appendTo("#yside");$("<hr />").appendTo("#yside");var p='selected="selected">';var q='<select class="selector" id="yglobal"><option value="local"';var r='local</option><option value="global"';var s="global</option></select>";if(global){select=q+">"+r+p+s}else{select=q+p+r+">"+s}$('<div class="ui-widget ynav"><label for="yglobal">Get local/global results:</label><br />'+select+"</div>").appendTo("#yside");$("#yglobal").combobox({selected:function(a,b){if(b.item.value=="global"){global=true}else{global=false}yacysearch(true)}});q='<select class="selector" id="yrecent"><option value="relevance"';r='Relevance</option><option value="date"';s="Date</option></select>";var t=unescape($("#yquery").getValue());if(t.indexOf("/date")!=-1){select=q+">"+r+p+s}else{select=q+p+r+">"+s}$('<div class="ui-widget ynav"><label for="yrecent">Sort result by:</label><br />'+select+"</div>").appendTo("#yside");$("#yrecent").combobox({selected:function(a,b){if(b.item.value=="date"){t=t+" /date"}else{t=t.replace(/\s\/date/g,"")}$("#yquery").setValue($.trim(t));$("#yquery").trigger("keyup")}});$("<hr />").appendTo("#yside");$("<p class='ytxt'>You can narrow down your search by selecting one of the below navigators:</p>").appendTo("#yside");$.each(data.channels[0].navigation,function(a,b){if(b){var c="#y"+b.facetname;var d='<label for="y'+b.facetname+'">'+b.displayname+": </label><br />";var e='<select id="y'+b.facetname+'"><option value="">Select one...</option></select>';$('<div class="ui-widget ynav">'+d+e+"</div>").appendTo("#yside");$.each(b.elements,function(a,b){var d='<option value="'+b.modifier+'">'+b.name+" ("+b.count+")</option>";$(d).appendTo(c)});$(c).combobox({selected:function(a,b){var c=unescape($("#yquery").getValue()+" "+b.item.value);$("#yquery").setValue(c);ynavigators.push(b.item.value);$("#yquery").trigger("keyup")}})}});$("<hr />").appendTo("#yside");if(ynavigators.length>0){$("<p class='ytxt'>Uncheck to release navigators:</p>").appendTo("#yside")}g(ynavigators,"#yside");if($("#ypopup .yloading").length==0){$(".ynav-cancel").bind("change",function(a){var b=$("#yquery").getValue();var c=$(a.target).val();var d=ynavigators.indexOf($.trim(c));if(d!=-1)ynavigators.splice(d,1);var e=new RegExp(" "+c.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"));$("#yquery").setValue($.trim(b.replace(e,"")));startRecord=0;$("#yquery").trigger("keyup")});f();if($("#ypopup").dialog("isOpen")){if($("#ypopup h3 :last").position().top<$("#ypopup").dialog("option","height")&&i==maximumRecords){startRecord=startRecord+maximumRecords;yacysearch(false)}}}}})}function yrun(){maximumRecords=parseInt($("#ysearch input[name='maximumRecords']").getValue());global=yconf.global;$("#ypopup").dialog({autoOpen:false,height:yconf.height,width:yconf.width,minWidth:yconf.width,position:yconf.position,modal:yconf.modal,resizable:yconf.resizable,title:yconf.title,show:yconf.show,hide:yconf.hide,drag:function(a,b){var c=$("#ypopup").parent(".ui-dialog").position();var d=$("#ypopup").parent(".ui-dialog").width()+5+c.left;$("#yside").dialog("option","position",[d,c.top+32])},dragStop:function(a,b){var c=$("#ypopup").parent(".ui-dialog").position();var d=$("#ypopup").parent(".ui-dialog").width()+5+c.left;$("#yside").dialog("option","position",[d,c.top+32])},resizeStop:function(a,b){var c=$("#ypopup").parent(".ui-dialog").position();var d=$("#ypopup").parent(".ui-dialog").height()-55;var e=$("#ypopup").parent(".ui-dialog").width()+5+c.left;$("#yside").dialog("option","height",d);$("#yside").dialog("option","position",[e,c.top+32])},close:function(a,b){$("#yquery").setValue("");$("#yside").dialog("destroy");$("#yside").remove()},open:function(a,b){$('<div id="yside" style="padding:0px;"></div>').insertAfter("#ypopup").parent(".ui-dialog-content");var c=$("#ypopup").parent(".ui-dialog").position();$("#yside").dialog({title:"Navigation",autoOpen:false,draggable:false,resizable:false,width:220,height:$("#ypopup").parent(".ui-dialog").height()-55,minHeight:$("#ypopup").parent(".ui-dialog").height()-55,show:"slide",hide:"slide",position:[c.left+$("#ypopup").parent(".ui-dialog").width()+5,c.top+32],open:function(a,b){$("div.ui-widget-shadow").remove();$("#ypopup").dialog("moveToTop")}});$(".ui-widget-shadow").remove();$('div[aria-labelledby="ui-dialog-title-yside"] div.ui-dialog-titlebar').remove();$("#ypopup").bind("scroll",function(a){p1=$("#ypopup h3 :last").position().top;if(p1-$("#ypopup").dialog("option","height")<0){startRecord=startRecord+maximumRecords;yacysearch(false)}})}});$("#ysearch").keyup(function(a){if(a.which==27){$("#ypopup").dialog("close");$("#yquery").setValue("")}if(a.which==18){global=true;ycurr=$("#yquery").getValue();yacysearch(true)}if(ycurr==$("#yquery").getValue()){return false}global=yconf.global;if($("#yquery").getValue()==""){if($("#ypopup").dialog("isOpen"))$("#ypopup").dialog("close")}else{ycurr=$("#yquery").getValue();yacysearch(true)}return false});$("#ysearch").submit(function(){ycurr=$("#yquery").getValue();if(!$("#ypopup").dialog("isOpen"))$("#ypopup").dialog("open");else if($("#yside").dialog("isOpen"))$("#yside").dialog("close");$("#yquery").focus();yacysearch(true);return false})}function statuscheck(){if(load_status<5){return}else{window.clearInterval(loading);yrun()}}$(document).ready(function(){ynavigators=new Array;$.ajaxSetup({timeout:5e3,cache:true});ycurr="";startRecord=0;maximumRecords=10;submit=false;yconf=$.extend({url:"",global:false,theme:"start",title:"YaCy Search Widget",logo:yconf.url+"/yacy/ui/img/yacy-logo.png",link:"http://yacy.net",width:640,height:640,position:[150,50],modal:false,resizable:true,show:"",hide:"",load_js:true,load_css:true},yconf);$('<div id="ypopup" class="classic"></div>').appendTo("#yacylivesearch");if(yconf.load_css){var a=yconf.url+"/portalsearch/yacy-portalsearch.css";var b=yconf.url+"/jquery/themes/"+yconf.theme+"/jquery-ui-1.8.16.custom.css";var c=yconf.url+"/jquery/css/jquery-ui-combobox.css";var d=document.getElementsByTagName("head")[0];$(document.createElement("link")).attr({type:"text/css",href:a,rel:"stylesheet",media:"screen"}).appendTo(d);$(document.createElement("link")).attr({type:"text/css",href:b,rel:"stylesheet",media:"screen"}).appendTo(d);$(document.createElement("link")).attr({type:"text/css",href:c,rel:"stylesheet",media:"screen"}).appendTo(d)}load_status=0;loading=window.setInterval("statuscheck()",200);if(yconf.load_js){var e=yconf.url+"/jquery/js/jquery.query-2.1.7.js";var f=yconf.url+"/jquery/js/jquery.form-2.73.js";var g=yconf.url+"/jquery/js/jquery.field-0.9.2.min.js";var h=yconf.url+"/jquery/js/jquery-ui-1.8.16.custom.min.js";var i=yconf.url+"/jquery/js/jquery-ui-combobox.js";$.getScript(e,function(){load_status++});$.getScript(f,function(){load_status++});$.getScript(g,function(){load_status++});$.getScript(h,function(){load_status++});$.getScript(i,function(){load_status++})}else{yrun()}})
\ No newline at end of file