@bmlt-enabled/croutonjs 3.20.11 → 3.21.0
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/crouton-core.css +3 -0
- package/crouton-core.js +102 -86
- package/crouton-core.min.css +1 -1
- package/crouton-core.min.js +1 -1
- package/crouton-gmaps.js +189 -99
- package/crouton-gmaps.min.js +1 -1
- package/crouton-map.js +85 -13
- package/crouton-map.min.js +1 -1
- package/crouton-nocore.js +63 -40
- package/crouton-nocore.min.js +1 -1
- package/crouton.css +23 -1
- package/crouton.js +187 -99
- package/crouton.min.css +1 -1
- package/crouton.min.js +1 -1
- package/crouton.nojquery.js +187 -99
- package/crouton.nojquery.min.js +1 -1
- package/package.json +1 -1
package/crouton-gmaps.js
CHANGED
|
@@ -13294,9 +13294,9 @@ function CroutonLocalization(language) {
|
|
|
13294
13294
|
"formats": "Struktur",
|
|
13295
13295
|
"map": "Kort",
|
|
13296
13296
|
"neighborhood": "Neighborhood",
|
|
13297
|
-
"near_me": "
|
|
13298
|
-
"text_search": "
|
|
13299
|
-
"click_search": "
|
|
13297
|
+
"near_me": "Find nearby meetings",
|
|
13298
|
+
"text_search": "Find meetings there",
|
|
13299
|
+
"click_search": "Find meetings near to a point on the map",
|
|
13300
13300
|
"pan_and_zoom": "Pan + Zoom",
|
|
13301
13301
|
"languages": "Languages",
|
|
13302
13302
|
"common_needs": "Common Needs",
|
|
@@ -13390,7 +13390,7 @@ function CroutonLocalization(language) {
|
|
|
13390
13390
|
'filter by visibility': "Zeige nur Meetings, die gerade auf dem Karte stehen",
|
|
13391
13391
|
'go': "Los!"
|
|
13392
13392
|
},
|
|
13393
|
-
|
|
13393
|
+
"en-AU": {
|
|
13394
13394
|
"days_of_the_week" : ["", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
|
13395
13395
|
"weekday" : "Weekday",
|
|
13396
13396
|
"city" : "City",
|
|
@@ -13404,10 +13404,10 @@ function CroutonLocalization(language) {
|
|
|
13404
13404
|
"postal_codes" : "Postcodes",
|
|
13405
13405
|
"formats" : "Formats",
|
|
13406
13406
|
"map" : "Map",
|
|
13407
|
-
"neighborhood": "
|
|
13408
|
-
"near_me": "
|
|
13409
|
-
"text_search": "
|
|
13410
|
-
"click_search": "
|
|
13407
|
+
"neighborhood": "Neighbourhood",
|
|
13408
|
+
"near_me": "Find nearby meetings",
|
|
13409
|
+
"text_search": "Find meetings there",
|
|
13410
|
+
"click_search": "Find meetings near to a point on the map",
|
|
13411
13411
|
"languages": "Languages",
|
|
13412
13412
|
"common_needs": "Common Needs",
|
|
13413
13413
|
"meeting_count": "Weekly Meetings:",
|
|
@@ -13437,7 +13437,7 @@ function CroutonLocalization(language) {
|
|
|
13437
13437
|
'show meetings near...': 'Show meetings near...',
|
|
13438
13438
|
'filter meetings': 'Filter meetings',
|
|
13439
13439
|
'visible meeting list': 'Visible meetings as list',
|
|
13440
|
-
'enter a city or zip code': 'Enter a city
|
|
13440
|
+
'enter a city or zip code': 'Enter a city and state',
|
|
13441
13441
|
'toggle fullscreen mode': 'Toggle fullscreen mode',
|
|
13442
13442
|
'close': "Close",
|
|
13443
13443
|
'meeting page': "Meeting Page",
|
|
@@ -13462,9 +13462,9 @@ function CroutonLocalization(language) {
|
|
|
13462
13462
|
"formats" : "Formats",
|
|
13463
13463
|
"map" : "Map",
|
|
13464
13464
|
"neighborhood": "Neighborhood",
|
|
13465
|
-
"near_me": "
|
|
13466
|
-
"text_search": "
|
|
13467
|
-
"click_search": "
|
|
13465
|
+
"near_me": "Find nearby meetings",
|
|
13466
|
+
"text_search": "Find meetings there",
|
|
13467
|
+
"click_search": "Find meetings near to a point on the map",
|
|
13468
13468
|
"pan_and_zoom": "Pan + Zoom",
|
|
13469
13469
|
"languages": "Languages",
|
|
13470
13470
|
"common_needs": "Common Needs",
|
|
@@ -13520,9 +13520,9 @@ function CroutonLocalization(language) {
|
|
|
13520
13520
|
"formats" : "Formats",
|
|
13521
13521
|
"map" : "Map",
|
|
13522
13522
|
"neighborhood": "Neighborhood",
|
|
13523
|
-
"near_me": "
|
|
13524
|
-
"text_search": "
|
|
13525
|
-
"click_search": "
|
|
13523
|
+
"near_me": "Find nearby meetings",
|
|
13524
|
+
"text_search": "Find meetings there",
|
|
13525
|
+
"click_search": "Find meetings near to a point on the map",
|
|
13526
13526
|
"pan_and_zoom": "Pan + Zoom",
|
|
13527
13527
|
"languages": "Languages",
|
|
13528
13528
|
"common_needs": "Common Needs",
|
|
@@ -13578,9 +13578,9 @@ function CroutonLocalization(language) {
|
|
|
13578
13578
|
"formats" : "Formats",
|
|
13579
13579
|
"map" : "Map",
|
|
13580
13580
|
"neighborhood": "Neighborhood",
|
|
13581
|
-
"near_me": "
|
|
13582
|
-
"text_search": "
|
|
13583
|
-
"click_search": "
|
|
13581
|
+
"near_me": "Find nearby meetings",
|
|
13582
|
+
"text_search": "Find meetings there",
|
|
13583
|
+
"click_search": "Find meetings near to a point on the map",
|
|
13584
13584
|
"pan_and_zoom": "Pan + Zoom",
|
|
13585
13585
|
"languages": "Languages",
|
|
13586
13586
|
"common_needs": "Common Needs",
|
|
@@ -13636,9 +13636,9 @@ function CroutonLocalization(language) {
|
|
|
13636
13636
|
"formats" : "Formats",
|
|
13637
13637
|
"map" : "Map",
|
|
13638
13638
|
"neighborhood": "Neighborhood",
|
|
13639
|
-
"near_me": "
|
|
13640
|
-
"text_search": "
|
|
13641
|
-
"click_search": "
|
|
13639
|
+
"near_me": "Find nearby meetings",
|
|
13640
|
+
"text_search": "Find meetings there",
|
|
13641
|
+
"click_search": "Find meetings near to a point on the map",
|
|
13642
13642
|
"pan_and_zoom": "Pan + Zoom",
|
|
13643
13643
|
"languages": "Languages",
|
|
13644
13644
|
"common_needs": "Common Needs",
|
|
@@ -13718,7 +13718,7 @@ function CroutonLocalization(language) {
|
|
|
13718
13718
|
"share": "compartir",
|
|
13719
13719
|
"no_meetings_for_this_day": "No hay reuniones en este día",
|
|
13720
13720
|
'css-textalign': 'Alineación de texto CSS',
|
|
13721
|
-
'tabular':
|
|
13721
|
+
'tabular': 'Formato tabla',
|
|
13722
13722
|
'google_directions': 'Indicaciones de Google',
|
|
13723
13723
|
'css-floatdirection': "Dirección float-CSS",
|
|
13724
13724
|
'all': 'Todos',
|
|
@@ -13752,9 +13752,9 @@ function CroutonLocalization(language) {
|
|
|
13752
13752
|
"formats" : "فورمت ها",
|
|
13753
13753
|
"map" : "نقشه",
|
|
13754
13754
|
"neighborhood": "Neighborhood",
|
|
13755
|
-
"near_me": "
|
|
13756
|
-
"text_search": "
|
|
13757
|
-
"click_search": "
|
|
13755
|
+
"near_me": "Find nearby meetings",
|
|
13756
|
+
"text_search": "Find meetings there",
|
|
13757
|
+
"click_search": "Find meetings near to a point on the map",
|
|
13758
13758
|
"pan_and_zoom": "Pan + Zoom",
|
|
13759
13759
|
"languages": "Languages",
|
|
13760
13760
|
"common_needs": "Common Needs",
|
|
@@ -14670,8 +14670,19 @@ this["hbs_Crouton"]["templates"]["mapMenu"] = Handlebars.template({"1":function(
|
|
|
14670
14670
|
+ alias1((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias3).call(alias2,"go",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":49,"column":59},"end":{"line":49,"column":75}}}))
|
|
14671
14671
|
+ "</button>\n </div>\n </div>\n</div>\n\n";
|
|
14672
14672
|
},"usePartial":true,"useData":true,"useDepths":true});
|
|
14673
|
-
this["hbs_Crouton"]["templates"]["mapSearch"] = Handlebars.template({"
|
|
14674
|
-
var
|
|
14673
|
+
this["hbs_Crouton"]["templates"]["mapSearch"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
|
|
14674
|
+
var lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
14675
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
14676
|
+
return parent[propertyName];
|
|
14677
|
+
}
|
|
14678
|
+
return undefined
|
|
14679
|
+
};
|
|
14680
|
+
|
|
14681
|
+
return " <div class=\"modal-search\">\n <button id=\"bmltsearch-clicksearch\" class=\"filter-button\">"
|
|
14682
|
+
+ container.escapeExpression((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||container.hooks.helperMissing).call(depth0 != null ? depth0 : (container.nullContext || {}),"click_search",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":19,"column":86},"end":{"line":20,"column":48}}}))
|
|
14683
|
+
+ "</button>\n </div>\n";
|
|
14684
|
+
},"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
|
14685
|
+
var stack1, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
14675
14686
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
14676
14687
|
return parent[propertyName];
|
|
14677
14688
|
}
|
|
@@ -14682,17 +14693,27 @@ this["hbs_Crouton"]["templates"]["mapSearch"] = Handlebars.template({"compiler":
|
|
|
14682
14693
|
+ alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"Open Search Dialog",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":1,"column":58},"end":{"line":1,"column":90}}}))
|
|
14683
14694
|
+ "\">\n <span class=\"menu-button-label\" style=\"position:initial;\">"
|
|
14684
14695
|
+ alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"Search for meetings",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":2,"column":62},"end":{"line":2,"column":95}}}))
|
|
14685
|
-
+ "</span>\n</button>\n<div id=\"bmltsearch_modal\" class=\"modal\" style=\"display: none;\">\n
|
|
14686
|
-
+ alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"Search for meetings",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":
|
|
14687
|
-
+ "</
|
|
14688
|
-
+ alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"Enter a city or zip code",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":
|
|
14689
|
-
+ "\" style=\"margin-bottom:5px;\">\n
|
|
14690
|
-
+ alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"text_search",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":
|
|
14691
|
-
+ "</button>\n
|
|
14692
|
-
+ alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"near_me",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":
|
|
14693
|
-
+ "</button>\n
|
|
14694
|
-
+
|
|
14695
|
-
+ "
|
|
14696
|
+
+ "</span>\n</button>\n<div id=\"bmltsearch_modal\" class=\"modal\" style=\"display: none;\">\n <div id=\"bmltsearch_content\" class=\"modal-content\">\n <span id=\"close_search\" class=\"modal-close\">x</span>\n <div id=\"modal-search-page\">\n <div class=\"modal-title\">"
|
|
14697
|
+
+ alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"Search for meetings",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":8,"column":37},"end":{"line":8,"column":70}}}))
|
|
14698
|
+
+ "</div>\n <div id=\"modal-search-box\" class=\"modal-search\">\n <input id=\"bmltsearch-goto-text\" type=\"text\"\n placeholder=\""
|
|
14699
|
+
+ alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"Enter a city or zip code",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":11,"column":45},"end":{"line":11,"column":83}}}))
|
|
14700
|
+
+ "\" style=\"margin-bottom:5px;\">\n <button id=\"bmltsearch-text-button\" class=\"filter-button\">"
|
|
14701
|
+
+ alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"text_search",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":12,"column":86},"end":{"line":12,"column":111}}}))
|
|
14702
|
+
+ "</button>\n </div>\n <div class=\"modal-search\">\n <button id=\"bmltsearch-nearbyMeetings\" class=\"filter-button\">"
|
|
14703
|
+
+ alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"near_me",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":15,"column":89},"end":{"line":15,"column":110}}}))
|
|
14704
|
+
+ "</button>\n </div>\n"
|
|
14705
|
+
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"hasClickSearch") : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":17,"column":16},"end":{"line":22,"column":23}}})) != null ? stack1 : "")
|
|
14706
|
+
+ " <button id=\"show-search-parameters\" class=\"advanced-search-button\">"
|
|
14707
|
+
+ alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"Adjust Search",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":23,"column":79},"end":{"line":23,"column":106}}}))
|
|
14708
|
+
+ "</button>\n </div>\n <div id=\"modal-seach-parameters\">\n <div class=\"modal-title\">"
|
|
14709
|
+
+ alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"Configure Search",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":26,"column":37},"end":{"line":26,"column":67}}}))
|
|
14710
|
+
+ "</div>\n <input type=\"number\" id=\"search_parameter\" name=\"search_parameter\" maxlength=\"3\" size=\"3\">\n <p>"
|
|
14711
|
+
+ alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"This number represents:",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":28,"column":15},"end":{"line":28,"column":52}}}))
|
|
14712
|
+
+ "</p>\n <input type=\"radio\" id=\"search_radius\" name=\"map_search_type\" value=\"radius\">\n <label id=\"search_radius_label\" for=\"search_radius\"></label><br>\n <input type=\"radio\" id=\"search_count\" name=\"map_search_type\" value=\"count\">\n <label for=\"search_count\">"
|
|
14713
|
+
+ alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"Approx. number of meetings in result",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":32,"column":38},"end":{"line":32,"column":88}}}))
|
|
14714
|
+
+ "</label><br>\n <button id=\"show-search-page\" class=\"advanced-search-button\">"
|
|
14715
|
+
+ alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"Back",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":33,"column":73},"end":{"line":33,"column":91}}}))
|
|
14716
|
+
+ "</button>\n </div>\n </div>\n</div>";
|
|
14696
14717
|
},"useData":true});
|
|
14697
14718
|
this["hbs_Crouton"]["templates"]["meetings"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
|
|
14698
14719
|
var stack1, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3=container.escapeExpression, alias4=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
@@ -14956,6 +14977,9 @@ var croutonDefaultTemplates = {
|
|
|
14956
14977
|
"<div class='location-information'>{{this.formatted_location_info}}</div>",
|
|
14957
14978
|
"{{#if this.virtual_meeting_additional_info}}",
|
|
14958
14979
|
" <div class='meeting-additional-info'>{{this.virtual_meeting_additional_info}}</div>",
|
|
14980
|
+
"{{/if}}",
|
|
14981
|
+
"{{#if this.distance}}",
|
|
14982
|
+
" <div class='meeting-distance'>{{getWord 'Distance'}}: {{this.distance}}</div>",
|
|
14959
14983
|
"{{/if}}"
|
|
14960
14984
|
].join('\n'),
|
|
14961
14985
|
|
|
@@ -14987,7 +15011,6 @@ var croutonDefaultTemplates = {
|
|
|
14987
15011
|
" {{getWord 'meeting details'}}",
|
|
14988
15012
|
" </a>",
|
|
14989
15013
|
" </div>",
|
|
14990
|
-
" <div class='geo hide'>{{this.latitude}},{{this.longitude}}</div>",
|
|
14991
15014
|
" {{/unless}}",
|
|
14992
15015
|
"{{/isNotTemporarilyClosed}}"
|
|
14993
15016
|
].join('\n'),
|
|
@@ -15094,7 +15117,7 @@ var croutonDefaultTemplates = {
|
|
|
15094
15117
|
This meeting is in <a href="{{serviceBodyUrl}}">{{serviceBodyName}}</a><br/>
|
|
15095
15118
|
{{> offerIcsButton}}
|
|
15096
15119
|
</td>`,
|
|
15097
|
-
marker_contents_template:
|
|
15120
|
+
marker_contents_template:
|
|
15098
15121
|
`<h4>{{meeting_name}}</h4>
|
|
15099
15122
|
<div class="active">
|
|
15100
15123
|
<div class="marker_div_location_text">{{{this.location_text}}}</div>
|
|
@@ -16171,6 +16194,7 @@ function Crouton(config) {
|
|
|
16171
16194
|
int_include_unpublished: 0, // Includes unpublished meeting
|
|
16172
16195
|
button_filters: [
|
|
16173
16196
|
{'title': 'City', 'field': 'location_municipality'},
|
|
16197
|
+
{'title': 'Distance', 'field': 'distance_in_km'},
|
|
16174
16198
|
],
|
|
16175
16199
|
button_format_filters: [],
|
|
16176
16200
|
default_filter_dropdown: "", // Sets the default format for the dropdowns, the names will match the `has_` fields dropdowns without `has_. Example: `formats=closed`.
|
|
@@ -16191,8 +16215,6 @@ function Crouton(config) {
|
|
|
16191
16215
|
has_common_needs: false, // Shows the Common Needs dropdown
|
|
16192
16216
|
has_venues: true, // Shows the venue types dropdown
|
|
16193
16217
|
has_meeting_count: false, // Shows the meeting count
|
|
16194
|
-
show_distance: false, // Determines distance on page load
|
|
16195
|
-
distance_search: 0, // Makes a distance based search with results either number of / or distance from coordinates
|
|
16196
16218
|
recurse_service_bodies: false,// Recurses service bodies when making service bodies request
|
|
16197
16219
|
service_body: [], // Array of service bodies to return data for.
|
|
16198
16220
|
formats: '', // Return only meetings with these formats (format shared-id, not key-string)
|
|
@@ -16236,7 +16258,9 @@ function Crouton(config) {
|
|
|
16236
16258
|
maxZoom: 18
|
|
16237
16259
|
},
|
|
16238
16260
|
minZoom: 6,
|
|
16239
|
-
maxZoom: 17
|
|
16261
|
+
maxZoom: 17,
|
|
16262
|
+
distance_units: 'miles',
|
|
16263
|
+
noMap: false
|
|
16240
16264
|
};
|
|
16241
16265
|
|
|
16242
16266
|
self.setConfig(config);
|
|
@@ -16369,6 +16393,10 @@ function Crouton(config) {
|
|
|
16369
16393
|
}
|
|
16370
16394
|
}
|
|
16371
16395
|
|
|
16396
|
+
if (self.config.map_search) {
|
|
16397
|
+
self.queryable_data_keys.push('distance_in_km');
|
|
16398
|
+
self.queryable_data_keys.push('distance_in_miles');
|
|
16399
|
+
}
|
|
16372
16400
|
self.collectDataKeys(self.config['meeting_data_template']);
|
|
16373
16401
|
self.collectDataKeys(self.config['metadata_template']);
|
|
16374
16402
|
self.collectDataKeys(self.config['observer_template']);
|
|
@@ -16387,6 +16415,9 @@ function Crouton(config) {
|
|
|
16387
16415
|
return prev +'&formats[]='+id;
|
|
16388
16416
|
}, '');
|
|
16389
16417
|
}
|
|
16418
|
+
if (self.config.map_search && self.config['venue_types'].length === 0) {
|
|
16419
|
+
self.config['venue_types'].push('-2');
|
|
16420
|
+
}
|
|
16390
16421
|
if (self.config['venue_types']) {
|
|
16391
16422
|
url += self.config['venue_types'].reduce(function(prev,id) {
|
|
16392
16423
|
return prev +'&venue_types[]='+id;
|
|
@@ -16398,16 +16429,7 @@ function Crouton(config) {
|
|
|
16398
16429
|
url += "&advanced_published=-1"
|
|
16399
16430
|
}
|
|
16400
16431
|
|
|
16401
|
-
if (self.config['
|
|
16402
|
-
return retrieveGeolocation().then((position) => {
|
|
16403
|
-
url += '&lat_val=' + position.latitude + '&long_val=' + position.longitude + '&sort_results_by_distance=1';
|
|
16404
|
-
url += (self.config['distance_units'] === "km" ? '&geo_width_km=' : '&geo_width=') + self.config['distance_search'];
|
|
16405
|
-
return self.getMeetings(url);
|
|
16406
|
-
}).catch((error) => {
|
|
16407
|
-
console.error(error.message);
|
|
16408
|
-
return self.getMeetings(url); // Proceed without geolocation if error occurs
|
|
16409
|
-
});
|
|
16410
|
-
} else if (self.config['custom_query'] != null) {
|
|
16432
|
+
if (self.config['custom_query'] != null) {
|
|
16411
16433
|
url += self.config['custom_query'] + '&sort_keys=' + self.config['sort_keys'];
|
|
16412
16434
|
return self.getMeetings(url);
|
|
16413
16435
|
} else if (self.config['service_body'].length > 0) {
|
|
@@ -16462,6 +16484,8 @@ function Crouton(config) {
|
|
|
16462
16484
|
self.dayView();
|
|
16463
16485
|
} else if (viewName === "city") {
|
|
16464
16486
|
self.filteredView("location_municipality");
|
|
16487
|
+
} else if (viewName === "distance") {
|
|
16488
|
+
self.filteredView("distance_in_km");
|
|
16465
16489
|
} else {
|
|
16466
16490
|
self.filteredView(viewName);
|
|
16467
16491
|
}
|
|
@@ -16618,7 +16642,7 @@ function Crouton(config) {
|
|
|
16618
16642
|
crouton_Handlebars.registerPartial('bydays', hbs_Crouton.templates['byday']);
|
|
16619
16643
|
crouton_Handlebars.registerPartial('formatPopup', hbs_Crouton.templates['formatPopup']);
|
|
16620
16644
|
window.crouton = self;
|
|
16621
|
-
croutonMap.initialize(self.createBmltMapElement(),self.meetingData,context,null,fitBounds,callback);
|
|
16645
|
+
croutonMap.initialize(self.createBmltMapElement(),self.meetingData,context,null,fitBounds,callback,self.config['noMap']);
|
|
16622
16646
|
}
|
|
16623
16647
|
self.getCurrentLocation = function(callback) {
|
|
16624
16648
|
retrieveGeolocation().then(position => {
|
|
@@ -16701,31 +16725,6 @@ function Crouton(config) {
|
|
|
16701
16725
|
});
|
|
16702
16726
|
}
|
|
16703
16727
|
|
|
16704
|
-
self.showLocation = function(position) {
|
|
16705
|
-
var latitude = position.latitude;
|
|
16706
|
-
var longitude = position.longitude;
|
|
16707
|
-
var distanceUnit;
|
|
16708
|
-
var distanceCalculation;
|
|
16709
|
-
|
|
16710
|
-
if (self.config['distance_units'] === "km") {
|
|
16711
|
-
distanceUnit = "km";
|
|
16712
|
-
distanceCalculation = "K";
|
|
16713
|
-
} else if (self.config['distance_units'] === "nm") {
|
|
16714
|
-
distanceUnit = "nm";
|
|
16715
|
-
distanceCalculation = "N";
|
|
16716
|
-
} else {
|
|
16717
|
-
distanceUnit = "mi";
|
|
16718
|
-
distanceCalculation = "M";
|
|
16719
|
-
}
|
|
16720
|
-
|
|
16721
|
-
jQuery( ".geo" ).each(function() {
|
|
16722
|
-
var target = jQuery( this ).html();
|
|
16723
|
-
var arr = target.split(',');
|
|
16724
|
-
var distance_result = self.distance(latitude, longitude, arr[0], arr[1], distanceCalculation);
|
|
16725
|
-
jQuery( this ).removeClass("hide").addClass("show").html(distance_result.toFixed(1) + ' ' + distanceUnit);
|
|
16726
|
-
});
|
|
16727
|
-
};
|
|
16728
|
-
|
|
16729
16728
|
self.errorHandler = function(msg) {
|
|
16730
16729
|
jQuery('.geo').removeClass("hide").addClass("show").html('');
|
|
16731
16730
|
};
|
|
@@ -16982,6 +16981,22 @@ function Crouton(config) {
|
|
|
16982
16981
|
);
|
|
16983
16982
|
}
|
|
16984
16983
|
|
|
16984
|
+
meetingData[m]['distance'] = '';
|
|
16985
|
+
if (self.config['distance_units'] === "km") {
|
|
16986
|
+
if (meetingData[m]['distance_in_km']) {
|
|
16987
|
+
const d = meetingData[m]['distance_in_km'];
|
|
16988
|
+
if (d < 1) {
|
|
16989
|
+
meetingData[m]['distance'] = Math.round( d * 1000) + 'm';
|
|
16990
|
+
}
|
|
16991
|
+
else {
|
|
16992
|
+
meetingData[m]['distance'] = (Math.round(d * 10) / 10).toFixed(1) + 'km';
|
|
16993
|
+
}
|
|
16994
|
+
}
|
|
16995
|
+
} else if (meetingData[m]['distance_in_miles']) {
|
|
16996
|
+
const d = meetingData[m]['distance_in_miles'];
|
|
16997
|
+
meetingData[m]['distance'] = (Math.round(d * 100) / 100).toFixed(2) + ' miles';
|
|
16998
|
+
}
|
|
16999
|
+
|
|
16985
17000
|
meetings.push(meetingData[m])
|
|
16986
17001
|
}
|
|
16987
17002
|
|
|
@@ -17046,7 +17061,6 @@ Crouton.prototype.setConfig = function(config) {
|
|
|
17046
17061
|
self.config.show_map = false;
|
|
17047
17062
|
self.config.map_page = true;
|
|
17048
17063
|
}
|
|
17049
|
-
self.config["distance_search"] = parseInt(self.config["distance_search"] || 0);
|
|
17050
17064
|
self.config["day_sequence"] = [];
|
|
17051
17065
|
self.config.day_sequence.push(self.config.int_start_day_id);
|
|
17052
17066
|
for (var i = 1; i < 7; i++) {
|
|
@@ -17297,6 +17311,7 @@ Crouton.prototype.render = function(doMeetingMap = false) {
|
|
|
17297
17311
|
|
|
17298
17312
|
for (var f = 0; f < self.config.button_filters.length; f++) {
|
|
17299
17313
|
var groupByName = self.config.button_filters[f]['field'];
|
|
17314
|
+
if (groupByName.startsWith('distance')) continue;
|
|
17300
17315
|
var groupByData = getUniqueValuesOfKey(daysOfTheWeekMeetings, groupByName).sort();
|
|
17301
17316
|
for (var i = 0; i < groupByData.length; i++) {
|
|
17302
17317
|
var groupByMeetings = daysOfTheWeekMeetings.filterByObjectKeyValue(groupByName, groupByData[i]);
|
|
@@ -17335,15 +17350,20 @@ Crouton.prototype.render = function(doMeetingMap = false) {
|
|
|
17335
17350
|
|
|
17336
17351
|
var buttonFiltersDataSorted = {};
|
|
17337
17352
|
for (var b = 0; b < self.config.button_filters.length; b++) {
|
|
17338
|
-
var sortKey = [];
|
|
17339
17353
|
var groupByName = self.config.button_filters[b]['field'];
|
|
17354
|
+
buttonFiltersDataSorted[groupByName] = {};
|
|
17355
|
+
if (groupByName.startsWith('distance')) {
|
|
17356
|
+
buttonFiltersDataSorted[groupByName]['Sorted by Distance'] = [...self.meetingData].sort((a,b) => a['distance_in_km'] - b['distance_in_km']);
|
|
17357
|
+
continue;
|
|
17358
|
+
}
|
|
17359
|
+
var sortKey = [];
|
|
17360
|
+
|
|
17340
17361
|
for (var buttonFiltersDataItem in buttonFiltersData[groupByName]) {
|
|
17341
17362
|
sortKey.push(buttonFiltersDataItem);
|
|
17342
17363
|
}
|
|
17343
17364
|
|
|
17344
17365
|
sortKey.sort();
|
|
17345
17366
|
|
|
17346
|
-
buttonFiltersDataSorted[groupByName] = {};
|
|
17347
17367
|
for (var s = 0; s < sortKey.length; s++) {
|
|
17348
17368
|
buttonFiltersDataSorted[groupByName][sortKey[s]] = buttonFiltersData[groupByName][sortKey[s]]
|
|
17349
17369
|
}
|
|
@@ -17533,10 +17553,6 @@ Crouton.prototype.render = function(doMeetingMap = false) {
|
|
|
17533
17553
|
jQuery("#filter-dropdown-" + filter[0]).val('a-' + filter[1]).trigger('change').trigger('select2:select');
|
|
17534
17554
|
}
|
|
17535
17555
|
|
|
17536
|
-
if (self.config['show_distance']) {
|
|
17537
|
-
self.getCurrentLocation(self.showLocation);
|
|
17538
|
-
}
|
|
17539
|
-
|
|
17540
17556
|
if (self.config['show_map'] && !self.config['refresh_map'] && !doMeetingMap) {
|
|
17541
17557
|
croutonMap.initialize(self.createBmltMapElement(), self.meetingData);
|
|
17542
17558
|
jQuery("#bmlt-map").removeClass("hide");
|
|
@@ -18073,7 +18089,7 @@ function MeetingMap(inConfig) {
|
|
|
18073
18089
|
* \brief Load the map and set it up. *
|
|
18074
18090
|
****************************************************************************************/
|
|
18075
18091
|
|
|
18076
|
-
function loadMap(inDiv, menuContext, handlebarMapOptions=null,cb=null) {
|
|
18092
|
+
function loadMap(inDiv, menuContext, handlebarMapOptions=null,cb=null,hide=false) {
|
|
18077
18093
|
if (inDiv) {
|
|
18078
18094
|
crouton_Handlebars.registerPartial("markerContentsTemplate", config['marker_contents_template']);
|
|
18079
18095
|
gInDiv = inDiv;
|
|
@@ -18093,7 +18109,7 @@ function MeetingMap(inConfig) {
|
|
|
18093
18109
|
}
|
|
18094
18110
|
let loc = {latitude: config.lat, longitude: config.lng, zoom: config.zoom};
|
|
18095
18111
|
if (handlebarMapOptions) loc = {latitude: handlebarMapOptions.lat, longitude: handlebarMapOptions.lng};
|
|
18096
|
-
if (gDelegate.createMap(inDiv, loc)) {
|
|
18112
|
+
if (gDelegate.createMap(inDiv, loc, hide)) {
|
|
18097
18113
|
gDelegate.addListener('zoomend', function (ev) {
|
|
18098
18114
|
if (shouldRedrawMarkers() && gAllMeetings) {
|
|
18099
18115
|
if (listOnlyVisible) {
|
|
@@ -18119,12 +18135,19 @@ function MeetingMap(inConfig) {
|
|
|
18119
18135
|
};
|
|
18120
18136
|
};
|
|
18121
18137
|
var gSearchModal;
|
|
18122
|
-
function createSearchButton(
|
|
18123
|
-
|
|
18124
|
-
|
|
18125
|
-
|
|
18138
|
+
function createSearchButton() {
|
|
18139
|
+
const template = hbs_Crouton.templates['mapSearch'];
|
|
18140
|
+
const controlDiv = document.createElement('div');
|
|
18141
|
+
const params = {'hasClickSearch': gDelegate.hasClickSearch()}
|
|
18142
|
+
controlDiv.innerHTML = template(params);
|
|
18126
18143
|
controlDiv.querySelector("#map-search-button").addEventListener('click', showBmltSearchDialog);
|
|
18127
18144
|
controlDiv.querySelector("#bmltsearch-nearbyMeetings").addEventListener('click', nearMeSearch);
|
|
18145
|
+
controlDiv.querySelector("#bmltsearch-goto-text").addEventListener('keypress', function (event) {
|
|
18146
|
+
if (event.key === "Enter") {
|
|
18147
|
+
event.preventDefault();
|
|
18148
|
+
document.getElementById("bmltsearch-text-button").click();
|
|
18149
|
+
}
|
|
18150
|
+
});
|
|
18128
18151
|
controlDiv.querySelector("#bmltsearch-text-button").addEventListener('click', function () {
|
|
18129
18152
|
let text = document.getElementById("bmltsearch-goto-text").value.trim();
|
|
18130
18153
|
if (text === "") return;
|
|
@@ -18132,7 +18155,35 @@ function MeetingMap(inConfig) {
|
|
|
18132
18155
|
gDelegate.callGeocoder(text, null, mapSearchGeocode);
|
|
18133
18156
|
closeModalWindow(gSearchModal);
|
|
18134
18157
|
});
|
|
18135
|
-
controlDiv.querySelector("#
|
|
18158
|
+
controlDiv.querySelector("#modal-seach-parameters").style.display = 'none';
|
|
18159
|
+
controlDiv.querySelector("#show-search-parameters").addEventListener('click', function (e) {
|
|
18160
|
+
const controlDiv = e.target.parentElement.parentElement;
|
|
18161
|
+
let w = config.map_search.width;
|
|
18162
|
+
let checked = '#search_radius';
|
|
18163
|
+
if (w < 0) {
|
|
18164
|
+
w = -w;
|
|
18165
|
+
checked = '#search_count';
|
|
18166
|
+
}
|
|
18167
|
+
controlDiv.querySelector(checked).checked = true;
|
|
18168
|
+
controlDiv.querySelector('#search_parameter').value = w;
|
|
18169
|
+
controlDiv.querySelector("#modal-seach-parameters").style.display = 'block';
|
|
18170
|
+
controlDiv.querySelector("#modal-search-page").style.display = 'none';
|
|
18171
|
+
controlDiv.querySelector("#search_radius_label").innerHTML = crouton.localization.getWord('Radius of search in $$').replace('$$', crouton.config.distance_units);
|
|
18172
|
+
});
|
|
18173
|
+
controlDiv.querySelector("#show-search-page").addEventListener('click', function (e) {
|
|
18174
|
+
const controlDiv = e.target.parentElement.parentElement;
|
|
18175
|
+
let w = controlDiv.querySelector('#search_parameter').value;
|
|
18176
|
+
if (controlDiv.querySelector('#search_count')) {
|
|
18177
|
+
w = -Math.round(w);
|
|
18178
|
+
if (w == 0) w = -1;
|
|
18179
|
+
}
|
|
18180
|
+
config.map_search.width = w;
|
|
18181
|
+
controlDiv.querySelector("#modal-seach-parameters").style.display = 'none';
|
|
18182
|
+
controlDiv.querySelector("#modal-search-page").style.display = 'block';
|
|
18183
|
+
});
|
|
18184
|
+
|
|
18185
|
+
|
|
18186
|
+
if (gDelegate.hasClickSearch()) controlDiv.querySelector("#bmltsearch-clicksearch").addEventListener('click', clickSearch);
|
|
18136
18187
|
[...controlDiv.getElementsByClassName('modal-close')].forEach((elem)=>elem.addEventListener('click', (e)=>closeModalWindow(e.target)));
|
|
18137
18188
|
gSearchModal = controlDiv.querySelector("#bmltsearch_modal");
|
|
18138
18189
|
gSearchModal.parentElement.removeChild(gSearchModal);
|
|
@@ -18227,14 +18278,14 @@ function MeetingMap(inConfig) {
|
|
|
18227
18278
|
function hasMapSearch() {
|
|
18228
18279
|
return 'map_search' in config;
|
|
18229
18280
|
}
|
|
18230
|
-
function loadFromCrouton(inDiv_id, meetings_responseObject, menuContext = null, handlebarMapOptions = null, fitBounds = true, callback) {
|
|
18281
|
+
function loadFromCrouton(inDiv_id, meetings_responseObject, menuContext = null, handlebarMapOptions = null, fitBounds = true, callback, hide) {
|
|
18231
18282
|
if (!gDelegate.isApiLoaded()) {
|
|
18232
|
-
preloadApiLoadedCallback(loadFromCrouton, [inDiv_id, meetings_responseObject, menuContext, handlebarMapOptions, fitBounds, callback]);
|
|
18283
|
+
preloadApiLoadedCallback(loadFromCrouton, [inDiv_id, meetings_responseObject, menuContext, handlebarMapOptions, fitBounds, callback, hide]);
|
|
18233
18284
|
gDelegate.loadApi();
|
|
18234
18285
|
return;
|
|
18235
18286
|
}
|
|
18236
18287
|
let inDiv = document.getElementById(inDiv_id);
|
|
18237
|
-
loadMap(inDiv, menuContext, handlebarMapOptions,callback);
|
|
18288
|
+
loadMap(inDiv, menuContext, handlebarMapOptions, callback, hide);
|
|
18238
18289
|
loadAllMeetings(meetings_responseObject, fitBounds, true);
|
|
18239
18290
|
};
|
|
18240
18291
|
function loadPopupMap(inDiv_id, meeting, handlebarMapOptions = null) {
|
|
@@ -18309,10 +18360,14 @@ function MeetingMap(inConfig) {
|
|
|
18309
18360
|
};
|
|
18310
18361
|
};
|
|
18311
18362
|
function mapSearchGeocode(resp) {
|
|
18312
|
-
|
|
18363
|
+
showThrobber();
|
|
18313
18364
|
if (document.getElementById("bmltsearch-goto-text"))
|
|
18314
18365
|
document.getElementById("bmltsearch-goto-text").value = "";
|
|
18315
|
-
|
|
18366
|
+
let latlng = gDelegate.getGeocodeCenter(resp);
|
|
18367
|
+
if (!latlng) {
|
|
18368
|
+
hideThrobber();
|
|
18369
|
+
return;
|
|
18370
|
+
}
|
|
18316
18371
|
crouton.searchByCoordinates(latlng.lat, latlng.lng, config.map_search.width);
|
|
18317
18372
|
}
|
|
18318
18373
|
function loadAllMeetings(meetings_responseObject, fitBounds=true, fitAll=false) {
|
|
@@ -18795,7 +18850,14 @@ function MapDelegate(in_config) {
|
|
|
18795
18850
|
var firstScriptTag = document.getElementsByTagName('script')[0];
|
|
18796
18851
|
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
|
18797
18852
|
};
|
|
18798
|
-
function createMap(inDiv, inCenter) {
|
|
18853
|
+
function createMap(inDiv, inCenter, inHidden = false) {
|
|
18854
|
+
if ( inHidden ) {
|
|
18855
|
+
gDiv = inDiv;
|
|
18856
|
+
gDiv.style.height = 'auto';
|
|
18857
|
+
gDiv.style.marginBottom = '10px';
|
|
18858
|
+
gMainMap = null;
|
|
18859
|
+
return gDiv;
|
|
18860
|
+
}
|
|
18799
18861
|
g_icon_image_single = new google.maps.MarkerImage ( config.BMLTPlugin_images+"/NAMarker.png", new google.maps.Size(23, 32), new google.maps.Point(0,0), new google.maps.Point(12, 32) );
|
|
18800
18862
|
g_icon_image_multi = new google.maps.MarkerImage ( config.BMLTPlugin_images+"/NAMarkerG.png", new google.maps.Size(23, 32), new google.maps.Point(0,0), new google.maps.Point(12, 32) );
|
|
18801
18863
|
g_icon_image_selected = new google.maps.MarkerImage ( config.BMLTPlugin_images+"/NAMarkerSel.png", new google.maps.Size(23, 32), new google.maps.Point(0,0), new google.maps.Point(12, 32) );
|
|
@@ -18835,6 +18897,7 @@ function MapDelegate(in_config) {
|
|
|
18835
18897
|
return gMainMap;
|
|
18836
18898
|
}
|
|
18837
18899
|
function addListener(ev,f,once) {
|
|
18900
|
+
if (!gMainMap) return;
|
|
18838
18901
|
var e = ev;
|
|
18839
18902
|
switch (ev) {
|
|
18840
18903
|
case "zoomend":
|
|
@@ -18850,9 +18913,11 @@ function MapDelegate(in_config) {
|
|
|
18850
18913
|
}
|
|
18851
18914
|
}
|
|
18852
18915
|
function removeListener(f) {
|
|
18916
|
+
if (!gMainMap) return;
|
|
18853
18917
|
f.remove();
|
|
18854
18918
|
}
|
|
18855
18919
|
function fitBounds(locations) {
|
|
18920
|
+
if (!gMainMap) return;
|
|
18856
18921
|
google.maps.event.addListenerOnce(gMainMap, "bounds_changed", function () {
|
|
18857
18922
|
gMainMap.setZoom(parseInt(Math.min(gMainMap.getZoom(), config.maxZoom)));
|
|
18858
18923
|
});
|
|
@@ -18866,6 +18931,7 @@ function MapDelegate(in_config) {
|
|
|
18866
18931
|
gMainMap.fitBounds(bounds);
|
|
18867
18932
|
}
|
|
18868
18933
|
function setViewToPosition(position, filterMeetings, f) {
|
|
18934
|
+
if (!gMainMap) return;
|
|
18869
18935
|
var latlng = new google.maps.LatLng(position.latitude, position.longitude);
|
|
18870
18936
|
gMainMap.setCenter(latlng);
|
|
18871
18937
|
gMainMap.setZoom(getZoomAdjust(false, filterMeetings));
|
|
@@ -18873,6 +18939,7 @@ function MapDelegate(in_config) {
|
|
|
18873
18939
|
}
|
|
18874
18940
|
function clearAllMarkers ()
|
|
18875
18941
|
{
|
|
18942
|
+
if (!gMainMap) return;
|
|
18876
18943
|
gAllMarkers && gAllMarkers.forEach(function(m) {
|
|
18877
18944
|
m && m.marker.info_win && gAllMarkers[c].marker.info_win_.close();
|
|
18878
18945
|
m.marker.setMap( null );
|
|
@@ -18918,34 +18985,42 @@ function MapDelegate(in_config) {
|
|
|
18918
18985
|
return ret;
|
|
18919
18986
|
}
|
|
18920
18987
|
function setZoom(filterMeetings, force=0) {
|
|
18988
|
+
if (!gMainMap) return;
|
|
18921
18989
|
(force > 0) ? gMainMap.setZoom(force) :
|
|
18922
18990
|
gMainMap.setZoom(getZoomAdjust(false,filterMeetings));
|
|
18923
18991
|
}
|
|
18924
18992
|
function getZoom() {
|
|
18993
|
+
if (!gMainMap) return 12;
|
|
18925
18994
|
return gMainMap.getZoom();
|
|
18926
18995
|
}
|
|
18927
18996
|
function zoomOut(filterMeetings) {
|
|
18997
|
+
if (!gMainMap) return;
|
|
18928
18998
|
gMainMap.setZoom(getZoomAdjust(true,filterMeetings));
|
|
18929
18999
|
}
|
|
18930
19000
|
function contains(bounds, lat, lng) {
|
|
19001
|
+
if (!gMainMap) return true;
|
|
18931
19002
|
return bounds.contains(new google.maps.LatLng ( lat, lng));
|
|
18932
19003
|
}
|
|
18933
19004
|
function getBounds() {
|
|
19005
|
+
if (!gMainMap) return null;
|
|
18934
19006
|
return gMainMap.getBounds();
|
|
18935
19007
|
}
|
|
18936
19008
|
function fromLatLngToPoint(lat, lng) {
|
|
19009
|
+
if (!gMainMap) return null;
|
|
18937
19010
|
var latLng = new google.maps.LatLng ( lat, lng);
|
|
18938
19011
|
var scale = 1 << gMainMap.getZoom();
|
|
18939
19012
|
var worldPoint = gMainMap.getProjection().fromLatLngToPoint(latLng);
|
|
18940
19013
|
return new google.maps.Point(worldPoint.x * scale, worldPoint.y * scale);
|
|
18941
19014
|
};
|
|
18942
19015
|
function setZoom(filterMeetings) {
|
|
19016
|
+
if (!gMainMap) return;
|
|
18943
19017
|
gMainMap.setZoom(getZoomAdjust(false,filterMeetings));
|
|
18944
19018
|
}
|
|
18945
19019
|
function createClusterLayer() {
|
|
18946
19020
|
gIsClustering = true;
|
|
18947
19021
|
}
|
|
18948
19022
|
function removeClusterLayer() {
|
|
19023
|
+
if (!gMainMap) return;
|
|
18949
19024
|
gIsClustering =false;
|
|
18950
19025
|
gMarkerClusterer && gMarkerClusterer.setMap(null);
|
|
18951
19026
|
gMarkerClusterer = null;
|
|
@@ -18956,6 +19031,7 @@ function MapDelegate(in_config) {
|
|
|
18956
19031
|
}
|
|
18957
19032
|
}
|
|
18958
19033
|
function addClusterLayer() {
|
|
19034
|
+
if (!gMainMap) return;
|
|
18959
19035
|
let markers = gAllMarkers.map((m)=>m.marker);
|
|
18960
19036
|
if (gIsClustering) {
|
|
18961
19037
|
gMarkerClusterer = new markerClusterer.MarkerClusterer( { 'map': gMainMap, 'markers': markers, 'imagePath': 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'} );
|
|
@@ -19005,6 +19081,7 @@ function createMarker ( inCoords, ///< The long/lat for the marker.
|
|
|
19005
19081
|
inIds
|
|
19006
19082
|
)
|
|
19007
19083
|
{
|
|
19084
|
+
if (!gMainMap) return;
|
|
19008
19085
|
var in_main_icon = (multi ? g_icon_image_multi : g_icon_image_single)
|
|
19009
19086
|
var marker = null;
|
|
19010
19087
|
|
|
@@ -19049,6 +19126,10 @@ function createMarker ( inCoords, ///< The long/lat for the marker.
|
|
|
19049
19126
|
gAllMarkers[gAllMarkers.length] = {ids: inIds, marker: marker};
|
|
19050
19127
|
};
|
|
19051
19128
|
function addControl(div,pos,cb) {
|
|
19129
|
+
if (!gMainMap) {
|
|
19130
|
+
gDiv.appendChild(div);
|
|
19131
|
+
return;
|
|
19132
|
+
}
|
|
19052
19133
|
var p = pos;
|
|
19053
19134
|
switch(pos) {
|
|
19054
19135
|
case 'topright':
|
|
@@ -19080,10 +19161,12 @@ function addControl(div,pos,cb) {
|
|
|
19080
19161
|
* \brief This catches the AJAX response, and fills in the response form. *
|
|
19081
19162
|
****************************************************************************************/
|
|
19082
19163
|
function fitAndZoom(ev) {
|
|
19164
|
+
if (!gMainMap) return;
|
|
19083
19165
|
gMainMap.fitBounds(this.response[0].geometry.viewport);
|
|
19084
19166
|
gMainMap.setZoom(getZoomAdjust(true,this.filterMeetings));
|
|
19085
19167
|
}
|
|
19086
19168
|
function openMarker(id) {
|
|
19169
|
+
if (!gMainMap) return;
|
|
19087
19170
|
marker = gAllMarkers.find((m) => m.ids.includes(id));
|
|
19088
19171
|
if (marker) {
|
|
19089
19172
|
google.maps.event.trigger(marker.marker, 'click')
|
|
@@ -19137,6 +19220,7 @@ function geoCallback( in_geocode_response ) {
|
|
|
19137
19220
|
function invalidateSize() {
|
|
19138
19221
|
}
|
|
19139
19222
|
function clickSearch(ev, cb) {
|
|
19223
|
+
if (!gMainMap) return;
|
|
19140
19224
|
gMainMap.setOptions({
|
|
19141
19225
|
draggableCursor: 'crosshair',
|
|
19142
19226
|
zoomControl: false,
|
|
@@ -19152,11 +19236,15 @@ function geoCallback( in_geocode_response ) {
|
|
|
19152
19236
|
})
|
|
19153
19237
|
};
|
|
19154
19238
|
function afterInit(f) {
|
|
19239
|
+
if (!gMainMap) return;
|
|
19155
19240
|
if (typeof gMainMap.getBounds() !== 'undefined') f();
|
|
19156
19241
|
else addListener('idle', f, true);
|
|
19157
19242
|
}
|
|
19158
19243
|
function modalOn() {}
|
|
19159
19244
|
function modalOff() {}
|
|
19245
|
+
function hasClickSearch() {
|
|
19246
|
+
return gMainMap != null;
|
|
19247
|
+
}
|
|
19160
19248
|
this.createMap = createMap;
|
|
19161
19249
|
this.addListener = addListener;
|
|
19162
19250
|
this.addControl = addControl;
|
|
@@ -19184,6 +19272,7 @@ function geoCallback( in_geocode_response ) {
|
|
|
19184
19272
|
this.modalOff = modalOff;
|
|
19185
19273
|
this.removeListener = removeListener;
|
|
19186
19274
|
this.afterInit = afterInit;
|
|
19275
|
+
this.hasClickSearch = hasClickSearch;
|
|
19187
19276
|
}
|
|
19188
19277
|
MapDelegate.prototype.createMap = null;
|
|
19189
19278
|
MapDelegate.prototype.addListener = null;
|
|
@@ -19212,6 +19301,7 @@ MapDelegate.prototype.getGeocodeCenter = null;
|
|
|
19212
19301
|
MapDelegate.prototype.modalOn = null;
|
|
19213
19302
|
MapDelegate.prototype.modalOff = null;
|
|
19214
19303
|
MapDelegate.prototype.afterInit = null;
|
|
19304
|
+
MapDelegate.prototype.hasClickSearch = null;
|
|
19215
19305
|
var markerClusterer=function(t){"use strict";function e(t,e){var s={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(s[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(s[r[o]]=t[r[o]])}return s}class s{static isAdvancedMarkerAvailable(t){return google.maps.marker&&!0===t.getMapCapabilities().isAdvancedMarkersAvailable}static isAdvancedMarker(t){return google.maps.marker&&t instanceof google.maps.marker.AdvancedMarkerElement}static setMap(t,e){this.isAdvancedMarker(t)?t.map=e:t.setMap(e)}static getPosition(t){if(this.isAdvancedMarker(t)){if(t.position){if(t.position instanceof google.maps.LatLng)return t.position;if(t.position.lat&&t.position.lng)return new google.maps.LatLng(t.position.lat,t.position.lng)}return new google.maps.LatLng(null)}return t.getPosition()}static getVisible(t){return!!this.isAdvancedMarker(t)||t.getVisible()}}class r{constructor(t){let{markers:e,position:s}=t;this.markers=e,s&&(s instanceof google.maps.LatLng?this._position=s:this._position=new google.maps.LatLng(s))}get bounds(){if(0===this.markers.length&&!this._position)return;const t=new google.maps.LatLngBounds(this._position,this._position);for(const e of this.markers)t.extend(s.getPosition(e));return t}get position(){return this._position||this.bounds.getCenter()}get count(){return this.markers.filter((t=>s.getVisible(t))).length}push(t){this.markers.push(t)}delete(){this.marker&&(s.setMap(this.marker,null),this.marker=void 0),this.markers.length=0}}const o=(t,e,r,o)=>{const n=i(t.getBounds(),e,o);return r.filter((t=>n.contains(s.getPosition(t))))},i=(t,e,s)=>{const{northEast:r,southWest:o}=h(t,e),i=l({northEast:r,southWest:o},s);return c(i,e)},n=(t,e,s)=>{const r=i(t,e,s),o=r.getNorthEast(),n=r.getSouthWest();return[n.lng(),n.lat(),o.lng(),o.lat()]},a=(t,e)=>{const s=(e.lat-t.lat)*Math.PI/180,r=(e.lng-t.lng)*Math.PI/180,o=Math.sin(s/2),i=Math.sin(r/2),n=o*o+Math.cos(t.lat*Math.PI/180)*Math.cos(e.lat*Math.PI/180)*i*i;return 6371*(2*Math.atan2(Math.sqrt(n),Math.sqrt(1-n)))},h=(t,e)=>({northEast:e.fromLatLngToDivPixel(t.getNorthEast()),southWest:e.fromLatLngToDivPixel(t.getSouthWest())}),l=(t,e)=>{let{northEast:s,southWest:r}=t;return s.x+=e,s.y-=e,r.x-=e,r.y+=e,{northEast:s,southWest:r}},c=(t,e)=>{let{northEast:s,southWest:r}=t;const o=e.fromDivPixelToLatLng(r),i=e.fromDivPixelToLatLng(s);return new google.maps.LatLngBounds(o,i)};class u{constructor(t){let{maxZoom:e=16}=t;this.maxZoom=e}noop(t){let{markers:e}=t;return m(e)}}class p extends u{constructor(t){var{viewportPadding:s=60}=t;super(e(t,["viewportPadding"])),this.viewportPadding=60,this.viewportPadding=s}calculate(t){let{markers:e,map:s,mapCanvasProjection:r}=t;return s.getZoom()>=this.maxZoom?{clusters:this.noop({markers:e}),changed:!1}:{clusters:this.cluster({markers:o(s,r,e,this.viewportPadding),map:s,mapCanvasProjection:r})}}}const m=t=>t.map((t=>new r({position:s.getPosition(t),markers:[t]})));function d(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var g=function t(e,s){if(e===s)return!0;if(e&&s&&"object"==typeof e&&"object"==typeof s){if(e.constructor!==s.constructor)return!1;var r,o,i;if(Array.isArray(e)){if((r=e.length)!=s.length)return!1;for(o=r;0!=o--;)if(!t(e[o],s[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===s.source&&e.flags===s.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===s.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===s.toString();if((r=(i=Object.keys(e)).length)!==Object.keys(s).length)return!1;for(o=r;0!=o--;)if(!Object.prototype.hasOwnProperty.call(s,i[o]))return!1;for(o=r;0!=o--;){var n=i[o];if(!t(e[n],s[n]))return!1}return!0}return e!=e&&s!=s},f=d(g);const k=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class w{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,s]=new Uint8Array(t,0,2);if(219!==e)throw new Error("Data does not appear to be in a KDBush format.");const r=s>>4;if(1!==r)throw new Error(`Got v${r} data when expected v1.`);const o=k[15&s];if(!o)throw new Error("Unrecognized array type.");const[i]=new Uint16Array(t,2,1),[n]=new Uint32Array(t,4,1);return new w(n,i,o,t)}constructor(t,e=64,s=Float64Array,r){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=s,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const o=k.indexOf(this.ArrayType),i=2*t*this.ArrayType.BYTES_PER_ELEMENT,n=t*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-n%8)%8;if(o<0)throw new Error(`Unexpected typed array class: ${s}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+n+a,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+i+n+a),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+n+a,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+o]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=t,this.coords[this._pos++]=e,s}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return y(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,s,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:i,nodeSize:n}=this,a=[0,o.length-1,0],h=[];for(;a.length;){const l=a.pop()||0,c=a.pop()||0,u=a.pop()||0;if(c-u<=n){for(let n=u;n<=c;n++){const a=i[2*n],l=i[2*n+1];a>=t&&a<=s&&l>=e&&l<=r&&h.push(o[n])}continue}const p=u+c>>1,m=i[2*p],d=i[2*p+1];m>=t&&m<=s&&d>=e&&d<=r&&h.push(o[p]),(0===l?t<=m:e<=d)&&(a.push(u),a.push(p-1),a.push(1-l)),(0===l?s>=m:r>=d)&&(a.push(p+1),a.push(c),a.push(1-l))}return h}within(t,e,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:o,nodeSize:i}=this,n=[0,r.length-1,0],a=[],h=s*s;for(;n.length;){const l=n.pop()||0,c=n.pop()||0,u=n.pop()||0;if(c-u<=i){for(let s=u;s<=c;s++)C(o[2*s],o[2*s+1],t,e)<=h&&a.push(r[s]);continue}const p=u+c>>1,m=o[2*p],d=o[2*p+1];C(m,d,t,e)<=h&&a.push(r[p]),(0===l?t-s<=m:e-s<=d)&&(n.push(u),n.push(p-1),n.push(1-l)),(0===l?t+s>=m:e+s>=d)&&(n.push(p+1),n.push(c),n.push(1-l))}return a}}function y(t,e,s,r,o,i){if(o-r<=s)return;const n=r+o>>1;M(t,e,n,r,o,i),y(t,e,s,r,n-1,1-i),y(t,e,s,n+1,o,1-i)}function M(t,e,s,r,o,i){for(;o>r;){if(o-r>600){const n=o-r+1,a=s-r+1,h=Math.log(n),l=.5*Math.exp(2*h/3),c=.5*Math.sqrt(h*l*(n-l)/n)*(a-n/2<0?-1:1);M(t,e,s,Math.max(r,Math.floor(s-a*l/n+c)),Math.min(o,Math.floor(s+(n-a)*l/n+c)),i)}const n=e[2*s+i];let a=r,h=o;for(v(t,e,r,s),e[2*o+i]>n&&v(t,e,r,o);a<h;){for(v(t,e,a,h),a++,h--;e[2*a+i]<n;)a++;for(;e[2*h+i]>n;)h--}e[2*r+i]===n?v(t,e,r,h):(h++,v(t,e,h,o)),h<=s&&(r=h+1),s<=h&&(o=h-1)}}function v(t,e,s,r){x(t,s,r),x(e,2*s,2*r),x(e,2*s+1,2*r+1)}function x(t,e,s){const r=t[e];t[e]=t[s],t[s]=r}function C(t,e,s,r){const o=t-s,i=e-r;return o*o+i*i}const P={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},_=Math.fround||(E=new Float32Array(1),t=>(E[0]=+t,E[0]));var E;const A=3,b=5,L=6;class O{constructor(t){this.options=Object.assign(Object.create(P),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){const{log:e,minZoom:s,maxZoom:r}=this.options;e&&console.time("total time");const o=`prepare ${t.length} points`;e&&console.time(o),this.points=t;const i=[];for(let e=0;e<t.length;e++){const s=t[e];if(!s.geometry)continue;const[r,o]=s.geometry.coordinates,n=_(T(r)),a=_(j(o));i.push(n,a,1/0,e,-1,1),this.options.reduce&&i.push(0)}let n=this.trees[r+1]=this._createTree(i);e&&console.timeEnd(o);for(let t=r;t>=s;t--){const s=+Date.now();n=this.trees[t]=this._createTree(this._cluster(n,t)),e&&console.log("z%d: %d clusters in %dms",t,n.numItems,+Date.now()-s)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let s=((t[0]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,t[1]));let o=180===t[2]?180:((t[2]+180)%360+360)%360-180;const i=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)s=-180,o=180;else if(s>o){const t=this.getClusters([s,r,180,i],e),n=this.getClusters([-180,r,o,i],e);return t.concat(n)}const n=this.trees[this._limitZoom(e)],a=n.range(T(s),j(i),T(o),j(r)),h=n.data,l=[];for(const t of a){const e=this.stride*t;l.push(h[e+b]>1?Z(h,e,this.clusterProps):this.points[h[e+A]])}return l}getChildren(t){const e=this._getOriginId(t),s=this._getOriginZoom(t),r="No cluster with the specified id.",o=this.trees[s];if(!o)throw new Error(r);const i=o.data;if(e*this.stride>=i.length)throw new Error(r);const n=this.options.radius/(this.options.extent*Math.pow(2,s-1)),a=i[e*this.stride],h=i[e*this.stride+1],l=o.within(a,h,n),c=[];for(const e of l){const s=e*this.stride;i[s+4]===t&&c.push(i[s+b]>1?Z(i,s,this.clusterProps):this.points[i[s+A]])}if(0===c.length)throw new Error(r);return c}getLeaves(t,e,s){e=e||10,s=s||0;const r=[];return this._appendLeaves(r,t,e,s,0),r}getTile(t,e,s){const r=this.trees[this._limitZoom(t)],o=Math.pow(2,t),{extent:i,radius:n}=this.options,a=n/i,h=(s-a)/o,l=(s+1+a)/o,c={features:[]};return this._addTileFeatures(r.range((e-a)/o,h,(e+1+a)/o,l),r.data,e,s,o,c),0===e&&this._addTileFeatures(r.range(1-a/o,h,1,l),r.data,o,s,o,c),e===o-1&&this._addTileFeatures(r.range(0,h,a/o,l),r.data,-1,s,o,c),c.features.length?c:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const s=this.getChildren(t);if(e++,1!==s.length)break;t=s[0].properties.cluster_id}return e}_appendLeaves(t,e,s,r,o){const i=this.getChildren(e);for(const e of i){const i=e.properties;if(i&&i.cluster?o+i.point_count<=r?o+=i.point_count:o=this._appendLeaves(t,i.cluster_id,s,r,o):o<r?o++:t.push(e),t.length===s)break}return o}_createTree(t){const e=new w(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let s=0;s<t.length;s+=this.stride)e.add(t[s],t[s+1]);return e.finish(),e.data=t,e}_addTileFeatures(t,e,s,r,o,i){for(const n of t){const t=n*this.stride,a=e[t+b]>1;let h,l,c;if(a)h=I(e,t,this.clusterProps),l=e[t],c=e[t+1];else{const s=this.points[e[t+A]];h=s.properties;const[r,o]=s.geometry.coordinates;l=T(r),c=j(o)}const u={type:1,geometry:[[Math.round(this.options.extent*(l*o-s)),Math.round(this.options.extent*(c*o-r))]],tags:h};let p;p=a||this.options.generateId?e[t+A]:this.points[e[t+A]].id,void 0!==p&&(u.id=p),i.features.push(u)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,e){const{radius:s,extent:r,reduce:o,minPoints:i}=this.options,n=s/(r*Math.pow(2,e)),a=t.data,h=[],l=this.stride;for(let s=0;s<a.length;s+=l){if(a[s+2]<=e)continue;a[s+2]=e;const r=a[s],c=a[s+1],u=t.within(a[s],a[s+1],n),p=a[s+b];let m=p;for(const t of u){const s=t*l;a[s+2]>e&&(m+=a[s+b])}if(m>p&&m>=i){let t,i=r*p,n=c*p,d=-1;const g=((s/l|0)<<5)+(e+1)+this.points.length;for(const r of u){const h=r*l;if(a[h+2]<=e)continue;a[h+2]=e;const c=a[h+b];i+=a[h]*c,n+=a[h+1]*c,a[h+4]=g,o&&(t||(t=this._map(a,s,!0),d=this.clusterProps.length,this.clusterProps.push(t)),o(t,this._map(a,h)))}a[s+4]=g,h.push(i/m,n/m,1/0,g,-1,m),o&&h.push(d)}else{for(let t=0;t<l;t++)h.push(a[s+t]);if(m>1)for(const t of u){const s=t*l;if(!(a[s+2]<=e)){a[s+2]=e;for(let t=0;t<l;t++)h.push(a[s+t])}}}}return h}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e,s){if(t[e+b]>1){const r=this.clusterProps[t[e+L]];return s?Object.assign({},r):r}const r=this.points[t[e+A]].properties,o=this.options.map(r);return s&&o===r?Object.assign({},o):o}}function Z(t,e,s){return{type:"Feature",id:t[e+A],properties:I(t,e,s),geometry:{type:"Point",coordinates:[(r=t[e],360*(r-.5)),S(t[e+1])]}};var r}function I(t,e,s){const r=t[e+b],o=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r,i=t[e+L],n=-1===i?{}:Object.assign({},s[i]);return Object.assign(n,{cluster:!0,cluster_id:t[e+A],point_count:r,point_count_abbreviated:o})}function T(t){return t/360+.5}function j(t){const e=Math.sin(t*Math.PI/180),s=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return s<0?0:s>1?1:s}function S(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}class z extends u{constructor(t){var{maxZoom:s,radius:r=60}=t,o=e(t,["maxZoom","radius"]);super({maxZoom:s}),this.state={zoom:-1},this.superCluster=new O(Object.assign({maxZoom:this.maxZoom,radius:r},o))}calculate(t){let e=!1;const r={zoom:t.map.getZoom()};if(!f(t.markers,this.markers)){e=!0,this.markers=[...t.markers];const r=this.markers.map((t=>{const e=s.getPosition(t);return{type:"Feature",geometry:{type:"Point",coordinates:[e.lng(),e.lat()]},properties:{marker:t}}}));this.superCluster.load(r)}return e||(this.state.zoom<=this.maxZoom||r.zoom<=this.maxZoom)&&(e=!f(this.state,r)),this.state=r,e&&(this.clusters=this.cluster(t)),{clusters:this.clusters,changed:e}}cluster(t){let{map:e}=t;return this.superCluster.getClusters([-180,-90,180,90],Math.round(e.getZoom())).map((t=>this.transformCluster(t)))}transformCluster(t){let{geometry:{coordinates:[e,o]},properties:i}=t;if(i.cluster)return new r({markers:this.superCluster.getLeaves(i.cluster_id,1/0).map((t=>t.properties.marker)),position:{lat:o,lng:e}});const n=i.marker;return new r({markers:[n],position:s.getPosition(n)})}}class U{constructor(t,e){this.markers={sum:t.length};const s=e.map((t=>t.count)),r=s.reduce(((t,e)=>t+e),0);this.clusters={count:e.length,markers:{mean:r/e.length,sum:r,min:Math.min(...s),max:Math.max(...s)}}}}class B{render(t,e,r){let{count:o,position:i}=t;const n=`<svg fill="${o>Math.max(10,e.clusters.markers.mean)?"#ff0000":"#0000ff"}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240" width="50" height="50">\n<circle cx="120" cy="120" opacity=".6" r="70" />\n<circle cx="120" cy="120" opacity=".3" r="90" />\n<circle cx="120" cy="120" opacity=".2" r="110" />\n<text x="50%" y="50%" style="fill:#fff" text-anchor="middle" font-size="50" dominant-baseline="middle" font-family="roboto,arial,sans-serif">${o}</text>\n</svg>`,a=`Cluster of ${o} markers`,h=Number(google.maps.Marker.MAX_ZINDEX)+o;if(s.isAdvancedMarkerAvailable(r)){const t=(new DOMParser).parseFromString(n,"image/svg+xml").documentElement;t.setAttribute("transform","translate(0 25)");const e={map:r,position:i,zIndex:h,title:a,content:t};return new google.maps.marker.AdvancedMarkerElement(e)}const l={position:i,zIndex:h,title:a,icon:{url:`data:image/svg+xml;base64,${btoa(n)}`,anchor:new google.maps.Point(25,25)}};return new google.maps.Marker(l)}}class D{constructor(){!function(t,e){for(let s in e.prototype)t.prototype[s]=e.prototype[s]}(D,google.maps.OverlayView)}}var N;t.MarkerClustererEvents=void 0,(N=t.MarkerClustererEvents||(t.MarkerClustererEvents={})).CLUSTERING_BEGIN="clusteringbegin",N.CLUSTERING_END="clusteringend",N.CLUSTER_CLICK="click";const F=(t,e,s)=>{s.fitBounds(e.bounds)};return t.AbstractAlgorithm=u,t.AbstractViewportAlgorithm=p,t.Cluster=r,t.ClusterStats=U,t.DefaultRenderer=B,t.GridAlgorithm=class extends p{constructor(t){var{maxDistance:s=4e4,gridSize:r=40}=t;super(e(t,["maxDistance","gridSize"])),this.clusters=[],this.state={zoom:-1},this.maxDistance=s,this.gridSize=r}calculate(t){let{markers:e,map:s,mapCanvasProjection:r}=t;const i={zoom:s.getZoom()};let n=!1;return this.state.zoom>=this.maxZoom&&i.zoom>=this.maxZoom||(n=!f(this.state,i)),this.state=i,s.getZoom()>=this.maxZoom?{clusters:this.noop({markers:e}),changed:n}:{clusters:this.cluster({markers:o(s,r,e,this.viewportPadding),map:s,mapCanvasProjection:r})}}cluster(t){let{markers:e,map:s,mapCanvasProjection:r}=t;return this.clusters=[],e.forEach((t=>{this.addToClosestCluster(t,s,r)})),this.clusters}addToClosestCluster(t,e,o){let n=this.maxDistance,h=null;for(let e=0;e<this.clusters.length;e++){const r=this.clusters[e],o=a(r.bounds.getCenter().toJSON(),s.getPosition(t).toJSON());o<n&&(n=o,h=r)}if(h&&i(h.bounds,o,this.gridSize).contains(s.getPosition(t)))h.push(t);else{const e=new r({markers:[t]});this.clusters.push(e)}}},t.MarkerClusterer=class extends D{constructor(t){let{map:e,markers:s=[],algorithmOptions:r={},algorithm:o=new z(r),renderer:i=new B,onClusterClick:n=F}=t;super(),this.markers=[...s],this.clusters=[],this.algorithm=o,this.renderer=i,this.onClusterClick=n,e&&this.setMap(e)}addMarker(t,e){this.markers.includes(t)||(this.markers.push(t),e||this.render())}addMarkers(t,e){t.forEach((t=>{this.addMarker(t,!0)})),e||this.render()}removeMarker(t,e){const r=this.markers.indexOf(t);return-1!==r&&(s.setMap(t,null),this.markers.splice(r,1),e||this.render(),!0)}removeMarkers(t,e){let s=!1;return t.forEach((t=>{s=this.removeMarker(t,!0)||s})),s&&!e&&this.render(),s}clearMarkers(t){this.markers.length=0,t||this.render()}render(){const e=this.getMap();if(e instanceof google.maps.Map&&e.getProjection()){google.maps.event.trigger(this,t.MarkerClustererEvents.CLUSTERING_BEGIN,this);const{clusters:r,changed:o}=this.algorithm.calculate({markers:this.markers,map:e,mapCanvasProjection:this.getProjection()});if(o||null==o){const t=new Set;for(const e of r)1==e.markers.length&&t.add(e.markers[0]);const e=[];for(const r of this.clusters)null!=r.marker&&(1==r.markers.length?t.has(r.marker)||s.setMap(r.marker,null):e.push(r.marker));this.clusters=r,this.renderClusters(),requestAnimationFrame((()=>e.forEach((t=>s.setMap(t,null)))))}google.maps.event.trigger(this,t.MarkerClustererEvents.CLUSTERING_END,this)}}onAdd(){this.idleListener=this.getMap().addListener("idle",this.render.bind(this)),this.render()}onRemove(){google.maps.event.removeListener(this.idleListener),this.reset()}reset(){this.markers.forEach((t=>s.setMap(t,null))),this.clusters.forEach((t=>t.delete())),this.clusters=[]}renderClusters(){const e=new U(this.markers,this.clusters),r=this.getMap();this.clusters.forEach((o=>{1===o.markers.length?o.marker=o.markers[0]:(o.marker=this.renderer.render(o,e,r),o.markers.forEach((t=>s.setMap(t,null))),this.onClusterClick&&o.marker.addListener("click",(e=>{google.maps.event.trigger(this,t.MarkerClustererEvents.CLUSTER_CLICK,o),this.onClusterClick(e,o,r)}))),s.setMap(o.marker,r)}))}},t.MarkerUtils=s,t.NoopAlgorithm=class extends u{constructor(t){super(e(t,[]))}calculate(t){let{markers:e,map:s,mapCanvasProjection:r}=t;return{clusters:this.cluster({markers:e,map:s,mapCanvasProjection:r}),changed:!1}}cluster(t){return this.noop(t)}},t.SuperClusterAlgorithm=z,t.SuperClusterViewportAlgorithm=class extends p{constructor(t){var{maxZoom:s,radius:r=60,viewportPadding:o=60}=t,i=e(t,["maxZoom","radius","viewportPadding"]);super({maxZoom:s,viewportPadding:o}),this.superCluster=new O(Object.assign({maxZoom:this.maxZoom,radius:r},i)),this.state={zoom:-1,view:[0,0,0,0]}}calculate(t){const e={zoom:Math.round(t.map.getZoom()),view:n(t.map.getBounds(),t.mapCanvasProjection,this.viewportPadding)};let r=!f(this.state,e);if(!f(t.markers,this.markers)){r=!0,this.markers=[...t.markers];const e=this.markers.map((t=>{const e=s.getPosition(t);return{type:"Feature",geometry:{type:"Point",coordinates:[e.lng(),e.lat()]},properties:{marker:t}}}));this.superCluster.load(e)}return r&&(this.clusters=this.cluster(t),this.state=e),{clusters:this.clusters,changed:r}}cluster(t){let{map:e,mapCanvasProjection:s}=t;const r={zoom:Math.round(e.getZoom()),view:n(e.getBounds(),s,this.viewportPadding)};return this.superCluster.getClusters(r.view,r.zoom).map((t=>this.transformCluster(t)))}transformCluster(t){let{geometry:{coordinates:[e,o]},properties:i}=t;if(i.cluster)return new r({markers:this.superCluster.getLeaves(i.cluster_id,1/0).map((t=>t.properties.marker)),position:{lat:o,lng:e}});const n=i.marker;return new r({markers:[n],position:s.getPosition(n)})}},t.defaultOnClusterClickHandler=F,t.distanceBetweenPoints=a,t.extendBoundsToPaddedViewport=i,t.extendPixelBounds=l,t.filterMarkersToPaddedViewport=o,t.getPaddedViewport=n,t.noop=m,t.pixelBoundsToLatLngBounds=c,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
|
|
19216
19306
|
//# sourceMappingURL=index.min.js.map
|
|
19217
19307
|
|