@bmlt-enabled/croutonjs 3.12.4 → 3.12.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/croutonjs-build1044-5a3e2d25bcc57fdc85e3af669234ce0b16bc772e.zip +0 -0
- package/crouton.css +4 -0
- package/crouton.js +870 -145
- package/crouton.min.css +1 -1
- package/crouton.min.js +1 -1
- package/crouton.nojquery.js +870 -145
- package/crouton.nojquery.min.js +1 -1
- package/dist_croutonjs/github/croutonjs.zip +0 -0
- package/dist_croutonjs/s3/croutonjs-build1044-5a3e2d25bcc57fdc85e3af669234ce0b16bc772e.zip +0 -0
- package/package.json +1 -1
- package/templates/themes/asheboro.json +3 -0
- package/templates/themes/florida-nights.css +22 -0
- package/templates/themes/florida-nights.json +163 -0
- package/templates/themes/frog.css +22 -0
- package/templates/themes/frog.json +163 -0
- package/templates/themes/gold-coast.json +3 -0
- package/templates/themes/jack.json +3 -0
- package/templates/themes/kevin.json +3 -0
- package/templates/themes/lucy.json +3 -0
- package/templates/themes/one-nine.json +3 -0
- package/templates/themes/orange-monster.json +3 -0
- package/templates/themes/patrick.json +3 -0
- package/templates/themes/quebec.json +3 -0
- package/templates/themes/seattle-rain.json +3 -0
- package/templates/themes/sezf.json +3 -0
- package/templates/themes/truth.css +22 -0
- package/templates/themes/truth.json +163 -0
- package/build/croutonjs-build948-616b0b3a16e4f5ee9a7f7ad3e83475a888f9d211.zip +0 -0
- package/dist_croutonjs/s3/croutonjs-build948-616b0b3a16e4f5ee9a7f7ad3e83475a888f9d211.zip +0 -0
package/crouton.js
CHANGED
|
@@ -12863,6 +12863,14 @@ function CroutonLocalization(language) {
|
|
|
12863
12863
|
IN_PERSON: "In Person",
|
|
12864
12864
|
VIRTUAL: "Virtual",
|
|
12865
12865
|
},
|
|
12866
|
+
"service_body_types": {
|
|
12867
|
+
AS: "Area Service Committee",
|
|
12868
|
+
RS: "Regional Service Committee",
|
|
12869
|
+
ZF: "Zonal Forum",
|
|
12870
|
+
MA: "Metropolitan Service Committee",
|
|
12871
|
+
LS: "Local Service Forum",
|
|
12872
|
+
GS: "Group Support Forum"
|
|
12873
|
+
},
|
|
12866
12874
|
"share": "share",
|
|
12867
12875
|
},
|
|
12868
12876
|
"de-DE":{
|
|
@@ -12889,6 +12897,14 @@ function CroutonLocalization(language) {
|
|
|
12889
12897
|
IN_PERSON: "Präsens-Meetings",
|
|
12890
12898
|
VIRTUAL: "Online-Meetings",
|
|
12891
12899
|
},
|
|
12900
|
+
"service_body_types": {
|
|
12901
|
+
AS: "Area Service Committee",
|
|
12902
|
+
RS: "Regional Service Committee",
|
|
12903
|
+
ZF: "Zonal Forum",
|
|
12904
|
+
MA: "Metropolitan Service Committee",
|
|
12905
|
+
LS: "Local Service Forum",
|
|
12906
|
+
GS: "Group Support Forum"
|
|
12907
|
+
},
|
|
12892
12908
|
"share": "Teilen",
|
|
12893
12909
|
},
|
|
12894
12910
|
"en-AU": {
|
|
@@ -12915,6 +12931,14 @@ function CroutonLocalization(language) {
|
|
|
12915
12931
|
IN_PERSON: "In Person",
|
|
12916
12932
|
VIRTUAL: "Virtual",
|
|
12917
12933
|
},
|
|
12934
|
+
"service_body_types": {
|
|
12935
|
+
AS: "Area Service Committee",
|
|
12936
|
+
RS: "Regional Service Committee",
|
|
12937
|
+
ZF: "Zonal Forum",
|
|
12938
|
+
MA: "Metropolitan Service Committee",
|
|
12939
|
+
LS: "Local Service Forum",
|
|
12940
|
+
GS: "Group Support Forum"
|
|
12941
|
+
},
|
|
12918
12942
|
"share": "share",
|
|
12919
12943
|
},
|
|
12920
12944
|
"en-CA": {
|
|
@@ -12941,6 +12965,14 @@ function CroutonLocalization(language) {
|
|
|
12941
12965
|
IN_PERSON: "In Person",
|
|
12942
12966
|
VIRTUAL: "Virtual",
|
|
12943
12967
|
},
|
|
12968
|
+
"service_body_types": {
|
|
12969
|
+
AS: "Area Service Committee",
|
|
12970
|
+
RS: "Regional Service Committee",
|
|
12971
|
+
ZF: "Zonal Forum",
|
|
12972
|
+
MA: "Metropolitan Service Committee",
|
|
12973
|
+
LS: "Local Service Forum",
|
|
12974
|
+
GS: "Group Support Forum"
|
|
12975
|
+
},
|
|
12944
12976
|
"share": "share",
|
|
12945
12977
|
},
|
|
12946
12978
|
"en-NZ": {
|
|
@@ -12967,6 +12999,14 @@ function CroutonLocalization(language) {
|
|
|
12967
12999
|
IN_PERSON: "In Person",
|
|
12968
13000
|
VIRTUAL: "Virtual",
|
|
12969
13001
|
},
|
|
13002
|
+
"service_body_types": {
|
|
13003
|
+
AS: "Area Service Committee",
|
|
13004
|
+
RS: "Regional Service Committee",
|
|
13005
|
+
ZF: "Zonal Forum",
|
|
13006
|
+
MA: "Metropolitan Service Committee",
|
|
13007
|
+
LS: "Local Service Forum",
|
|
13008
|
+
GS: "Group Support Forum"
|
|
13009
|
+
},
|
|
12970
13010
|
"share": "share",
|
|
12971
13011
|
},
|
|
12972
13012
|
"en-UK": {
|
|
@@ -12993,6 +13033,14 @@ function CroutonLocalization(language) {
|
|
|
12993
13033
|
IN_PERSON: "In Person",
|
|
12994
13034
|
VIRTUAL: "Virtual",
|
|
12995
13035
|
},
|
|
13036
|
+
"service_body_types": {
|
|
13037
|
+
AS: "Area Service Committee",
|
|
13038
|
+
RS: "Regional Service Committee",
|
|
13039
|
+
ZF: "Zonal Forum",
|
|
13040
|
+
MA: "Metropolitan Service Committee",
|
|
13041
|
+
LS: "Local Service Forum",
|
|
13042
|
+
GS: "Group Support Forum"
|
|
13043
|
+
},
|
|
12996
13044
|
"share": "share",
|
|
12997
13045
|
},
|
|
12998
13046
|
"en-US": {
|
|
@@ -13019,6 +13067,14 @@ function CroutonLocalization(language) {
|
|
|
13019
13067
|
IN_PERSON: "In Person",
|
|
13020
13068
|
VIRTUAL: "Virtual",
|
|
13021
13069
|
},
|
|
13070
|
+
"service_body_types": {
|
|
13071
|
+
AS: "Area Service Committee",
|
|
13072
|
+
RS: "Regional Service Committee",
|
|
13073
|
+
ZF: "Zonal Forum",
|
|
13074
|
+
MA: "Metropolitan Service Committee",
|
|
13075
|
+
LS: "Local Service Forum",
|
|
13076
|
+
GS: "Group Support Forum"
|
|
13077
|
+
},
|
|
13022
13078
|
"share": "share",
|
|
13023
13079
|
},
|
|
13024
13080
|
"es-US": {
|
|
@@ -13045,6 +13101,14 @@ function CroutonLocalization(language) {
|
|
|
13045
13101
|
IN_PERSON: "In Person",
|
|
13046
13102
|
VIRTUAL: "Virtual",
|
|
13047
13103
|
},
|
|
13104
|
+
"service_body_types": {
|
|
13105
|
+
AS: "Area Service Committee",
|
|
13106
|
+
RS: "Regional Service Committee",
|
|
13107
|
+
ZF: "Zonal Forum",
|
|
13108
|
+
MA: "Metropolitan Service Committee",
|
|
13109
|
+
LS: "Local Service Forum",
|
|
13110
|
+
GS: "Group Support Forum"
|
|
13111
|
+
},
|
|
13048
13112
|
"share": "share",
|
|
13049
13113
|
},
|
|
13050
13114
|
"fa-IR": {
|
|
@@ -13071,6 +13135,14 @@ function CroutonLocalization(language) {
|
|
|
13071
13135
|
IN_PERSON: "In Person",
|
|
13072
13136
|
VIRTUAL: "Virtual",
|
|
13073
13137
|
},
|
|
13138
|
+
"service_body_types": {
|
|
13139
|
+
AS: "Area Service Committee",
|
|
13140
|
+
RS: "Regional Service Committee",
|
|
13141
|
+
ZF: "Zonal Forum",
|
|
13142
|
+
MA: "Metropolitan Service Committee",
|
|
13143
|
+
LS: "Local Service Forum",
|
|
13144
|
+
GS: "Group Support Forum"
|
|
13145
|
+
},
|
|
13074
13146
|
"share": "share",
|
|
13075
13147
|
},
|
|
13076
13148
|
"fr-CA": {
|
|
@@ -13097,6 +13169,14 @@ function CroutonLocalization(language) {
|
|
|
13097
13169
|
IN_PERSON: "In Person",
|
|
13098
13170
|
VIRTUAL: "Virtual",
|
|
13099
13171
|
},
|
|
13172
|
+
"service_body_types": {
|
|
13173
|
+
AS: "Area Service Committee",
|
|
13174
|
+
RS: "Regional Service Committee",
|
|
13175
|
+
ZF: "Zonal Forum",
|
|
13176
|
+
MA: "Metropolitan Service Committee",
|
|
13177
|
+
LS: "Local Service Forum",
|
|
13178
|
+
GS: "Group Support Forum"
|
|
13179
|
+
},
|
|
13100
13180
|
"share": "share",
|
|
13101
13181
|
},
|
|
13102
13182
|
"it-IT": {
|
|
@@ -13123,6 +13203,14 @@ function CroutonLocalization(language) {
|
|
|
13123
13203
|
IN_PERSON: "In Person",
|
|
13124
13204
|
VIRTUAL: "Virtual",
|
|
13125
13205
|
},
|
|
13206
|
+
"service_body_types": {
|
|
13207
|
+
AS: "Area Service Committee",
|
|
13208
|
+
RS: "Regional Service Committee",
|
|
13209
|
+
ZF: "Zonal Forum",
|
|
13210
|
+
MA: "Metropolitan Service Committee",
|
|
13211
|
+
LS: "Local Service Forum",
|
|
13212
|
+
GS: "Group Support Forum"
|
|
13213
|
+
},
|
|
13126
13214
|
"share": "Condividi"
|
|
13127
13215
|
},
|
|
13128
13216
|
"nl-NL": {
|
|
@@ -13149,6 +13237,14 @@ function CroutonLocalization(language) {
|
|
|
13149
13237
|
IN_PERSON: "Fysiek",
|
|
13150
13238
|
VIRTUAL: "Online",
|
|
13151
13239
|
},
|
|
13240
|
+
"service_body_types": {
|
|
13241
|
+
AS: "Area Service Committee",
|
|
13242
|
+
RS: "Regional Service Committee",
|
|
13243
|
+
ZF: "Zonal Forum",
|
|
13244
|
+
MA: "Metropolitan Service Committee",
|
|
13245
|
+
LS: "Local Service Forum",
|
|
13246
|
+
GS: "Group Support Forum"
|
|
13247
|
+
},
|
|
13152
13248
|
"share": "share",
|
|
13153
13249
|
},
|
|
13154
13250
|
"pl-PL": {
|
|
@@ -13175,6 +13271,14 @@ function CroutonLocalization(language) {
|
|
|
13175
13271
|
IN_PERSON: "In Person",
|
|
13176
13272
|
VIRTUAL: "Virtual",
|
|
13177
13273
|
},
|
|
13274
|
+
"service_body_types": {
|
|
13275
|
+
AS: "Area Service Committee",
|
|
13276
|
+
RS: "Regional Service Committee",
|
|
13277
|
+
ZF: "Zonal Forum",
|
|
13278
|
+
MA: "Metropolitan Service Committee",
|
|
13279
|
+
LS: "Local Service Forum",
|
|
13280
|
+
GS: "Group Support Forum"
|
|
13281
|
+
},
|
|
13178
13282
|
"share": "share",
|
|
13179
13283
|
},
|
|
13180
13284
|
"pt-BR": {
|
|
@@ -13201,6 +13305,14 @@ function CroutonLocalization(language) {
|
|
|
13201
13305
|
IN_PERSON: "Presencial",
|
|
13202
13306
|
VIRTUAL: "Virtual",
|
|
13203
13307
|
},
|
|
13308
|
+
"service_body_types": {
|
|
13309
|
+
AS: "Area Service Committee",
|
|
13310
|
+
RS: "Regional Service Committee",
|
|
13311
|
+
ZF: "Zonal Forum",
|
|
13312
|
+
MA: "Metropolitan Service Committee",
|
|
13313
|
+
LS: "Local Service Forum",
|
|
13314
|
+
GS: "Group Support Forum"
|
|
13315
|
+
},
|
|
13204
13316
|
"share": "Compartilhar",
|
|
13205
13317
|
},
|
|
13206
13318
|
"ru-RU": {
|
|
@@ -13227,6 +13339,14 @@ function CroutonLocalization(language) {
|
|
|
13227
13339
|
IN_PERSON: "In Person",
|
|
13228
13340
|
VIRTUAL: "Virtual",
|
|
13229
13341
|
},
|
|
13342
|
+
"service_body_types": {
|
|
13343
|
+
AS: "Area Service Committee",
|
|
13344
|
+
RS: "Regional Service Committee",
|
|
13345
|
+
ZF: "Zonal Forum",
|
|
13346
|
+
MA: "Metropolitan Service Committee",
|
|
13347
|
+
LS: "Local Service Forum",
|
|
13348
|
+
GS: "Group Support Forum"
|
|
13349
|
+
},
|
|
13230
13350
|
"share": "share",
|
|
13231
13351
|
},
|
|
13232
13352
|
"sv-SE": {
|
|
@@ -13253,6 +13373,14 @@ function CroutonLocalization(language) {
|
|
|
13253
13373
|
IN_PERSON: "In Person",
|
|
13254
13374
|
VIRTUAL: "Virtual",
|
|
13255
13375
|
},
|
|
13376
|
+
"service_body_types": {
|
|
13377
|
+
AS: "Area Service Committee",
|
|
13378
|
+
RS: "Regional Service Committee",
|
|
13379
|
+
ZF: "Zonal Forum",
|
|
13380
|
+
MA: "Metropolitan Service Committee",
|
|
13381
|
+
LS: "Local Service Forum",
|
|
13382
|
+
GS: "Group Support Forum"
|
|
13383
|
+
},
|
|
13256
13384
|
"share": "share",
|
|
13257
13385
|
}
|
|
13258
13386
|
};
|
|
@@ -13270,6 +13398,10 @@ CroutonLocalization.prototype.getVenueType = function(type) {
|
|
|
13270
13398
|
return words[this.language]['venue_type_choices'][type];
|
|
13271
13399
|
}
|
|
13272
13400
|
|
|
13401
|
+
CroutonLocalization.prototype.getServiceBodyType = function(type) {
|
|
13402
|
+
return words[this.language]['service_body_types'][type];
|
|
13403
|
+
}
|
|
13404
|
+
|
|
13273
13405
|
this["hbs_Crouton"] = this["hbs_Crouton"] || {};
|
|
13274
13406
|
this["hbs_Crouton"]["templates"] = this["hbs_Crouton"]["templates"] || {};
|
|
13275
13407
|
this["hbs_Crouton"]["templates"]["byday"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
|
|
@@ -13733,7 +13865,7 @@ this["hbs_Crouton"]["templates"]["meetings"] = Handlebars.template({"1":function
|
|
|
13733
13865
|
+ "\"\n data-states=\""
|
|
13734
13866
|
+ alias2((lookupProperty(helpers,"formatDataPointer")||(depth0 && lookupProperty(depth0,"formatDataPointer"))||alias4).call(alias3,(depth0 != null ? lookupProperty(depth0,"location_province") : depth0),{"name":"formatDataPointer","hash":{},"data":data,"loc":{"start":{"line":12,"column":15},"end":{"line":12,"column":59}}}))
|
|
13735
13867
|
+ "\"\n data-venues=\""
|
|
13736
|
-
+ alias2((lookupProperty(helpers,"formatDataFromArray")||(depth0 && lookupProperty(depth0,"formatDataFromArray"))||alias4).call(alias3,(depth0 != null ? lookupProperty(depth0,"
|
|
13868
|
+
+ alias2((lookupProperty(helpers,"formatDataFromArray")||(depth0 && lookupProperty(depth0,"formatDataFromArray"))||alias4).call(alias3,(depth0 != null ? lookupProperty(depth0,"venue_type_name") : depth0),{"name":"formatDataFromArray","hash":{},"data":data,"loc":{"start":{"line":13,"column":15},"end":{"line":13,"column":59}}}))
|
|
13737
13869
|
+ "\"\n data-languages=\""
|
|
13738
13870
|
+ alias2((lookupProperty(helpers,"formatDataPointerFormats")||(depth0 && lookupProperty(depth0,"formatDataPointerFormats"))||alias4).call(alias3,(depth0 != null ? lookupProperty(depth0,"formats_expanded") : depth0),{"name":"formatDataPointerFormats","hash":{},"data":data,"loc":{"start":{"line":14,"column":18},"end":{"line":14,"column":68}}}))
|
|
13739
13871
|
+ "\">\n <td class=\"bmlt-column1\">\n <div class=\"bmlt-day\">"
|
|
@@ -13790,7 +13922,7 @@ this["hbs_Crouton"]["templates"]["meetings"] = Handlebars.template({"1":function
|
|
|
13790
13922
|
return undefined
|
|
13791
13923
|
};
|
|
13792
13924
|
|
|
13793
|
-
return " <a href=\"javascript:void(0);\" id=\"share-button\" class=\"btn btn-primary btn-xs\" onclick
|
|
13925
|
+
return " <a href=\"javascript:void(0);\" id=\"share-button\" class=\"btn btn-primary btn-xs\" onclick='navigator.share({ text: JSON.stringify(\""
|
|
13794
13926
|
+ alias2(alias1((depth0 != null ? lookupProperty(depth0,"formatted_day") : depth0), depth0))
|
|
13795
13927
|
+ " "
|
|
13796
13928
|
+ alias2(alias1((depth0 != null ? lookupProperty(depth0,"start_time_formatted") : depth0), depth0))
|
|
@@ -13804,11 +13936,11 @@ this["hbs_Crouton"]["templates"]["meetings"] = Handlebars.template({"1":function
|
|
|
13804
13936
|
+ alias2(alias1((depth0 != null ? lookupProperty(depth0,"formatted_address") : depth0), depth0))
|
|
13805
13937
|
+ " "
|
|
13806
13938
|
+ alias2(alias1((depth0 != null ? lookupProperty(depth0,"formatted_location_info") : depth0), depth0))
|
|
13807
|
-
+ ((stack1 = lookupProperty(helpers,"if").call(alias3,(depth0 != null ? lookupProperty(depth0,"virtual_meeting_additional_info") : depth0),{"name":"if","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":55,"column":
|
|
13808
|
-
+ "
|
|
13809
|
-
+ ((stack1 = (lookupProperty(helpers,"isVirtualOrHybrid")||(depth0 && lookupProperty(depth0,"isVirtualOrHybrid"))||alias4).call(alias3,depth0,{"name":"isVirtualOrHybrid","hash":{},"fn":container.program(8, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":55,"column":
|
|
13810
|
-
+ ((stack1 = (lookupProperty(helpers,"isInPersonOrHybrid")||(depth0 && lookupProperty(depth0,"isInPersonOrHybrid"))||alias4).call(alias3,depth0,{"name":"isInPersonOrHybrid","hash":{},"fn":container.program(13, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":55,"column":
|
|
13811
|
-
+ "
|
|
13939
|
+
+ ((stack1 = lookupProperty(helpers,"if").call(alias3,(depth0 != null ? lookupProperty(depth0,"virtual_meeting_additional_info") : depth0),{"name":"if","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":55,"column":320},"end":{"line":55,"column":412}}})) != null ? stack1 : "")
|
|
13940
|
+
+ "\"), url: \""
|
|
13941
|
+
+ ((stack1 = (lookupProperty(helpers,"isVirtualOrHybrid")||(depth0 && lookupProperty(depth0,"isVirtualOrHybrid"))||alias4).call(alias3,depth0,{"name":"isVirtualOrHybrid","hash":{},"fn":container.program(8, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":55,"column":422},"end":{"line":55,"column":609}}})) != null ? stack1 : "")
|
|
13942
|
+
+ ((stack1 = (lookupProperty(helpers,"isInPersonOrHybrid")||(depth0 && lookupProperty(depth0,"isInPersonOrHybrid"))||alias4).call(alias3,depth0,{"name":"isInPersonOrHybrid","hash":{},"fn":container.program(13, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":55,"column":609},"end":{"line":55,"column":792}}})) != null ? stack1 : "")
|
|
13943
|
+
+ "\"})'><span class=\"glyphicon glyphicon-share\"></span> "
|
|
13812
13944
|
+ alias2(alias1((depth0 != null ? lookupProperty(depth0,"share_word") : depth0), depth0))
|
|
13813
13945
|
+ "</a>\n";
|
|
13814
13946
|
},"6":function(container,depth0,helpers,partials,data) {
|
|
@@ -13829,8 +13961,8 @@ this["hbs_Crouton"]["templates"]["meetings"] = Handlebars.template({"1":function
|
|
|
13829
13961
|
return undefined
|
|
13830
13962
|
};
|
|
13831
13963
|
|
|
13832
|
-
return ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"virtual_meeting_link") : depth0),{"name":"if","hash":{},"fn":container.program(9, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":55,"column":
|
|
13833
|
-
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"phone_meeting_number") : depth0),{"name":"if","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":55,"column":
|
|
13964
|
+
return ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"virtual_meeting_link") : depth0),{"name":"if","hash":{},"fn":container.program(9, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":55,"column":449},"end":{"line":55,"column":518}}})) != null ? stack1 : "")
|
|
13965
|
+
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"phone_meeting_number") : depth0),{"name":"if","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":55,"column":518},"end":{"line":55,"column":587}}})) != null ? stack1 : "");
|
|
13834
13966
|
},"9":function(container,depth0,helpers,partials,data) {
|
|
13835
13967
|
var lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
13836
13968
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
@@ -14037,15 +14169,17 @@ function Crouton(config) {
|
|
|
14037
14169
|
self.searchByCoordinates = function(latitude, longitude) {
|
|
14038
14170
|
var width = self.config['map_search']['width'] || -50;
|
|
14039
14171
|
|
|
14040
|
-
self.config['custom_query'] = self.config['custom_query']
|
|
14172
|
+
self.config['custom_query'] = (self.config['custom_query'] !== null ? self.config['custom_query'] : "")
|
|
14173
|
+
+ "&lat_val=" + latitude + "&long_val=" + longitude
|
|
14041
14174
|
+ (self.config['distance_units'] === "km" ? '&geo_width_km=' : '&geo_width=') + width;
|
|
14042
|
-
self.meetingSearch(
|
|
14043
|
-
|
|
14044
|
-
|
|
14045
|
-
|
|
14046
|
-
self.
|
|
14175
|
+
self.meetingSearch()
|
|
14176
|
+
.then(function() {
|
|
14177
|
+
self.reset();
|
|
14178
|
+
self.render();
|
|
14179
|
+
self.initMap(function() {
|
|
14180
|
+
self.addCurrentLocationPin(latitude, longitude);
|
|
14181
|
+
});
|
|
14047
14182
|
});
|
|
14048
|
-
});
|
|
14049
14183
|
};
|
|
14050
14184
|
|
|
14051
14185
|
self.addCurrentLocationPin = function(latitude, longitude) {
|
|
@@ -14112,38 +14246,44 @@ function Crouton(config) {
|
|
|
14112
14246
|
//infoWindow.close();
|
|
14113
14247
|
};
|
|
14114
14248
|
|
|
14115
|
-
self.getMeetings = function(url
|
|
14116
|
-
|
|
14117
|
-
|
|
14118
|
-
|
|
14119
|
-
|
|
14120
|
-
|
|
14121
|
-
|
|
14249
|
+
self.getMeetings = function(url) {
|
|
14250
|
+
var promises = [fetchJsonp(this.config['root_server'] + url).then(function(response) { return response.json(); })];
|
|
14251
|
+
|
|
14252
|
+
if (self.config['extra_meetings'].length > 0) {
|
|
14253
|
+
var extra_meetings_query = "";
|
|
14254
|
+
for (var i = 0; i < self.config['extra_meetings'].length; i++) {
|
|
14255
|
+
extra_meetings_query += "&meeting_ids[]=" + self.config["extra_meetings"][i];
|
|
14122
14256
|
}
|
|
14123
|
-
|
|
14124
|
-
|
|
14125
|
-
|
|
14126
|
-
|
|
14127
|
-
|
|
14128
|
-
var
|
|
14129
|
-
|
|
14130
|
-
|
|
14257
|
+
promises.push(fetchJsonp(self.config['root_server'] + url + extra_meetings_query).then(function (response) { return response.json(); }));
|
|
14258
|
+
}
|
|
14259
|
+
|
|
14260
|
+
return Promise.all(promises)
|
|
14261
|
+
.then(function(data) {
|
|
14262
|
+
var mainMeetings = data[0];
|
|
14263
|
+
var extraMeetings;
|
|
14264
|
+
if (data.length === 2) {
|
|
14265
|
+
extraMeetings = data[1];
|
|
14266
|
+
}
|
|
14267
|
+
if (JSON.stringify(mainMeetings['meetings']) === "{}") {
|
|
14268
|
+
var fullUrl = self.config['root_server'] + url
|
|
14269
|
+
console.log("Could not find any meetings for the criteria specified with the query <a href=\"" + fullUrl + "\" target=_blank>" + fullUrl + "</a>");
|
|
14270
|
+
jQuery('#' + self.config['placeholder_id']).html("No meetings found.");
|
|
14271
|
+
return;
|
|
14272
|
+
}
|
|
14273
|
+
mainMeetings['meetings'].exclude(self.config['exclude_zip_codes'], "location_postal_code_1");
|
|
14274
|
+
self.meetingData = mainMeetings['meetings'];
|
|
14275
|
+
self.formatsData = mainMeetings['formats'];
|
|
14276
|
+
|
|
14277
|
+
if (extraMeetings) {
|
|
14278
|
+
self.meetingData = self.meetingData.concat(extraMeetings['meetings']);
|
|
14131
14279
|
}
|
|
14132
|
-
jQuery.getJSON(self.config['root_server'] + url + '&callback=?' + extra_meetings_query, function (data) {
|
|
14133
|
-
self.meetingData = self.meetingData.concat(data);
|
|
14134
|
-
self.mutex = false;
|
|
14135
|
-
callback();
|
|
14136
|
-
});
|
|
14137
|
-
} else {
|
|
14138
14280
|
self.mutex = false;
|
|
14139
|
-
|
|
14140
|
-
}
|
|
14141
|
-
});
|
|
14281
|
+
});
|
|
14142
14282
|
};
|
|
14143
14283
|
self.mutex = true;
|
|
14144
14284
|
|
|
14145
|
-
self.meetingSearch = function(
|
|
14146
|
-
var
|
|
14285
|
+
self.meetingSearch = function() {
|
|
14286
|
+
var base_data_field_keys = [
|
|
14147
14287
|
'location_postal_code_1',
|
|
14148
14288
|
'duration_time',
|
|
14149
14289
|
'start_time',
|
|
@@ -14166,20 +14306,55 @@ function Crouton(config) {
|
|
|
14166
14306
|
'worldid_mixed',
|
|
14167
14307
|
'root_server_uri',
|
|
14168
14308
|
'id_bigint',
|
|
14309
|
+
'venue_type',
|
|
14169
14310
|
];
|
|
14170
14311
|
|
|
14171
|
-
var
|
|
14172
|
-
|
|
14173
|
-
|
|
14174
|
-
|
|
14175
|
-
|
|
14176
|
-
|
|
14177
|
-
|
|
14178
|
-
|
|
14179
|
-
|
|
14312
|
+
var calculated_keys = [
|
|
14313
|
+
"serviceBodyName",
|
|
14314
|
+
"serviceBodyUrl",
|
|
14315
|
+
"serviceBodyPhone",
|
|
14316
|
+
"serviceBodyDescription",
|
|
14317
|
+
"serviceBodyType",
|
|
14318
|
+
"parentServiceBodyName",
|
|
14319
|
+
"parentServiceBodyUrl",
|
|
14320
|
+
"parentServiceBodyPhone",
|
|
14321
|
+
"parentServiceBodyDescription",
|
|
14322
|
+
"parentServiceBodyType",
|
|
14323
|
+
"map_word",
|
|
14324
|
+
"share_word",
|
|
14325
|
+
"show_qrcode",
|
|
14326
|
+
"formatted_day",
|
|
14327
|
+
"formatted_address",
|
|
14328
|
+
"formats_expanded",
|
|
14329
|
+
"formatted_location_info",
|
|
14330
|
+
"end_time_formatted",
|
|
14331
|
+
"start_time_formatted",
|
|
14332
|
+
"formatted_comments",
|
|
14333
|
+
"start_time_raw",
|
|
14334
|
+
"venue_type_name",
|
|
14335
|
+
"day_of_the_week",
|
|
14336
|
+
];
|
|
14337
|
+
|
|
14338
|
+
self.all_data_keys = base_data_field_keys.clone();
|
|
14339
|
+
self.queryable_data_keys = base_data_field_keys.clone();
|
|
14340
|
+
|
|
14341
|
+
self.collectDataKeys = function(template) {
|
|
14342
|
+
var extra_fields_regex = /this\.([A-Za-z0-9_]*)}}/gi;
|
|
14343
|
+
while (arr = extra_fields_regex.exec(template)) {
|
|
14344
|
+
self.all_data_keys.push(arr[1]);
|
|
14345
|
+
if (!inArray(arr[1], calculated_keys)) {
|
|
14346
|
+
self.queryable_data_keys.push(arr[1]);
|
|
14347
|
+
}
|
|
14348
|
+
}
|
|
14180
14349
|
}
|
|
14350
|
+
|
|
14351
|
+
self.collectDataKeys(self.config['meeting_data_template']);
|
|
14352
|
+
self.collectDataKeys(self.config['metadata_template']);
|
|
14353
|
+
self.collectDataKeys(self.config['observer_template']);
|
|
14354
|
+
|
|
14355
|
+
var unique_data_field_keys = arrayUnique(self.queryable_data_keys);
|
|
14181
14356
|
var url = '/client_interface/jsonp/?switcher=GetSearchResults&get_used_formats&lang_enum=' + self.config['short_language'] +
|
|
14182
|
-
'&data_field_key=' +
|
|
14357
|
+
'&data_field_key=' + unique_data_field_keys.join(',');
|
|
14183
14358
|
|
|
14184
14359
|
if (self.config['int_include_unpublished'] === 1) {
|
|
14185
14360
|
url += "&advanced_published=0"
|
|
@@ -14189,18 +14364,20 @@ function Crouton(config) {
|
|
|
14189
14364
|
|
|
14190
14365
|
if (self.config['distance_search'] !== 0) {
|
|
14191
14366
|
if (navigator.geolocation) {
|
|
14192
|
-
|
|
14367
|
+
return new Promise(function (resolve, reject) {
|
|
14368
|
+
navigator.geolocation.getCurrentPosition(resolve, reject);
|
|
14369
|
+
}).then(function(position) {
|
|
14193
14370
|
url += '&lat_val=' + position.coords.latitude
|
|
14194
14371
|
+ '&long_val=' + position.coords.longitude
|
|
14195
14372
|
+ '&sort_results_by_distance=1';
|
|
14196
14373
|
|
|
14197
14374
|
url += (self.config['distance_units'] === "km" ? '&geo_width_km=' : '&geo_width=') + self.config['distance_search'];
|
|
14198
|
-
self.getMeetings(url
|
|
14199
|
-
}
|
|
14375
|
+
return self.getMeetings(url);
|
|
14376
|
+
});
|
|
14200
14377
|
}
|
|
14201
14378
|
} else if (self.config['custom_query'] != null) {
|
|
14202
14379
|
url += self.config['custom_query'] + '&sort_keys=' + self.config['sort_keys'];
|
|
14203
|
-
self.getMeetings(url
|
|
14380
|
+
return self.getMeetings(url);
|
|
14204
14381
|
} else if (self.config['service_body'].length > 0) {
|
|
14205
14382
|
for (var i = 0; i < self.config['service_body'].length; i++) {
|
|
14206
14383
|
url += '&services[]=' + self.config['service_body'][i];
|
|
@@ -14212,14 +14389,18 @@ function Crouton(config) {
|
|
|
14212
14389
|
|
|
14213
14390
|
url += '&sort_keys=' + self.config['sort_keys'];
|
|
14214
14391
|
|
|
14215
|
-
self.getMeetings(url
|
|
14392
|
+
return self.getMeetings(url);
|
|
14393
|
+
} else {
|
|
14394
|
+
return new Promise(function(resolve, reject) {
|
|
14395
|
+
resolve();
|
|
14396
|
+
});
|
|
14216
14397
|
}
|
|
14217
14398
|
};
|
|
14218
14399
|
|
|
14219
14400
|
if (self.config['map_search'] !== null) {
|
|
14220
14401
|
self.loadGapi('crouton.renderMap');
|
|
14221
14402
|
} else {
|
|
14222
|
-
self.meetingSearch(
|
|
14403
|
+
self.meetingSearch();
|
|
14223
14404
|
}
|
|
14224
14405
|
|
|
14225
14406
|
self.lock = function(callback) {
|
|
@@ -14350,16 +14531,30 @@ function Crouton(config) {
|
|
|
14350
14531
|
callback();
|
|
14351
14532
|
};
|
|
14352
14533
|
|
|
14353
|
-
self.getServiceBodies = function
|
|
14354
|
-
|
|
14355
|
-
|
|
14534
|
+
self.getServiceBodies = function(service_bodies_id) {
|
|
14535
|
+
var requires_parents = false;
|
|
14536
|
+
for (var i = 0; i < self.all_data_keys.length; i++) {
|
|
14537
|
+
var data_key = self.all_data_keys[i];
|
|
14538
|
+
if (data_key.indexOf("parentServiceBody") >= 0) {
|
|
14539
|
+
requires_parents = true;
|
|
14540
|
+
break;
|
|
14541
|
+
}
|
|
14542
|
+
}
|
|
14543
|
+
|
|
14544
|
+
var url = this.config['root_server'] + '/client_interface/jsonp/?switcher=GetServiceBodies'
|
|
14545
|
+
+ (requires_parents ? '&parents=1' : '') + getServiceBodiesQueryString(service_bodies_id);
|
|
14546
|
+
return fetchJsonp(url)
|
|
14547
|
+
.then(function(response) {
|
|
14548
|
+
return response.json();
|
|
14549
|
+
});
|
|
14356
14550
|
};
|
|
14357
14551
|
|
|
14358
|
-
self.getMasterFormats = function
|
|
14359
|
-
|
|
14360
|
-
|
|
14361
|
-
|
|
14362
|
-
|
|
14552
|
+
self.getMasterFormats = function() {
|
|
14553
|
+
var url = this.config['root_server'] + '/client_interface/jsonp/?switcher=GetFormats&lang_enum=en&key_strings[]=TC&key_strings[]=VM&key_strings[]=HY';
|
|
14554
|
+
return fetchJsonp(url)
|
|
14555
|
+
.then(function(response) {
|
|
14556
|
+
return response.json();
|
|
14557
|
+
});
|
|
14363
14558
|
}
|
|
14364
14559
|
|
|
14365
14560
|
self.showLocation = function(position) {
|
|
@@ -14460,7 +14655,8 @@ function Crouton(config) {
|
|
|
14460
14655
|
}
|
|
14461
14656
|
}
|
|
14462
14657
|
|
|
14463
|
-
meetingData[m]['venue_type'] =
|
|
14658
|
+
meetingData[m]['venue_type'] = parseInt(meetingData[m]['venue_type']);
|
|
14659
|
+
meetingData[m]['venue_type_name'] = getVenueTypeName(meetingData[m]);
|
|
14464
14660
|
meetingData[m]['formats_expanded'] = formats_expanded;
|
|
14465
14661
|
var addressParts = [
|
|
14466
14662
|
meetingData[m]['location_street'],
|
|
@@ -14485,6 +14681,23 @@ function Crouton(config) {
|
|
|
14485
14681
|
}
|
|
14486
14682
|
}
|
|
14487
14683
|
}
|
|
14684
|
+
|
|
14685
|
+
var serviceBodyInfo = self.getServiceBodyDetails(meetingData[m]['service_body_bigint'])
|
|
14686
|
+
meetingData[m]['serviceBodyUrl'] = serviceBodyInfo["url"];
|
|
14687
|
+
meetingData[m]['serviceBodyPhone'] = serviceBodyInfo["helpline"];
|
|
14688
|
+
meetingData[m]['serviceBodyName'] = serviceBodyInfo["name"];
|
|
14689
|
+
meetingData[m]['serviceBodyDescription'] = serviceBodyInfo["description"];
|
|
14690
|
+
meetingData[m]['serviceBodyType'] = self.localization.getServiceBodyType(serviceBodyInfo["type"]);
|
|
14691
|
+
|
|
14692
|
+
var parentBodyInfo = self.getServiceBodyDetails(serviceBodyInfo["parent_id"]);
|
|
14693
|
+
if (parentBodyInfo !== undefined) {
|
|
14694
|
+
meetingData[m]['parentServiceBodyUrl'] = parentBodyInfo["url"];
|
|
14695
|
+
meetingData[m]['parentServiceBodyPhone'] = parentBodyInfo["helpline"];
|
|
14696
|
+
meetingData[m]['parentServiceBodyName'] = parentBodyInfo["name"];
|
|
14697
|
+
meetingData[m]['parentServiceBodyDescription'] = parentBodyInfo["description"];
|
|
14698
|
+
meetingData[m]['parentServiceBodyType'] = self.localization.getServiceBodyType(parentBodyInfo["type"]);
|
|
14699
|
+
}
|
|
14700
|
+
|
|
14488
14701
|
meetings.push(meetingData[m])
|
|
14489
14702
|
}
|
|
14490
14703
|
|
|
@@ -14508,7 +14721,9 @@ function Crouton(config) {
|
|
|
14508
14721
|
Crouton.prototype.setConfig = function(config) {
|
|
14509
14722
|
var self = this;
|
|
14510
14723
|
for (var propertyName in config) {
|
|
14511
|
-
if (propertyName.indexOf("
|
|
14724
|
+
if (propertyName.indexOf("_template") > 0 && config[propertyName].trim() === "") {
|
|
14725
|
+
continue;
|
|
14726
|
+
} else if (propertyName.indexOf("int_") === -1) {
|
|
14512
14727
|
if (config[propertyName] === "1" || config[propertyName] === 1) {
|
|
14513
14728
|
self.config[propertyName] = true;
|
|
14514
14729
|
} else if (config[propertyName] === "0" || config[propertyName] === 0) {
|
|
@@ -14581,7 +14796,7 @@ Crouton.prototype.serviceBodyNames = function(callback) {
|
|
|
14581
14796
|
var self = this;
|
|
14582
14797
|
self.lock(function() {
|
|
14583
14798
|
var ids = getUniqueValuesOfKey(self.meetingData, 'service_body_bigint');
|
|
14584
|
-
self.getServiceBodies(ids
|
|
14799
|
+
self.getServiceBodies(ids).then(function (service_bodies) {
|
|
14585
14800
|
var n = service_bodies.length;
|
|
14586
14801
|
var names = [];
|
|
14587
14802
|
for (var i = 0; i < n; i++) {
|
|
@@ -14606,7 +14821,17 @@ Crouton.prototype.serviceBodyNames = function(callback) {
|
|
|
14606
14821
|
});
|
|
14607
14822
|
};
|
|
14608
14823
|
|
|
14609
|
-
Crouton.prototype.
|
|
14824
|
+
Crouton.prototype.getServiceBodyDetails = function(serviceBodyId) {
|
|
14825
|
+
var self = this;
|
|
14826
|
+
for (var s = 0; s < self.all_service_bodies.length; s++) {
|
|
14827
|
+
var service_body = self.all_service_bodies[s];
|
|
14828
|
+
if (service_body['id'] === serviceBodyId) {
|
|
14829
|
+
return service_body;
|
|
14830
|
+
}
|
|
14831
|
+
}
|
|
14832
|
+
}
|
|
14833
|
+
|
|
14834
|
+
Crouton.prototype.render = function() {
|
|
14610
14835
|
var self = this;
|
|
14611
14836
|
self.lock(function() {
|
|
14612
14837
|
var body = jQuery("body");
|
|
@@ -14620,6 +14845,10 @@ Crouton.prototype.render = function(callback) {
|
|
|
14620
14845
|
self.showMessage("No meetings found for parameters specified.");
|
|
14621
14846
|
return;
|
|
14622
14847
|
}
|
|
14848
|
+
|
|
14849
|
+
var unique_service_bodies_ids = getUniqueValuesOfKey(self.meetingData, 'service_body_bigint').sort();
|
|
14850
|
+
var promises = [self.getMasterFormats(), self.getServiceBodies(unique_service_bodies_ids)];
|
|
14851
|
+
|
|
14623
14852
|
self.uniqueData = {
|
|
14624
14853
|
'groups': getUniqueValuesOfKey(self.meetingData, 'meeting_name').sort(),
|
|
14625
14854
|
'cities': getUniqueValuesOfKey(self.meetingData, 'location_municipality').sort(),
|
|
@@ -14628,22 +14857,26 @@ Crouton.prototype.render = function(callback) {
|
|
|
14628
14857
|
'neighborhoods': getUniqueValuesOfKey(self.meetingData, 'location_neighborhood').sort(),
|
|
14629
14858
|
'states': getUniqueValuesOfKey(self.meetingData, 'location_province').sort(),
|
|
14630
14859
|
'zips': getUniqueValuesOfKey(self.meetingData, 'location_postal_code_1').sort(),
|
|
14631
|
-
'unique_service_bodies_ids':
|
|
14860
|
+
'unique_service_bodies_ids': unique_service_bodies_ids,
|
|
14632
14861
|
'venue_types': getValuesFromObject(crouton.localization.getWord("venue_type_choices")).sort()
|
|
14633
14862
|
};
|
|
14634
|
-
|
|
14635
|
-
|
|
14636
|
-
|
|
14637
|
-
|
|
14863
|
+
|
|
14864
|
+
Promise.all(promises)
|
|
14865
|
+
.then(function(data) {
|
|
14866
|
+
self.active_service_bodies = [];
|
|
14867
|
+
self.all_service_bodies = [];
|
|
14868
|
+
self.masterFormatCodes = data[0];
|
|
14869
|
+
var service_bodies = data[1];
|
|
14638
14870
|
for (var i = 0; i < service_bodies.length; i++) {
|
|
14871
|
+
self.all_service_bodies.push(service_bodies[i]);
|
|
14639
14872
|
for (var j = 0; j < self.uniqueData['unique_service_bodies_ids'].length; j++) {
|
|
14640
14873
|
if (service_bodies[i]["id"] === self.uniqueData['unique_service_bodies_ids'][j]) {
|
|
14641
|
-
active_service_bodies.push(service_bodies[i]);
|
|
14874
|
+
self.active_service_bodies.push(service_bodies[i]);
|
|
14642
14875
|
}
|
|
14643
14876
|
}
|
|
14644
14877
|
}
|
|
14645
14878
|
|
|
14646
|
-
self.uniqueData['areas'] = active_service_bodies.sortByKey('name');
|
|
14879
|
+
self.uniqueData['areas'] = self.active_service_bodies.sortByKey('name');
|
|
14647
14880
|
if (!jQuery.isEmptyObject(self.formatsData)) {
|
|
14648
14881
|
self.formatsData = self.formatsData.sortByKey('name_string');
|
|
14649
14882
|
}
|
|
@@ -14820,7 +15053,6 @@ Crouton.prototype.render = function(callback) {
|
|
|
14820
15053
|
});
|
|
14821
15054
|
});
|
|
14822
15055
|
});
|
|
14823
|
-
});
|
|
14824
15056
|
};
|
|
14825
15057
|
|
|
14826
15058
|
Crouton.prototype.mapSearchClickMode = function() {
|
|
@@ -14870,61 +15102,67 @@ Crouton.prototype.mapSearchTextMode = function(location) {
|
|
|
14870
15102
|
Crouton.prototype.renderMap = function() {
|
|
14871
15103
|
var self = this;
|
|
14872
15104
|
jQuery("#bmlt-tabs").before("<div id='bmlt-map' class='bmlt-map'></div>");
|
|
14873
|
-
|
|
14874
15105
|
self.geocoder = new google.maps.Geocoder();
|
|
14875
|
-
self.
|
|
14876
|
-
|
|
14877
|
-
|
|
14878
|
-
lat: self.config['map_search']['latitude'],
|
|
14879
|
-
lng: self.config['map_search']['longitude'],
|
|
14880
|
-
},
|
|
14881
|
-
mapTypeControl: false,
|
|
14882
|
-
});
|
|
14883
|
-
|
|
14884
|
-
var controlDiv = document.createElement('div');
|
|
14885
|
-
|
|
14886
|
-
// Set CSS for the control border
|
|
14887
|
-
var controlUI = document.createElement('div');
|
|
14888
|
-
controlUI.className = 'mapcontrolcontainer';
|
|
14889
|
-
controlUI.title = 'Click to recenter the map';
|
|
14890
|
-
controlDiv.appendChild(controlUI);
|
|
14891
|
-
|
|
14892
|
-
// Set CSS for the control interior
|
|
14893
|
-
var clickSearch = document.createElement('div');
|
|
14894
|
-
clickSearch.className = 'mapcontrols';
|
|
14895
|
-
clickSearch.innerHTML = '<label for="nearme" class="mapcontrolslabel"><input type="radio" id="nearme" name="mapcontrols"> ' + self.localization.getWord('near_me') + '</label><label for="textsearch" class="mapcontrolslabel"><input type="radio" id="textsearch" name="mapcontrols"> ' + self.localization.getWord('text_search') + '</label><label for="clicksearch" class="mapcontrolslabel"><input type="radio" id="clicksearch" name="mapcontrols"> ' + self.localization.getWord('click_search') + '</label><label for="panzoom" class="mapcontrolslabel"><input type="radio" id="panzoom" name="mapcontrols" checked> ' + self.localization.getWord('pan_and_zoom') + '</label>';
|
|
14896
|
-
controlUI.appendChild(clickSearch);
|
|
14897
|
-
controlDiv.index = 1;
|
|
14898
|
-
|
|
14899
|
-
google.maps.event.addDomListener(clickSearch, 'click', function() {
|
|
14900
|
-
var controlsButtonSelections = jQuery("input:radio[name='mapcontrols']:checked").attr("id");
|
|
14901
|
-
if (controlsButtonSelections === "textsearch") {
|
|
14902
|
-
self.mapSearchTextMode(prompt("Enter a location or postal code:"));
|
|
14903
|
-
} else if (controlsButtonSelections === "nearme") {
|
|
14904
|
-
self.mapSearchNearMeMode();
|
|
14905
|
-
} else if (controlsButtonSelections === "clicksearch") {
|
|
14906
|
-
self.mapSearchClickMode();
|
|
14907
|
-
} else if (controlsButtonSelections === "panzoom") {
|
|
14908
|
-
self.mapSearchPanZoomMode();
|
|
15106
|
+
jQuery.when(jQuery.getJSON(self.config['template_path'] + "/themes/" + self.config['theme'] + ".json").then(
|
|
15107
|
+
function (data, textStatus, jqXHR) {
|
|
15108
|
+
return self.config["theme_js"] = data["google_map_theme"];
|
|
14909
15109
|
}
|
|
14910
|
-
|
|
15110
|
+
)).then(function() {
|
|
15111
|
+
self.map = new google.maps.Map(document.getElementById('bmlt-map'), {
|
|
15112
|
+
zoom: self.config['map_search']['zoom'] || 10,
|
|
15113
|
+
center: {
|
|
15114
|
+
lat: self.config['map_search']['latitude'],
|
|
15115
|
+
lng: self.config['map_search']['longitude'],
|
|
15116
|
+
},
|
|
15117
|
+
mapTypeControl: false,
|
|
15118
|
+
styles: self.config["theme_js"]
|
|
15119
|
+
});
|
|
14911
15120
|
|
|
14912
|
-
|
|
14913
|
-
|
|
14914
|
-
|
|
14915
|
-
|
|
14916
|
-
|
|
14917
|
-
|
|
14918
|
-
|
|
14919
|
-
|
|
15121
|
+
var controlDiv = document.createElement('div');
|
|
15122
|
+
|
|
15123
|
+
// Set CSS for the control border
|
|
15124
|
+
var controlUI = document.createElement('div');
|
|
15125
|
+
controlUI.className = 'mapcontrolcontainer';
|
|
15126
|
+
controlUI.title = 'Click to recenter the map';
|
|
15127
|
+
controlDiv.appendChild(controlUI);
|
|
15128
|
+
|
|
15129
|
+
// Set CSS for the control interior
|
|
15130
|
+
var clickSearch = document.createElement('div');
|
|
15131
|
+
clickSearch.className = 'mapcontrols';
|
|
15132
|
+
clickSearch.innerHTML = '<label for="nearme" class="mapcontrolslabel"><input type="radio" id="nearme" name="mapcontrols"> ' + self.localization.getWord('near_me') + '</label><label for="textsearch" class="mapcontrolslabel"><input type="radio" id="textsearch" name="mapcontrols"> ' + self.localization.getWord('text_search') + '</label><label for="clicksearch" class="mapcontrolslabel"><input type="radio" id="clicksearch" name="mapcontrols"> ' + self.localization.getWord('click_search') + '</label><label for="panzoom" class="mapcontrolslabel"><input type="radio" id="panzoom" name="mapcontrols" checked> ' + self.localization.getWord('pan_and_zoom') + '</label>';
|
|
15133
|
+
controlUI.appendChild(clickSearch);
|
|
15134
|
+
controlDiv.index = 1;
|
|
15135
|
+
|
|
15136
|
+
google.maps.event.addDomListener(clickSearch, 'click', function () {
|
|
15137
|
+
var controlsButtonSelections = jQuery("input:radio[name='mapcontrols']:checked").attr("id");
|
|
15138
|
+
if (controlsButtonSelections === "textsearch") {
|
|
15139
|
+
self.mapSearchTextMode(prompt("Enter a location or postal code:"));
|
|
15140
|
+
} else if (controlsButtonSelections === "nearme") {
|
|
15141
|
+
self.mapSearchNearMeMode();
|
|
15142
|
+
} else if (controlsButtonSelections === "clicksearch") {
|
|
15143
|
+
self.mapSearchClickMode();
|
|
15144
|
+
} else if (controlsButtonSelections === "panzoom") {
|
|
15145
|
+
self.mapSearchPanZoomMode();
|
|
15146
|
+
}
|
|
15147
|
+
});
|
|
14920
15148
|
|
|
14921
|
-
|
|
14922
|
-
self.
|
|
14923
|
-
|
|
14924
|
-
|
|
14925
|
-
|
|
14926
|
-
|
|
14927
|
-
|
|
15149
|
+
self.map.controls[google.maps.ControlPosition.TOP_LEFT].push(controlDiv);
|
|
15150
|
+
self.map.addListener('click', function (data) {
|
|
15151
|
+
if (self.mapClickSearchMode) {
|
|
15152
|
+
self.mapSearchPanZoomMode();
|
|
15153
|
+
jQuery("#panzoom").prop("checked", true);
|
|
15154
|
+
self.searchByCoordinates(data.latLng.lat(), data.latLng.lng());
|
|
15155
|
+
}
|
|
15156
|
+
});
|
|
15157
|
+
|
|
15158
|
+
if (self.config['map_search']['auto']) {
|
|
15159
|
+
self.mapSearchNearMeMode();
|
|
15160
|
+
} else if (self.config['map_search']['location'] !== undefined) {
|
|
15161
|
+
self.mapSearchTextMode(self.config['map_search']['location']);
|
|
15162
|
+
} else if (self.config['map_search']['coordinates_search']) {
|
|
15163
|
+
self.searchByCoordinates(self.config['map_search']['latitude'], self.config['map_search']['longitude']);
|
|
15164
|
+
}
|
|
15165
|
+
})
|
|
14928
15166
|
};
|
|
14929
15167
|
|
|
14930
15168
|
Crouton.prototype.initMap = function(callback) {
|
|
@@ -15079,6 +15317,7 @@ function getFalseResult(options, ctx) {
|
|
|
15079
15317
|
return options.inverse !== undefined ? options.inverse(ctx) : false;
|
|
15080
15318
|
}
|
|
15081
15319
|
|
|
15320
|
+
// [deprecated] Retire after root server 2.16.4 is rolled out everywhere.
|
|
15082
15321
|
function getMasterFormatId(code, data) {
|
|
15083
15322
|
for (var f = 0; f < crouton.masterFormatCodes.length; f++) {
|
|
15084
15323
|
var format = crouton.masterFormatCodes[f];
|
|
@@ -15088,18 +15327,25 @@ function getMasterFormatId(code, data) {
|
|
|
15088
15327
|
}
|
|
15089
15328
|
}
|
|
15090
15329
|
|
|
15091
|
-
|
|
15330
|
+
// [deprecated] Retire after root server 2.16.4 is rolled out everywhere.
|
|
15331
|
+
var masterFormatVenueType = {
|
|
15092
15332
|
IN_PERSON: "IN_PERSON",
|
|
15093
15333
|
VIRTUAL: "VIRTUAL",
|
|
15094
15334
|
}
|
|
15095
15335
|
|
|
15096
|
-
|
|
15097
|
-
|
|
15098
|
-
|
|
15099
|
-
|
|
15100
|
-
|
|
15336
|
+
var venueType = {
|
|
15337
|
+
IN_PERSON: 1,
|
|
15338
|
+
VIRTUAL: 2,
|
|
15339
|
+
HYBRID: 3,
|
|
15340
|
+
}
|
|
15341
|
+
|
|
15342
|
+
function getVenueTypeName(data) {
|
|
15343
|
+
if (data['venue_type'] === venueType.HYBRID || inArray(getMasterFormatId('HY', data), getFormats(data))) {
|
|
15344
|
+
return [crouton.localization.getVenueType(masterFormatVenueType.VIRTUAL), crouton.localization.getVenueType(masterFormatVenueType.IN_PERSON)];
|
|
15345
|
+
} else if (data['venue_type'] === venueType.VIRTUAL || inArray(getMasterFormatId('VM', data), getFormats(data))) {
|
|
15346
|
+
return [crouton.localization.getVenueType(masterFormatVenueType.VIRTUAL)];
|
|
15101
15347
|
} else {
|
|
15102
|
-
return [crouton.localization.getVenueType(
|
|
15348
|
+
return [crouton.localization.getVenueType(masterFormatVenueType.IN_PERSON)];
|
|
15103
15349
|
}
|
|
15104
15350
|
}
|
|
15105
15351
|
|
|
@@ -15128,8 +15374,8 @@ crouton_Handlebars.registerHelper('canShare', function(data, options) {
|
|
|
15128
15374
|
* @deprecated Since version 3.12.2, will be removed in a future version.
|
|
15129
15375
|
*/
|
|
15130
15376
|
crouton_Handlebars.registerHelper('isVirtual', function(data, options) {
|
|
15131
|
-
return ((inArray(getMasterFormatId('HY', data), getFormats(data)) && !inArray(getMasterFormatId('TC', data), getFormats(data)))
|
|
15132
|
-
|| inArray(getMasterFormatId('VM', data), getFormats(data)))
|
|
15377
|
+
return ((data['venue_type'] === venueType.HYBRID || data['venue_type'] === venueType.VIRTUAL) || ((inArray(getMasterFormatId('HY', data), getFormats(data)) && !inArray(getMasterFormatId('TC', data), getFormats(data)))
|
|
15378
|
+
|| inArray(getMasterFormatId('VM', data), getFormats(data))))
|
|
15133
15379
|
&& (data['virtual_meeting_link'] || data['phone_meeting_number'] || data['virtual_meeting_additional_info']) ? getTrueResult(options, this) : getFalseResult(options, this);
|
|
15134
15380
|
});
|
|
15135
15381
|
|
|
@@ -15137,21 +15383,21 @@ crouton_Handlebars.registerHelper('isVirtual', function(data, options) {
|
|
|
15137
15383
|
* Assumes consistent set of venue type formats (enforced for newly edited meetings in root server 2.16.0 or greater)
|
|
15138
15384
|
*/
|
|
15139
15385
|
crouton_Handlebars.registerHelper('isVirtualOnly', function(data, options) {
|
|
15140
|
-
return inArray(getMasterFormatId('VM', data), getFormats(data)) ? getTrueResult(options, this) : getFalseResult(options, this);
|
|
15386
|
+
return data['venue_type'] === venueType.VIRTUAL || inArray(getMasterFormatId('VM', data), getFormats(data)) ? getTrueResult(options, this) : getFalseResult(options, this);
|
|
15141
15387
|
});
|
|
15142
15388
|
|
|
15143
15389
|
/**
|
|
15144
15390
|
* @deprecated Since version 3.12.2 will be removed in a future version.
|
|
15145
15391
|
*/
|
|
15146
15392
|
crouton_Handlebars.registerHelper('isHybrid', function(data, options) {
|
|
15147
|
-
return inArray(getMasterFormatId('HY', data), getFormats(data)) ? getTrueResult(options, this) : getFalseResult(options, this);
|
|
15393
|
+
return data['venue_type'] === venueType.HYBRID || inArray(getMasterFormatId('HY', data), getFormats(data)) ? getTrueResult(options, this) : getFalseResult(options, this);
|
|
15148
15394
|
});
|
|
15149
15395
|
|
|
15150
15396
|
/**
|
|
15151
15397
|
* Assumes consistent set of venue type formats (enforced for newly edited meetings in root server 2.16.0 or greater)
|
|
15152
15398
|
*/
|
|
15153
15399
|
crouton_Handlebars.registerHelper('isHybridOnly', function(data, options) {
|
|
15154
|
-
return inArray(getMasterFormatId('HY', data), getFormats(data)) ? getTrueResult(options, this) : getFalseResult(options, this);
|
|
15400
|
+
return data['venue_type'] === venueType.HYBRID || inArray(getMasterFormatId('HY', data), getFormats(data)) ? getTrueResult(options, this) : getFalseResult(options, this);
|
|
15155
15401
|
});
|
|
15156
15402
|
|
|
15157
15403
|
crouton_Handlebars.registerHelper('isTemporarilyClosed', function(data, options) {
|
|
@@ -15166,22 +15412,22 @@ crouton_Handlebars.registerHelper('isNotTemporarilyClosed', function(data, optio
|
|
|
15166
15412
|
* Assumes consistent set of venue type formats (enforced for newly edited meetings in root server 2.16.0 or greater)
|
|
15167
15413
|
*/
|
|
15168
15414
|
crouton_Handlebars.registerHelper('isInPersonOrHybrid', function(data, options) {
|
|
15169
|
-
return !inArray(getMasterFormatId('VM', data), getFormats(data)) ? getTrueResult(options, this) : getFalseResult(options, this);
|
|
15415
|
+
return data['venue_type'] !== venueType.VIRTUAL && !inArray(getMasterFormatId('VM', data), getFormats(data)) ? getTrueResult(options, this) : getFalseResult(options, this);
|
|
15170
15416
|
});
|
|
15171
15417
|
|
|
15172
15418
|
/**
|
|
15173
15419
|
* Assumes consistent set of venue type formats (enforced for newly edited meetings in root server 2.16.0 or greater)
|
|
15174
15420
|
*/
|
|
15175
15421
|
crouton_Handlebars.registerHelper('isInPersonOnly', function(data, options) {
|
|
15176
|
-
return !inArray(getMasterFormatId('VM', data), getFormats(data))
|
|
15177
|
-
&& !inArray(getMasterFormatId('HY', data), getFormats(data)) ? getTrueResult(options, this) : getFalseResult(options, this);
|
|
15422
|
+
return data['venue_type'] === venueType.IN_PERSON || (!inArray(getMasterFormatId('VM', data), getFormats(data))
|
|
15423
|
+
&& !inArray(getMasterFormatId('HY', data), getFormats(data))) ? getTrueResult(options, this) : getFalseResult(options, this);
|
|
15178
15424
|
});
|
|
15179
15425
|
|
|
15180
15426
|
/**
|
|
15181
15427
|
* Assumes consistent set of venue type formats (enforced for newly edited meetings in root server 2.16.0 or greater)
|
|
15182
15428
|
*/
|
|
15183
15429
|
crouton_Handlebars.registerHelper('isVirtualOrHybrid', function(data, options) {
|
|
15184
|
-
return inArray(getMasterFormatId('VM', data), getFormats(data))
|
|
15430
|
+
return (data['venue_type'] === venueType.VIRTUAL || data['venue_type'] === venueType.HYBRID) || inArray(getMasterFormatId('VM', data), getFormats(data))
|
|
15185
15431
|
|| inArray(getMasterFormatId('HY', data), getFormats(data)) ? getTrueResult(options, this) : getFalseResult(options, this);
|
|
15186
15432
|
});
|
|
15187
15433
|
|
|
@@ -15372,6 +15618,10 @@ function getServiceBodiesQueryString(service_bodies_id) {
|
|
|
15372
15618
|
return service_bodies_query;
|
|
15373
15619
|
}
|
|
15374
15620
|
|
|
15621
|
+
Array.prototype.clone = function() {
|
|
15622
|
+
return this.slice();
|
|
15623
|
+
}
|
|
15624
|
+
|
|
15375
15625
|
Array.prototype.filterByObjectKeyValue = function(key, value) {
|
|
15376
15626
|
var ret = [];
|
|
15377
15627
|
for (var i = 0; i < this.length; i++) {
|
|
@@ -17888,3 +18138,478 @@ Note: The Google Maps API v3 must be included *before* this code
|
|
|
17888
18138
|
}
|
|
17889
18139
|
|
|
17890
18140
|
}).call(this);
|
|
18141
|
+
|
|
18142
|
+
var defaultOptions = {
|
|
18143
|
+
timeout: 300000,
|
|
18144
|
+
jsonpCallback: 'callback',
|
|
18145
|
+
jsonpCallbackFunction: null,
|
|
18146
|
+
};
|
|
18147
|
+
|
|
18148
|
+
function generateCallbackFunction() {
|
|
18149
|
+
return 'jsonp_' + Date.now().toString() + '_' + Math.ceil(Math.random() * 100000).toString();
|
|
18150
|
+
}
|
|
18151
|
+
|
|
18152
|
+
function clearFunction(functionName) {
|
|
18153
|
+
// IE8 throws an exception when you try to delete a property on window
|
|
18154
|
+
// http://stackoverflow.com/a/1824228/751089
|
|
18155
|
+
try {
|
|
18156
|
+
delete window[functionName];
|
|
18157
|
+
} catch (e) {
|
|
18158
|
+
window[functionName] = undefined;
|
|
18159
|
+
}
|
|
18160
|
+
}
|
|
18161
|
+
|
|
18162
|
+
function removeScript(scriptId) {
|
|
18163
|
+
var script = document.getElementById(scriptId);
|
|
18164
|
+
if (script) {
|
|
18165
|
+
document.getElementsByTagName('head')[0].removeChild(script);
|
|
18166
|
+
}
|
|
18167
|
+
}
|
|
18168
|
+
|
|
18169
|
+
function fetchJsonp(_url, options) {
|
|
18170
|
+
if (!options) {
|
|
18171
|
+
options = {};
|
|
18172
|
+
}
|
|
18173
|
+
// to avoid param reassign
|
|
18174
|
+
var url = _url;
|
|
18175
|
+
var timeout = options.timeout || defaultOptions.timeout;
|
|
18176
|
+
var jsonpCallback = options.jsonpCallback || defaultOptions.jsonpCallback;
|
|
18177
|
+
|
|
18178
|
+
var timeoutId;
|
|
18179
|
+
|
|
18180
|
+
return new Promise(function (resolve, reject) {
|
|
18181
|
+
var callbackFunction = options.jsonpCallbackFunction || generateCallbackFunction();
|
|
18182
|
+
var scriptId = jsonpCallback + '_' + callbackFunction;
|
|
18183
|
+
|
|
18184
|
+
window[callbackFunction] = function (response) {
|
|
18185
|
+
resolve({
|
|
18186
|
+
ok: true,
|
|
18187
|
+
// keep consistent with fetch API
|
|
18188
|
+
json: function () { return Promise.resolve(response); },
|
|
18189
|
+
});
|
|
18190
|
+
|
|
18191
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
18192
|
+
|
|
18193
|
+
removeScript(scriptId);
|
|
18194
|
+
|
|
18195
|
+
clearFunction(callbackFunction);
|
|
18196
|
+
};
|
|
18197
|
+
|
|
18198
|
+
// Check if the user set their own params, and if not add a ? to start a list of params
|
|
18199
|
+
url += (url.indexOf('?') === -1) ? '?' : '&';
|
|
18200
|
+
|
|
18201
|
+
var jsonpScript = document.createElement('script');
|
|
18202
|
+
jsonpScript.setAttribute('src', url + jsonpCallback + '=' + callbackFunction);
|
|
18203
|
+
if (options.charset) {
|
|
18204
|
+
jsonpScript.setAttribute('charset', options.charset);
|
|
18205
|
+
}
|
|
18206
|
+
if (options.nonce) {
|
|
18207
|
+
jsonpScript.setAttribute('nonce', options.nonce);
|
|
18208
|
+
}
|
|
18209
|
+
if (options.referrerPolicy) {
|
|
18210
|
+
jsonpScript.setAttribute('referrerPolicy', options.referrerPolicy);
|
|
18211
|
+
}
|
|
18212
|
+
jsonpScript.id = scriptId;
|
|
18213
|
+
document.getElementsByTagName('head')[0].appendChild(jsonpScript);
|
|
18214
|
+
|
|
18215
|
+
timeoutId = setTimeout(function () {
|
|
18216
|
+
reject(new Error('JSONP request to ' + _url + ' timed out'));
|
|
18217
|
+
|
|
18218
|
+
clearFunction(callbackFunction);
|
|
18219
|
+
removeScript(scriptId);
|
|
18220
|
+
window[callbackFunction] = function () {
|
|
18221
|
+
clearFunction(callbackFunction);
|
|
18222
|
+
};
|
|
18223
|
+
}, timeout);
|
|
18224
|
+
|
|
18225
|
+
// Caught if got 404/500
|
|
18226
|
+
jsonpScript.onerror = function () {
|
|
18227
|
+
reject(new Error('JSONP request to ' + _url + ' failed'));
|
|
18228
|
+
|
|
18229
|
+
clearFunction(callbackFunction);
|
|
18230
|
+
removeScript(scriptId);
|
|
18231
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
18232
|
+
};
|
|
18233
|
+
});
|
|
18234
|
+
}
|
|
18235
|
+
|
|
18236
|
+
// export as global function
|
|
18237
|
+
/*
|
|
18238
|
+
let local;
|
|
18239
|
+
if (typeof global !== 'undefined') {
|
|
18240
|
+
local = global;
|
|
18241
|
+
} else if (typeof self !== 'undefined') {
|
|
18242
|
+
local = self;
|
|
18243
|
+
} else {
|
|
18244
|
+
try {
|
|
18245
|
+
local = Function('return this')();
|
|
18246
|
+
} catch (e) {
|
|
18247
|
+
throw new Error('polyfill failed because global object is unavailable in this environment');
|
|
18248
|
+
}
|
|
18249
|
+
}
|
|
18250
|
+
local.fetchJsonp = fetchJsonp;
|
|
18251
|
+
*/
|
|
18252
|
+
|
|
18253
|
+
|
|
18254
|
+
(function (global, factory) {
|
|
18255
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
|
|
18256
|
+
typeof define === 'function' && define.amd ? define(factory) :
|
|
18257
|
+
(factory());
|
|
18258
|
+
}(this, (function () { 'use strict';
|
|
18259
|
+
|
|
18260
|
+
/**
|
|
18261
|
+
* @this {Promise}
|
|
18262
|
+
*/
|
|
18263
|
+
function finallyConstructor(callback) {
|
|
18264
|
+
var constructor = this.constructor;
|
|
18265
|
+
return this.then(
|
|
18266
|
+
function(value) {
|
|
18267
|
+
// @ts-ignore
|
|
18268
|
+
return constructor.resolve(callback()).then(function() {
|
|
18269
|
+
return value;
|
|
18270
|
+
});
|
|
18271
|
+
},
|
|
18272
|
+
function(reason) {
|
|
18273
|
+
// @ts-ignore
|
|
18274
|
+
return constructor.resolve(callback()).then(function() {
|
|
18275
|
+
// @ts-ignore
|
|
18276
|
+
return constructor.reject(reason);
|
|
18277
|
+
});
|
|
18278
|
+
}
|
|
18279
|
+
);
|
|
18280
|
+
}
|
|
18281
|
+
|
|
18282
|
+
function allSettled(arr) {
|
|
18283
|
+
var P = this;
|
|
18284
|
+
return new P(function(resolve, reject) {
|
|
18285
|
+
if (!(arr && typeof arr.length !== 'undefined')) {
|
|
18286
|
+
return reject(
|
|
18287
|
+
new TypeError(
|
|
18288
|
+
typeof arr +
|
|
18289
|
+
' ' +
|
|
18290
|
+
arr +
|
|
18291
|
+
' is not iterable(cannot read property Symbol(Symbol.iterator))'
|
|
18292
|
+
)
|
|
18293
|
+
);
|
|
18294
|
+
}
|
|
18295
|
+
var args = Array.prototype.slice.call(arr);
|
|
18296
|
+
if (args.length === 0) return resolve([]);
|
|
18297
|
+
var remaining = args.length;
|
|
18298
|
+
|
|
18299
|
+
function res(i, val) {
|
|
18300
|
+
if (val && (typeof val === 'object' || typeof val === 'function')) {
|
|
18301
|
+
var then = val.then;
|
|
18302
|
+
if (typeof then === 'function') {
|
|
18303
|
+
then.call(
|
|
18304
|
+
val,
|
|
18305
|
+
function(val) {
|
|
18306
|
+
res(i, val);
|
|
18307
|
+
},
|
|
18308
|
+
function(e) {
|
|
18309
|
+
args[i] = { status: 'rejected', reason: e };
|
|
18310
|
+
if (--remaining === 0) {
|
|
18311
|
+
resolve(args);
|
|
18312
|
+
}
|
|
18313
|
+
}
|
|
18314
|
+
);
|
|
18315
|
+
return;
|
|
18316
|
+
}
|
|
18317
|
+
}
|
|
18318
|
+
args[i] = { status: 'fulfilled', value: val };
|
|
18319
|
+
if (--remaining === 0) {
|
|
18320
|
+
resolve(args);
|
|
18321
|
+
}
|
|
18322
|
+
}
|
|
18323
|
+
|
|
18324
|
+
for (var i = 0; i < args.length; i++) {
|
|
18325
|
+
res(i, args[i]);
|
|
18326
|
+
}
|
|
18327
|
+
});
|
|
18328
|
+
}
|
|
18329
|
+
|
|
18330
|
+
// Store setTimeout reference so promise-polyfill will be unaffected by
|
|
18331
|
+
// other code modifying setTimeout (like sinon.useFakeTimers())
|
|
18332
|
+
var setTimeoutFunc = setTimeout;
|
|
18333
|
+
// @ts-ignore
|
|
18334
|
+
var setImmediateFunc = typeof setImmediate !== 'undefined' ? setImmediate : null;
|
|
18335
|
+
|
|
18336
|
+
function isArray(x) {
|
|
18337
|
+
return Boolean(x && typeof x.length !== 'undefined');
|
|
18338
|
+
}
|
|
18339
|
+
|
|
18340
|
+
function noop() {}
|
|
18341
|
+
|
|
18342
|
+
// Polyfill for Function.prototype.bind
|
|
18343
|
+
function bind(fn, thisArg) {
|
|
18344
|
+
return function() {
|
|
18345
|
+
fn.apply(thisArg, arguments);
|
|
18346
|
+
};
|
|
18347
|
+
}
|
|
18348
|
+
|
|
18349
|
+
/**
|
|
18350
|
+
* @constructor
|
|
18351
|
+
* @param {Function} fn
|
|
18352
|
+
*/
|
|
18353
|
+
function Promise(fn) {
|
|
18354
|
+
if (!(this instanceof Promise))
|
|
18355
|
+
throw new TypeError('Promises must be constructed via new');
|
|
18356
|
+
if (typeof fn !== 'function') throw new TypeError('not a function');
|
|
18357
|
+
/** @type {!number} */
|
|
18358
|
+
this._state = 0;
|
|
18359
|
+
/** @type {!boolean} */
|
|
18360
|
+
this._handled = false;
|
|
18361
|
+
/** @type {Promise|undefined} */
|
|
18362
|
+
this._value = undefined;
|
|
18363
|
+
/** @type {!Array<!Function>} */
|
|
18364
|
+
this._deferreds = [];
|
|
18365
|
+
|
|
18366
|
+
doResolve(fn, this);
|
|
18367
|
+
}
|
|
18368
|
+
|
|
18369
|
+
function handle(self, deferred) {
|
|
18370
|
+
while (self._state === 3) {
|
|
18371
|
+
self = self._value;
|
|
18372
|
+
}
|
|
18373
|
+
if (self._state === 0) {
|
|
18374
|
+
self._deferreds.push(deferred);
|
|
18375
|
+
return;
|
|
18376
|
+
}
|
|
18377
|
+
self._handled = true;
|
|
18378
|
+
Promise._immediateFn(function() {
|
|
18379
|
+
var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;
|
|
18380
|
+
if (cb === null) {
|
|
18381
|
+
(self._state === 1 ? resolve : reject)(deferred.promise, self._value);
|
|
18382
|
+
return;
|
|
18383
|
+
}
|
|
18384
|
+
var ret;
|
|
18385
|
+
try {
|
|
18386
|
+
ret = cb(self._value);
|
|
18387
|
+
} catch (e) {
|
|
18388
|
+
reject(deferred.promise, e);
|
|
18389
|
+
return;
|
|
18390
|
+
}
|
|
18391
|
+
resolve(deferred.promise, ret);
|
|
18392
|
+
});
|
|
18393
|
+
}
|
|
18394
|
+
|
|
18395
|
+
function resolve(self, newValue) {
|
|
18396
|
+
try {
|
|
18397
|
+
// Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
|
|
18398
|
+
if (newValue === self)
|
|
18399
|
+
throw new TypeError('A promise cannot be resolved with itself.');
|
|
18400
|
+
if (
|
|
18401
|
+
newValue &&
|
|
18402
|
+
(typeof newValue === 'object' || typeof newValue === 'function')
|
|
18403
|
+
) {
|
|
18404
|
+
var then = newValue.then;
|
|
18405
|
+
if (newValue instanceof Promise) {
|
|
18406
|
+
self._state = 3;
|
|
18407
|
+
self._value = newValue;
|
|
18408
|
+
finale(self);
|
|
18409
|
+
return;
|
|
18410
|
+
} else if (typeof then === 'function') {
|
|
18411
|
+
doResolve(bind(then, newValue), self);
|
|
18412
|
+
return;
|
|
18413
|
+
}
|
|
18414
|
+
}
|
|
18415
|
+
self._state = 1;
|
|
18416
|
+
self._value = newValue;
|
|
18417
|
+
finale(self);
|
|
18418
|
+
} catch (e) {
|
|
18419
|
+
reject(self, e);
|
|
18420
|
+
}
|
|
18421
|
+
}
|
|
18422
|
+
|
|
18423
|
+
function reject(self, newValue) {
|
|
18424
|
+
self._state = 2;
|
|
18425
|
+
self._value = newValue;
|
|
18426
|
+
finale(self);
|
|
18427
|
+
}
|
|
18428
|
+
|
|
18429
|
+
function finale(self) {
|
|
18430
|
+
if (self._state === 2 && self._deferreds.length === 0) {
|
|
18431
|
+
Promise._immediateFn(function() {
|
|
18432
|
+
if (!self._handled) {
|
|
18433
|
+
Promise._unhandledRejectionFn(self._value);
|
|
18434
|
+
}
|
|
18435
|
+
});
|
|
18436
|
+
}
|
|
18437
|
+
|
|
18438
|
+
for (var i = 0, len = self._deferreds.length; i < len; i++) {
|
|
18439
|
+
handle(self, self._deferreds[i]);
|
|
18440
|
+
}
|
|
18441
|
+
self._deferreds = null;
|
|
18442
|
+
}
|
|
18443
|
+
|
|
18444
|
+
/**
|
|
18445
|
+
* @constructor
|
|
18446
|
+
*/
|
|
18447
|
+
function Handler(onFulfilled, onRejected, promise) {
|
|
18448
|
+
this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
|
|
18449
|
+
this.onRejected = typeof onRejected === 'function' ? onRejected : null;
|
|
18450
|
+
this.promise = promise;
|
|
18451
|
+
}
|
|
18452
|
+
|
|
18453
|
+
/**
|
|
18454
|
+
* Take a potentially misbehaving resolver function and make sure
|
|
18455
|
+
* onFulfilled and onRejected are only called once.
|
|
18456
|
+
*
|
|
18457
|
+
* Makes no guarantees about asynchrony.
|
|
18458
|
+
*/
|
|
18459
|
+
function doResolve(fn, self) {
|
|
18460
|
+
var done = false;
|
|
18461
|
+
try {
|
|
18462
|
+
fn(
|
|
18463
|
+
function(value) {
|
|
18464
|
+
if (done) return;
|
|
18465
|
+
done = true;
|
|
18466
|
+
resolve(self, value);
|
|
18467
|
+
},
|
|
18468
|
+
function(reason) {
|
|
18469
|
+
if (done) return;
|
|
18470
|
+
done = true;
|
|
18471
|
+
reject(self, reason);
|
|
18472
|
+
}
|
|
18473
|
+
);
|
|
18474
|
+
} catch (ex) {
|
|
18475
|
+
if (done) return;
|
|
18476
|
+
done = true;
|
|
18477
|
+
reject(self, ex);
|
|
18478
|
+
}
|
|
18479
|
+
}
|
|
18480
|
+
|
|
18481
|
+
Promise.prototype['catch'] = function(onRejected) {
|
|
18482
|
+
return this.then(null, onRejected);
|
|
18483
|
+
};
|
|
18484
|
+
|
|
18485
|
+
Promise.prototype.then = function(onFulfilled, onRejected) {
|
|
18486
|
+
// @ts-ignore
|
|
18487
|
+
var prom = new this.constructor(noop);
|
|
18488
|
+
|
|
18489
|
+
handle(this, new Handler(onFulfilled, onRejected, prom));
|
|
18490
|
+
return prom;
|
|
18491
|
+
};
|
|
18492
|
+
|
|
18493
|
+
Promise.prototype['finally'] = finallyConstructor;
|
|
18494
|
+
|
|
18495
|
+
Promise.all = function(arr) {
|
|
18496
|
+
return new Promise(function(resolve, reject) {
|
|
18497
|
+
if (!isArray(arr)) {
|
|
18498
|
+
return reject(new TypeError('Promise.all accepts an array'));
|
|
18499
|
+
}
|
|
18500
|
+
|
|
18501
|
+
var args = Array.prototype.slice.call(arr);
|
|
18502
|
+
if (args.length === 0) return resolve([]);
|
|
18503
|
+
var remaining = args.length;
|
|
18504
|
+
|
|
18505
|
+
function res(i, val) {
|
|
18506
|
+
try {
|
|
18507
|
+
if (val && (typeof val === 'object' || typeof val === 'function')) {
|
|
18508
|
+
var then = val.then;
|
|
18509
|
+
if (typeof then === 'function') {
|
|
18510
|
+
then.call(
|
|
18511
|
+
val,
|
|
18512
|
+
function(val) {
|
|
18513
|
+
res(i, val);
|
|
18514
|
+
},
|
|
18515
|
+
reject
|
|
18516
|
+
);
|
|
18517
|
+
return;
|
|
18518
|
+
}
|
|
18519
|
+
}
|
|
18520
|
+
args[i] = val;
|
|
18521
|
+
if (--remaining === 0) {
|
|
18522
|
+
resolve(args);
|
|
18523
|
+
}
|
|
18524
|
+
} catch (ex) {
|
|
18525
|
+
reject(ex);
|
|
18526
|
+
}
|
|
18527
|
+
}
|
|
18528
|
+
|
|
18529
|
+
for (var i = 0; i < args.length; i++) {
|
|
18530
|
+
res(i, args[i]);
|
|
18531
|
+
}
|
|
18532
|
+
});
|
|
18533
|
+
};
|
|
18534
|
+
|
|
18535
|
+
Promise.allSettled = allSettled;
|
|
18536
|
+
|
|
18537
|
+
Promise.resolve = function(value) {
|
|
18538
|
+
if (value && typeof value === 'object' && value.constructor === Promise) {
|
|
18539
|
+
return value;
|
|
18540
|
+
}
|
|
18541
|
+
|
|
18542
|
+
return new Promise(function(resolve) {
|
|
18543
|
+
resolve(value);
|
|
18544
|
+
});
|
|
18545
|
+
};
|
|
18546
|
+
|
|
18547
|
+
Promise.reject = function(value) {
|
|
18548
|
+
return new Promise(function(resolve, reject) {
|
|
18549
|
+
reject(value);
|
|
18550
|
+
});
|
|
18551
|
+
};
|
|
18552
|
+
|
|
18553
|
+
Promise.race = function(arr) {
|
|
18554
|
+
return new Promise(function(resolve, reject) {
|
|
18555
|
+
if (!isArray(arr)) {
|
|
18556
|
+
return reject(new TypeError('Promise.race accepts an array'));
|
|
18557
|
+
}
|
|
18558
|
+
|
|
18559
|
+
for (var i = 0, len = arr.length; i < len; i++) {
|
|
18560
|
+
Promise.resolve(arr[i]).then(resolve, reject);
|
|
18561
|
+
}
|
|
18562
|
+
});
|
|
18563
|
+
};
|
|
18564
|
+
|
|
18565
|
+
// Use polyfill for setImmediate for performance gains
|
|
18566
|
+
Promise._immediateFn =
|
|
18567
|
+
// @ts-ignore
|
|
18568
|
+
(typeof setImmediateFunc === 'function' &&
|
|
18569
|
+
function(fn) {
|
|
18570
|
+
// @ts-ignore
|
|
18571
|
+
setImmediateFunc(fn);
|
|
18572
|
+
}) ||
|
|
18573
|
+
function(fn) {
|
|
18574
|
+
setTimeoutFunc(fn, 0);
|
|
18575
|
+
};
|
|
18576
|
+
|
|
18577
|
+
Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {
|
|
18578
|
+
if (typeof console !== 'undefined' && console) {
|
|
18579
|
+
console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console
|
|
18580
|
+
}
|
|
18581
|
+
};
|
|
18582
|
+
|
|
18583
|
+
/** @suppress {undefinedVars} */
|
|
18584
|
+
var globalNS = (function() {
|
|
18585
|
+
// the only reliable means to get the global object is
|
|
18586
|
+
// `Function('return this')()`
|
|
18587
|
+
// However, this causes CSP violations in Chrome apps.
|
|
18588
|
+
if (typeof self !== 'undefined') {
|
|
18589
|
+
return self;
|
|
18590
|
+
}
|
|
18591
|
+
if (typeof window !== 'undefined') {
|
|
18592
|
+
return window;
|
|
18593
|
+
}
|
|
18594
|
+
if (typeof global !== 'undefined') {
|
|
18595
|
+
return global;
|
|
18596
|
+
}
|
|
18597
|
+
throw new Error('unable to locate global object');
|
|
18598
|
+
})();
|
|
18599
|
+
|
|
18600
|
+
// Expose the polyfill if Promise is undefined or set to a
|
|
18601
|
+
// non-function value. The latter can be due to a named HTMLElement
|
|
18602
|
+
// being exposed by browsers for legacy reasons.
|
|
18603
|
+
// https://github.com/taylorhakes/promise-polyfill/issues/114
|
|
18604
|
+
if (typeof globalNS['Promise'] !== 'function') {
|
|
18605
|
+
globalNS['Promise'] = Promise;
|
|
18606
|
+
} else {
|
|
18607
|
+
if (!globalNS.Promise.prototype['finally']) {
|
|
18608
|
+
globalNS.Promise.prototype['finally'] = finallyConstructor;
|
|
18609
|
+
}
|
|
18610
|
+
if (!globalNS.Promise.allSettled) {
|
|
18611
|
+
globalNS.Promise.allSettled = allSettled;
|
|
18612
|
+
}
|
|
18613
|
+
}
|
|
18614
|
+
|
|
18615
|
+
})));
|