1function arrayUnique(array){ 2 return array.filter(function(el, index, arr) { 3 return index === arr.indexOf(el); 4 }); 5} 6 7function getCustomDateFormat(dateObject) { 8 var d = new Date(dateObject); 9 var day = d.getDate(); 10 var month = d.getMonth() + 1; 11 var year = d.getFullYear(); 12 if (day < 10) { 13 day = "0" + day; 14 } 15 if (month < 10) { 16 month = "0" + month; 17 } 18 var date = day + "-" + month + "-" + year; 19 return date; 20} 21 22function getUrlVars() 23{ 24 var vars = [], hash; 25 var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); 26 for(var i = 0; i < hashes.length; i++) 27 { 28 hash = hashes[i].split('='); 29 vars.push(hash[0]); 30 vars[hash[0]] = hash[1]; 31 } 32 return vars; 33} 34 35function getCountrySignFromJs(club_id, amount, default_val) { 36 var country_sign =''; 37 $.ajax({ 38 url: 'controllers/ajax_request.php', 39 type: 'POST', 40 dataType: 'json', 41 async:false, 42 data: {action: 'get_country_sign_from_js', clubId: club_id, amount: amount, default_val : default_val}, 43 }) 44 .done(function(data) { 45 if(data.status == 'success') { 46 country_sign = data.country_sign; 47 } 48 }); 49 return country_sign; 50} 51 52function setGetParameter(paramName, paramValue) 53{ 54 var url = window.location.href; 55 var hash = location.hash; 56 url = url.replace(hash, ''); 57 if (url.indexOf(paramName + "=") >= 0) 58 { 59 var prefix = url.substring(0, url.indexOf(paramName + "=")); 60 var suffix = url.substring(url.indexOf(paramName + "=")); 61 suffix = suffix.substring(suffix.indexOf("=") + 1); 62 suffix = (suffix.indexOf("&") >= 0) ? suffix.substring(suffix.indexOf("&")) : ""; 63 url = prefix + paramName + "=" + paramValue + suffix; 64 } 65 else 66 { 67 if (url.indexOf("?") < 0) 68 url += "?" + paramName + "=" + paramValue; 69 else 70 url += "&" + paramName + "=" + paramValue; 71 } 72 window.location.href = url + hash; 73} 74 75function addParameterUrl(urlPath, urlSlug, urlVal) { 76 // Create a URL object from the current location 77 const url = new URL(urlPath); 78 // Get the URLSearchParams object 79 const params = new URLSearchParams(url.search); 80 params.set(urlSlug, urlVal); 81 url.search = params.toString(); 82 // Update the URL without reloading 83 window.history.pushState({}, '', url); 84} 85 86function widgetSetShipToData(country_id, state_id, is_selected, customer_id) { 87 $.ajax({ 88 url: 'controllers/cart.php', 89 type: 'POST', 90 dataType: 'json', 91 data: { 92 action: 'widget_set_ship_to_data', 93 country_id : country_id, 94 state_id : state_id, 95 customer_id : customer_id, 96 is_selected : is_selected 97 }, 98 async: false, 99 }) 100 .done(function(response) { 101 if(response.status == 'success') { 102 addParameterUrl(window.location.href, 'customer', customer_id); 103 window.location.reload(); 104 } else if(response.status == 'warning') { 105 alert(response.message); 106 window.location.reload(); 107 } else { 108 if(response.browserVal == 'safari') { 109 if(!$("#notification-modal.modal").hasClass('in')) { 110 $('#notification-modal').modal('show'); 111 $('#notification-modal').attr('data_href', '#session-url'); 112 return false; 113 } 114 } else { 115 if(!$("#notification-modal.modal").hasClass('in')) { 116 $('#session-url')[0].click(); 117 } 118 } 119 } 120 }); 121} 122 123function widgetCheckSessionLink() { 124 $.post("controllers/ajax_request.php", { 125 action: 'widget_check_session_link', 126 }, function(response){ 127 if(response.status == 'error') { 128 $('#session-widhget-url')[0].click(); 129 } 130 },"json"); 131} 132 133function country_state_region_option(type, id) 134{ 135 var remove_billing_state = '0' 136 if ($('.dynamic-country').hasClass('remove-billing-state')) { 137 remove_billing_state = '1' 138 } 139 140 $.ajax({ 141 url: "controllers/ajax_request.php", 142 type: 'POST', 143 data: {action: 'get_country_state_region_option', data_id: id, data_type: type, remove_billing_state: remove_billing_state}, 144 dataType: "json", 145 // async: true, 146 success:function(response){ 147 if(type =='country_data') { 148 $('.dynamic-region').html(''); 149 $('.dynamic-region').attr('disabled', 'disabled'); 150 $('.dynamic-region').val('0'); 151 $('.dynamic-state').siblings('span.custom-select').text('Select...'); 152 $('.dynamic-region').siblings('span.custom-select').text('Select...'); 153 $('.dynamic-state').html(response.html); 154 } 155 if(type =='state_data') { 156 $('.dynamic-region').siblings('span.custom-select').text('Select...'); 157 $('.dynamic-region').removeAttr('disabled'); 158 $('.dynamic-region').html(response.html); 159 } 160 } 161 }); 162} 163 164function isCheckLocalStorage() { 165 var storageOrUndefined = false;
166 try { 167 storageOrUndefined = (window.localStorage && true); 168 } catch (e) { 169 } 170 return storageOrUndefined; 171} 172 173function getExperienceData(param) { 174 var tempLocalStore = isCheckLocalStorage(); 175 $.ajax({ 176 type: 'POST', 177 url : 'controllers/ajax_request.php', 178 dataType: "json", 179 data: {action: 'get_experience_data', currentDate: param.date_value, temp_ex_id: param.ex_date_id, club_id: param.club_id}, 180 success: function(data) { 181 if(data.status == 'success') { 182 var tempLocalStoreExList = {}; 183 if(tempLocalStore) { 184 if(typeof localStorage.widget_ex_single_data !== "undefined") { 185 tempLocalStoreExList = JSON.parse(localStorage.widget_ex_single_data); 186 if (typeof tempLocalStoreExList[param.ex_date_id] != "undefined") { 187 delete tempLocalStoreExList[param.ex_date_id]; 188 } 189 } 190 if(typeof data.ex_list_view !== "undefined" && data.ex_list_view != '') { 191 tempLocalStoreExList[param.ex_date_id] = data.ex_list_view[param.ex_date_id]; 192 } 193 if(typeof tempLocalStoreExList !== "undefined" && tempLocalStoreExList != '') { 194 setLocalStorage('execute_ex_single_val', JSON.stringify(tempLocalStoreExList), 0); 195 } 196 } 197 } 198 } 199 }, 'json'); 200} 201 202function setLocalStorage(storeKey, storeData, directExecute=0) { 203 if(storeData != '') { 204 var dataConvert = JSON.parse(storeData); 205 if(storeKey == 'availableDay') { 206 if(localStorage.getItem('ex_available_day') != null && directExecute == 0) { 207 var localStoreVal = JSON.parse(localStorage.ex_available_day); 208 $.each(dataConvert, function(resKey, responseRow){ 209 $.each(localStoreVal, function(index, cleanDataSetRow){ 210 $.each(cleanDataSetRow, function(key, value) { 211 localStoreVal[index][resKey] = responseRow; 212 }); 213 }); 214 }); 215 localStorage.setItem('ex_available_day', JSON.stringify(localStoreVal)); 216 } else { 217 localStorage.setItem('ex_available_day', JSON.stringify($.makeArray(dataConvert))); 218 } 219 } 220 if(storeKey == 'monthly') { 221 if(localStorage.getItem('ex_monthly_date') != null && directExecute == 0) { 222 var localStoreVal = JSON.parse(localStorage.ex_monthly_date); 223 $.each(dataConvert, function(resKey, responseRow){ 224 $.each(localStoreVal, function(index, cleanDataSetRow){ 225 $.each(cleanDataSetRow, function(key, value) { 226 localStoreVal[index][resKey] = responseRow; 227 }); 228 }); 229 }); 230 localStorage.setItem('ex_monthly_date', JSON.stringify(localStoreVal)); 231 } else { 232 localStorage.setItem('ex_monthly_date', JSON.stringify($.makeArray(dataConvert))); 233 } 234 } 235 if(storeKey == 'special_opening') { 236 if(localStorage.getItem('ex_special_date') != null && directExecute == 0) { 237 var localStoreVal = JSON.parse(localStorage.ex_special_date); 238 $.each(dataConvert, function(resKey, responseRow){ 239 $.each(localStoreVal, function(index, cleanDataSetRow){ 240 $.each(cleanDataSetRow, function(key, value) { 241 localStoreVal[index][resKey] = responseRow; 242 }); 243 }); 244 }); 245 localStorage.setItem('ex_special_date', JSON.stringify(localStoreVal)); 246 } else { 247 localStorage.setItem('ex_special_date', JSON.stringify($.makeArray(dataConvert))); 248 } 249 } 250 if(storeKey == 'hour_notice_date') { 251 if(localStorage.getItem('ex_hour_notice_date') != null && directExecute == 0) { 252 var localStoreVal = JSON.parse(localStorage.ex_hour_notice_date); 253 $.each(dataConvert, function(resKey, responseRow){ 254 $.each(localStoreVal, function(index, cleanDataSetRow){ 255 $.each(cleanDataSetRow, function(key, value) { 256 localStoreVal[index][resKey] = responseRow; 257 }); 258 }); 259 }); 260 localStorage.setItem('ex_hour_notice_date', JSON.stringify(localStoreVal)); 261 } else { 262 localStorage.setItem('ex_hour_notice_date', JSON.stringify($.makeArray(dataConvert))); 263 } 264 } 265 if(storeKey == 'booked_date') { 266 if(localStorage.getItem('ex_widget_booked_date') != null && directExecute == 0) { 267 var localStoreVal = JSON.parse(localStorage.ex_widget_booked_date); 268 $.each(dataConvert, function(resKey, responseRow){ 269 $.each(localStoreVal, function(index, cleanDataSetRow){ 270 $.each(cleanDataSetRow, function(key, value) { 271 localStoreVal[index][resKey] = responseRow; 272 }); 273 }); 274 }); 275 localStorage.setItem('ex_widget_booked_date', JSON.stringify(localStoreVal)); 276 } else { 277 localStorage.setItem('ex_widget_booked_date', JSON.stringify($.makeArray(dataConvert))); 278 } 279 } 280 if(storeKey == 'closed_date') { 281 if(localStorage.getItem('ex_widget_closed_date') != null && directExecute == 0) { 282 var localStoreVal = JSON.parse(localStorage.ex_widget_closed_date); 283 $.each(dataConvert, function(resKey, responseRow){ 284 $.each(localStoreVal, function(index, cleanDataSetRow){ 285 $.each(cleanDataSetRow, function(key, value) { 286 localStoreVal[index][resKey] = responseRow; 287 }); 288 }); 289 }); 290 localStorage.setItem('ex_widget_closed_date', JSON.stringify(localStoreVal)); 291 } else { 292 localStorage.setItem('ex_widget_closed_date', JSON.stringify($.makeArray(dataConvert))); 293 } 294 } 295 if(storeKey == 'execute_month_val') { 296 if(localStorage.getItem('widget_execute_month_date') != null && directExecute == 0) { 297 var localStoreVal = JSON.parse(localStorage.widget_execute_month_date); 298 $.each(dataConvert, function(resKey, responseRow){ 299 $.each(localStoreVal, function(index, cleanDataSetRow){ 300 $.each(cleanDataSetRow, function(key, value) { 301 localStoreVal[index][resKey] = responseRow; 302 }); 303 }); 304 }); 305 localStorage.setItem('widget_execute_month_date', JSON.stringify(localStoreVal)); 306 } else { 307 localStorage.setItem('widget_execute_month_date', JSON.stringify($.makeArray(dataConvert))); 308 } 309 } 310 if(storeKey == 'close_date_val') { 311 if(localStorage.getItem('ex_close_date') != null && directExecute == 0) { 312 var localStoreVal = JSON.parse(localStorage.ex_close_date); 313 $.each(dataConvert, function(resKey, responseRow){ 314 $.each(localStoreVal, function(index, cleanDataSetRow){ 315 $.each(cleanDataSetRow, function(key, value) { 316 localStoreVal[index][resKey] = responseRow; 317 }); 318 }); 319 }); 320 localStorage.setItem('ex_close_date', JSON.stringify(localStoreVal)); 321 } else { 322 localStorage.setItem('ex_close_date', JSON.stringify($.makeArray(dataConvert))); 323 } 324 } 325 if(storeKey == 'execute_ex_single_val') { 326 localStorage.setItem('widget_ex_single_data', JSON.stringify(dataConvert)); 327 } 328 } 329} 330 331function clearLocalStorage() { 332 // localStorage.removeItem('ex_monthly_date'); 333 // localStorage.removeItem('ex_special_date'); 334 // localStorage.removeItem('ex_hour_notice_date'); 335 // localStorage.removeItem('ex_available_day'); 336 // localStorage.removeItem('ex_widget_booked_date'); 337 // localStorage.removeItem('ex_close_date'); 338} 339 340function getWidgetProductFromLocal(storeData, totalProCount, storeType) { 341 if(storeData != '') { 342 var limitCount = 500; 343 var dataConvert = JSON.parse(JSON.stringify(storeData));
344 var dividedCount = Math.ceil(totalProCount / limitCount); 345 if(storeType == 'winery') { 346 for (var i = 0; i < dividedCount; i++) { 347 try { 348 localStorage.setItem('widget_winery_product_list_'+(i + 1), JSON.stringify(dataConvert.splice(0, limitCount))); 349 } catch (e) { 350 } 351 } 352 } else { 353 for (var i = 0; i < dividedCount; i++) { 354 try { 355 localStorage.setItem('widget_product_list_'+(i + 1), JSON.stringify(dataConvert.splice(0, limitCount))); 356 } catch (e) { 357 } 358 } 359 } 360 } 361} 362 363function removeWidgetProductFromLocal() { 364 if(typeof localStorage.widget_winery_product_total !== "undefined") { 365 var limitCount = 500; 366 var totalProCount = parseInt(localStorage.widget_winery_product_total); 367 var dividedCount = Math.ceil(totalProCount / limitCount); 368 for (var i = 0; i < dividedCount; i++) { 369 try { 370 localStorage.removeItem('widget_winery_product_list_'+(i + 1)); 371 } catch (e) { 372 } 373 } 374 } 375} 376 377function storeWidgetProductFromLocal(storeType, business_id) { 378 if(storeType == 'winery' && business_id != '') { 379 $.ajax({ 380 url: 'controllers/widget_product_request.php', 381 type: 'POST', 382 dataType: 'json', 383 data: {action : 'store_winery_widget_product', business_id: business_id}, 384 async: false, 385 }).done(function(response) { 386 if(response.status == 'success') { 387 removeWidgetProductFromLocal(); 388 var totalProduct = parseInt(response.count); 389 try { 390 localStorage.setItem('widget_winery_product_total', totalProduct); 391 localStorage.setItem('widget_winery_search_list', JSON.stringify(response.result.search)); 392 getWidgetProductFromLocal(response.result.product_list, totalProduct, 'winery'); 393 } catch (e) { 394 } 395 if(response.result.fillter_val != '') { 396 try { 397 localStorage.setItem('widget_winery_product_fillter', JSON.stringify(response.result.fillter_val)); 398 } catch (e) { 399 } 400 } else { 401 localStorage.removeItem('widget_winery_product_fillter'); 402 } 403 } else { 404 localStorage.removeItem('widget_winery_product_total'); 405 localStorage.removeItem('widget_winery_search_list'); 406 localStorage.removeItem('widget_winery_product_fillter'); 407 } 408 }); 409 } 410} 411 412function reservedBookingTime(minute, timerCustomerVal) { 413 var currentDate = new Date(); 414 var timer = minute.split(':'); 415 var min = parseInt(timer[0], 10); 416 var sec = parseInt(timer[1], 10); 417 seconds = (min * 60) + sec; 418 var booking_time = new Date(currentDate.getTime() + (seconds * 1000)); 419 seconds = parseInt(($.cookie('reservedBookingTime'))) || seconds; 420 function tick() { 421 var currentDate = new Date(); 422 var reservedTime = $.cookie('tempWidgetreservedBookingTime'); 423 if(new Date(reservedTime) < new Date(currentDate)) { 424 $.removeCookie('tempWidgetreservedBookingTime'); 425 } 426 if(reservedTime != undefined) { 427 var time = new Date(reservedTime); 428 var time1 = new Date(currentDate.getTime()); 429 var time2 = new Date(time.getTime()); 430 var diffTime = parseInt(time2 - time1)/1000; 431 if(diffTime > 0) { 432 seconds = parseInt(diffTime); 433 } else { 434 $.removeCookie('tempWidgetreservedBookingTime'); 435 } 436 } 437 if($.cookie('tempWidgetreservedBookingTime') === undefined) { 438 currentDate.setTime(currentDate.getTime() + (seconds * 1000)); 439 $.cookie('tempWidgetreservedBookingTime', booking_time, { expires: currentDate }); 440 } 441 seconds--; 442 $.cookie('reservedWidgetBookingTime', seconds); 443 if($.cookie('temp_id') === undefined) { 444 $.cookie('temp_id', timerCustomerVal); 445 } 446 var current_minutes = parseInt(seconds/60); 447 var current_seconds = seconds % 60; 448 $('.timer-count-block .time-title').html('This experience is reserved for the next <span class="count-down"></span> minutes.'); 449 $('.timer-count-block .count-down').html(current_minutes + ":" + (current_seconds < 10 ? "0" : "") + current_seconds); 450 if(seconds > 0 && timerCustomerVal != '') { 451 window.setTimeout(tick, 1000); 452 } else { 453 var temp_id = $.cookie('temp_id'); 454 $.removeCookie('temp_id'); 455 $.removeCookie('reservedWidgetBookingTime'); 456 $.removeCookie('tempWidgetreservedBookingTime'); 457 if(temp_id != '') { 458 $.ajax({ 459 type: 'POST', 460 url: "controllers/ajax_request.php", 461 dataType: "json", 462 data: {action: 'remove_reserved_experience_set', id: temp_id}, 463 success: function(data) { 464 if(data.status == 'success') { 465 $.removeCookie('temp_id'); 466 $.removeCookie('reservedWidgetBookingTime'); 467 $.removeCookie('tempWidgetreservedBookingTime'); 468 } 469 } 470 }, 'json'); 471 } 472 } 473 } 474 tick(); 475} 476 477function checkReservedBookingTime() { 478 var currentDate = new Date(); 479 var reservedTime = $.cookie('tempWidgetreservedBookingTime'); 480 var timerCustomerVal = $.cookie('temp_id'); 481 if(reservedTime != undefined && new Date(reservedTime) > new Date(currentDate) && timerCustomerVal != undefined) { 482 var time = new Date(reservedTime); 483 var time1 = new Date(currentDate.getTime()); 484 var time2 = new Date(time.getTime()); 485 var diffTime = parseInt(time2 - time1)/1000; 486 if(diffTime > 0) { 487 seconds = parseInt(diffTime); 488 } 489 seconds--; 490 if(seconds > 0 && timerCustomerVal != '') { 491 window.setTimeout(checkReservedBookingTime, 1000); 492 } else { 493 var temp_id = $.cookie('temp_id'); 494 $.removeCookie('temp_id'); 495 $.removeCookie('reservedWidgetBookingTime'); 496 $.removeCookie('tempWidgetreservedBookingTime'); 497 if(temp_id != '' && temp_id != undefined) { 498 $.ajax({ 499 type: 'POST', 500 url: "controllers/ajax_request.php", 501 dataType: "json", 502 data: {action: 'remove_reserved_experience_set', id: temp_id}, 503 success: function(data) { 504 if(data.status == 'success') { 505 $.removeCookie('temp_id'); 506 $.removeCookie('reservedWidgetBookingTime'); 507 $.removeCookie('tempWidgetreservedBookingTime'); 508 } 509 } 510 }, 'json'); 511 } 512 } 513 } else { 514 if(new Date(reservedTime) < new Date(currentDate)) { 515 $.removeCookie('tempWidgetreservedBookingTime'); 516 } 517 var temp_id = $.cookie('temp_id'); 518 $.removeCookie('temp_id'); 519 $.removeCookie('reservedWidgetBookingTime'); 520 $.removeCookie('tempWidgetreservedBookingTime'); 521 if(temp_id != '' && temp_id != undefined) { 522 $.ajax({ 523 type: 'POST', 524 url: "controllers/ajax_request.php", 525 dataType: "json", 526 data: {action: 'remove_reserved_experience_set', id: temp_id}, 527 success: function(data) { 528 if(data.status == 'success') { 529 $.removeCookie('temp_id'); 530 $.removeCookie('reservedWidgetBookingTime'); 531 $.removeCookie('tempWidgetreservedBookingTime'); 532 } 533 } 534 }, 'json'); 535 } 536 } 537} 538 539function replace_special_symbol(string) { 540 var pattern = ["é", "è", "ë", "ê", "Ã", "Ã", "Ã", "Ã", "á", "à ", "ä", "â", "Ã¥", "Ã", "Ã", "Ã", "Ã", "à ", "ó", "ò", "ö", "ô", "Ã", "Ã", "Ã", "Ã", "õ", "Ã", "ì", "ï", "î", "Ã", "Ã", "Ã", "Ã", "ú", "ù", "ü", "û", "Ã", "Ã", "Ã", "Ã", "ý", "ÿ", "Ã", "ø", "Ã", "Å", "Å", "Ã", "ç", "Ã", "Ã", "ñ", "Ž", "ž", "Å ", "Å¡"]; 541 var replace = ['e', 'e', 'e', 'e', 'E', 'E', 'E', 'E', 'a', 'a', 'a', 'a', 'a', 'A', 'A', 'A', 'A', 'A', 'o', 'o', 'o', 'o', 'O', 'O', 'O', 'O', 'o', 'i', 'i', 'i', 'I', 'I', 'I', 'I', 'I', 'u', 'u', 'u', 'u', 'U', 'U', 'U', 'U', 'y', '
541y', 'Y', 'o', 'O', 'a', 'A', 'A', 'c', 'C', 'N', 'n', 'Z', 'z', 'S', 's']; 542 if(string != '') { 543 $.each(pattern,function(i,v) { 544 string = string.replace(new RegExp(v, 'g'),replace[i]); 545 }); 546 } 547 return string; 548} 549 550$(document).ready(function() { 551 $("body").tooltip({ selector: '[data-toggle="tooltip"]' }); 552 setTimeout(function(){ 553 if($("#shipping-country-option").length > 0 && $("#shipping-country-option").val() == '') { 554 $("#shipping-country-option").attr({ 555 'data-toggle': 'tooltip', 556 'data-placement': 'bottom', 557 'data-original-title': 'Please select the country you <br> want to ship to', 558 'data-html': 'true' 559 }); 560 $("#shipping-country-option").tooltip('show'); 561 } 562 }, 1500); 563 564 var pgurl = window.location.href.substr(window.location.href.lastIndexOf("/")+1); 565 566 var query = getUrlVars() 567 var parameter = query.q + '.php'; 568 569 $('footer ul li a').each(function(){ 570 if($(this).attr("href") == pgurl || $(this).attr("href") == parameter || $(this).attr("href") == '' ) 571 $(this).addClass("active"); 572 }); 573 574 $('footer ul li a').click(function(){ 575 $('li a').removeClass("active"); 576 $(this).addClass("active"); 577 }); 578 579 $('.btn-back a').on('click', function(){ 580 window.history.back(); 581 }); 582 583 /* close login popup on click on close sign */ 584 $('#login-close').on('click', function(){ 585 $('#gcs-login').hide(); 586 $('.opacity-overlay').hide(); 587 }); 588 589 var lat = $('#golf_lat').val(); 590 var lon = $('#golf_long').val(); 591 592 if(typeof(lat) != "undefined" && typeof(lon) != "undefined") { 593 var weather_url = 'https://www.vintrail.com/getweather'; 594 var weather_html = ''; 595 var days = ["Sun","Mon","Tues","Wed","Thu","Fri","Sat"]; 596 597 // $('#weather-info').html('<div class="text-center"><img src="images/loading2.gif"></div>'); 598 // $.ajax({ 599 // dataType: "jsonp", 600 // url: weather_url, 601 // jsonCallback: 'jsonp', 602 // data: { lat: lat, lon: lon, cnt: 3, units: "metric" }, 603 // cache: false, 604 // success: function (data) { 605 // $.each(data.list, function(i,v){ 606 // //console.log(v); 607 // var date = new Date(v.dt*1000); 608 // var final_date = date.getDate() +'/'+ (date.getMonth()+1) +'/'+ date.getFullYear(); 609 // var weather_str = v.weather[0].description; 610 // var wind_speed = v.speed; 611 // var huminity = v.huminity; 612 // var deg = v.deg; 613 // var img = v.weather[0].icon; 614 // var temperature = Math.round(10*(v.temp.day))/10 ; 615 616 // weather_html += '<article class="box"> \ 617 // <figure> \ 618 // <img src="https://openweathermap.org/img/w/'+ img +'.png" alt=""> \ 619 // </figure> \ 620 // <div class="details"> \ 621 // <h5 class="blue-text">'+ final_date +', '+ days[date.getDay()] +'</h5> \ 622 // <h5 class="green-text uppercase">'+ weather_str +'</h5> \ 623 // <h5 style="font-size: 24px;">'+ temperature +'°C </h5> \ 624 // <h5>Wind Speed: '+ wind_speed +'m/s </h5> \ 625 // </div> \ 626 // </article>'; 627 // }); 628 // $('#weather-info').html(weather_html); 629 // } 630 // }); 631 } 632 633 if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { 634 $('.menu-btn').on('click touchend', function(e) { 635 $('.loader').show(); 636 e.preventDefault(); 637 var href = $(this).attr('href'); 638 window.location.replace(href); 639 }); 640 } 641 642 $(document).on('click touchend', '.menu-btn', function(e) { 643 $('.loader').show(); 644 e.preventDefault(); 645 var href = $(this).attr('href'); 646 window.location.replace(href); 647 }); 648 649 $('.state').on('change', function() { 650 var state_id = $(this).val(); 651 $('.region').removeAttr('disabled'); 652 653 $.post("controllers/ajax_request.php",{ action : 'get_region_list', state_id : state_id }, function( data ) { 654 if(data.status == 'success') { 655 $('.region').html(data.html); 656 } else { 657 $('.region').html(' '); 658 $('.region').html(data.html); 659 } 660 },"json"); 661 662 $('.region').find('option').each(function(i,v) { 663 if($(this).hasClass('hide')) { 664 $(this).clone().insertAfter($(this).parent('.region').find('option:last-child')); 665 $(this).remove(); 666 } 667 }); 668 669 var textValue = optionText(state_id, '.state'); 670 $(this).siblings('span.custom-select').text(textValue); 671 672 $('.region').val(''); 673 $('.region').siblings('span.custom-select').text('Select...'); 674 675 //add the last option for the 676 $('.region option:first-child').attr('selected', true); 677 }); 678 679 // save club for the player database 680 $('.btn-save-club').on('click', function() { 681 var club_id = $(this).attr('rel'); 682 683 $.post( "controllers/ajax_request.php",{ action : 'player_club_save', club_id:club_id}, function( data ) { 684 if(data.status == 'success') { 685 window.location.reload(); 686 } 687 },"json"); 688 }); 689 690 // remove club for the player database 691 $('.btn-remove-club').on('click', function() { 692 var id = $(this).attr('rel'); 693 694 $.post( "controllers/ajax_request.php",{ action : 'delete_saved_club', id: id}, function( data ) { 695 if(data.status == 'success') { 696 window.location.reload(); 697 } 698 },"json"); 699 }); 700 701 // check the received message in the modal from the inbox 702 $('.check-view-email').on('click', function(){ 703 var id = $(this).attr('rel'); 704 $(this).closest('tr').find('td:nth-child(5) span.mail-unread').addClass('label-success').removeClass('label-danger'); 705 $(this).closest('tr').find('td:nth-child(5) span.mail-unread').text('Read'); 706 $.post( "controllers/ajax_request.php",{ action : 'check_email', id : id, },function( data ){ 707 if(data.status == 'success') { 708 $('#email_info_modal').modal(); 709 $('#email_info_modal .modal-body').html(data.content); 710 $('#replay_player_id').val(data.sender_id); 711 } 712 },"json"); 713 }); 714 715 // replay message hide and show messagebox by adding hide class 716 $('#message-replay').on('click', function(){ 717 $('.email-show-replay').toggleClass('hide'); 718 }); 719 720 // to send a back replay of message to the sender 721 $('#send-replay').on('click', function() { 722 var id = $('#replay_player_id').val(); 723 var member_email_body = $('#replay_message_body').val(); 724 var subject = 'Replay message';
725 726 if(member_email_body == '') { 727 alert('Please enter message body content'); 728 return false; 729 } 730 731 $.post("controllers/edit_player.php",{ 'id': id, 'email_subject': subject, 'member_email_body': member_email_body, 'action': 'member_contact_info' },function( result ) { 732 location.reload(); 733 },'json' 734 ); 735 }); 736 737 //remove a received message from the inbox 738 $('.remove-mail-btn').on('click', function() { 739 var id = $(this).attr('rel'); 740 if (confirm("Are you sure you want to delete ?")) { 741 $.post( "controllers/ajax_request.php", { action : 'remove_member_email', id : id, }, function( data ) { 742 if(data.status == 'success') { 743 location.reload(); 744 } else { 745 alert('Sorry, A system error occured'); 746 } 747 },"json"); 748 } 749 }); 750 751 // see the full member profile 752 $(".view-member").click('on', function() { 753 var id = $(this).attr('rel'); 754 var action = "view_member_profile"; 755 756 $.post( "controllers/ajax_request.php", { id: id, action : action }, function( data ) { 757 if(data.status == "success") { 758 $('#member_info_modal').modal(); 759 $('#member_name').html(data.player_data.name); 760 $('#member_handicap').html(data.player_data.handicap); 761 $('#member_club').html(data.player_data.member_cb_name); 762 $('#member_profession').html(data.player_data.member_profession); 763 $('#member_about_you').html(data.player_data.about); 764 $('#member_criteria').html(data.player_data.play_criteria); 765 $('#member_region').html(data.player_data.region_name); 766 $('#member_available_days').html(data.days_html); 767 $('.member-scorecard-tbl').html(data.score_html); 768 } 769 },"json"); 770 }); 771 772 // open a modal for sending message from the member listing profile 773 $('.player-contact-btn').on('click', function() { 774 var id = $(this).attr('rel'); 775 $('#receiver_id').val(id); 776 $.post( "controllers/ajax_request.php",{ action : 'get_template_data', id : id, },function( data ) { 777 if(data.status == 'success') { 778 $('#member_contact_modal').modal(); 779 $('#member_email_body').html(data.tmpl_content); 780 } 781 },"json"); 782 }); 783 784 // change the content in textarea by changing the message selection choice which message they want to send it 785 $("#message_selection").change(function () { 786 var tmpl_id = $(this).val(); 787 var id = $('#receiver_id').val(); 788 789 $.post( "controllers/ajax_request.php",{ action : 'get_template_data', id : id, 'tmpl_id' : tmpl_id },function( data ) { 790 if(data.status == 'success') { 791 $('#member_contact_modal').modal(); 792 $('#member_email_body').html(data.tmpl_content); 793 } 794 },"json"); 795 }); 796 797 // send mail by clicking send button for contacting member 798 $('.member-contact-btn').on('click',function() { 799 var id = $('#receiver_id').val(); 800 var member_email_body = $('#member_email_body').val(); 801 var subject = 'Member contact from golf247'; 802 803 if(member_email_body == '') { 804 alert('Please enter message body content'); 805 return false; 806 } 807 808 $.post("controllers/edit_player.php",{ 'id': id, 'email_subject': subject, 'member_email_body': member_email_body, 'action': 'member_contact_info' },function( result ) { 809 location.reload(); 810 },'json' 811 ); 812 }); 813 814 $(document).on('change', '.country-reg', function(){ 815 var country_id = $(this).val(); 816 $('.region').attr('disabled', 'disabled'); 817 $('.region').val('0'); 818 819 $('.state-reg').find('option').each(function(i,v){ 820 var country = ($(this).attr('rel')); 821 $(this).removeAttr('selected').end(); 822 823 if(country_id != country) 824 { 825 $(this).addClass('hide'); 826 } 827 else 828 { 829 $(this).removeClass('hide'); 830 } 831 832 if(country == 0) 833 { 834 $(this).removeClass('hide'); 835 } 836 }); 837 838 var textValue = optionText(country_id, '.country-reg'); 839 $(this).siblings('span.custom-select').text(textValue); 840 841 $('.state-reg').val(''); 842 $('.state-reg').siblings('span.custom-select').text('Select...'); 843 }); 844 845 $('.state-reg').on('change', function() { 846 var state_id = $(this).val(); 847 $('.region').removeAttr('disabled'); 848 849 // $.post("controllers/ajax_request.php",{ action : 'get_region_list', state_id : state_id }, function( data ) { 850 // if(data.status == 'success') { 851 // $('.region').html(data.html); 852 // } else { 853 // $('.region').html(' '); 854 // $('.region').html(data.html); 855 // } 856 // },"json"); 857 858 $('.region').find('option').each(function(i,v){ 859 var state = ($(this).attr('rel')); 860 $(this).removeAttr('selected').end(); 861 862 if(state_id != state) 863 { 864 $(this).addClass('hide'); 865 } 866 else 867 { 868 $(this).removeClass('hide'); 869 } 870 871 if(state == 0) 872 { 873 $(this).removeClass('hide'); 874 } 875 }); 876 877 $('.region').find('option').each(function(i,v) { 878 if($(this).hasClass('hide')) 879 { 880 $(this).clone().insertAfter($(this).parent('.region').find('option:last-child')); 881 $(this).remove(); 882 } 883 }); 884 885 var textValue = optionText(state_id, '.state'); 886 $(this).siblings('span.custom-select').text(textValue); 887 888 $('.region').val(''); 889 $('.region').siblings('span.custom-select').text('Select...'); 890 891 //add the last option for the 892 $('.region option:first-child').attr('selected', true); 893 }); 894 895 $('[name="guest_remember"]').change(function() 896 { 897 if($(this).attr('checked')) 898 { 899 $(this).val('1'); 900 } 901 else 902 { 903 $(this).val('0'); 904 } 905 }); 906 907 $('[name="send_newsletter"]').change(function() 908 { 909 if($(this).attr('checked')) 910 { 911 $(this).val('1'); 912 } 913 else 914 { 915 $(this).val('0'); 916 } 917 }); 918 919 $(document).on('change', '.country', function(){ 920 var country_id = $(this).val(); 921 $('.region').attr('disabled', 'disabled'); 922 $('.region').val('0'); 923 924 $('.state').find('option').each(function(i,v){ 925 var country = ($(this).attr('rel')); 926 $(this).removeAttr('selected').end(); 927 928 if(country_id != country) 929 { 930 $(this).addClass('hide'); 931 } 932 else 933 { 934 $(this).removeClass('hide'); 935 } 936 937 if(country == 0) 938 { 939 $(this).removeClass('hide'); 940 } 941 }); 942 943 var textValue = optionText(country_id, '.country'); 944 $(this).siblings('span.custom-select').text(textValue); 945 946 $('.state').val(''); 947 $('.state').siblings('span.custom-select').text('Select...'); 948 }); 949 950 $(document).on('change', '.dynamic-country', function(){ 951 var country_id = $(this).val(); 952 country_state_region_option('country_data', country_id); 953 }); 954 955 $(document).on('change', '.dynamic-state', function(){ 956 var state_id = $(this).val(); 957 country_state_region_option('state_data', state_id); 958 }); 959 $(document).on('click', 'body', function(event){ 960 if($(this).find('#notification-modal').hasClass('in') == true) { 961 $("#notification-modal").modal('hide'); 962 } 963 }); 964 $(document).on('hide.bs.modal', '#notification-modal', function(){ 965 var data_trigger = $(this).attr('data_trigger'); 966 var data_href = $(this).attr('data_href'); 967 var data_affiliate_session = $(this).attr('data_session'); 968 969 if(data_affiliate_session !== undefined && data_affiliate_session != '') { 970 $(this).attr('data_session', ''); 971 window.open(data_affiliate_session, '_blank'); 972 } 973 if(data_href !== undefined && data_href != '') { 974 if(data_href == '#redirect-form-view') { 975 if($('#redirect-to-cart').length > 0) { 976 setTimeout(function(e){ 977 $('#redirect-to-cart')[0].click(); 978 }, 10000); 979 } 980 $(data_href).submit(); 981 } else { 982 $(this).attr('data_href', ''); 983 $(data_href)[0].click(); 984 } 985 } 986 if(data_trigger !== undefined && data_trigger != '') { 987 $(this).attr('data_trigger', ''); 988 $(data_trigger).trigger('click'); 989 } 990 }); 991 992 function formatState (state) { 993 if (!state.id) { return state.text; } 994 var $state = $('<span><img src="' + $(state.element).attr('data-src') + '" class="img-flag" width="38" /> ' + state.text + '</span>'); 995 return $state; 996 }; 997 $('.custom-select-block').select2({ 998 minimumResultsForSearch: Infinity, 999 templateResult: formatState, 1000 templateSelection: formatState, 1001 dropdownAutoWidth : true, 1002 dropdownParent: $('.custom-select-view') 1003 }); 1004 1005 $(document).on('click', '#reviews .review-sub-block span.readmore_review_desc', function(){ 1006 $(this).siblings('.review-description').find('.inner-review-desc').toggleClass('open'); 1007 var read_more_txt = ($(this).siblings('.review-description').find('.inner-review-desc').hasClass('open')) ? 'See Less' : 'See More'; 1008 $(this).text(read_more_txt); 1009 }); 1010 1011 $(document).on('click', '#reviews .review-block .see-more-reviews', function(){ 1012 var is_review_data = false;
1013 var review_this = $(this); 1014 var defaultDisplayReview = 5; 1015 if($(this).parents('.review-block').find('.review-sub-block').hasClass('hide')) { 1016 is_review_data = true; 1017 } 1018 $(this).parents('.review-block').find('.review-sub-block').each(function(index, el) 1019 { 1020 if(is_review_data) { 1021 if($(this).hasClass('hide')) { 1022 $(this).removeClass('hide'); 1023 review_this.text('See less Reviews'); 1024 } 1025 } else { 1026 if(index >= defaultDisplayReview) { 1027 $(this).addClass('hide'); 1028 review_this.text('See more Reviews'); 1029 } 1030 } 1031 }); 1032 }); 1033 1034 $(document).on('change', '.custom-validate', function(event) { 1035 $('form .form-error').remove(); 1036 $('form label.error').remove(); 1037 var tempVal = $(this).val(); 1038 if (tempVal == '') { 1039 $(this).after('<label class="form-error error">This field is required.</label>'); 1040 } else { 1041 var validateType = $(this).data('custom_valid'); 1042 if (typeof validateType !== "undefined" && validateType == "email") { 1043 var is_check_validate = /[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/igm.test(tempVal); 1044 if(!is_check_validate) { 1045 $(this).after('<label class="form-error error">Please enter valid email</label>'); 1046 } 1047 } 1048 if (typeof validateType !== "undefined" && validateType == "phone") { 1049 var is_check_validate = /^[\+\d]?(?:[\d-.\s()]*)$/.test(tempVal); 1050 if(!is_check_validate) { 1051 $(this).after('<label class="form-error error">You can only use the + and numbers</label>'); 1052 } 1053 } 1054 } 1055 }); 1056 $(document).on('click', '.filter-toggle-block .pos-filter-toggle', function(event) { 1057 $(this).parents('.search-view-block').find('.mobile-pos-category').toggleClass('hide'); 1058 var scrollTop = $('.mobile-pos-category'); 1059 $("html,body").animate({scrollTop: 0}, 1000); 1060 }); 1061}); 1062 1063$(window).bind('resize load scroll', function() { 1064 checkReservedBookingTime(); 1065 1066 var currentWidth = $(window).width(); 1067 var currentHeight = $(window).scrollTop(); 1068 $('.error_wrapper .pro-message').css({top: currentHeight+'px'}); 1069 if (currentWidth < 990) { 1070 $('.skip-button-block-mobile').removeClass('hide'); 1071 $('.skip-button-block-desktop').addClass('hide'); 1072 1073 $('.product-cart-block-mobile').removeClass('hide'); 1074 $('.product-cart-block-desktop').addClass('hide'); 1075 1076 $('.not-service-info-block').addClass('hide'); 1077 $('.service-info-block').addClass('hide'); 1078 // $('.discount-list-block').addClass('hide'); 1079 1080 $('.experience-list-desktop').addClass('hide'); 1081 $('.experience-list-mobile').html($('.experience-list-desktop').html()); 1082 } else { 1083 $('.skip-button-block-mobile').addClass('hide'); 1084 $('.skip-button-block-desktop').removeClass('hide'); 1085 1086 $('.product-cart-block-mobile').addClass('hide'); 1087 $('.product-cart-block-desktop').removeClass('hide'); 1088 1089 $('.not-service-info-block').removeClass('hide'); 1090 $('.service-info-block').removeClass('hide'); 1091 // $('.discount-list-block').removeClass('hide'); 1092 1093 $('.experience-list-desktop').removeClass('hide'); 1094 $('.experience-list-mobile').html(''); 1095 } 1096});
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.