From c001a020a9674796a362cb79d329b64e0c2d4cd2 Mon Sep 17 00:00:00 2001 From: apfelmaennchen Date: Sat, 28 Mar 2009 23:06:15 +0000 Subject: [PATCH] - small modifications to yacyui-portalsearch - see http://forum.yacy-websuche.de/viewtopic.php?f=15&t=1762&p=13459#p13459 git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5748 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/yacy/ui/js/yacyui-portalsearch.js | 62 +++++++++---------- htroot/yacy/ui/yacyui-portaltest.html | 76 ++++++++++++++---------- 2 files changed, 71 insertions(+), 67 deletions(-) diff --git a/htroot/yacy/ui/js/yacyui-portalsearch.js b/htroot/yacy/ui/js/yacyui-portalsearch.js index e4b04b807..f3bcd4dba 100644 --- a/htroot/yacy/ui/js/yacyui-portalsearch.js +++ b/htroot/yacy/ui/js/yacyui-portalsearch.js @@ -7,11 +7,8 @@ $(document).ready(function() { $('
').appendTo("#yacy"); - startRecord = 0; - - var style1 = yurl + '/yacy/ui/css/yacyui-portalsearch.css'; - var style2 = yurl + '/yacy/ui/css/themes/'+ytheme+'/ui.base.css'; - var style3 = yurl + '/yacy/ui/css/themes/'+ytheme+'/ui.theme.css'; + var style1 = yconf.url + '/yacy/ui/css/yacyui-portalsearch.css'; + var style2 = yconf.url + '/yacy/ui/css/themes/'+yconf.theme+'/ui.all.css'; var head = document.getElementsByTagName('head')[0]; @@ -21,37 +18,38 @@ $(document).ready(function() { $(document.createElement('link')) .attr({type:'text/css', href: style2, rel:'stylesheet', media:'screen'}) .appendTo(head); - $(document.createElement('link')) - .attr({type:'text/css', href: style3, rel:'stylesheet', media:'screen'}) - .appendTo(head); - var script1 = yurl + '/yacy/ui/js/jquery.query.js'; - var script2 = yurl + '/yacy/ui/js/jquery.form.js'; - var script3 = yurl + '/yacy/ui/js/jquery.field.min.js'; - var script4 = yurl + '/yacy/ui/js/jquery-faviconize-1.0.js'; - var script5 = yurl + '/yacy/ui/js/jquery.ui.all.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-faviconize-1.0.js'; + var script5 = yconf.url + '/yacy/ui/js/jquery.ui.all.min.js'; $.getScript(script1, function(){}); $.getScript(script2, function(){}); $.getScript(script3, function(){}); $.getScript(script4, function(){}); + $.getScript(script5, function(){ + startRecord = 0; + maximumRecords = parseInt($("#ysearch input[name='maximumRecords']").getValue()); + $("#ypopup").dialog({ autoOpen: false, - height: 500, - width: 420, - minWidth: 420, + height: yconf.height, + width: yconf.width, + minWidth: yconf.width, position: ['top',50], modal: false, resizable: true, - title: "YaCy P2P Web Search", + title: yconf.title, buttons: { Next: function() { - startRecord = startRecord + 10; + startRecord = startRecord + maximumRecords; $('#ysearch').trigger('submit'); }, Prev: function() { - startRecord = startRecord - 10; + startRecord = startRecord - maximumRecords; if(startRecord < 0) startRecord = 0; $('#ysearch').trigger('submit'); } @@ -68,25 +66,21 @@ $(document).ready(function() { $('#ysearch').submit(function() { var query = $('#yquery').getValue(); - var url = yurl + '/yacysearch.json?callback=?' + var url = yconf.url + '/yacysearch.json?callback=?' $('#ypopup').empty(); - $('#ypopup').append("

Loading: "+yurl+"

"); + $('#ypopup').append("

Loading: "+yconf.url+"

"); if (!$("#ypopup").dialog('isOpen')) { $("#ypopup").dialog('open'); } $("#yquery").focus(); - - var param = [ - { name : 'startRecord', value : startRecord } - ,{ name : 'maximumRecords', value : 10 } - ,{ name : 'query', value : query} - ]; - - if (yparam) { - for (var pi = 0; pi < yparam.length; pi++) param[param.length] = yparam[pi]; - } + + var param = []; + $("#ysearch input").each(function(i){ + var item = { name : $(this).attr('name'), value : $(this).attr('value') }; + param[i] = item; + }); $.getJSON(url, param, function(json, status){ @@ -98,10 +92,10 @@ $(document).ready(function() { 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 + 10; + var end = startRecord + maximumRecords; $("div .ybpane").remove(); - var ylogo = "
www.yacy.net
"; + var ylogo = "
www.yacy.net
"; var yresult = "
Displaying result "+start+" to "+end+"
of "+total+" total results.
"; $("div .ui-dialog-buttonpane").prepend(ylogo+yresult); @@ -120,7 +114,7 @@ $(document).ready(function() { ); $(".linktitle a").faviconize({ position: "before", - defaultImage: yurl + "/yacy/ui/img-2/article.png", + defaultImage: yconf.url + "/yacy/ui/img-2/article.png", className: "favicon" }); } diff --git a/htroot/yacy/ui/yacyui-portaltest.html b/htroot/yacy/ui/yacyui-portaltest.html index 688632e08..963c1f02d 100644 --- a/htroot/yacy/ui/yacyui-portaltest.html +++ b/htroot/yacy/ui/yacyui-portaltest.html @@ -4,50 +4,60 @@ - + -

YaCy Portal Search:

+

YaCy Portal Search:

-
- + + + + + + + + + +

Code Snippet:

-<script src="http://localhost:8080/yacy/ui/js/jquery-1.3.1.min.js" type="text/javascript"></script>
-<script>
+<script src="http://localhost:8081/yacy/ui/js/jquery-1.3.1.min.js" type="text/javascript"></script>
+<script>			
 	$(document).ready(function() {
-		yurl = 'http://localhost:8080/'; 
-		ytheme = 'start';
-		yparam = [
-			 { name : 'verify', value : 'false'}
-			,{ name : 'resource', value : 'local'}
-			,{ name : 'urlmaskfilter', value : '.*'}
-			,{ name : 'prefermaskfilter', value : ''}
-		];
-		$.getScript(yurl+'/yacy/ui/js/yacyui-portalsearch.js', function(){});
+		yconf = {
+			url : 'http://localhost:8081/',
+			theme : 'start',
+			title : 'YaCy P2P Web Search',
+			width : 420,
+			height : 500
+		};
+		$.getScript(yconf.url+'/yacy/ui/js/yacyui-portalsearch.js', function(){});
 	});
-</script> 			
-<div id="yacy">
-	<form id="ysearch" method="get" accept-charset="UTF-8" action="">
-		<input id="yquery" type="text" size="15" maxlength="80" value=""/>
-	</form>
+</script>
+<div id="yacy">
+	<form id="ysearch" method="get" accept-charset="UTF-8" action="http://localhost:8081/yacysearch.html">
+		<input name="query" id="yquery" type="text" size="15" maxlength="80" value=""/>
+		<input type="hidden" name="verify" value="false" />
+		<input type="hidden" name="maximumRecords" value="10" />
+		<input type="hidden" name="resource" value="local" />
+		<input type="hidden" name="urlmaskfilter" value=".*" />
+		<input type="hidden" name="prefermaskfilter" value="" />
+		<input type="hidden" name="former" value="" />
+		<input type="hidden" name="display" value="2" />
+		<input type="submit" name="Enter" value="Suchen" />
+	</form>
 </div>