picky-generators 4.0.5 → 4.0.6
Sign up to get free protection for your applications and to get access to all the features.
@@ -11,7 +11,7 @@ this.searchTextEntered=function(a,c){if($.inArray(c.keyCode,[0,8,13,32,46,48,49,
|
|
11
11
|
new PickyController(b);var e=this.insert=function(d,j,n){g.insert(d,j||{},n||true)};this.insertFromURL=function(d){if(d&&d!="")e(d);else(d=g.lastQuery())&&e(d)};window.History&&window.History.Adapter.bind(window,"statechange",function(){var d=window.History.getState();(d=g.extractQuery(d.url))&&e(d)})};var PickyAddination=function(b,i){this.remove=function(){i.find(".addination").remove()};this.render=function(g){var e=g.total,d,j=g.renderedAmount();d=g.offset+j;j=d+j;g=g.total;if(g<j)j=g;d={offset:d,start:d+1,end:j};if(d.offset<e){e=$("<div class='addination'>"+t("results.addination.more")+"</div>");e.bind("click",{offset:d.offset},b.addinationClicked);return e}else return""}};var PickyResultsRenderer=function(b,i){var g=i.wrapResults||'<ol class="results"></ol>',e=["street_number","zipcode"],d=function(k){var m=k[k.length-1];k=k.slice(0,k.length-1);if(k==[])k=[k];if(!e.include(m[0]))if(m[1].match(/[^\*~]$/))m[1]+="*";k.push(m);return k},j=function(k){for(var m=Localization.explanations&&Localization.explanations[PickyI18n.locale]||{},r=[],p,a=0,c=k.length;a<c;a++){p=k[a];var f=p[0];f=m[f]||f;r.push([f,p[1]])}return r},n=function(k,m){return[k.replace(/([\w\s\u00c4\u00e4\u00d6\u00f6\u00dc\u00fc\u00e9\u00e8\u00e0]+)/,
|
12
12
|
"<strong>$1</strong>"),m].join(" ")},s=function(k,m){var r=Localization.explanation_delimiters[PickyI18n.locale],p=j(d(m)),a="",c=[];p=$.map(p,function(f){var o=f[0];f=f[1];if(a==""||o==a){f=f.replace(/[\w,]+:(.+)/,"$1");c.push(f);a=o}else{var q=n(a,c.join(" "));c=[];c.push(f);a=o;return q}});p.push(n(a,c.join(" ")));p=p.join(" "+r+" ");return'<span class="explanation">'+k+" "+p+"</span>"},u=function(k,m){var r='<div class="header">';r+=s(m.type,m.combination);if(k.offset>0)r+='<div class="tothetop"><a href="#" onclick="javascript:$(\'body\').animate({scrollTop: 0}, 500);">↑</a></div>';
|
13
13
|
return r};this.render=function(k){var m=$("#picky div.results");k.allocations.each(function(r,p){if(p.entries.length>0){m.append(u(k,p)).append(p.entries.join(""));m.children("li").wrapAll(g)}});m.append(b.render(k))}};function AllocationRenderer(b,i){function g(a){var c={},f={},o=[],q;q=0;for(l=a.length;q<l;q++){var w=a[q][0];if(w in c){c[w]=c[w]+" "+a[q][1];o.push(q)}else{c[w]=a[q][1];f[q]=w}}for(q in f)a[q][1]=c[f[q]];for(q=o.length-1;q>=0;q--)a.remove(o[q]);return a}function e(a){return $.map(a,function(c,f){return"%"+(f+1)+"$s"}).join(" ")}function d(a){if(a.length==0)return"";var c=a=g(a);c.sort(function(x,z){return x[0]<z[0]?-1:1});for(var f=[],o=0,q=c.length;o<q;o++)f.push(c[o][0]);var w=f.length==1,v=r[f]||
|
14
|
-
(r[f]=e(f));if($.type(v)==="string"){r[f]={format:v};v=r[f]}var h=1,y=v.format;$.each(a,function(x,z){var
|
15
|
-
for(a=c.length-1;a>=0;a--){x=c[a];if(x.length>0)break}x=x[x.length-1];p.include(x[0])||(x[1]+="...");return $.map(c,function(z){return d(z)})}function n(a){var c=[],f,o;for(o in a){f=a[o][0];f=u[f]||f;c[o]=f+":"+a[o][
|
16
|
-
"zipcode"];this.contract=g;this.rendered=d;this.groupify=j;this.querify=n;this.render=function(a){var c=a.combination,f=a.count;a=n(c);c=j(c).join(" ");c=$('<li><div class="text">'+c+'</div><div class="count">'+f+"</div></li>");c.bind("click",{query:a},b);return c}};var PickyAllocationsCloud=function(b,i){var g=$("#picky .allocations"),e=g.find(".shown"),d=g.find(".more"),j=g.find(".hidden"),n=function(){g.hide()},s=new AllocationRenderer(function(m){n();b.allocationChosen(m)},i),u=function(m){var r=[];m.each(function(p,a){r.push(s.render(a))});return r},k=function(m){if(m.length==0)return $("#search .allocations").hide();e.empty();d.hide();j.empty().hide();if(m.length>3){$.each(m.slice(0,2),function(r,p){e.append(p)});$.each(m.slice(2),function(r,p){j.append(p)});
|
14
|
+
(r[f]=e(f));if($.type(v)==="string"){r[f]={format:v};v=r[f]}var h=1,y=v.format;$.each(a,function(x,z){var B=z[0],A=z[2];if(v.filter)A=v.filter(A);console.log(A);B=k[B]||B;if(w&&!(v&&v.ignoreSingle))return y=A+" ("+B+")";y=y.replace(RegExp("%"+h+"\\$s","g"),A);h+=1;return h});return y}function j(a){for(var c=[],f=0,o=m.length;f<o;f++)c.push([]);c.push([]);f=0;for(o=a.length;f<o;f++){for(var q=a[f],w=q[0],v=false,h=0,y=m.length;h<y;h++)if(m[h].include(w)){c[h].push(q);v=true;break}v||c[c.length-
|
15
|
+
1].push(q)}var x;for(a=c.length-1;a>=0;a--){x=c[a];if(x.length>0)break}x=x[x.length-1];p.include(x[0])||(x[1]+="...");return $.map(c,function(z){return d(z)})}function n(a){var c=[],f,o;for(o in a){f=a[o][0];f=u[f]||f;c[o]=f+":"+a[o][2]}return c.join(" ")}var s=PickyI18n.locale,u=Localization.qualifiers&&Localization.qualifiers[s]||{},k=Localization.explanations&&Localization.explanations[s]||{},m=i.groups||[],r=Localization.choices&&Localization.choices[s]||{};this.explanation=this.query=this.text=
|
16
|
+
"";var p=["street_number","zipcode"];this.contract=g;this.rendered=d;this.groupify=j;this.querify=n;this.render=function(a){var c=a.combination,f=a.count;a=n(c);c=j(c).join(" ");c=$('<li><div class="text">'+c+'</div><div class="count">'+f+"</div></li>");c.bind("click",{query:a},b);return c}};var PickyAllocationsCloud=function(b,i){var g=$("#picky .allocations"),e=g.find(".shown"),d=g.find(".more"),j=g.find(".hidden"),n=function(){g.hide()},s=new AllocationRenderer(function(m){n();b.allocationChosen(m)},i),u=function(m){var r=[];m.each(function(p,a){r.push(s.render(a))});return r},k=function(m){if(m.length==0)return $("#search .allocations").hide();e.empty();d.hide();j.empty().hide();if(m.length>3){$.each(m.slice(0,2),function(r,p){e.append(p)});$.each(m.slice(2),function(r,p){j.append(p)});
|
17
17
|
d.show()}else $.each(m,function(r,p){e.append(p)});return $("#search .allocations").show()};d.click(function(){d.hide();j.show()});this.hide=n;this.show=function(m){k(u(m.allocations));g.show()}};
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: picky-generators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-01-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70284616398220 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,29 +21,29 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70284616398220
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: picky
|
27
|
-
requirement: &
|
27
|
+
requirement: &70284616396880 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 4.0.
|
32
|
+
version: 4.0.6
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70284616396880
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: picky-client
|
38
|
-
requirement: &
|
38
|
+
requirement: &70284616396380 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 4.0.
|
43
|
+
version: 4.0.6
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70284616396380
|
47
47
|
description: Generators for Picky.
|
48
48
|
email: florian.hanke+picky-generators@gmail.com
|
49
49
|
executables:
|