picky-generators 4.23.2 → 4.24.0

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: 5d26fdc2517acf372e525190dfed0ec0e3d224bd
4
- data.tar.gz: 21528e4b47bfbfe3a8ac0b7c4766342ff9287df2
3
+ metadata.gz: 3dcb35e721ce75ecef022566c3144b5f6eb7b0aa
4
+ data.tar.gz: 1b012e867bb1711bffefac48131cca355fcf789b
5
5
  SHA512:
6
- metadata.gz: 31cbbcd9714003fda44b74f0430f95913d2329ae7fa8103358d7c810dc3ef1e10537de13131519dc68602c72c3e7cada97a2b3fc801663e1f3513ac8816e5062
7
- data.tar.gz: b776d0301f5bbc5c03dcd9097c10521b5967ad17fc5aac589d86f97fa3ae067fa902246be79f47e06c2afd8e7bd3503799e1623f50852c893cadddc9af979da4
6
+ metadata.gz: c58a1cc148c6d1e09ea9ff9c2d88e7e0f5cde2b4bb0b28e978064e7b989867e8e062c4d1bf0effee95b6b67b6288494dfbc95ad25991319cc2caa295c75b930e
7
+ data.tar.gz: 0786d03fe5b1d77d436c5b45abd8500cf891c69e2a34004b210b8bf8eb0d191cf407c14f2de621b3a6b95f59575222b209e8a349ce163b7e93cb2020f7e36e5c
@@ -1,20 +1,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);">&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()}};
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,i=h.length;k<i;k++){j=j[h[k]];if(j==undefined){j="Translation missing: "+a+"."+b;break}}return j};function Allocation(a,b,h,j,k,i){var n=this;this.type=a;this.weight=b;this.count=h;this.combination=j;this.ids=k||[];this.entries=this.rendered=i||[];this.isType=function(s){return s==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 i=0;k.each(function(n,s){i+=s.rendered.length});return i};this.isEmpty=function(){return b==0}};var PickyView=function(a,b){var h=b.showResultsLimit||10,j=b.alwaysShowResults||false,k=b.alwaysShowSelection||false,i=b.input,n=b.reset,s=b.button,v=b.counter,x=b.form,A=b.moreSelector,w=b.results,f=b.noResults,l=new PickyAddination(this,w),m=new PickyAllocationsCloud(this,b),q=new PickyResultsRenderer(l,b),g=function(e){i.val(e);n.fadeTo(166,0);x.attr("class","empty");v.empty();m.hide();f.hide()};this.reset=g;var d=function(){return i.val()};this.text=d;var p=function(e){if(e.offset==0){w.empty();
4
+ q.render(w,e);w.show();i.focus()}else{var c=$(A).position().top;l.remove();q.render(w,e);$("body").animate({scrollTop:c-12},500)}},o=function(e){e>0&&e<=5&&v.fadeTo("fast",0.5).fadeTo("fast",1)},u=function(e){if(e.isEmpty())return"none";if(e.total>h&&e.allocations.length>1)return"support";return"ok"};this.insert=function(e){i.val(e);i.select()};this.fullResultsCallback=function(e){var c=u(e);x.attr("class",c);m.hide();f.hide();n.fadeTo(166,1);c=e.total;v.text(c);o(c);if(e.isEmpty()){w.empty();f.show()}else if(e.total>
5
+ h&&e.allocations.length>1){j&&p(e);m.show(e)}else{p(e);k&&m.show(e)}};this.liveResultsCallback=function(e){var c=u(e);x.attr("class",c);e=e.total;v.text(e);o(e)};this.allocationChosen=function(e){e=e.data.query;a.insert(e);a.allocationChosen(e)};this.addinationClicked=function(e){a.addinationClicked(d(),e)};(function(){i.keyup(function(e){if(d()==""){g();a.searchTextCleared()}else n.fadeTo(166,1);a.searchTextEntered(d(),e)});v.click(function(){a.searchButtonClicked(d())});s.click(function(){a.searchButtonClicked(d())});
6
+ n.click(function(){g();a.clearButtonClicked();i.focus()})})();i.focus()};var PickyBackend=function(a){var b=function(h,j,k){var i=k||{};i=$.extend({query:h},k);$.getJSON(a,i,function(n){j&&j(new PickyData(n))})};this.search=function(h,j,k,i){b(h,function(n){j&&j(i,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,i,n){n=n||{};var s=new Date;n.live=s;i=$.extend({ids:a.liveResults||0,offset:0},i);h.search(j,function(v,x){if(!v.live||v.live==s)k&&k(x,j)},i,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,i,n){n=n||{};var s=new Date;n.full=s;i=$.extend({ids:a.fullResults||20,offset:0},i);h.search(j,function(v,x){if(!v.full||v.full==s)k&&k(x,j)},i,n)}};var PickyController=function(a){var b=new PickyView(this,a),h=a.backends,j=a.beforeInsert||function(c){return c},k=a.beforeParams||function(c){return c},i=a.before||function(c){return c},n=a.success||function(c){return c},s=a.after||function(c){return c},v=a.searchOnEmpty||false,x=a.liveRendered||false,A=a.liveSearchInterval||180,w,f=function(c){return(c=c&&c.match(/q=([^&]+)/))&&decodeURIComponent(c[1].replace(/\+/g," "))||""};this.extractQuery=f;var l=function(){var c=window.History&&window.History.getState();
8
+ return f(c&&c.url)};this.lastFullQuery=l;var m=function(c,r,B,y){if(!v&&r=="")b.reset();else{y=k(y);var z=i(r,y);if(z!=undefined)r=z;w=[c,r,B,y];z=r;if(z!=l()){z=!v&&z==""?"/":"?q="+encodeURIComponent(z);window.History&&window.History.getState()&&window.History.pushState&&window.History.pushState(null,null,z)}(c=h[c])&&c.search(r,B,y)}};this.resend=function(){w&&m.apply(this,w)};var q=function(c,r){(c=n(c,r))&&b.fullResultsCallback(c);s(c,r)},g=function(c,r){clearInterval(p);m("full",c,q,r||{})};
9
+ a=function(c,r){(c=n(c,r))&&b.liveResultsCallback(c);s(c,r)};var d=x?q:a,p,o=function(){var c=b.text();m("live",c,d,{});clearInterval(p)};p=setInterval(o,A);clearInterval(p);var u=function(c,r,B){var y=j(c);if(y!=undefined)c=y;b.insert(c);B&&g(c,r)};this.insert=u;this.clearButtonClicked=function(){clearInterval(p)};this.searchTextCleared=function(){clearInterval(p)};var e=[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(c,r){if($.inArray(r.keyCode,
10
+ e)<0)if(r.keyCode==13)g(c);else{clearInterval(p);p=setInterval(o,A)}};this.searchButtonClicked=function(c){g(c)};this.allocationChosen=function(c){g(c)};this.addinationClicked=function(c,r){g(c,{offset:r.data.offset})};window.History&&window.History.Adapter.bind(window,"statechange",function(){var c=window.History.getState();c=f(c.url);c!=undefined&&c!=(w&&w.length>1&&w[1])&&u(c,{},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(i,n,s){j.insert(i,n||{},s||true)};this.resend=j.resend;this.insertFromURL=
13
+ function(i){if(i)k(i);else(i=j.lastFullQuery())&&k(i)}};var PickyAddination=function(a,b){this.remove=function(){b.find(".addination").remove()};this.render=function(h){var j=h.total,k,i=h.renderedAmount();k=h.offset+i;i=k+i;h=h.total;if(h<i)i=h;k={offset:k,start:k+1,end:i};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"},i=b.explanationTokenDelimiter||{},n=b.explanationTokenCallback,s=b.resultsDivider,v=b.wrapResults,x=b.nonPartial,A=function(g){var d=g[g.length-1];if(d===undefined)return[];g=g.slice(0,g.length-1);if(g==[])g=[g];if(!x.include(d[0]))if(d[1].match(/[^\*~]$/))d[1]+="*";g.push(d);return g};this.asteriskifyLastToken=A;var w=function(g){for(var d=j[h]||{},p=[],
14
+ o,u=0,e=g.length;u<e;u++){o=g[u];var c=o[0];p.push([c,d[c]||c,o[1]])}return p};this.explainCategory=w;var f=function(g,d){return["<strong>"+g+"</strong>",d].join(" ")};this.strongify=f;var l=function(g,d,p){var o=n&&n(g,p);return o?o:f(d,p.join((i[h]||{})[g]||" "))},m=function(g,d){var p=k[h]||"&",o="",u=[],e=[];w(A(d)).each(function(c,r){var B=r[0],y=r[1],z=r[2];z=z.replace(/[\w,]+:(.+)/,"$1");if(o==""||B==o){u.push(z);o=B;lastExplainedCategory=y}else{var C=l(o,lastExplainedCategory,u);u=[];u.push(z);
15
+ o=B;lastExplainedCategory=y;e.push(C)}});e.push(l(o,lastExplainedCategory,u));e=e.join(" "+p+" ");return e='<span class="explanation">'+g+" "+e+"</span>"};this.explain=m;var q=function(g,d){var p='<div class="header">';p+=m(d.type,d.combination);if(g.offset>0)p+='<div class="tothetop"><a href="#" onclick="javascript:$(\'body\').animate({scrollTop: 0}, 500);">&uarr;</a></div>';p+="</div>";return p};this.renderHeader=q;this.render=function(g,d){d.allocations.each(function(p,o){if(o.entries.length>0){g.append(q(d,
16
+ o)).append(o.entries.join(s));g.children("li").wrapAll(v)}});g.append(a.render(d))}};function AllocationRenderer(a){function b(f){var l={},m={},q={},g=[],d,p;d=0;for(p=f.length;d<p;d++){var o=f[d][0];if(o in l){l[o].push(f[d][1]);m[o].push(f[d][2]);g.push(d)}else{l[o]=[f[d][1]];m[o]=[f[d][2]];q[d]=o}}for(d in q){f[d][1]=l[q[d]];f[d][2]=m[q[d]]}for(d=g.length-1;d>=0;d--)f.remove(g[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,q=f.length;m<q;m++)l.push(f[m][0]);var g=l.length==1,d=
17
+ A[l.join(",")];if(d===undefined)d=A[l]=h(l);if(typeof d==="string"){A[l]={format:d,ignoreSingle:true};d=A[l]}var p=d.format;f.each(function(o,u){var e=u[0],c=u[1],r=u[2];r.map(function(B,y){var z=c[B];if(z.charAt(z.length-1)=="*")y+="...";return y});d.filter&&r.map(function(B,y){return d.filter(y)});if(g&&!(d&&d.ignoreSingle)){e=v[e]||e;return p=r.join("&nbsp;")+"&nbsp;("+e+")"}r.map(function(B,y){return y.replace(/[\w,]+:(.+)/,"$1")});p=p.replace(RegExp("%"+(o+1)+"\\$s","g"),r.join("&nbsp;"))});
18
+ return p}function k(f){for(var l=[],m=0,q=x.length;m<q;m++)l.push([]);l.push([]);m=0;for(q=f.length;m<q;m++){for(var g=f[m],d=g[0],p=false,o=0,u=x.length;o<u;o++)if(x[o].include(d)){l[o].push(g);p=true;break}p||l[l.length-1].push(g)}var e;for(f=l.length-1;f>=0;f--){e=l[f];if(e.length>0)break}e=e[e.length-1];w.include(e[0])||(e[1]=e[1].valueOf()+"*");return l}function i(f){var l=[];k(f).each(function(m,q){var g=j(q);g&&l.push(g)});return l.join(" ")}var n=a.locale,s=a.qualifiers&&a.qualifiers[n]||
19
+ {},v=a.explanations&&a.explanations[n]||{},x=a.groups||[],A=a.choices&&a.choices[n]||{},w=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,q,g;for(g in f){m=f[g][0];m=s[m]||m;q=(q=f[g][1])||"";q=q.charAt(q.length-1)=="*"?"*":"";l[g]=m+":"+f[g][2]+q}return l.join(" ")};this.suggestify=i;this.render=function(f){return i(f.combination)}};var PickyAllocationsCloud=function(a,b){var h=b.allocations,j=b.shownAllocations,k=b.showMoreAllocations,i=b.hiddenAllocations,n=b.maxSuggestions,s=function(){h.hide()},v=function(f){s();a.allocationChosen(f)},x=new AllocationRenderer(b),A=function(f){var l=[];f.each(function(m,q){var g=x.querify(q.combination),d=x.render(q);d=$('<li><div class="text">'+d+'</div><div class="count">'+q.count+"</div></li>");d.bind("click",{query:g},v);l.push(d)});return l},w=function(f){if(f.length==0)return h.hide();
20
+ j.empty();k.hide();i.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){i.append(m)});k.show()}else $.each(f,function(l,m){j.append(m)});return h.show()};k.click(function(){k.hide();i.show()});this.hide=s;this.show=function(f){w(A(f.allocations));h.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.23.2
4
+ version: 4.24.0
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-04 00:00:00.000000000 Z
11
+ date: 2014-11-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.23.2
33
+ version: 4.24.0
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.23.2
40
+ version: 4.24.0
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.23.2
47
+ version: 4.24.0
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.23.2
54
+ version: 4.24.0
55
55
  description: Generators for Picky.
56
56
  email: florian.hanke+picky-generators@gmail.com
57
57
  executables: