picky-client 4.20.1 → 4.20.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/javascripts/picky.min.js +20 -20
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1b9a1c7f840066c040659d07222247486055940
|
4
|
+
data.tar.gz: 3d6b2b27b404f18840bd5472628880779b60e2e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 938abfe240525ccb2add312d82184c6a0bb2ee7a57a18be25128b32b9f5a4e1f10cc45448f928d9d197a0893e11fdf7af7552e0ffe284c68cface2c92e7e5bb1
|
7
|
+
data.tar.gz: 3f6bd4adad8d2b66717bfa15d3deabe942360dfebe8f9a20611d267e800ded3c04bc2ec6b54265754a0c4f256abd0017e73b10f2190981f968272391d1c911c7
|
data/javascripts/picky.min.js
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
Array.prototype.index=function(a){for(var
|
2
|
-
"en",
|
3
|
-
function PickyData(a){var
|
4
|
-
p.render(
|
5
|
-
|
6
|
-
|
7
|
-
a.full||alert("A full backend path must be provided."),
|
8
|
-
e
|
9
|
-
|
10
|
-
|
11
|
-
a.form=$(
|
12
|
-
a.showMoreAllocations=$(a.showMoreAllocations||a.allocations.find(".more"));a.hiddenAllocations=$(a.hiddenAllocations||a.allocations.find(".hidden"));a.maxSuggestions=a.maxSuggestions||3;a.results=$(a.resultsSelector||
|
13
|
-
function(
|
14
|
-
o,
|
15
|
-
o=
|
16
|
-
o)).append(o.entries.join(r));
|
17
|
-
w[
|
18
|
-
return q}function
|
19
|
-
{},u=a.explanations&&a.explanations[
|
20
|
-
|
1
|
+
Array.prototype.index=function(a){for(var c=0,g=this.length;c<g;c++)if(this[c]==a)return c;return null};Array.prototype.include=function(a){return this.index(a)!==null};Array.prototype.remove=function(a){this.splice(a,1);return this};Array.prototype.compare=function(a){return this.join("")==a.join("")};Array.prototype.each=function(a){for(var c=0,g=this.length;c<g;c++)a(c,this[c]);return this};Array.prototype.map=function(a){for(var c=0,g=this.length;c<g;c++)this[c]=a(c,this[c]);return this};var dictionary={common:{join:{de:"und",fr:"et",it:"e",en:"and",ch:"und"},"with":{de:"mit",fr:"avec",it:"con",en:"with",ch:"mit"},of:{de:"von",fr:"de",it:"di",en:"of",ch:"vo"},to:{de:"bis",fr:"\u00e0",it:"alla",en:"to",ch:"bis"}},results:{addination:{more:{de:"Weitere Resultate",fr:"Autres r\u00e9sultats",it:"Altri risultati",en:"More results",ch:"Mee Resultaat"}},header:{de:"Ergebnisse",fr:"R\u00e9sultats",it:"Risultati",en:"Results",ch:"Erg\u00e4bnis"}}},t=function(a){for(var c=PickyI18n.locale||
|
2
|
+
"en",g=a.split(".").concat(c),i=dictionary,j=0,f=g.length;j<f;j++){i=i[g[j]];if(i==undefined){i="Translation missing: "+a+"."+c;break}}return i};function Allocation(a,c,g,i,j,f){var m=this;this.type=a;this.weight=c;this.count=g;this.combination=i;this.ids=j||[];this.entries=this.rendered=f||[];this.isType=function(r){return r==m.type}}function Allocations(a){this.allocations=[];for(var c=0,g=a.length;c<g;c++){var i=a[c];this.allocations.push(new Allocation(i[0],i[1],i[2],i[3],i[4],i[5]))}this.length=this.allocations.length;this.remove=function(j){this.allocations.splice(j,1)};this.each=function(j){this.allocations.each(j)}}
|
3
|
+
function PickyData(a){var c=a.total,g=a.duration,i=a.offset,j=new Allocations(a.allocations||[]);this.original_hash=a;this.total=c;this.duration=g;this.offset=i;this.allocations=j;this.renderedAmount=function(){var f=0;j.each(function(m,r){f+=r.rendered.length});return f};this.isEmpty=function(){return c==0}};var PickyView=function(a,c){var g=c.showResultsLimit||10,i=c.alwaysShowResults||false,j=c.alwaysShowSelection||false,f=c.input,m=c.reset,r=c.button,u=c.counter,v=c.form,w=c.moreSelector,y=c.results,e=c.noResults,k=new PickyAddination(this,y),l=new PickyAllocationsCloud(this,c),p=new PickyResultsRenderer(k,c),h=function(b){f.val(b);m.fadeTo(166,0);v.attr("class","empty");u.empty();l.hide();e.hide()};this.reset=h;var d=function(){return f.val()};this.text=d;var q=function(b){if(b.offset==0){y.empty();
|
4
|
+
p.render(y,b);y.show();f.focus()}else{var n=$(w).position().top;k.remove();p.render(y,b);$("body").animate({scrollTop:n-12},500)}},o=function(b){b>0&&b<=5&&u.fadeTo("fast",0.5).fadeTo("fast",1)},s=function(b){if(b.isEmpty())return"none";if(b.total>g&&b.allocations.length>1)return"support";return"ok"};this.insert=function(b){f.val(b);f.select()};this.fullResultsCallback=function(b){var n=s(b);v.attr("class",n);l.hide();e.hide();m.fadeTo(166,1);n=b.total;u.text(n);o(n);if(b.isEmpty()){y.empty();e.show()}else if(b.total>
|
5
|
+
g&&b.allocations.length>1){i&&q(b);l.show(b)}else{q(b);j&&l.show(b)}};this.liveResultsCallback=function(b){var n=s(b);v.attr("class",n);b=b.total;u.text(b);o(b)};this.allocationChosen=function(b){b=b.data.query;a.insert(b);a.allocationChosen(b)};this.addinationClicked=function(b){a.addinationClicked(d(),b)};(function(){f.keyup(function(b){if(d()==""){h();a.searchTextCleared()}else m.fadeTo(166,1);a.searchTextEntered(d(),b)});u.click(function(){a.searchButtonClicked(d())});r.click(function(){a.searchButtonClicked(d())});
|
6
|
+
m.click(function(){h();a.clearButtonClicked();f.focus()})})();f.focus()};var PickyBackend=function(a){var c=function(g,i,j){var f=j||{};f=$.extend({query:g},j);$.getJSON(a,f,function(m){i&&i(new PickyData(m))})};this.search=function(g,i,j,f){c(g,function(m){i&&i(f,m)},j)}},LiveBackend=function(a){var c=a.live||alert("A live backend path must be provided."),g=new PickyBackend(c);this.search=function(i,j,f,m){m=m||{};var r=new Date;m.live=r;f=$.extend({ids:a.liveResults||0,offset:0},f);g.search(i,function(u,v){if(!u.live||u.live==r)j&&j(v,i)},f,m)}},FullBackend=function(a){var c=
|
7
|
+
a.full||alert("A full backend path must be provided."),g=new PickyBackend(c);this.search=function(i,j,f,m){m=m||{};var r=new Date;m.full=r;f=$.extend({ids:a.fullResults||20,offset:0},f);g.search(i,function(u,v){if(!u.full||u.full==r)j&&j(v,i)},f,m)}};var PickyController=function(a){var c=new PickyView(this,a),g=a.backends,i=a.beforeInsert||function(b){return b},j=a.before||function(b){return b},f=a.success||function(b){return b},m=a.after||function(b){return b},r=a.searchOnEmpty||false,u=a.liveRendered||false,v=a.liveSearchInterval||180,w,y=function(b){return(b=b&&b.match(/q=([^&]+)/))&&decodeURIComponent(b[1].replace(/\+/g," "))||""};this.extractQuery=y;var e=function(){var b=window.History&&window.History.getState();return y(b&&b.url)};this.lastFullQuery=
|
8
|
+
e;var k=function(b,n,z,A){var x=j(n,A);if(x!=undefined)n=x;w=[b,n,z,A];x=n;if(x!=e()){x=!r&&x==""?"/":"?q="+encodeURIComponent(x);window.History&&window.History.getState()&&window.History.pushState&&window.History.pushState(null,null,x)}if(!r&&n=="")c.reset();else(b=g[b])&&b.search(n,z,A)};this.resend=function(){w&&k.apply(this,w)};var l=function(b,n){(b=f(b,n))&&c.fullResultsCallback(b);m(b,n)},p=function(b,n){clearInterval(d);k("full",b,l,n||{})};a=function(b,n){(b=f(b,n))&&c.liveResultsCallback(b);
|
9
|
+
m(b,n)};var h=u?l:a,d,q=function(){var b=c.text();k("live",b,h,{});clearInterval(d)};d=setInterval(q,v);clearInterval(d);var o=function(b,n,z){var A=i(b);if(A!=undefined)b=A;c.insert(b);z&&p(b,n)};this.insert=o;this.clearButtonClicked=function(){clearInterval(d)};this.searchTextCleared=function(){clearInterval(d)};var s=[1,2,3,4,5,6,7,9,10,11,12,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31];this.searchTextEntered=function(b,n){if($.inArray(n.keyCode,s)<0)if(n.keyCode==13)p(b);else{clearInterval(d);
|
10
|
+
d=setInterval(q,v)}};this.searchButtonClicked=function(b){p(b)};this.allocationChosen=function(b){p(b)};this.addinationClicked=function(b,n){p(b,{offset:n.data.offset})};window.History&&window.History.Adapter.bind(window,"statechange",function(){var b=window.History.getState();b=y(b.url);b!=undefined&&b!=(w&&w.length>1&&w[1])&&o(b,{},true)})};var PickyI18n={},PickyClient=function(a){PickyI18n.locale=$("html").attr("lang").split("-")[0]||"en";a.locale=a.locale||PickyI18n.locale;a.qualifiers=a.qualifiers||{};a.explanations=a.explanations||{};a.choices=a.choices||{};var c=a.backends;if(c){c.live||alert("Both a full and live backend must be provided.");c.full||alert("Both a full and live backend must be provided.")}else a.backends={live:new LiveBackend(a),full:new FullBackend(a)};c=a.enclosingSelector||".picky";var g=a.formSelector||c+" form";
|
11
|
+
a.form=$(g);a.input=$(a.inputSelector||g+" input[type=search]");a.reset=$(a.resetSelector||g+" div.reset");a.button=$(a.buttonSelector||g+" input[type=button]");a.counter=$(a.counterSelector||g+" div.status");a.results=$(a.resultsSelector||c+" div.results");a.noResults=$(a.noResultsSelector||c+" div.no_results");a.moreSelector=a.moreSelector||c+" div.results div.addination:last";a.allocations=$(a.allocationsSelector||c+" .allocations");a.shownAllocations=$(a.shownAllocations||a.allocations.find(".shown"));
|
12
|
+
a.showMoreAllocations=$(a.showMoreAllocations||a.allocations.find(".more"));a.hiddenAllocations=$(a.hiddenAllocations||a.allocations.find(".hidden"));a.maxSuggestions=a.maxSuggestions||3;a.results=$(a.resultsSelector||c+" div.results");a.resultsDivider=a.resultsDivider||"";a.nonPartial=a.nonPartial||[];a.wrapResults=a.wrapResults||"<ol></ol>";var i=a.controller&&new a.controller(a)||new PickyController(a);var j=this.insert=function(f,m,r){i.insert(f,m||{},r||true)};this.resend=i.resend;this.insertFromURL=
|
13
|
+
function(f){if(f)j(f);else(f=i.lastFullQuery())&&j(f)}};var PickyAddination=function(a,c){this.remove=function(){c.find(".addination").remove()};this.render=function(g){var i=g.total,j,f=g.renderedAmount();j=g.offset+f;f=j+f;g=g.total;if(g<f)f=g;j={offset:j,start:j+1,end:f};if(j.offset<i){i=$("<div class='addination'>"+t("results.addination.more")+"</div>");i.bind("click",{offset:j.offset},a.addinationClicked);return i}else return""}};var PickyResultsRenderer=function(a,c){var g=c.locale,i=c.explanations||{},j=c.explanationDelimiter||{ch:"und",de:"und",en:"and",fr:"et",it:"e"},f=c.explanationTokenDelimiter||{},m=c.explanationTokenCallback,r=c.resultsDivider,u=c.wrapResults,v=c.nonPartial,w=function(h){var d=h[h.length-1];if(d===undefined)return[];h=h.slice(0,h.length-1);if(h==[])h=[h];if(!v.include(d[0]))if(d[1].match(/[^\*~]$/))d[1]+="*";h.push(d);return h};this.asteriskifyLastToken=w;var y=function(h){for(var d=i[g]||{},q=[],
|
14
|
+
o,s=0,b=h.length;s<b;s++){o=h[s];var n=o[0];q.push([n,d[n]||n,o[1]])}return q};this.explainCategory=y;var e=function(h,d){return["<strong>"+h+"</strong>",d].join(" ")};this.strongify=e;var k=function(h,d,q){var o=m&&m(h,q);return o?o:e(d,q.join((f[g]||{})[h]||" "))},l=function(h,d){var q=j[g]||"&",o="",s=[],b=[];y(w(d)).each(function(n,z){var A=z[0],x=z[1],B=z[2];B=B.replace(/[\w,]+:(.+)/,"$1");if(o==""||A==o){s.push(B);o=A;lastExplainedCategory=x}else{var C=k(o,lastExplainedCategory,s);s=[];s.push(B);
|
15
|
+
o=A;lastExplainedCategory=x;b.push(C)}});b.push(k(o,lastExplainedCategory,s));b=b.join(" "+q+" ");return b='<span class="explanation">'+h+" "+b+"</span>"};this.explain=l;var p=function(h,d){var q='<div class="header">';q+=l(d.type,d.combination);if(h.offset>0)q+='<div class="tothetop"><a href="#" onclick="javascript:$(\'body\').animate({scrollTop: 0}, 500);">↑</a></div>';q+="</div>";return q};this.renderHeader=p;this.render=function(h,d){d.allocations.each(function(q,o){if(o.entries.length>0){h.append(p(d,
|
16
|
+
o)).append(o.entries.join(r));h.children("li").wrapAll(u)}});h.append(a.render(d))}};function AllocationRenderer(a){function c(e){var k={},l={},p={},h=[],d,q;d=0;for(q=e.length;d<q;d++){var o=e[d][0];if(o in k){k[o].push(e[d][1]);l[o].push(e[d][2]);h.push(d)}else{k[o]=[e[d][1]];l[o]=[e[d][2]];p[d]=o}}for(d in p){e[d][1]=k[p[d]];e[d][2]=l[p[d]]}for(d=h.length-1;d>=0;d--)e.remove(h[d]);return e}function g(e){e.map(function(k){return"%"+(k+1)+"$s"});return e.join(" ")}function i(e){if(e.length==0)return"";e=c(e);for(var k=[],l=0,p=e.length;l<p;l++)k.push(e[l][0]);var h=k.length==1,d=
|
17
|
+
w[k.join(",")];if(d===undefined)d=w[k]=g(k);if(typeof d==="string"){w[k]={format:d,ignoreSingle:true};d=w[k]}var q=d.format;e.each(function(o,s){var b=s[0],n=s[1],z=s[2];z.map(function(A,x){var B=n[A];if(B.charAt(B.length-1)=="*")x+="...";return x});d.filter&&z.map(function(A,x){return d.filter(x)});if(h&&!(d&&d.ignoreSingle)){b=u[b]||b;return q=z.join(" ")+" ("+b+")"}z.map(function(A,x){return x.replace(/[\w,]+:(.+)/,"$1")});q=q.replace(RegExp("%"+(o+1)+"\\$s","g"),z.join(" "))});
|
18
|
+
return q}function j(e){for(var k=[],l=0,p=v.length;l<p;l++)k.push([]);k.push([]);l=0;for(p=e.length;l<p;l++){for(var h=e[l],d=h[0],q=false,o=0,s=v.length;o<s;o++)if(v[o].include(d)){k[o].push(h);q=true;break}q||k[k.length-1].push(h)}var b;for(e=k.length-1;e>=0;e--){b=k[e];if(b.length>0)break}b=b[b.length-1];y.include(b[0])||(b[1]=b[1].valueOf()+"*");return k}function f(e){var k=[];j(e).each(function(l,p){var h=i(p);h&&k.push(h)});return k.join(" ")}var m=a.locale,r=a.qualifiers&&a.qualifiers[m]||
|
19
|
+
{},u=a.explanations&&a.explanations[m]||{},v=a.groups||[],w=a.choices&&a.choices[m]||{},y=a.nonPartial||[];this.explanation=this.query=this.text="";this.contract=c;this.makeUpMissingFormat=g;this.rendered=i;this.groupify=j;this.querify=function(e){var k=[],l,p,h;for(h in e){l=e[h][0];l=r[l]||l;p=(p=e[h][1])||"";p=p.charAt(p.length-1)=="*"?"*":"";k[h]=l+":"+e[h][2]+p}return k.join(" ")};this.suggestify=f;this.render=function(e){return f(e.combination)}};var PickyAllocationsCloud=function(a,c){var g=c.allocations,i=c.shownAllocations,j=c.showMoreAllocations,f=c.hiddenAllocations,m=c.maxSuggestions,r=function(){g.hide()},u=function(e){r();a.allocationChosen(e)},v=new AllocationRenderer(c),w=function(e){var k=[];e.each(function(l,p){var h=v.querify(p.combination),d=v.render(p);d=$('<li><div class="text">'+d+'</div><div class="count">'+p.count+"</div></li>");d.bind("click",{query:h},u);k.push(d)});return k},y=function(e){if(e.length==0)return g.hide();
|
20
|
+
i.empty();j.hide();f.empty().hide();if(e.length>m){$.each(e.slice(0,m-1),function(k,l){i.append(l)});$.each(e.slice(m-1),function(k,l){f.append(l)});j.show()}else $.each(e,function(k,l){i.append(l)});return g.show()};j.click(function(){j.hide();f.show()});this.hide=r;this.show=function(e){y(w(e.allocations));g.show()}};
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: picky-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.20.
|
4
|
+
version: 4.20.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Hanke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yajl-ruby
|
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
97
|
version: '0'
|
98
98
|
requirements: []
|
99
99
|
rubyforge_project: http://rubyforge.org/projects/picky
|
100
|
-
rubygems_version: 2.2.
|
100
|
+
rubygems_version: 2.2.2
|
101
101
|
signing_key:
|
102
102
|
specification_version: 4
|
103
103
|
summary: Picky Ruby Search Engine Client
|
@@ -111,4 +111,3 @@ test_files:
|
|
111
111
|
- spec/picky-client/helper_spec.rb
|
112
112
|
- spec/picky-client/spec/test_client_integration_spec.rb
|
113
113
|
- spec/picky-client/spec/test_client_spec.rb
|
114
|
-
has_rdoc: false
|