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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/javascripts/picky.min.js +20 -20
  3. metadata +3 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e731900f604014269c1b947ca9fc86797d857c6
4
- data.tar.gz: 9abae20c14fa61ea10b08cf6c87f8e3af65abe50
3
+ metadata.gz: a1b9a1c7f840066c040659d07222247486055940
4
+ data.tar.gz: 3d6b2b27b404f18840bd5472628880779b60e2e2
5
5
  SHA512:
6
- metadata.gz: 04bb70801dc68fd91894d45a4715d36cdc99e6a3f2c952e38160c3b134d7eac37abeae244971e2515510c9a102ec586f2eab269cf6b07da3254c9be55e39cbe7
7
- data.tar.gz: a930170097427d744465c29f15b2fc241e052de5816aae08b7fe8bda5250e1fb9e4650ba2f9a2f276587a52566bcf59f35a6cf4190d1222a8d42beaae3fa2201
6
+ metadata.gz: 938abfe240525ccb2add312d82184c6a0bb2ee7a57a18be25128b32b9f5a4e1f10cc45448f928d9d197a0893e11fdf7af7552e0ffe284c68cface2c92e7e5bb1
7
+ data.tar.gz: 3f6bd4adad8d2b66717bfa15d3deabe942360dfebe8f9a20611d267e800ded3c04bc2ec6b54265754a0c4f256abd0017e73b10f2190981f968272391d1c911c7
@@ -1,20 +1,20 @@
1
- Array.prototype.index=function(a){for(var b=0,h=this.length;b<h;b++)if(this[b]==a)return b;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 b=0,h=this.length;b<h;b++)a(b,this[b]);return this};Array.prototype.map=function(a){for(var b=0,h=this.length;b<h;b++)this[b]=a(b,this[b]);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 b=PickyI18n.locale||
2
- "en",h=a.split(".").concat(b),j=dictionary,k=0,g=h.length;k<g;k++){j=j[h[k]];if(j==undefined){j="Translation missing: "+a+"."+b;break}}return j};function Allocation(a,b,h,j,k,g){var n=this;this.type=a;this.weight=b;this.count=h;this.combination=j;this.ids=k||[];this.entries=this.rendered=g||[];this.isType=function(r){return r==n.type}}function Allocations(a){this.allocations=[];for(var b=0,h=a.length;b<h;b++){var j=a[b];this.allocations.push(new Allocation(j[0],j[1],j[2],j[3],j[4],j[5]))}this.length=this.allocations.length;this.remove=function(k){this.allocations.splice(k,1)};this.each=function(k){this.allocations.each(k)}}
3
- function PickyData(a){var b=a.total,h=a.duration,j=a.offset,k=new Allocations(a.allocations||[]);this.original_hash=a;this.total=b;this.duration=h;this.offset=j;this.allocations=k;this.renderedAmount=function(){var g=0;k.each(function(n,r){g+=r.rendered.length});return g};this.isEmpty=function(){return b==0}};var PickyView=function(a,b){var h=b.showResultsLimit||10,j=b.alwaysShowResults||false,k=b.alwaysShowSelection||false,g=b.input,n=b.reset,r=b.button,u=b.counter,v=b.form,w=b.moreSelector,x=b.results,f=b.noResults,l=new PickyAddination(this,x),m=new PickyAllocationsCloud(this,b),p=new PickyResultsRenderer(l,b),i=function(c){g.val(c);n.fadeTo(166,0);v.attr("class","empty");u.empty();m.hide();f.hide()};this.reset=i;var d=function(){return g.val()};this.text=d;var q=function(c){if(c.offset==0){x.empty();
4
- p.render(x,c);x.show();g.focus()}else{var s=$(w).position().top;l.remove();p.render(x,c);$("body").animate({scrollTop:s-12},500)}},o=function(c){c>0&&c<=5&&u.fadeTo("fast",0.5).fadeTo("fast",1)},e=function(c){if(c.isEmpty())return"none";if(c.total>h&&c.allocations.length>1)return"support";return"ok"};this.insert=function(c){g.val(c);g.select()};this.fullResultsCallback=function(c){var s=e(c);v.attr("class",s);m.hide();f.hide();n.fadeTo(166,1);s=c.total;u.text(s);o(s);if(c.isEmpty()){x.empty();f.show()}else if(c.total>
5
- h&&c.allocations.length>1){j&&q(c);m.show(c)}else{q(c);k&&m.show(c)}};this.liveResultsCallback=function(c){var s=e(c);v.attr("class",s);c=c.total;u.text(c);o(c)};this.allocationChosen=function(c){c=c.data.query;a.insert(c);a.allocationChosen(c)};this.addinationClicked=function(c){a.addinationClicked(d(),c)};(function(){g.keyup(function(c){if(d()==""){i();a.searchTextCleared()}else n.fadeTo(166,1);a.searchTextEntered(d(),c)});u.click(function(){a.searchButtonClicked(d())});r.click(function(){a.searchButtonClicked(d())});
6
- n.click(function(){i();a.clearButtonClicked();g.focus()})})();g.focus()};var PickyBackend=function(a){var b=function(h,j,k){var g=k||{};g=$.extend({query:h},k);$.getJSON(a,g,function(n){j&&j(new PickyData(n))})};this.search=function(h,j,k,g){b(h,function(n){j&&j(g,n)},k)}},LiveBackend=function(a){var b=a.live||alert("A live backend path must be provided."),h=new PickyBackend(b);this.search=function(j,k,g,n){n=n||{};var r=new Date;n.live=r;g=$.extend({ids:a.liveResults||0,offset:0},g);h.search(j,function(u,v){if(!u.live||u.live==r)k&&k(v,j)},g,n)}},FullBackend=function(a){var b=
7
- a.full||alert("A full backend path must be provided."),h=new PickyBackend(b);this.search=function(j,k,g,n){n=n||{};var r=new Date;n.full=r;g=$.extend({ids:a.fullResults||20,offset:0},g);h.search(j,function(u,v){if(!u.full||u.full==r)k&&k(v,j)},g,n)}};var PickyController=function(a){var b=new PickyView(this,a),h=a.backends,j=a.beforeInsert||function(e){return e},k=a.before||function(e){return e},g=a.success||function(e){return e},n=a.after||function(e){return e},r=a.searchOnEmpty||false,u=a.liveRendered||false,v=a.liveSearchInterval||180,w,x=function(e){return(e=e&&e.match(/q=([^&]+)/))&&decodeURIComponent(e[1]).replace(/\+/g," ").replace(/#/g,"")||""};this.extractQuery=x;var f=function(){var e=window.History&&window.History.getState();return x(e&&
8
- e.url)};this.lastFullQuery=f;var l=function(e,c,s,y){var z=k(c,y);if(z!=undefined)c=z;w=[e,c,s,y];z=c;if(z!=f()){z=!r&&z==""?"/":"?q="+escape(z).replace(/\*/g,"%2A");window.History&&window.History.getState()&&window.History.pushState&&window.History.pushState(null,null,z)}if(!r&&c=="")b.reset();else(e=h[e])&&e.search(c,s,y)};this.resend=function(){w&&l.apply(this,w)};var m=function(e,c){(e=g(e,c))&&b.fullResultsCallback(e);n(e,c)},p=function(e,c){clearInterval(d);l("full",e,m,c||{})};a=function(e,
9
- c){(e=g(e,c))&&b.liveResultsCallback(e);n(e,c)};var i=u?m:a,d,q=function(){var e=b.text();l("live",e,i,{});clearInterval(d)};d=setInterval(q,v);clearInterval(d);var o=function(e,c,s){var y=j(e);if(y!=undefined)e=y;b.insert(e);s&&p(e,c)};this.insert=o;this.clearButtonClicked=function(){clearInterval(d)};this.searchTextCleared=function(){clearInterval(d)};this.searchTextEntered=function(e,c){if($.inArray(c.keyCode,[0,8,13,32,46,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,71,72,73,74,75,76,77,78,
10
- 79,80,81,82,83,84,85,86,87,88,89,90])>-1)if(c.keyCode==13)p(e);else{clearInterval(d);d=setInterval(q,v)}};this.searchButtonClicked=function(e){p(e)};this.allocationChosen=function(e){p(e)};this.addinationClicked=function(e,c){p(e,{offset:c.data.offset})};window.History&&window.History.Adapter.bind(window,"statechange",function(){var e=window.History.getState();e=x(e.url);e!=undefined&&e!=(w&&w.length>1&&w[1])&&o(e,{},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 b=a.backends;if(b){b.live||alert("Both a full and live backend must be provided.");b.full||alert("Both a full and live backend must be provided.")}else a.backends={live:new LiveBackend(a),full:new FullBackend(a)};b=a.enclosingSelector||".picky";var h=a.formSelector||b+" form";
11
- a.form=$(h);a.input=$(a.inputSelector||h+" input[type=search]");a.reset=$(a.resetSelector||h+" div.reset");a.button=$(a.buttonSelector||h+" input[type=button]");a.counter=$(a.counterSelector||h+" div.status");a.results=$(a.resultsSelector||b+" div.results");a.noResults=$(a.noResultsSelector||b+" div.no_results");a.moreSelector=a.moreSelector||b+" div.results div.addination:last";a.allocations=$(a.allocationsSelector||b+" .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||b+" div.results");a.resultsDivider=a.resultsDivider||"";a.nonPartial=a.nonPartial||[];a.wrapResults=a.wrapResults||"<ol></ol>";var j=a.controller&&new a.controller(a)||new PickyController(a);var k=this.insert=function(g,n,r){j.insert(g,n||{},r||true)};this.resend=j.resend;this.insertFromURL=
13
- function(g){if(g)k(g);else(g=j.lastFullQuery())&&k(g)}};var PickyAddination=function(a,b){this.remove=function(){b.find(".addination").remove()};this.render=function(h){var j=h.total,k,g=h.renderedAmount();k=h.offset+g;g=k+g;h=h.total;if(h<g)g=h;k={offset:k,start:k+1,end:g};if(k.offset<j){j=$("<div class='addination'>"+t("results.addination.more")+"</div>");j.bind("click",{offset:k.offset},a.addinationClicked);return j}else return""}};var PickyResultsRenderer=function(a,b){var h=b.locale,j=b.explanations||{},k=b.explanationDelimiter||{ch:"und",de:"und",en:"and",fr:"et",it:"e"},g=b.explanationTokenDelimiter||{},n=b.explanationTokenCallback,r=b.resultsDivider,u=b.wrapResults,v=b.nonPartial,w=function(i){var d=i[i.length-1];if(d===undefined)return[];i=i.slice(0,i.length-1);if(i==[])i=[i];if(!v.include(d[0]))if(d[1].match(/[^\*~]$/))d[1]+="*";i.push(d);return i};this.asteriskifyLastToken=w;var x=function(i){for(var d=j[h]||{},q=[],
14
- o,e=0,c=i.length;e<c;e++){o=i[e];var s=o[0];q.push([s,d[s]||s,o[1]])}return q};this.explainCategory=x;var f=function(i,d){return["<strong>"+i+"</strong>",d].join(" ")};this.strongify=f;var l=function(i,d,q){var o=n&&n(i,q);return o?o:f(d,q.join((g[h]||{})[i]||" "))},m=function(i,d){var q=k[h]||"&",o="",e=[],c=[];x(w(d)).each(function(s,y){var z=y[0],A=y[1],B=y[2];B=B.replace(/[\w,]+:(.+)/,"$1");if(o==""||z==o){e.push(B);o=z;lastExplainedCategory=A}else{var C=l(o,lastExplainedCategory,e);e=[];e.push(B);
15
- o=z;lastExplainedCategory=A;c.push(C)}});c.push(l(o,lastExplainedCategory,e));c=c.join(" "+q+" ");return c='<span class="explanation">'+i+" "+c+"</span>"};this.explain=m;var p=function(i,d){var q='<div class="header">';q+=m(d.type,d.combination);if(i.offset>0)q+='<div class="tothetop"><a href="#" onclick="javascript:$(\'body\').animate({scrollTop: 0}, 500);">&uarr;</a></div>';q+="</div>";return q};this.renderHeader=p;this.render=function(i,d){d.allocations.each(function(q,o){if(o.entries.length>0){i.append(p(d,
16
- o)).append(o.entries.join(r));i.children("li").wrapAll(u)}});i.append(a.render(d))}};function AllocationRenderer(a){function b(f){var l={},m={},p={},i=[],d,q;d=0;for(q=f.length;d<q;d++){var o=f[d][0];if(o in l){l[o].push(f[d][1]);m[o].push(f[d][2]);i.push(d)}else{l[o]=[f[d][1]];m[o]=[f[d][2]];p[d]=o}}for(d in p){f[d][1]=l[p[d]];f[d][2]=m[p[d]]}for(d=i.length-1;d>=0;d--)f.remove(i[d]);return f}function h(f){f.map(function(l){return"%"+(l+1)+"$s"});return f.join(" ")}function j(f){if(f.length==0)return"";f=b(f);for(var l=[],m=0,p=f.length;m<p;m++)l.push(f[m][0]);var i=l.length==1,d=
17
- w[l.join(",")];if(d===undefined)d=w[l]=h(l);if(typeof d==="string"){w[l]={format:d,ignoreSingle:true};d=w[l]}var q=d.format;f.each(function(o,e){var c=e[0],s=e[1],y=e[2];y.map(function(z,A){var B=s[z];if(B.charAt(B.length-1)=="*")A+="...";return A});d.filter&&y.map(function(z,A){return d.filter(A)});if(i&&!(d&&d.ignoreSingle)){c=u[c]||c;return q=y.join("&nbsp;")+"&nbsp;("+c+")"}y.map(function(z,A){return A.replace(/[\w,]+:(.+)/,"$1")});q=q.replace(RegExp("%"+(o+1)+"\\$s","g"),y.join("&nbsp;"))});
18
- return q}function k(f){for(var l=[],m=0,p=v.length;m<p;m++)l.push([]);l.push([]);m=0;for(p=f.length;m<p;m++){for(var i=f[m],d=i[0],q=false,o=0,e=v.length;o<e;o++)if(v[o].include(d)){l[o].push(i);q=true;break}q||l[l.length-1].push(i)}var c;for(f=l.length-1;f>=0;f--){c=l[f];if(c.length>0)break}c=c[c.length-1];x.include(c[0])||(c[1]=c[1].valueOf()+"*");return l}function g(f){var l=[];k(f).each(function(m,p){var i=j(p);i&&l.push(i)});return l.join(" ")}var n=a.locale,r=a.qualifiers&&a.qualifiers[n]||
19
- {},u=a.explanations&&a.explanations[n]||{},v=a.groups||[],w=a.choices&&a.choices[n]||{},x=a.nonPartial||[];this.explanation=this.query=this.text="";this.contract=b;this.makeUpMissingFormat=h;this.rendered=j;this.groupify=k;this.querify=function(f){var l=[],m,p,i;for(i in f){m=f[i][0];m=r[m]||m;p=(p=f[i][1])||"";p=p.charAt(p.length-1)=="*"?"*":"";l[i]=m+":"+f[i][2]+p}return l.join(" ")};this.suggestify=g;this.render=function(f){return g(f.combination)}};var PickyAllocationsCloud=function(a,b){var h=b.allocations,j=b.shownAllocations,k=b.showMoreAllocations,g=b.hiddenAllocations,n=b.maxSuggestions,r=function(){h.hide()},u=function(f){r();a.allocationChosen(f)},v=new AllocationRenderer(b),w=function(f){var l=[];f.each(function(m,p){var i=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:i},u);l.push(d)});return l},x=function(f){if(f.length==0)return h.hide();
20
- j.empty();k.hide();g.empty().hide();if(f.length>n){$.each(f.slice(0,n-1),function(l,m){j.append(m)});$.each(f.slice(n-1),function(l,m){g.append(m)});k.show()}else $.each(f,function(l,m){j.append(m)});return h.show()};k.click(function(){k.hide();g.show()});this.hide=r;this.show=function(f){x(w(f.allocations));h.show()}};
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);">&uarr;</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("&nbsp;")+"&nbsp;("+b+")"}z.map(function(A,x){return x.replace(/[\w,]+:(.+)/,"$1")});q=q.replace(RegExp("%"+(o+1)+"\\$s","g"),z.join("&nbsp;"))});
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.1
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-02-13 00:00:00.000000000 Z
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.0
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