Skip to content

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

- added a new YaCy-UI Widget: /yacy/ui/yacyui-widget.html?style=xyz - http://forum.yacy-websuche.de/viewtopic.php?f=9&t=1127#p12781

apfelmaennchenbe29ece9d0d9
diff --git a/htroot/yacy/ui/css/widget.css b/htroot/yacy/ui/css/widget.css
new file mode 100644
index 000000000..a7a10bc60
--- /dev/null
+++ b/htroot/yacy/ui/css/widget.css
@@ -0,0 +1,29 @@
+/* Body */
+body {
+ font-size: 75.0%;
+}
+p.url {
+ padding-top: 1px;
+ font-size: 0.9em;
+ line-height: 1.1em;
+ margin-bottom:0.6em;
+ margin-left: 26px;
+}
+p.linktitle {
+ margin-top:2px;
+ margin-bottom: -0.5em;
+ font-size: 1.0em;
+ line-height: 1.1em;
+ color:#239AFF;
+ margin-left: 26px;
+}
+a.favicon {
+ color:#20A020;
+ text-decoration:none;
+}
+img.favicon{
+ width: 16px;
+ height: 16px;
+ vertical-align: middle;
+ margin-bottom: -40px;
+}
diff --git a/htroot/yacy/ui/js/jquery.scrollTo-min.js b/htroot/yacy/ui/js/jquery.scrollTo-min.js
new file mode 100644
index 000000000..453382d24
--- /dev/null
+++ b/htroot/yacy/ui/js/jquery.scrollTo-min.js
@@ -0,0 +1,11 @@
+/**
+ * jQuery.ScrollTo - Easy element scrolling using jQuery.
+ * Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
+ * Dual licensed under MIT and GPL.
+ * Date: 9/11/2008
+ * @author Ariel Flesler
+ * @version 1.4
+ *
+ * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
+ */
+;(function(h){var m=h.scrollTo=function(b,c,g){h(window).scrollTo(b,c,g)};m.defaults={axis:'y',duration:1};m.window=function(b){return h(window).scrollable()};h.fn.scrollable=function(){return this.map(function(){var b=this.parentWindow||this.defaultView,c=this.nodeName=='#document'?b.frameElement||b:this,g=c.contentDocument||(c.contentWindow||c).document,i=c.setInterval;return c.nodeName=='IFRAME'||i&&h.browser.safari?g.body:i?g.documentElement:this})};h.fn.scrollTo=function(r,j,a){if(typeof j=='object'){a=j;j=0}if(typeof a=='function')a={onAfter:a};a=h.extend({},m.defaults,a);j=j||a.speed||a.duration;a.queue=a.queue&&a.axis.length>1;if(a.queue)j/=2;a.offset=n(a.offset);a.over=n(a.over);return this.scrollable().each(function(){var k=this,o=h(k),d=r,l,e={},p=o.is('html,body');switch(typeof d){case'number':case'string':if(/^([+-]=)?\d+(px)?$/.test(d)){d=n(d);break}d=h(d,this);case'object':if(d.is||d.style)l=(d=h(d)).offset()}h.each(a.axis.split(''),function(b,c){var g=c=='x'?'Left':'Top',i=g.toLowerCase(),f='scroll'+g,s=k[f],t=c=='x'?'Width':'Height',v=t.toLowerCase();if(l){e[f]=l[i]+(p?0:s-o.offset()[i]);if(a.margin){e[f]-=parseInt(d.css('margin'+g))||0;e[f]-=parseInt(d.css('border'+g+'Width'))||0}e[f]+=a.offset[i]||0;if(a.over[i])e[f]+=d[v]()*a.over[i]}else e[f]=d[i];if(/^\d+$/.test(e[f]))e[f]=e[f]<=0?0:Math.min(e[f],u(t));if(!b&&a.queue){if(s!=e[f])q(a.onAfterFirst);delete e[f]}});q(a.onAfter);function q(b){o.animate(e,j,a.easing,b&&function(){b.call(this,r,a)})};function u(b){var c='scroll'+b,g=k.ownerDocument;return p?Math.max(g.documentElement[c],g.body[c]):k[c]}}).end()};function n(b){return typeof b=='object'?b:{top:b,left:b}}})(jQuery);
\ No newline at end of file
diff --git a/htroot/yacy/ui/js/jquery.serialScroll-min.js b/htroot/yacy/ui/js/jquery.serialScroll-min.js
new file mode 100644
index 000000000..1c76359fc
--- /dev/null
+++ b/htroot/yacy/ui/js/jquery.serialScroll-min.js
@@ -0,0 +1,11 @@
+/**
+ * jQuery[a] - Animated scrolling of series
+ * Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
+ * Dual licensed under MIT and GPL.
+ * Date: 3/20/2008
+ * @author Ariel Flesler
+ * @version 1.2.1
+ *
+ * http://flesler.blogspot.com/2008/02/jqueryserialscroll.html
+ */
+;(function($){var a='serialScroll',b='.'+a,c='bind',C=$[a]=function(b){$.scrollTo.window()[a](b)};C.defaults={duration:1e3,axis:'x',event:'click',start:0,step:1,lock:1,cycle:1,constant:1};$.fn[a]=function(y){y=$.extend({},C.defaults,y);var z=y.event,A=y.step,B=y.lazy;return this.each(function(){var j=y.target?this:document,k=$(y.target||this,j),l=k[0],m=y.items,o=y.start,p=y.interval,q=y.navigation,r;if(!B)m=w();if(y.force)t({},o);$(y.prev||[],j)[c](z,-A,s);$(y.next||[],j)[c](z,A,s);if(!l.ssbound)k[c]('prev'+b,-A,s)[c]('next'+b,A,s)[c]('goto'+b,t);if(p)k[c]('start'+b,function(e){if(!p){v();p=1;u()}})[c]('stop'+b,function(){v();p=0});k[c]('notify'+b,function(e,a){var i=x(a);if(i>-1)o=i});l.ssbound=1;if(y.jump)(B?k:w())[c](z,function(e){t(e,x(e.target))});if(q)q=$(q,j)[c](z,function(e){e.data=Math.round(w().length/q.length)*q.index(this);t(e,this)});function s(e){e.data+=o;t(e,this)};function t(e,a){if(!isNaN(a)){e.data=a;a=l}var c=e.data,n,d=e.type,f=y.exclude?w().slice(0,-y.exclude):w(),g=f.length,h=f[c],i=y.duration;if(d)e.preventDefault();if(p){v();r=setTimeout(u,y.interval)}if(!h){n=c<0?0:n=g-1;if(o!=n)c=n;else if(!y.cycle)return;else c=g-n-1;h=f[c]}if(!h||d&&o==c||y.lock&&k.is(':animated')||d&&y.onBefore&&y.onBefore.call(a,e,h,k,w(),c)===!1)return;if(y.stop)k.queue('fx',[]).stop();if(y.constant)i=Math.abs(i/A*(o-c));k.scrollTo(h,i,y).trigger('notify'+b,[c])};function u(){k.trigger('next'+b)};function v(){clearTimeout(r)};function w(){return $(m,l)};function x(a){if(!isNaN(a))return a;var b=w(),i;while((i=b.index(a))==-1&&a!=l)a=a.parentNode;return i}})}})(jQuery);
\ No newline at end of file
diff --git a/htroot/yacy/ui/yacyui-widget.html b/htroot/yacy/ui/yacyui-widget.html
new file mode 100644
index 000000000..daf524c39
--- /dev/null
+++ b/htroot/yacy/ui/yacyui-widget.html
@@ -0,0 +1,126 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+ <link media="screen" type="text/css" href="css/widget.css" rel="stylesheet" />
+ <link media="screen" type="text/css" href="css/themes/base/ui.base.css" rel="stylesheet" title="base"/>
+ <link media="screen" type="text/css" href="css/themes/base/ui.theme.css" rel="stylesheet" title="base"/>
+ <link media="screen" type="text/css" href="css/themes/humanity/ui.base.css" rel="alternate stylesheet" title="humanity"/>
+ <link media="screen" type="text/css" href="css/themes/humanity/ui.theme.css" rel="alternate stylesheet" title="humanity"/>
+ <link media="screen" type="text/css" href="css/themes/cupertino/ui.base.css" rel="alternate stylesheet" title="cupertino"/>
+ <link media="screen" type="text/css" href="css/themes/cupertino/ui.theme.css" rel="alternate stylesheet" title="cupertino"/>
+ <link media="screen" type="text/css" href="css/themes/redmond/ui.base.css" rel="alternate stylesheet" title="redmond"/>
+ <link media="screen" type="text/css" href="css/themes/redmond/ui.theme.css" rel="alternate stylesheet" title="redmond"/>
+ <link media="screen" type="text/css" href="css/themes/smoothness/ui.base.css" rel="alternate stylesheet" title="smoothness"/>
+ <link media="screen" type="text/css" href="css/themes/smoothness/ui.theme.css" rel="alternate stylesheet" title="smoothness"/>
+ <link media="screen" type="text/css" href="css/themes/darkness/ui.base.css" rel="alternate stylesheet" title="darkness"/>
+ <link media="screen" type="text/css" href="css/themes/darkness/ui.theme.css" rel="alternate stylesheet" title="darkness"/>
+
+ <script src="js/jquery-1.3.1.min.js" type="text/javascript"></script>
+ <script src="js/jquery.ui.all.min.js" type="text/javascript"></script>
+ <script src="js/jquery.query.js" type="text/javascript""></script>
+ <script src="js/jquery.form.js" type="text/javascript"></script>
+ <script src="js/jquery.field.min.js" type="text/javascript"></script>
+ <script src="js/jquery-faviconize-1.0.js" type="text/javascript"></script>
+ <script src="js/jquery.serialScroll-min.js" type="text/javascript"></script>
+ <script src="js/jquery.scrollTo-min.js" type="text/javascript"></script>
+
+ <script type="text/javascript">
+ //<![CDATA[
+ $(document).ready(function() {
+
+ var style = $.query.get('style');
+ $.query.REMOVE('style');
+ if (style) {
+ switchStylestyle(style);
+ }
+
+ $("#yresult").dialog({
+ autoOpen: false,
+ height: 600,
+ width: 500,
+ position: ['top',50],
+ modal: false,
+ resizable: true,
+ buttons: {
+ Close: function() { $("#yresult").dialog("close"); }
+ }
+ });
+
+ $('#yresult').serialScroll({
+ items:'div',
+ force:true,
+ cycle:true,
+ axis:'y',
+ easing:'linear',
+ lazy:true,
+ interval:1500,
+ step:1
+ });
+
+ /* Load Search Result */
+ $('#searchbox').keyup(function() {
+ if (!$("#yresult").dialog('isOpen')) {
+ $("#yresult").dialog('open');
+ }
+ $("#search").focus();
+
+ var param = [
+ { name : 'maximumRecords', value : '100' }
+ ,{ name : 'verify', value : 'false' }
+ ,{ name : 'resource', value : 'local' }
+ ,{ name : 'search', value : $("#searchbox input[name='search']").getValue()}
+ ];
+
+ $.ajax({
+ type: 'GET',
+ url: '/yacysearch.json',
+ data: param,
+ dataType: 'json',
+ success: function(data){
+ $("#yresult").empty();
+ $.each (
+ data.channels[0].items,
+ function(i,item) {
+ if (item) {
+ $("#yresult").append("<div><a class='favicon' href='"+item.link+"'><p class='linktitle'>"+item.title+"</p><p class='url'>"+item.link+"</p></a></div>")
+ }
+ }
+ );
+ $("a.favicon").faviconize({
+ position: "before",
+ defaultImage: "img-2/article.png",
+ className: "favicon"
+ });
+ $("#yresult").trigger('start');
+ }
+ });
+ });
+ $('#searchbox').submit(function() {
+ return false;
+ });
+ });
+ function switchStylestyle(styleName) {
+ $('link[rel*=style][title]').each(function(i)
+ {
+ this.disabled = true;
+ if (this.getAttribute('title') == styleName) this.disabled = false;
+ });
+ }
+ //]]>
+ </script>
+ <title>YaCy-UI Widget</title>
+ </head>
+ <body>
+ <div class="yform">
+ <form id="searchbox" class="small" method="get" accept-charset="UTF-8" action="jQuery">
+ <input id="search" name="search" type="text" size="15" maxlength="80" value=""/>
+ </form>
+ </div>
+ <!-- Search Result -->
+ <div id="yresult" title="YaCy P2P Web Search" style="overflow: hidden;">
+ </div>
+ </body>
+</html>
\ No newline at end of file
diff --git a/htroot/yacy/ui/yacyuisearch.html b/htroot/yacy/ui/yacyuisearch.html
index 645562227..f0dbc7ea9 100644
--- a/htroot/yacy/ui/yacyuisearch.html
+++ b/htroot/yacy/ui/yacyuisearch.html
@@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link media="screen" type="text/css" href="css/jquery.flexigrid.css" rel="stylesheet" />
<link media="screen" type="text/css" href="css/base.css" rel="stylesheet" />
- <script src="js/jquery-1.2.6.min.js" type="text/javascript"></script>
+ <script src="js/jquery-1.3.1.min.js" type="text/javascript"></script>
<script src="js/jquery.query.js" type="text/javascript""></script>
<script src="js/jquery.dimensions.min.js" type="text/javascript"></script>
<script src="js/jquery-faviconize-1.0.js" type="text/javascript"></script>