1document.addEventListener("DOMContentLoaded", function () { 2 var input = document.getElementById("txtSearch"); 3 if (input && input.value.includes("of Ivory")) { 4 input.value = input.value.replace(/of Ivory/g, "d'Ivoire"); 5 } 6}); 7function bindExportClubControl(latitude, longitude, query) { 8 var mainLink = "/api/sitecore/FindAClub/Download"; 9 var params = "?longitude=" + longitude + "&latitude=" + latitude + "&" + query; 10 11 $(".exportCSV").attr("href", mainLink + "Csv" + params); 12 $(".exportXLS").attr("href", mainLink + "Xlsx" + params); 13} 14 15function SearchClubs(latitude, longitude) { 16 var delimiter = window.location.search ? "&" : ""; 17 18 var query = window.location.search 19 .replace("?", "") + 20 delimiter; 21 22 query = query + 23 "longitude=" + 24 longitude + 25 "&latitude=" + 26 latitude; 27 28 if ('URLSearchParams' in window) { 29 var searchParams = new URLSearchParams(window.location.search); 30 searchParams.set("longitude", longitude); 31 searchParams.set("latitude", latitude); 32 if (window.location.href.indexOf("?") > 0) { 33 window.history.pushState({ path: RemoveParametersIfExist() + "?" + searchParams.toString() }, '', RemoveParametersIfExist() + "?" + searchParams.toString()); 34 } 35 query = searchParams.toString(); 36 } 37 38 SearchClubsWithData(query); 39} 40 41function InitiliazeFindaClubMap() { 42 var defaultLat = $("#DefaultWhqLatitude").val(); 43 var defaultLong = $("#DefaultWhqLongitude").val(); 44 Geolocate(function (position) { 45 var latitude = position.coords.latitude; 46 var longitude = position.coords.longitude; 47 $("#latitude").val(latitude); 48 $("#longitude").val(longitude); 49 SearchClubs(latitude, longitude); 50 }, 51 SearchClubs(defaultLat, defaultLong), 52 function () { handleNoGeolocation(); }, 53 function () { handleNoGeolocation(); }); 54} 55 56function bindFindAClubLocations(data) { 57 var $results = $("#searchResults .results"); 58 $results.empty(); 59 60 var clubLocations = $("<ul/>", { "class": "itemList" }); 61 if (data != null && data.length > 0) { 62 $.each(data, 63 function (index, club) { 64 var linkItem = $("<a/>", { "href": clubUrl(club), "onclick": "getScrollBarPosition()" }); 65 66 var clubAddress = ""; 67 if (stringIsNotEmpty(club.Address.City)) { 68 clubAddress += club.Address.City; 69 } 70 71 if (stringIsNotEmpty(club.Address.PrimaryRegion.Value)) { 72 clubAddress += ", " + club.Address.PrimaryRegion.Value; 73 } 74 75 if (stringIsNotEmpty(club.CountryName)) { 76 clubAddress += ", " + club.CountryName; 77 } 78 79 if (Math.abs(club.Distance) > 0.01) { 80 clubAddress += " (" + club.Distance.toFixed(2) + " mi)"; 81 } 82 83 var iconContainer = $("<div/>", { "class": "col-xs-1 col-md-2" }); 84 var iconLocation = $("<div/>", { "class": "icon-location" }).text(index + 1); 85 iconContainer.append(iconLocation); 86 87 if (club.Note.length > 1) { 88 iconContainer.append($("<div/>", { "class": "advanced-club-icon" })); 89 } 90 91 if (club.Restriction.length > 0) { 92 iconContainer.append($("<div/>", { "class": "required-club-icon" })); 93 } 94 95 if (club.AllowsVirtualAttendance === true) { 96 iconContainer.append($("<div/>", { "class": "virtual-club-icon" })); 97 } 98 99 if (club.HasUpcomingEvent === true) { 100 iconContainer.append($("<div/>", { "class": "clubEvent-club-icon-club" })); 101 } 102 103 if (club.IsProspective === true) { 104 iconContainer.append($("<div/>", { "class": "prospective-club-icon" })); 105 } 106 107 var meetingTime = $("<span/>", { "class": "meetingtime" }).text(club.MeetingTime + " / " + club.MeetingDay); 108 109 if (club.HasUpcomingEvent === true) { 110 var clubEventSpan = $("<span/>", { "class": "meetingtime cus-club-event-search" }).html("<b>Club Events:</b> Join this club at an event soon!"); 111 } 112 113 meetingTime.append(clubEventSpan); 114 115 var info = $("<dd/>", { "html": clubAddress + $($("<div/>").append(meetingTime)).html() }); 116 117 var dataContainer = $("<div/>", { "class": "col-xs-8 col-md-10 cus-padding-left" }).append($("<div/>", { "class": "title" }).text(club.Identification.Name)).append($("<dl/>").append(info)); 118 119 linkItem.append(iconContainer).append(dataContainer).append($("<div/>", { "style": "clear:both" })); 120 121 var clubItem = $("<li/>").append(linkItem); 122 123 clubLocations.append(clubItem); 124 }); 125 } else { 126 clubLocations.append($("<li/>").text(window.noClubsFoundMessage)); 127 } 128 129 var content = $("<div/>").append(clubLocations).html(); 130 $results.append(content); 131 if (sessionStorage.getItem("scrollPosition") != null) { 132 setScrollBarPosition(sessionStorage.getItem("scrollPosition")); 133 } 134} 135 136function getScrollBarPosition() { 137 var scroll = $('.search-scroll').scrollTop(); 138 sessionStorage.setItem("scrollPosition", scroll); 139} 140 141function setScrollBarPosition(scroll) { 142 $('.search-scroll').scrollTop(scroll); 143} 144 145function deleteMarkers() { 146 //some error with entities 147 //clearMarkers(); 148 markers = []; 149} 150 151function handleNoGeolocation() {
152 // Do nothing 153} 154 155function clubUrl(club) { 156 var number = club.Identification.Id.Value; 157 return "/Find-a-Club/" + 158 "00000000".substring(number.length) + 159 number + 160 "-" + 161 club.Identification.Name.toLowerCase().replace(/[^\w\s]/g, "").replace(/\s/g, "-"); 162} 163 164function stringIsNotEmpty(value) { 165 return value != undefined && value.length > 0; 166} 167 168function infoWindowHTML(club) { 169 var contentDiv = $("<div/>", { "class": "gm-card" }); 170 if (stringIsNotEmpty(club.Identification.Name)) { 171 var link = $("<a/>", { "href": clubUrl(club) }).text(club.Identification.Name); 172 contentDiv.append($("<h3/>", { "class": "card-title" }).append(link)); 173 } 174 175 var clubInfoDiv = $("<div/>", { "class": "club-info" }); 176 if (stringIsNotEmpty(club.Identification.Id.Value)) { 177 clubInfoDiv.append($("<dl/>").append($("<dt/>").text("Club Number:")).append($("<dd/>").text(club.Identification.Id.Value))); 178 } 179 180 var address = ""; 181 if (stringIsNotEmpty(club.Address.City)) { 182 address += club.Address.City; 183 } 184 if (stringIsNotEmpty(club.Address.PrimaryRegion.Value)) { 185 address += ", " + club.Address.PrimaryRegion.Value; 186 } 187 if (stringIsNotEmpty(club.CountryName)) { 188 address += ", " + club.CountryName; 189 } 190 clubInfoDiv.append($("<div/>", { "class": "address" }).text(address)); 191 contentDiv.append(clubInfoDiv); 192 193 if (club.MeetingTime !== "" || club.MeetingDays !== "") { 194 var meetingInfo = ""; 195 if (stringIsNotEmpty(club.MeetingTime)) { 196 meetingInfo += club.MeetingTime + ", "; 197 } 198 199 if (stringIsNotEmpty(club.MeetingDay)) { 200 meetingInfo += "" + club.MeetingDay; 201 } 202 203 var timeDiv = $("<div/>", { "class": "time" }) 204 .append($("<dl/>") 205 .append($("<dt/>").text("Meeting Details:")) 206 .append($("<dd/>").append($("<strong/>").text(meetingInfo)))); 207 contentDiv.append(timeDiv); 208 } 209 210 var button = $("<a/>", { "class": "btn btn-default" }); 211 212 var buttonDiv = $("<div/>", { "class": "buttons" }) 213 .append(button.clone().attr("href", clubUrl(club) + "/contact-club").text("Contact Club")); 214 215 addInfoWindowExternalLink(buttonDiv, button, club.Website, "Website"); 216 addInfoWindowExternalLink(buttonDiv, button, club.FacebookLink, "Facebook"); 217 addInfoWindowExternalLink(buttonDiv, button, club.TwitterLink, "Twitter"); 218 219 var latitude = club.Address.Coordinates.Latitude; 220 var longitude = club.Address.Coordinates.Longitude; 221 var bingMapAddress = GetAzureMapsDirectionUrl(latitude, longitude); 222 addInfoWindowExternalLink(buttonDiv, button, bingMapAddress, "Directions"); 223 224 buttonDiv.append(button.clone().attr("href", clubUrl(club)).text("View Club Details")); 225 226 contentDiv.append(buttonDiv); 227 return $("<div/>").append(contentDiv).html(); 228} 229function GetAzureMapsDirectionUrl(lat, lon) { 230 return `https://www.bing.com/maps?rtp=~pos.${lat}_${lon}`; 231} 232 233function addInfoWindowExternalLink(div, button, link, text) { 234 if (stringIsNotEmpty(link)) { 235 if (link.indexOf("http") < 0) { 236 link = "http://" + link; 237 } 238 239 div.append(button.clone() 240 .attr("href", link) 241 .attr("target", "_BLANK") 242 .text(text)); 243 } 244} 245 246function bindFindClubControl(filter) { 247 filter = JSON.parse(filter); 248 249 if (filter.ClubName !== "") 250 $("#txtClubNameSearch").val(filter.ClubName); 251 252 if (filter.radius != null && filter.radius !== "") 253 $("#ddlRadius").val(filter.radius); 254 else 255 $("#ddlRadius").val("25"); 256 257 if (filter.district !== "" && filter.district != null) { 258 $("#ddlDistrict").val(filter.district); 259 $("#ddlRadius").val(""); 260 $("#txtSearch").val(""); 261 $("#ddlCountry").val(""); 262 } else if (filter.countryCode != null && filter.countryCode !== "") { 263 $("#ddlCountry").val(filter.countryCode); 264 $("#ddlRadius").val(""); 265 $("#ddlDistrict").val(""); 266 } 267 268 $('#fsMeetingDays input[type="checkbox"]') 269 .each(function () { 270 if (filter.MeetingDays && filter.MeetingDays.indexOf($(this).val()) !== -1) { 271 $(this).prop("checked", true); 272 } 273 }); 274 275 $('#fsMeetingTimes input[type="checkbox"]') 276 .each(function () { 277 if ($(this).val() == "AM" && filter.AllowMeetsInAM) { 278 $(this).prop("checked", true); 279 280 } else if ($(this).val() == "PM" && filter.AllowMeetsInPM) { 281 $(this).prop("checked", true); 282 } 283 }); 284 285 $('#fsClubStatus input[type="checkbox"]') 286 .each(function () { 287 if ($(this).val() == "O" && filter.AllowOpenClubs) { 288 $(this).prop("checked", true); 289 } else if ($(this).val() == "G" && filter.AllowClosedClubs) { 290 $(this).prop("checked", true); 291 } else if ($(this).val() == "A" && filter.AllowAdvancedClubs) { 292 $(this).prop("checked", true); 293 } 294 }); 295} 296 297function submitSearchForm() { 298 sessionStorage.clear(); 299 var data = $("#fac_filters").find("input, select").serialize(); 300 SetUrlwithParameters(data); 301} 302 303function SetUrlwithParameters(data) { 304 if (data.includes("d'Ivoire")) { 305 data = data.replace("d'Ivoire", "of Ivory"); 306 } 307 window.location.href = RemoveParametersIfExist() + "?" + data; 308} 309 310function RemoveParametersIfExist() { 311 var currenturl = window.location.href; 312 if (currenturl.indexOf("?") > 0) { 313 var index = currenturl.indexOf("?"); 314 var newUrl = currenturl.substring(0, index); 315 return newUrl; 316 } 317 return currenturl; 318} 319 320function getParameterByName(name) { 321 name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
322 var regexS = "[\\?&]" + name + "=([^&#]*)"; 323 var regex = new RegExp(regexS); 324 var results = regex.exec(window.location.href); 325 if (results == null) 326 return ""; 327 else 328 return decodeURIComponent(results[1].replace(/\+/g, " ")); 329} 330 331function jsgetFieldset(event) { 332 event.preventDefault(); 333 334 var $container = $(this).parents("*[data-jsget]"); 335 var ignoreEmptyValues = $container.data("ignoreemptyvalues") === true; 336 var $fields = $container.find("input, textarea, select").not("*[type=button]"); 337 338 if (this.name && this.name !== "") $fields.add(this); 339 340 var queryString = ""; 341 for (var i = 0; i < $fields.length; i++) { 342 var field = $fields[i]; 343 if (field.name === "") continue; 344 if (field.type === "checkbox" && !$(field).is(":checked")) continue; 345 if (field.type === "radio" && !$(field).is(":checked")) continue; 346 if (ignoreEmptyValues && $(field).val() === "") continue; 347 348 if (queryString.length > 0) queryString += "&"; 349 queryString += field.name + "=" + encodeURIComponent($(field).val()); 350 } 351 352 var url = $container.data("jsget") + "?" + queryString; 353 window.location.href = url; 354} 355 356function changeParamByName(href, paramName, newVal) { 357 var tmpRegex = new RegExp("(" + paramName + "=)[0-9]+", "ig"); 358 return href.replace(tmpRegex, "$1" + newVal); 359} 360 361//search box 362var searchterm; 363function GetSearchInput() { 364 searchterm = $("#txtSearch").val(); 365} 366 367$(function () { 368 $("#txtSearchdis").on("keypress", function (event) { 369 sessionStorage.clear(); 370 $("#autocomplete").val("false"); 371 if (event.which === 13) { 372 GetSearchInput(); 373 submitSearchForm(); 374 } 375 }); 376 $("*[data-jsget]") 377 .on("click", "*[type=button]", jsgetFieldset) 378 .on("keypress", "input[type=text]", function (e) { 379 if (e.which === 13) { 380 $(this).parents("*[data-jsget]").find("*[type=button]").click(); 381 return false; 382 } 383 }); 384 $("#ddlRadius").change(function () { 385 submitSearchForm(); 386 }); 387 $("#ddlDistrict").change(function () { 388 $("#ddlCountry").val(""); 389 $("#ddlRadius").val(""); 390 $("#txtSearch").val(""); 391 }); 392 $("#ddlCountry").change(function () { 393 $("#ddlDistrict").val(""); 394 $("#ddlRadius").val(""); 395 $("#txtSearch").val(""); 396 }); 397 $("#txtClubNameSearch").focus(function () { 398 if ("geolocation" in navigator) { 399 navigator.geolocation.getCurrentPosition( 400 function (position) { 401 $("#ddlRadius").val(""); 402 $("#txtSearch").val(""); 403 } 404 ); 405 } 406 }); 407 408 $(".btnSearch_FAC").on("click", submitSearchForm); 409});
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.