From 55dd15e344b3abee52d74945b1c4d7487f9148f4 Mon Sep 17 00:00:00 2001 From: apfelmaennchen Date: Thu, 29 Jan 2009 19:57:18 +0000 Subject: [PATCH] - clean up of YaCy-UI - added /yacy/ui/yacyuisearch.html (stand alone version) git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5534 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/yacy/ui/index.html | 15 +- htroot/yacy/ui/js/jquery-keynav.js | 200 ----- htroot/yacy/ui/js/jquery.pagination.js | 166 ---- htroot/yacy/ui/js/jquery.query.js | 211 +++++ htroot/yacy/ui/js/jquery.xslTransform.js | 420 --------- htroot/yacy/ui/js/sarissa.js | 1025 ---------------------- htroot/yacy/ui/js/sarissa_ieemu_xpath.js | 220 ----- htroot/yacy/ui/sidebar/sidebar_2.html | 2 +- htroot/yacy/ui/yacyui-admin.html | 4 +- htroot/yacy/ui/yacyui-widget.html | 7 +- htroot/yacy/ui/yacyuisearch.html | 154 ++++ 11 files changed, 376 insertions(+), 2048 deletions(-) delete mode 100644 htroot/yacy/ui/js/jquery-keynav.js delete mode 100644 htroot/yacy/ui/js/jquery.pagination.js create mode 100644 htroot/yacy/ui/js/jquery.query.js delete mode 100644 htroot/yacy/ui/js/jquery.xslTransform.js delete mode 100644 htroot/yacy/ui/js/sarissa.js delete mode 100644 htroot/yacy/ui/js/sarissa_ieemu_xpath.js create mode 100644 htroot/yacy/ui/yacyuisearch.html diff --git a/htroot/yacy/ui/index.html b/htroot/yacy/ui/index.html index 926534d62..f391b2129 100644 --- a/htroot/yacy/ui/index.html +++ b/htroot/yacy/ui/index.html @@ -15,10 +15,7 @@ - - - - + @@ -29,15 +26,11 @@ - - - - - + + + - - - * - * Copyright (c) 2006 Mike Hostetler - * Licensed under the MIT License: - * http://www.opensource.org/licenses/mit-license.php - */ - $.keynav = new Object(); - - $.fn.keynav = function (onClass,offClass) { - //Initialization - var kn = $.keynav; - if(!kn.init) { - kn.el = new Array(); - - $(document).keydown(function(e) { - var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0; - switch(key) { - case 37: - $.keynav.goLeft(); - break; - case 38: - $.keynav.goUp(); - break; - case 39: - $.keynav.goRight(); - break; - case 40: - $.keynav.goDown(); - break; - case 13: - $.keynav.activate(); - break; - } - }); - kn.init = true; - } - - return this.each(function() { - $.keynav.reg(this,onClass,offClass); - }); - } - $.fn.keynav_sethover = function(onClass,offClass) { - return this.each(function() { - this.onClass = onClass; - this.offClass = offClass; - }); - } - - $.keynav.reset = function() { - var kn = $.keynav; - kn.el = new Array(); - } - - $.keynav.reg = function(e,onClass,offClass) { - var kn = $.keynav; - e.pos = $.keynav.getPos(e); - e.onClass = onClass; - e.offClass = offClass; - e.onmouseover = function (e) { $.keynav.setActive(this); }; - kn.el.push(e); - } - $.keynav.setActive = function(e) { - var kn = $.keynav; - var cur = $.keynav.getCurrent(); - $(cur).trigger('blur'); - for(var i=0;i= 0) && (Math.abs(dx) - dy) <= 0) - return true; - else - return false; - }); - $.keynav.activateClosest(cur,quad); - } - $.keynav.goRight = function () { - var cur = $.keynav.getCurrent(); - var quad = $.keynav.quad(cur,function (dx,dy) { - if((dy <= 0) && (Math.abs(dx) + dy) <= 0) - return true; - else - return false; - }); - $.keynav.activateClosest(cur,quad); - } - - $.keynav.goUp = function () { - var cur = $.keynav.getCurrent(); - var quad = $.keynav.quad(cur,function (dx,dy) { - if((dx >= 0) && (Math.abs(dy) - dx) <= 0) - return true; - else - return false; - }); - $.keynav.activateClosest(cur,quad); - } - - $.keynav.goDown = function () { - var cur = $.keynav.getCurrent(); - var quad = $.keynav.quad(cur,function (dx,dy) { - if((dx <= 0) && (Math.abs(dy) + dx) <= 0) - return true; - else - return false; - }); - $.keynav.activateClosest(cur,quad); - } - - $.keynav.activate = function () { - var kn = $.keynav; - $(kn.currentEl).trigger('click'); - } - - /** - * This function was taken from Stefan's exellent interface plugin - * http://www.eyecon.ro/interface/ - * - * I included it in this library's namespace because the functions aren't - * quite the same. - */ - $.keynav.getPos = function (e) - { - var l = 0; - var t = 0; - var w = $.intval($.css(e,'width')); - var h = $.intval($.css(e,'height')); - while (e.offsetParent){ - l += e.offsetLeft + (e.currentStyle?$.intval(e.currentStyle.borderLeftWidth):0); - t += e.offsetTop + (e.currentStyle?$.intval(e.currentStyle.borderTopWidth):0); - e = e.offsetParent; - } - l += e.offsetLeft + (e.currentStyle?$.intval(e.currentStyle.borderLeftWidth):0); - t += e.offsetTop + (e.currentStyle?$.intval(e.currentStyle.borderTopWidth):0); - var cx = Math.round(t+(h/2)); - var cy = Math.round(l+(w/2)); - return {x:l, y:t, w:w, h:h, cx:cx, cy:cy}; - }; - - /** - * This function was taken from Stefan's exellent interface plugin - * http://www.eyecon.ro/interface/ - */ - $.intval = function (v) - { - v = parseInt(v); - return isNaN(v) ? 0 : v; - }; - diff --git a/htroot/yacy/ui/js/jquery.pagination.js b/htroot/yacy/ui/js/jquery.pagination.js deleted file mode 100644 index 9e6603fef..000000000 --- a/htroot/yacy/ui/js/jquery.pagination.js +++ /dev/null @@ -1,166 +0,0 @@ -/** - * This jQuery plugin displays pagination links inside the selected elements. - * - * @author Gabriel Birke (birke *at* d-scribe *dot* de) - * @version 1.1 - * @param {int} maxentries Number of entries to paginate - * @param {Object} opts Several options (see README for documentation) - * @return {Object} jQuery Object - */ -jQuery.fn.pagination = function(maxentries, opts){ - opts = jQuery.extend({ - items_per_page:10, - num_display_entries:10, - current_page:0, - num_edge_entries:0, - link_to:"#", - prev_text:"Prev", - next_text:"Next", - ellipse_text:"...", - prev_show_always:true, - next_show_always:true, - callback:function(){return false;} - },opts||{}); - - return this.each(function() { - /** - * Calculate the maximum number of pages - */ - function numPages() { - return Math.ceil(maxentries/opts.items_per_page); - } - - /** - * Calculate start and end point of pagination links depending on - * current_page and num_display_entries. - * @return {Array} - */ - function getInterval() { - var ne_half = Math.ceil(opts.num_display_entries/2); - var np = numPages(); - var upper_limit = np-opts.num_display_entries; - var start = current_page>ne_half?Math.max(Math.min(current_page-ne_half, upper_limit), 0):0; - var end = current_page>ne_half?Math.min(current_page+ne_half, np):Math.min(opts.num_display_entries, np); - return [start,end]; - } - - /** - * This is the event handling function for the pagination links. - * @param {int} page_id The new page number - */ - function pageSelected(page_id, evt){ - current_page = page_id; - drawLinks(); - var continuePropagation = opts.callback(page_id, panel); - if (!continuePropagation) { - if (evt.stopPropagation) { - evt.stopPropagation(); - } - else { - evt.cancelBubble = true; - } - } - return continuePropagation; - } - - /** - * This function inserts the pagination links into the container element - */ - function drawLinks() { - panel.empty(); - var interval = getInterval(); - var np = numPages(); - // This helper function returns a handler function that calls pageSelected with the right page_id - var getClickHandler = function(page_id) { - return function(evt){ return pageSelected(page_id,evt); } - } - // Helper function for generating a single link (or a span tag if it'S the current page) - var appendItem = function(page_id, appendopts){ - page_id = page_id<0?0:(page_id"+(appendopts.text)+""); - } - else - { - var lnk = $(""+(appendopts.text)+"") - .bind("click", getClickHandler(page_id)) - .attr('href', opts.link_to.replace(/__id__/,page_id)); - - - } - if(appendopts.classes){lnk.addClass(appendopts.classes);} - panel.append(lnk); - } - // Generate "Previous"-Link - if(opts.prev_text && (current_page > 0 || opts.prev_show_always)){ - appendItem(current_page-1,{text:opts.prev_text, classes:"prev"}); - } - // Generate starting points - if (interval[0] > 0 && opts.num_edge_entries > 0) - { - var end = Math.min(opts.num_edge_entries, interval[0]); - for(var i=0; i"+opts.ellipse_text+"").appendTo(panel); - } - } - // Generate interval links - for(var i=interval[0]; i 0) - { - if(np-opts.num_edge_entries > interval[1]&& opts.ellipse_text) - { - jQuery(""+opts.ellipse_text+"").appendTo(panel); - } - var begin = Math.max(np-opts.num_edge_entries, interval[1]); - for(var i=begin; i 0) { - pageSelected(current_page - 1); - return true; - } - else { - return false; - } - } - this.nextPage = function(){ - if(current_page < numPages()-1) { - pageSelected(current_page+1); - return true; - } - else { - return false; - } - } - // When all initialisation is done, draw the links - drawLinks(); - }); -} - - diff --git a/htroot/yacy/ui/js/jquery.query.js b/htroot/yacy/ui/js/jquery.query.js new file mode 100644 index 000000000..f7eac3f62 --- /dev/null +++ b/htroot/yacy/ui/js/jquery.query.js @@ -0,0 +1,211 @@ +/** + * jQuery.query - Query String Modification and Creation for jQuery + * Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com) + * Licensed under the WTFPL (http://sam.zoy.org/wtfpl/). + * Date: 2008/05/28 + * + * @author Blair Mitchelmore + * @version 2.0.1 + * + **/ +new function(settings) { + // Various Settings + var $separator = settings.separator || '&'; + var $spaces = settings.spaces === false ? false : true; + var $suffix = settings.suffix === false ? '' : '[]'; + var $prefix = settings.prefix === false ? false : true; + var $hash = $prefix ? settings.hash === true ? "#" : "?" : ""; + + jQuery.query = new function() { + var is = function(o, t) { + return o != undefined && o !== null && (!!t ? o.constructor == t : true); + }; + var parse = function(path) { + var m, rx = /\[([^[]*)\]/g, match = /^(\S+?)(\[\S*\])?$/.exec(path), base = match[1], tokens = []; + while (m = rx.exec(match[2])) tokens.push(m[1]); + return [base, tokens]; + }; + var set = function(target, tokens, value) { + var o, token = tokens.shift(); + if (typeof target != 'object') target = null; + if (token === "") { + if (!target) target = []; + if (is(target, Array)) { + target.push(tokens.length == 0 ? value : set(null, tokens.slice(0), value)); + } else if (is(target, Object)) { + var i = 0; + while (target[i++] != null); + target[--i] = tokens.length == 0 ? value : set(target[i], tokens.slice(0), value); + } else { + target = []; + target.push(tokens.length == 0 ? value : set(null, tokens.slice(0), value)); + } + } else if (token && token.match(/^\s*[0-9]+\s*$/)) { + var index = parseInt(token, 10); + if (!target) target = []; + target[index] = tokens.length == 0 ? value : set(target[index], tokens.slice(0), value); + } else if (token) { + var index = token.replace(/^\s*|\s*$/g, ""); + if (!target) target = {}; + if (is(target, Array)) { + var temp = {}; + for (var i = 0; i < target.length; ++i) { + temp[i] = target[i]; + } + target = temp; + } + target[index] = tokens.length == 0 ? value : set(target[index], tokens.slice(0), value); + } else { + return value; + } + return target; + }; + + var queryObject = function(a) { + var self = this; + self.keys = {}; + + if (a.queryObject) { + jQuery.each(a.get(), function(key, val) { + self.SET(key, val); + }); + } else { + jQuery.each(arguments, function() { + var q = "" + this; + q = q.replace(/^[?#]/,''); // remove any leading ? || # + q = q.replace(/[;&]$/,''); // remove any trailing & || ; + if ($spaces) q = q.replace(/[+]/g,' '); // replace +'s with spaces + + jQuery.each(q.split(/[&;]/), function(){ + var key = this.split('=')[0]; + var val = this.split('=')[1]; + + if (!key) return; + + if (/^[+-]?[0-9]+\.[0-9]*$/.test(val)) // simple float regex + val = parseFloat(val); + else if (/^[+-]?[0-9]+$/.test(val)) // simple int regex + val = parseInt(val, 10); + + val = (!val && val !== 0) ? true : val; + + if (val !== false && val !== true && typeof val != 'number') + val = decodeURIComponent(val); + + self.SET(key, val); + }); + }); + } + return self; + }; + + queryObject.prototype = { + queryObject: true, + has: function(key, type) { + var value = this.get(key); + return is(value, type); + }, + GET: function(key) { + if (!is(key)) return this.keys; + var parsed = parse(key), base = parsed[0], tokens = parsed[1]; + var target = this.keys[base]; + while (target != null && tokens.length != 0) { + target = target[tokens.shift()]; + } + return typeof target == 'number' ? target : target || ""; + }, + get: function(key) { + var target = this.GET(key); + if (is(target, Object)) + return jQuery.extend(true, {}, target); + else if (is(target, Array)) + return target.slice(0); + return target; + }, + SET: function(key, val) { + var value = !is(val) ? null : val; + var parsed = parse(key), base = parsed[0], tokens = parsed[1]; + var target = this.keys[base]; + this.keys[base] = set(target, tokens.slice(0), value); + return this; + }, + set: function(key, val) { + return this.copy().SET(key, val); + }, + REMOVE: function(key) { + return this.SET(key, null).COMPACT(); + }, + remove: function(key) { + return this.copy().REMOVE(key); + }, + EMPTY: function() { + var self = this; + jQuery.each(self.keys, function(key, value) { + delete self.keys[key]; + }); + return self; + }, + empty: function() { + return this.copy().EMPTY(); + }, + copy: function() { + return new queryObject(this); + }, + COMPACT: function() { + function build(orig) { + var obj = typeof orig == "object" ? is(orig, Array) ? [] : {} : orig; + if (typeof orig == 'object') { + function add(o, key, value) { + if (is(o, Array)) + o.push(value); + else + o[key] = value; + } + jQuery.each(orig, function(key, value) { + if (!is(value)) return true; + add(obj, key, build(value)); + }); + } + return obj; + } + this.keys = build(this.keys); + return this; + }, + compact: function() { + return this.copy().COMPACT(); + }, + toString: function() { + var i = 0, queryString = [], chunks = [], self = this; + var addFields = function(arr, key, value) { + if (!is(value) || value === false) return; + var o = [key]; + if (value !== true) { + o.push("="); + o.push(encodeURIComponent(value)); + } + arr.push(o.join("")); + }; + var build = function(obj, base) { + var newKey = function(key) { + return !base || base == "" ? [key].join("") : [base, "[", key, "]"].join(""); + }; + jQuery.each(obj, function(key, value) { + if (typeof value == 'object') + build(value, newKey(key)); + else + addFields(chunks, newKey(key), value); + }); + }; + + build(this.keys); + + if (chunks.length > 0) queryString.push($hash); + queryString.push(chunks.join($separator)); + + return queryString.join(""); + } + }; + + return new queryObject(location.search, location.hash); + }; +}(jQuery.query || {}); // Pass in jQuery.query as settings object diff --git a/htroot/yacy/ui/js/jquery.xslTransform.js b/htroot/yacy/ui/js/jquery.xslTransform.js deleted file mode 100644 index ff131a029..000000000 --- a/htroot/yacy/ui/js/jquery.xslTransform.js +++ /dev/null @@ -1,420 +0,0 @@ -/** - * xslTransform - * Tools for XSLT transformations; jQuery wrapper for Sarissa . - * See jQuery.fn.log below for documentation on $.log(). - * See jQuery.fn.getTransform below for documention on the $.getTransform(). - * See var DEBUG below for turning debugging/logging on and off. - * - * @version 20071214 - * @since 2006-07-05 - * @copyright Copyright (c) 2006 Glyphix Studio, Inc. http://www.glyphix.com - * @author Brad Brizendine , Matt Antone - * @license MIT http://www.opensource.org/licenses/mit-license.php - * @requires >= jQuery 1.0.3 http://jquery.com/ - * @requires jquery.debug.js http://jquery.glyphix.com/ - * @requires >= sarissa.js 0.9.7.6 http://sarissa.sourceforge.net/ - * - * @example - * var r = $.xsl.transform('path-to-xsl.xsl','path-to-xml.xml'); - * @desc Perform a transformation and place the results in var r - * - * @example - * var r = $.xsl.transform('path-to-xsl.xsl','path-to-xml.xml'); - * var str = $.xsl.serialize( r ); - * @desc Perform a transformation, then turn the result into a string - * - * @example - * var doc = $.xsl.load('path-to-xml.xml'); - * @desc Load an xml file and return a parsed xml object - * - * @example - * var xml = 'bar'; - * var doc = $.xsl.load(xml); - * @desc Load an xml string and return a parsed xml object - */ - -(function($){ - - /* - * JQuery XSLT transformation plugin. - * Replaces all matched elements with the results of an XSLT transformation. - * See xslTransform above for more documentation. - * - * @example - * @desc See the xslTransform-example/index.html - * - * @param xsl String the url to the xsl file - * @param xml String the url to the xml file - * @param options Object various switches you can send to this function - * + params: an object of key/value pairs to be sent to xsl as parameters - * + xpath: defines the root node within the provided xml file - * + eval: if true, will attempt to eval javascript found in the transformed result - * + callback: if a Function, evaluate it when transformation is complete - * @returns - */ - $.fn.getTransform = function( xsl, xml, options ){ - var settings = { - params: {}, // object of key/value pairs ... parameters to send to the XSL stylesheet - xpath: '', // xpath, used to send only a portion of the XML file to the XSL stylesheet - eval: true, // evaluate - @@ -148,4 +147,5 @@ $(function() { -

Peer Control


   
\ No newline at end of file + + \ No newline at end of file diff --git a/htroot/yacy/ui/yacyui-widget.html b/htroot/yacy/ui/yacyui-widget.html index 5547d49b8..fc492d0ef 100644 --- a/htroot/yacy/ui/yacyui-widget.html +++ b/htroot/yacy/ui/yacyui-widget.html @@ -7,11 +7,11 @@ YaCy Widget - + - + + + + + + + YaCy-UI Search + + + + +
+ + \ No newline at end of file