diff --git a/htroot/ConfigSearchPage_p.html b/htroot/ConfigSearchPage_p.html index e34a44627..a3f9a17fb 100644 --- a/htroot/ConfigSearchPage_p.html +++ b/htroot/ConfigSearchPage_p.html @@ -9,7 +9,7 @@ - + @@ -87,69 +87,77 @@ $(function() { -
+
- - - - - - - diff --git a/htroot/env/base.css b/htroot/env/base.css index f7e21283a..743faa3f3 100644 --- a/htroot/env/base.css +++ b/htroot/env/base.css @@ -672,7 +672,7 @@ dl.bplike { float: left; margin: 0 0; - width: 184px; + width: 194px; padding: 0; } diff --git a/htroot/yacy/ui/js/jquery.tagcloud.js b/htroot/yacy/ui/js/jquery.tagcloud.js new file mode 100644 index 000000000..6e66b6874 --- /dev/null +++ b/htroot/yacy/ui/js/jquery.tagcloud.js @@ -0,0 +1,92 @@ +/*! +* jquery.tagcloud.js +* A Simple Tag Cloud Plugin for JQuery +* +* https://github.com/addywaddy/jquery.tagcloud.js +* created by Adam Groves +*/ +(function($) { + + /*global jQuery*/ + "use strict"; + + var compareWeights = function(a, b) + { + return a - b; + }; + + // Converts hex to an RGB array + var toRGB = function(code) { + if (code.length === 4) { + code = code.replace(/(\w)(\w)(\w)/gi, "\$1\$1\$2\$2\$3\$3"); + } + var hex = /(\w{2})(\w{2})(\w{2})/.exec(code); + return [parseInt(hex[1], 16), parseInt(hex[2], 16), parseInt(hex[3], 16)]; + }; + + // Converts an RGB array to hex + var toHex = function(ary) { + return "#" + jQuery.map(ary, function(i) { + var hex = i.toString(16); + hex = (hex.length === 1) ? "0" + hex : hex; + return hex; + }).join(""); + }; + + var colorIncrement = function(color, range) { + return jQuery.map(toRGB(color.end), function(n, i) { + return (n - toRGB(color.start)[i])/range; + }); + }; + + var tagColor = function(color, increment, weighting) { + var rgb = jQuery.map(toRGB(color.start), function(n, i) { + var ref = Math.round(n + (increment[i] * weighting)); + if (ref > 255) { + ref = 255; + } else { + if (ref < 0) { + ref = 0; + } + } + return ref; + }); + return toHex(rgb); + }; + + $.fn.tagcloud = function(options) { + + var opts = $.extend({}, $.fn.tagcloud.defaults, options); + var tagWeights = this.map(function(){ + return $(this).attr("rel"); + }); + tagWeights = jQuery.makeArray(tagWeights).sort(compareWeights); + var lowest = tagWeights[0]; + var highest = tagWeights.pop(); + var range = highest - lowest; + if(range === 0) {range = 1;} + // Sizes + var fontIncr, colorIncr; + if (opts.size) { + fontIncr = (opts.size.end - opts.size.start)/range; + } + // Colors + if (opts.color) { + colorIncr = colorIncrement (opts.color, range); + } + return this.each(function() { + var weighting = $(this).attr("rel") - lowest; + if (opts.size) { + $(this).css({"font-size": opts.size.start + (weighting * fontIncr) + opts.size.unit}); + } + if (opts.color) { + $(this).css({"color": tagColor(opts.color, colorIncr, weighting)}); + } + }); + }; + + $.fn.tagcloud.defaults = { + size: {start: 14, end: 18, unit: "pt"} + }; + +})(jQuery); \ No newline at end of file diff --git a/htroot/yacy/ui/js/jquery.tagcloud.min.js b/htroot/yacy/ui/js/jquery.tagcloud.min.js deleted file mode 100644 index 7f799470d..000000000 --- a/htroot/yacy/ui/js/jquery.tagcloud.min.js +++ /dev/null @@ -1,8 +0,0 @@ -/* -* jQuery TagCloud 0.5.0 -* Copyright (c) 2008 Ron Valstar -* Dual licensed under the MIT and GPL licenses: -* http://www.opensource.org/licenses/mit-license.php -* http://www.gnu.org/licenses/gpl.html -*/ -(function(F){var C;var A={};var G={};var L=2.399963;F.tagcloud={id:"TagCloud",version:"0.5.0",defaults:{height:null,type:"cloud",sizemax:20,sizemin:10,colormax:"00F",colormin:"B4D2FF",seed:null,power:0.5}};F.fn.extend({tagcloud:function(M){C=F.extend({},F.tagcloud.defaults,M);if(C.seed===null){C.seed=Math.ceil(Math.random()*45309714203)}switch(C.type){case"sphere":case"cloud":A={position:"relative"};G={position:"absolute",display:"block"};break;case"list":A={height:"auto"};G={position:"static",display:"inline"};break}B.setSeed(C.seed+123456);return this.each(function(f,a){var q=F(a);var R=q.find(">li");var S=R.length;var Z=q.width();var l=C.height===null?(0.004*Z*S):C.height;q.css({width:Z,height:l,listStyle:"none",margin:0,padding:0});q.css(A);var e=-2147483647;var r=2147483648;var T=-1;for(var d=0;de){e=n}if(n0?0:this.M);return(this.seed*this.oneOverM)};B.rand=function(N,M){return Math.floor((M-N+1)*this.next()+N)};function I(M){return M.toString(16)}function K(M){return parseInt(M,16)}function H(Q){var M=Q.length==3;var O=[];for(var N=0;N<3;N++){var P=Q.substring(N*(M?1:2),(N+1)*(M?1:2));O.push(K(M?P+P:P))}return O}function J(M){var O="";for(var N=0;N<3;N++){var P=I(M[N]);if(P.length==1){P="0"+P}O+=P}return O}function D(R,S,P){var Q=H(R);var M=H(S);var O=[];for(var N=0;N<3;N++){O.push(Q[N]+Math.floor(P*(M[N]-Q[N])))}return J(O)}function E(M){if(window.console&&window.console.log){if(typeof (M)=="string"){window.console.log(M)}else{for(var N in M){window.console.log(N+": "+M[N])}}}}F.fn.TagCloud=F.fn.Tagcloud=F.fn.tagcloud})(jQuery); \ No newline at end of file diff --git a/htroot/yacysearch.html b/htroot/yacysearch.html index b0d25cd54..71b5597a6 100644 --- a/htroot/yacysearch.html +++ b/htroot/yacysearch.html @@ -14,7 +14,7 @@ - + diff --git a/htroot/yacysearchtrailer.html b/htroot/yacysearchtrailer.html index 3cf3eeb41..9a400906d 100644 --- a/htroot/yacysearchtrailer.html +++ b/htroot/yacysearchtrailer.html @@ -1,7 +1,7 @@
#(cat-location)#:: -
+
earthsearchlogo Show search results for "#[query]#" on map @@ -9,15 +9,25 @@ #(/cat-location)# #(nav-topics)#:: -
-
+
+
#{element}# +#[name]# +#{/element}#
+ #(/nav-topics)# #(nav-protocols)#:: -
+

Protocol Navigator

#{element}#
@@ -34,7 +44,7 @@ $(function() { $("#sidebarProtocols").accordion('activate', false); }); #(/nav-protocols)# #(nav-filetypes)#:: -
+

Filetype Navigator

#{element}#
@@ -51,7 +61,7 @@ $(function() { $("#sidebarFiletypes").accordion('activate', false); }); #(/nav-filetypes)# #(nav-domains)#:: -
+

Domain Navigator

#{element}#
@@ -68,7 +78,7 @@ $(function() { $("#sidebarDomains").accordion('activate', false); }); #(/nav-domains)# #(nav-namespace)#:: -
+

Name Space Navigator

#{element}#
@@ -85,7 +95,7 @@ $(function() { $("#sidebarNameSpace").accordion('activate', false); }); #(/nav-namespace)# #(nav-authors)#:: -
+

Author Navigator

#{element}#
@@ -102,7 +112,7 @@ $(function() { $("#sidebarAuthors").accordion('activate', false); }); #(/nav-authors)# #{nav-vocabulary}# -
+

#[navname]# Navigator

#{element}#
@@ -112,7 +122,7 @@ $(function() { $("#sidebarAuthors").accordion('activate', false); }); #{/nav-vocabulary}# #(nav-about)#:: -
+

#[headline]#

#[body]# diff --git a/htroot/yacysearchtrailer.java b/htroot/yacysearchtrailer.java index 05bdfb15d..853949f65 100644 --- a/htroot/yacysearchtrailer.java +++ b/htroot/yacysearchtrailer.java @@ -24,7 +24,9 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +import java.util.AbstractMap; import java.util.Iterator; +import java.util.LinkedList; import java.util.Map; import net.yacy.cora.document.analysis.Classification; @@ -46,7 +48,7 @@ import net.yacy.server.serverSwitch; public class yacysearchtrailer { - private static final int MAX_TOPWORDS = 12; + private static final int MAX_TOPWORDS = 16; private static final int MAXLIMIT_NAV_LOW = 5; private static final int MAXLIMIT_NAV_HIGH = 20; @@ -209,26 +211,29 @@ public class yacysearchtrailer { prop.put("nav-topics", "1"); navigatorIterator = topicNavigator.keys(false); int i = 0; - String queryStringForUrl; + String queryStringForUrl = theSearch.query.getQueryGoal().getOriginalQueryString(true); + // first sort the list to a form where the greatest element is in the middle + LinkedList> cloud = new LinkedList>(); while (i < MAX_TOPWORDS && navigatorIterator.hasNext()) { name = navigatorIterator.next(); count = topicNavigator.get(name); - if (count == 0) { - break; - } - queryStringForUrl = theSearch.query.getQueryGoal().getOriginalQueryString(true); - if (queryStringForUrl == null) { - break; - } - if (name != null) { - prop.put("nav-topics_element_" + i + "_on", 1); - prop.put(fileType, "nav-topics_element_" + i + "_modifier", name); - prop.put(fileType, "nav-topics_element_" + i + "_name", name); - prop.put(fileType, "nav-topics_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, queryStringForUrl + "+" + name).toString()); - prop.put("nav-topics_element_" + i + "_count", count); - prop.put("nav-topics_element_" + i + "_nl", 1); - i++; - } + if (count == 0) break; + if (name == null) continue; + Map.Entry entry = new AbstractMap.SimpleEntry(name, (count + MAX_TOPWORDS - i) / 2); + if (cloud.size() % 2 == 0) cloud.addFirst(entry); else cloud.addLast(entry); // alternating add entry to first or last position. + i++; + } + i= 0; + for (Map.Entry entry: cloud) { + name = entry.getKey(); + count = entry.getValue(); + prop.put("nav-topics_element_" + i + "_on", 1); + prop.put(fileType, "nav-topics_element_" + i + "_modifier", name); + prop.put(fileType, "nav-topics_element_" + i + "_name", name); + prop.put(fileType, "nav-topics_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, queryStringForUrl + "+" + name).toString()); + prop.put("nav-topics_element_" + i + "_count", count); + prop.put("nav-topics_element_" + i + "_nl", 1); + i++; } prop.put("nav-topics_element", i); i--;
-
- +
+ Tag + Topics + Cloud + Topics + Cloud + Tag + Cloud + Topic + Tag + Cloud
+
+

Protocol Navigator

+

Filetype Navigator

+

Domain Navigator

+

Wiki Name Space Navigator

+

Author Navigator

+

Vocabulary Navigator

+

about#[about.headline]#

#[about.body]#