1jQuery((function($) { 2 //sticky nav 3 $(".scroll-to-item").click((function() { 4 var sepLoc = $(this).attr("href"), 5 //sepWidth = Math.max( $(window).width(), window.innerWidth), 6 sepNavHeight = $("#stickysub").height(); 7 $("html, body").stop().animate({ 8 scrollTop: $(sepLoc).offset().top - (sepNavHeight - 5) 9 }, 550); 10 return false; 11 })); 12 if ($("body").hasClass("substicky")) { 13 var csect = $(".stickysub-section"), cnav = $("#stickysub-nav"), nav_height = cnav.outerHeight(); 14 $(window).on("scroll", (function() { 15 var cur_pos = $(this).scrollTop(); 16 csect.each((function() { 17 var top = $(this).offset().top - nav_height, bottom = top + $(this).outerHeight(); 18 if (cur_pos >= top && cur_pos <= bottom) { 19 cnav.find("a").removeClass("active"); 20 csect.removeClass("active"); 21 $(this).addClass("active"); 22 cnav.find('a[href="#' + $(this).attr("id") + '"]').addClass("active"); 23 } else { 24 $(this).removeClass("active"); 25 cnav.find('a[href="#' + $(this).attr("id") + '"]').removeClass("active"); 26 } 27 })); 28 })); 29 } 30 $("select.nav-dropdown").change((function(e) { 31 e.preventDefault(); 32 e.stopPropagation(); 33 // location.href = this.value; 34 // scroll to the selected section 35 var obj = cumulativeOffset(document.getElementById(this.value.replace("#", ""))); 36 setTimeout((function() { 37 // console.log("THIS.value", obj.top); 38 // window.scrollTo(0, obj.top); 39 $("html,body").animate({ 40 scrollTop: obj.top 41 }, 500); 42 }), 100); 43 })); 44 //pagination for monklets 45 $("body").on("click", ".m1-monklet #pagination a", (function(event) { 46 event.preventDefault(); 47 var $m1Monklet = $(this).parents(".m1-monklet"); 48 var data = $m1Monklet.data(); 49 if ($(this).attr("href") == undefined || $(this).attr("href") == "#") { 50 return false; 51 } else { 52 var thisurl = $(this).attr("href"); 53 var page = getmUrlParameter("page", thisurl); 54 if (page != undefined) { 55 data.page = page; 56 } 57 if (data.type === "classfinder" || data.type === "groups1" || data.type === "groups2") { 58 // different handling for groups1 monklet 59 var monkletHeight = $m1Monklet.find(".list-view").outerHeight(); 60 $m1Monklet.find(".list-view").css("min-height", monkletHeight + "px"); 61 $m1Monklet.find(".list-view").addClass("loading transparent"); 62 } else { 63 var monkletHeight = $m1Monklet.height(); 64 $m1Monklet.css("min-height", monkletHeight + "px"); 65 $m1Monklet.html("").addClass("loading transparent"); 66 } 67 $.ajax({ 68 url: "/_components/ajax/ministry_1/ajax-ministry-1.php", 69 type: "GET", 70 data: data, 71 success: function(results) { 72 if (data.type === "classfinder" || data.type === "groups1" || data.type === "groups2") { 73 // different handling for groups1/groups2 74 $m1Monklet.find(".items.list-view").removeClass("loading transparent").html(results); 75 } else { 76 $m1Monklet.html(results).removeClass("loading transparent"); 77 } 78 }, 79 error: function(results, textStatus, jqXHR) { 80 //add error messages as needed console.log(jqXHR.responseText); 81 } 82 }); 83 } 84 })); 85 populateSmallGroupsImage(); 86 populateClassfinderImage(); 87 if ($("#smallgroups2-map").length) { 88 initSmallGroups2(); 89 } 90})); 91 92var cumulativeOffset = function(element) { 93 var top = 0, left = 0; 94 do { 95 top += element.offsetTop || 0; 96 left += element.offsetLeft || 0; 97 element = element.offsetParent; 98 } while (element); 99 return { 100 top: top, 101 left: left 102 }; 103}; 104 105function getmUrlParameter(param, url) { 106 var sPageURL = url.split("?")[1]; 107 var sURLVariables = sPageURL.split("&"); 108 for (var i = 0; i < sURLVariables.length; i++) { 109 var sParameterName = sURLVariables[i].split("="); 110 if (sParameterName[0] == param) { 111 return sParameterName[1]; 112 } 113 } 114} 115 116function populateSmallGroupsImage() { 117 if ($("#small-groups-image").length) {
118 $.get("/_components/ajax/ministry_1/ajax-small-groups-image.php", (function(response) { 119 if (response != "blank") { 120 $("#small-groups-image").css("background-image", response).removeClass("blank"); 121 } 122 })); 123 } 124} 125 126function populateClassfinderImage() { 127 if ($("#classfinder-image").length) { 128 $.get("/_components/ajax/ministry_1/ajax-classfinder-image.php", (function(response) { 129 if (response != "blank") { 130 $("#classfinder-image").css("background-image", response).removeClass("blank"); 131 } 132 })); 133 } 134} 135 136function initSmallGroups2() { 137 // Reference to Google Map 138 var map; 139 // Array of map markers 140 var markers = []; 141 // Array of grouped map markers 142 var groupedMarkers = []; 143 // Default Zoom value 144 var defaultZoom = 2; 145 // Global infobox 146 var infoBox = new InfoBox; 147 // Default LatLng value 148 var defaultLatLng = new google.maps.LatLng(17.6, 0); 149 /** 150 * Removes all elements from `array` that `predicate` returns truthy for 151 * and returns an array of the removed elements. Lodash's remove method. 152 * @param {Array} array The array to modify. 153 * @param {Function} predicate The function invoked per iteration 154 * @return {Array} Returns the new array of removed elements. 155 */ function arrayRemove(array, predicate) { 156 var index = -1, length = array ? array.length : 0, result = []; 157 while (++index < length) { 158 var value = array[index]; 159 if (predicate(value, index, array)) { 160 result.push(value); 161 array.splice(index--, 1); 162 length--; 163 } 164 } 165 return result; 166 } 167 /** 168 * Reset all icon when the colorbox closes. 169 * @return {MapsEventListener} 170 */ function bindInfoBoxClose() { 171 return google.maps.event.addListener(infoBox, "closeclick", (function() { 172 setAllMarkerIcons(defaultMarkerIcon()); 173 setAllGroupedMarkerIcons(groupedMarkerIcon()); 174 })); 175 } 176 /** 177 * Toggle marker and infobox visibility when user clicks map marker. 178 * @param {Object} group the group marker to toggle 179 * @param {Marker} marker Google Map marker 180 * @return {MapsEventListener} 181 */ function bindInfoBoxMarkerToggle(group, marker) { 182 return google.maps.event.addListener(marker, "click", (function() { 183 if (infoBox.getVisible() && infoBox.getContent() === group.content) { 184 hideInfoBoxMarker(marker); 185 } else { 186 showInfoBoxMarker(group, marker); 187 } 188 })); 189 } 190 /** 191 * Toggle grouped marker and infobox visibility when user clicks map marker. 192 * @param {Object} grouped the grouped marker to toggle 193 * @param {Marker} marker Google Map marker 194 * @return {MapsEventListener} 195 */ function bindInfoBoxGroupedMarkerToggle(grouped, marker) { 196 var content = buildInfoboxGroupedContent(grouped); 197 return google.maps.event.addListener(marker, "click", (function() { 198 if (infoBox.getVisible() && infoBox.getContent() === content) { 199 hideInfoBoxGroupedMarker(marker); 200 } else { 201 showInfoBoxGroupedMarker(content, marker); 202 } 203 })); 204 } 205 /** 206 * build content for list view 207 * @param {Array} grouped Array of location grouping 208 * @return {String} html string 209 */ function buildInfoboxGroupedContent(grouped) { 210 var content = ""; 211 var address = grouped[0].address; 212 var title = '<div class="grouped title"><h5>' + grouped.length + " groups meet here.</h5></div>"; 213 var directions = '<div class="buttons grouped"><a href="http://maps.google.com/maps?q=' + address + '" target="_blank" class="map-directions"><span class="group-icon icon-pin_1"></span><span class="text">Get Directions</span></a></div>'; 214 grouped.forEach((function(group) { 215 content += "<li>" + group.listContent + "</li>"; 216 })); 217 return title + directions + "<ol>" + content + "</ol>"; 218 } 219 /** 220 * Calculates furthest bounds for a set of objects 221 * @param {Collection} objects Array of objects with geocode data 222 * @return {LatLngBounds} google.maps.LatLngBounds class 223 */ function calculateMaxBounds(objects) { 224 if (!objects || !objects.length) { 225 return false;
226 } else { 227 var max, degrees, latLngs = []; 228 // Build collection of LatLngBounds 229 objects.forEach((function(object, index, array) { 230 if (object.latitude && object.longitude) { 231 latLngs.push(new google.maps.LatLng(object.latitude, object.longitude)); 232 } 233 })); 234 // Compare each location and get the maximum bounds 235 latLngs.forEach((function(latLng, index, array) { 236 if (index === 0) { 237 max = new google.maps.LatLngBounds(latLng, latLng); 238 } else { 239 max.extend(latLng); 240 } 241 })); 242 degrees = latLngs.length === 1 ? .1 : .03; 243 return extendViewport(degrees, max); 244 } 245 } 246 // This function tries to keep the infobox a reasonable width/size on small mobile devices 247 function calcInfoBoxWidth() { 248 if ($("#smallgroups2-map").width() < 285) { 249 return $("#smallgroups2-map").width() - 20 + "px"; 250 } else { 251 return "275px"; 252 } 253 } 254 /** 255 * Get a new infobox configuration 256 * @param {String} content Html string containing the infobox content 257 * @return {Object} Configuration object 258 */ function defaultInfoBox(content) { 259 return { 260 content: content, 261 disableAutoPan: false, 262 maxWidth: 260, 263 alignBottom: true, 264 pixelOffset: new google.maps.Size(-56, -16), 265 zIndex: null, 266 boxStyle: { 267 width: "260px" 268 }, 269 closeBoxMargin: "6px 6px 0 0", 270 closeBoxURL: "/_assets/img/maps/square_delete_dark.svg", 271 infoBoxClearance: new google.maps.Size(20, 20), 272 isHidden: false, 273 pane: "floatPane", 274 disableAutoPan: true, 275 enableEventPropagation: false 276 }; 277 } 278 /** 279 * Get a new marker to draw on the map 280 * @param {Object} marker Marker object 281 * @param {Integer} index 0 based index of the map marker 282 * @return {Marker} New Google Map Marker 283 */ function defaultMarker(marker, index) { 284 return new google.maps.Marker({ 285 position: new google.maps.LatLng(marker.latitude, marker.longitude), 286 map: map, 287 icon: defaultMarkerIcon(), 288 animation: google.maps.Animation.DROP, 289 title: marker.name, 290 zIndex: index 291 }); 292 } 293 /** 294 * Get a new default icon 295 * @return {String} icon url 296 */ function defaultMarkerIcon() { 297 icon = { 298 path: "M16.1,31C16.1,31,16.1,31,16.1,31c0,0,10.9-14.5,10.9-19.3c0-7-5.5-10.1-10.9-10.1c-5.4,0-10.9,3.1-10.9,10.1,C5.2,16.5,16.1,31,16.1,31L16.1,31z M12.4,11.3C12.4,9.5,14,8,16.1,8s3.8,1.5,3.8,3.3s-1.7,3.3-3.8,3.3C14,14.6,12.4,13.1,12.4,11.3z", 299 fillColor: "#000000", 300 fillOpacity: 1, 301 anchor: new google.maps.Point(0, 0), 302 strokeWeight: 0, 303 scale: 1 304 }; 305 //return '/_assets/img/layouts/groupfinder_2/groupfinder_marker.svg'; 306 return icon; 307 } 308 /** 309 * Get a new active icon 310 * @return {String} icon path 311 */ function activeMarkerIcon() { 312 var icon = { 313 path: "M16.1,31C16.1,31,16.1,31,16.1,31c0,0,10.9-14.5,10.9-19.3c0-7-5.5-10.1-10.9-10.1c-5.4,0-10.9,3.1-10.9,10.1,C5.2,16.5,16.1,31,16.1,31L16.1,31z M12.4,11.3C12.4,9.5,14,8,16.1,8s3.8,1.5,3.8,3.3s-1.7,3.3-3.8,3.3C14,14.6,12.4,13.1,12.4,11.3z", 314 fillColor: "#000000", 315 fillOpacity: 1, 316 anchor: new google.maps.Point(0, 0), 317 strokeWeight: 0, 318 scale: 1 319 }; 320 //return '/_assets/img/layouts/groupfinder_2/groupfinder_marker-active.svg'; 321 return icon; 322 } 323 /** 324 * Get a new grouped icon 325 * @return {String} icon url 326 */ function groupedMarkerIcon() { 327 var icon = { 328 path: "M9,0c1.2,0,2.4,0.2,3.5,0.7c1.1,0.5,2,1.1,2.9,1.9s1.5,1.8,1.9,2.9S18,7.8,18,9c0,2.2-0.5,4.6-1.4,6.9 c-1,2.3-2,4.5-3.1,6.4s-2.6,4.1-4.5,6.5c-1.9-2.4-3.4-4.6-4.5-6.5c-1.1-1.9-2.2-4-3.1-6.4C0.5,13.5,0,11.2,0,9 c0-1.2,0.2-2.4,0.7-3.5c0.5-1.1,1.1-2,1.9-2.9s1.8-1.5,2.9-1.9C6.6,0.2,7.7,0,9,0z M9,14.4c1.5,0,2.8-0.5,3.8-1.6 c1-1,1.6-2.3,1.6-3.8s-0.5-2.8-1.6-3.8c-1-1-2.3-1.6-3.8-1.6S6.2,4.1,5.2,5.2c-1,1-1.6,2.3-1.6,3.8s0.5,2.8,1.6,3.8 C6.2,13.9,7.5,14.4,9,14.4z", 329 fillColor: "#000000", 330 fillOpacity: 1, 331 anchor: new google.maps.Point(0, 0), 332 strokeWeight: 0, 333 scale: 1 334 }; 335 //return '/_assets/img/layouts/groupfinder_2/groupfinder_marker_multiple.svg'; 336 return icon; 337 } 338 /** 339 * Get a new active grouped icon 340 * @return {String} icon url 341 */ function activeGroupedMarkerIcon() { 342 var icon = { 343 path: "M16.1,31C16.1,31,16.1,31,16.1,31c0,0,10.9-14.5,10.9-19.3c0-7-5.5-10.1-10.9-10.1c-5.4,0-10.9,3.1-10.9,10.1,C5.2,16.5,16.1,31,16.1,31L16.1,31z M12.4,11.3C12.4,9.5,14,8,16.1,8s3.8,1.5,3.8,3.3s-1.7,3.3-3.8,3.3C14,14.6,12.4,13.1,12.4,11.3z", 344 fillColor: "#000000", 345 fillOpacity: 1, 346 anchor: new google.maps.Point(0, 0), 347 strokeWeight: 0, 348 scale: 1 349 }; 350 //return '/_assets/img/layouts/groupfinder_2/groupfinder_marker-active.svg'; 351 return icon; 352 } 353 function deleteEmptyAside() { 354 $("#groupFinder aside").each((function() { 355 if (this.children && !this.children.length) { 356 $(this).remove(); 357 } 358 })); 359 } 360 /** 361 * Remove all markers from map 362 * @return {Null} 363 */ function deleteMarkers() { 364 setAllMarkers(null); 365 setAllGroupedMarkers(null); 366 infoBox.setVisible(false); 367 markers = []; 368 } 369 /** 370 * Disable map scrolling when mouse is inside infobox 371 * @return {null} 372 */ function disableInfoBoxScroll() { 373 // Disable map Dragging when cursor enters infoBox div 374 $(".infoBox").on("mouseenter", (function() { 375 map.setOptions({ 376 scrollwheel: false 377 }); 378 })); 379 $(".infoBox").on("mouseleave", (function() { 380 map.setOptions({ 381 scrollwheel: true 382 }); 383 })); 384 } 385 /** 386 * Extend LatLngBounds object to include a given range 387 * @param {int} degrees Degrees to expand range by 388 * @param {LatLngBounds} latLngBounds LatLngBounds to expand 389 * @return {LatLngBounds}
389 extended bounds 390 */ function extendViewport(degrees, latLngBounds) { 391 var ne = new google.maps.LatLng(latLngBounds.getNorthEast().lat() + degrees, latLngBounds.getNorthEast().lng() + degrees); 392 sw = new google.maps.LatLng(latLngBounds.getSouthWest().lat() - degrees, latLngBounds.getSouthWest().lng() - degrees); 393 return new google.maps.LatLngBounds(sw, ne); 394 } 395 function filterGroupedLocations(locations) { 396 var grouped = {}, locationsClone = $.extend(true, [], locations); 397 // Create objects 398 locationsClone.forEach((function(group, index) { 399 var key = group.latitude + "," + group.longitude; 400 if (grouped[key]) { 401 grouped[key].push(group); 402 // Seems to unnecessarily remove a location. The method arrayRemove() 403 // already performs removals. 404 // locations.splice(index, 1); 405 } else { 406 grouped[key] = [ group ]; 407 } 408 })); 409 // Remove locations with one or fewer groups 410 for (var group in grouped) { 411 if (grouped[group].length <= 1) { 412 delete grouped[group]; 413 } 414 } 415 // Remove initial colocational group from locations array 416 arrayRemove(locations, (function(value, index, array) { 417 var key = value.latitude + "," + value.longitude; 418 return grouped[key]; 419 })); 420 return grouped; 421 } 422 /** 423 * Returns an array that displays locations with valid 424 * coordinates. 425 * @param {Array} locations array of locations 426 * @return {Array} An array of valid locations 427 */ function filterValidLocations(locations) { 428 return locations.filter((function(location) { 429 return location.latitude && location.longitude; 430 })); 431 } 432 /** 433 * Hide InfoBox and reset markerIcon 434 * @param {Marker} marker Google Map marker 435 * @return {null} 436 */ function hideInfoBoxMarker(marker) { 437 marker.setIcon(defaultMarkerIcon()); 438 infoBox.setOptions(defaultInfoBox("")); 439 infoBox.setVisible(false); 440 } 441 /** 442 * Hide InfoBox and reset grouped markerIcon 443 * @param {Marker} marker Google Map marker 444 * @return {null} 445 */ function hideInfoBoxGroupedMarker(marker) { 446 marker.setIcon(groupedMarkerIcon()); 447 infoBox.setOptions(defaultInfoBox("")); 448 infoBox.setVisible(false); 449 } 450 /** 451 * Gets and renders markers 452 * @param {String} data Serialized filter data. 453 * @param {Function} callback Function to perform after query 454 * @return {Null} 455 */ function getMapMarkers(data, callback) { 456 $.getJSON("/_components/ajax/ministry_1/ajax-small-groups-map.php", data, (function(response) { 457 if ($.isFunction(callback)) { 458 callback(response); 459 } 460 })); 461 } 462 /** 463 * Get a new grouped marker to draw on the map 464 * @param {Object} group Group of locations 465 * @param {Integer} index 0 based index of the map marker 466 * @return {Marker} New Google Map Marker 467 */ function groupedMarker(group, index) { 468 return new google.maps.Marker({ 469 position: new google.maps.LatLng(group[0].latitude, group[0].longitude), 470 map: map, 471 icon: groupedMarkerIcon(), 472 animation: google.maps.Animation.DROP, 473 zIndex: index 474 }); 475 } 476 /** 477 * Initialize filterable map 478 * @param {DOM} canvas Dom element to bind map to. 479 * @return {Map} Google Map 480 */ function initializeMap(canvas) { 481 var mapOptions = { 482 minZoom: defaultZoom, 483 // imageDefaultUI: true, 484 disableDefaultUI: true, 485 mapTypeId: google.maps.MapTypeId.ROADMAP, 486 styles: [ { 487 featureType: "administrative", 488 elementType: "all", 489 stylers: [ { 490 visibility: "on" 491 }, { 492 saturation: -100 493 }, { 494 lightness: 20 495 } ] 496 }, { 497 featureType: "road", 498 elementType: "all", 499 stylers: [ { 500 visibility: "on" 501 }, { 502 saturation: -100 503 }, { 504 lightness: 40 505 } ] 506 }, { 507 featureType: "water", 508 elementType: "all", 509 stylers: [ { 510 visibility: "on" 511 }, { 512 saturation: -10 513 }, { 514 lightness: 30 515 } ] 516 }, { 517 featureType: "landscape.man_made", 518 elementType: "all", 519 stylers: [ { 520 visibility: "simplified" 521 }, { 522 saturation: -60 523 }, { 524 lightness: 10 525 } ] 526 }, { 527 featureType: "landscape.natural", 528 elementType: "all", 529 stylers: [ { 530 visibility: "simplified" 531 }, { 532 saturation: -60 533 }, { 534 lightness: 60 535 } ] 536 }, { 537 featureType: "poi", 538 elementType: "all", 539 stylers: [ { 540 visibility: "off" 541 }, { 542 saturation: -100 543 }, { 544 lightness: 60 545 } ] 546 }, { 547 featureType: "transit", 548 elementType: "all", 549 stylers: [ { 550 visibility: "off" 551 }, { 552 saturation: -100 553 }, { 554 lightness: 60 555 } ] 556 } ] 557 }; 558 map = new google.maps.Map(canvas, mapOptions); 559 var data = $(canvas).parents(".m1-monklet").data(); 560 // Get initial map markers and then add them to the map 561 updateMap(data); 562 return map; 563 } 564 /** 565 * Update map markers when pagination is clicked on list of groups/items. 566 * @return {Null} 567 */ function bindPagination() { 568 $("body").on("click", '.m1-monklet-section-groups[data-type="groups2"] #pagination a', (function(event) { 569 if ($(this).attr("href") === undefined) { 570 return false;
571 } else { 572 // pagination handled elsewhere simultaneously, so allow a little time for data attr to be updated 573 setTimeout((function() { 574 // gather data variables 575 var data = $("#smallgroups2-map").parents(".m1-monklet").data(); 576 // update the map 577 updateMap(data); 578 }), 100); 579 } 580 })); 581 } 582 /** 583 * Render ajax spinner 584 * @return {jQuery} 585 */ function resetList(elem) { 586 elem.append('<div class="overlay"></div>'); 587 } 588 /** 589 * Add default map markers to the map. 590 * @param {Array} locations array of locations 591 * @return {Null} 592 */ function setDefaultMapMarkers(locations) { 593 locations.forEach((function(group, index) { 594 if (group.latitude && group.longitude) { 595 var marker = defaultMarker(group, index); 596 markers.push(marker); 597 bindInfoBoxMarkerToggle(group, marker); 598 // // Display InfoBox marker if there is only one group 599 // if (locations.length === 1) { 600 // showInfoBoxMarker(group, marker); 601 // } 602 } 603 })); 604 } 605 /** 606 * Add grouped map markers to the map. 607 * @param {Array} grouped array of grouped locations 608 * @return {Null} 609 */ function setGroupedMapMarkers(grouped) { 610 var i = 0; 611 for (var group in grouped) { 612 var marker = groupedMarker(grouped[group], i); 613 groupedMarkers.push(marker); 614 bindInfoBoxGroupedMarkerToggle(grouped[group], marker); 615 i++; 616 } 617 } 618 /** 619 * Sets map markers 620 * @param {Array} groups Group data 621 */ function setMapMarkers(groups) { 622 var locations = filterValidLocations(groups), grouped = filterGroupedLocations(locations); 623 // Remove markers that are present 624 if (markers.length || groupedMarker.length) { 625 deleteMarkers(); 626 } 627 setGroupedMapMarkers(grouped); 628 setDefaultMapMarkers(locations); 629 } 630 /** 631 * Set map target for all markers 632 * @param {Map} map Google Map 633 * @return {Null} 634 */ function setAllMarkers(map) { 635 for (var i = 0; i < markers.length; i++) { 636 markers[i].setMap(map); 637 } 638 } 639 /** 640 * Set map target for all grouped markers 641 * @param {Map} map Google Map 642 * @return {Null} 643 */ function setAllGroupedMarkers(map) { 644 for (var i = 0; i < groupedMarkers.length; i++) { 645 groupedMarkers[i].setMap(map); 646 } 647 } 648 /** 649 * Set all marker icons for the map 650 * @param {Icon} Icon google.maps.icon 651 * @return {Null} 652 */ function setAllMarkerIcons(icon) { 653 for (var i = 0; i < markers.length; i++) { 654 markers[i].setIcon(icon); 655 } 656 } 657 /** 658 * Set all grouped marker icons for the map 659 * @param {Icon} Icon google.maps.icon 660 * @return {Null} 661 */ function setAllGroupedMarkerIcons(icon) { 662 for (var i = 0; i < groupedMarkers.length; i++) { 663 groupedMarkers[i].setIcon(icon); 664 } 665 } 666 /** 667 * Display InfoBox and marker for a given group. 668 * @param {Object} group Group to display infobox for. 669 * @param {Marker} marker Groups marker. 670 * @return {Null} 671 */ function showInfoBoxMarker(group, marker) { 672 setAllMarkerIcons(defaultMarkerIcon()); 673 marker.setIcon(activeMarkerIcon()); 674 infoBox.setOptions(defaultInfoBox(group.content)); 675 infoBox.setVisible(true); 676 infoBox.open(map, marker); 677 disableInfoBoxScroll(); 678 } 679 /** 680 * Display InfoBox and grouped marker for a given group. 681 * @param {String} content Content to display for the marker 682 * @param {Marker} marker Groups marker. 683 * @return {Null} 684 */ function showInfoBoxGroupedMarker(content, marker) { 685 setAllGroupedMarkerIcons(groupedMarkerIcon()); 686 marker.setIcon(activeGroupedMarkerIcon()); 687 infoBox.setOptions(defaultInfoBox(content)); 688 infoBox.setVisible(true); 689 infoBox.open(map, marker); 690 setTimeout(disableInfoBoxScroll, 100); 691 } 692 /** 693 * Update map markers and positions 694 * @param {String} data Serialized data 695 * @return {Null} 696 */ function updateMap(data) { 697 getMapMarkers(data, (function(results) { 698 if (results.length) { 699 var max = calculateMaxBounds(results), center = max.getCenter(); 700 setMapMarkers(results); 701 map.fitBounds(max); 702 } else { 703 deleteMarkers(); 704 map.panTo(defaultLatLng); 705 map.setZoom(defaultZoom); 706 } 707 })); 708 } 709 function getParamByName(name, url) { 710 if (!url) url = window.location.href; 711 name = name.replace(/[\[\]]/g, "\\$&"); 712 var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), results = regex.exec(url); 713 if (!results) return null; 714 if (!results[2]) return ""; 715 return decodeURIComponent(results[2].replace(/\+/g, " ")); 716 } 717 $(document).ready((function() { 718 var listMap = $("#smallgroups2-map")[0]; 719 if (listMap) { 720 bindInfoBoxClose(); 721 bindPagination(); 722 initializeMap(listMap); 723 } 724 })); 725}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.