picky-generators 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7b797ec9fe179ccfec401289ba5da5b487900c8d
4
- data.tar.gz: d06ec92c8d828797c917337637b8cdac5fce2b43
3
+ metadata.gz: 5b674cc80aa8be5c5503f7be16abddb5565f498c
4
+ data.tar.gz: dc52690bb7e4f42037edfa445329dd77cab62036
5
5
  SHA512:
6
- metadata.gz: 3a1dde3c095cc01134a9a3431eb8eec4a2d24bb5b141a3b292535d3c5a192a08e7640f84fe0f03b5cb247a7b63b063465489adc9d1edf7f66868e10c07d4aae4
7
- data.tar.gz: 09467c876e86a2f7f093db7f25993a9e3d46b9829a8b2de38481266de8e4960fa55c5bba768a99aba4109650fe749fbbd04528af78a26b83d3ca51eb22ddc96b
6
+ metadata.gz: ae9d68aeda321f4475bd87a68c664002f7930dd6e6848602687a4d6083bee20b60b1ba3370fa804541089a924cb6e212826e5587efc7e9a945fa80e3425720c9
7
+ data.tar.gz: bdf483d89bed6491cce7367760beeba3fd2bc38e6f9f7e1b0942df0bf8c04d2b84aa4f51c979ad431f36e59a59bd37ba6031310f46e4fa882a18d69b57ad16e7
@@ -6,6 +6,7 @@ gem 'picky-client', '~> 4.0'
6
6
  gem 'i18n'
7
7
  gem 'activesupport', :require => 'active_support/core_ext'
8
8
  gem 'sinatra'
9
+ gem 'tilt', '~> 1.4.1'
9
10
  gem 'haml'
10
11
 
11
12
  # Gems required by the Picky server.
@@ -2,6 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'picky', '~> 4.0'
4
4
  gem 'sinatra'
5
+ gem 'tilt', '~> 1.4.1'
5
6
  gem 'rake'
6
7
  gem 'rack'
7
8
  gem 'rack_fast_escape', '2009.06.24' # Optional.
@@ -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-generators
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: rspec
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 4.20.1
33
+ version: 4.20.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 4.20.1
40
+ version: 4.20.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: picky-client
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 4.20.1
47
+ version: 4.20.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 4.20.1
54
+ version: 4.20.2
55
55
  description: Generators for Picky.
56
56
  email: florian.hanke+picky-generators@gmail.com
57
57
  executables:
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
130
  version: '0'
131
131
  requirements: []
132
132
  rubyforge_project: http://rubyforge.org/projects/picky
133
- rubygems_version: 2.2.0
133
+ rubygems_version: 2.2.2
134
134
  signing_key:
135
135
  specification_version: 4
136
136
  summary: Generators for Picky the Ruby Search Engine.
@@ -139,4 +139,3 @@ test_files:
139
139
  - spec/lib/picky-generators/generators/client/sinatra_spec.rb
140
140
  - spec/lib/picky-generators/generators/selector_spec.rb
141
141
  - spec/lib/picky-generators/generators/server/sinatra_spec.rb
142
- has_rdoc: