1$ = jQuery; 2 3function isTestMode() { 4 const storageValue = localStorage.getItem('TestMode'); 5 const urlParams = new URLSearchParams(window.location.search); 6 const paramValue = urlParams.get('TestMode'); 7 8 return storageValue === 'true' || storageValue === '1' 9 || paramValue === 'true' || paramValue === '1'; 10} 11 12const testMode = isTestMode(); 13const isLando = window.location.hostname.endsWith('.lndo.site'); 14const useLandoBackend = isLando; 15 16if (testMode || isLando) { 17 $('.fill-form').show(); 18} 19 20function hasValue(elem) { 21 return $(elem).filter(function() { return $(this).val(); }).length > 0; 22} 23 24function getBackendDomain() { 25 return useLandoBackend ? 'https://secure-britannia-lanes.lndo.site' : 'https://secure.britannialanes.co.uk'; 26} 27 28function getDistance(origin,destination,callback) { 29 // var bounds = new google.maps.LatLngBounds; 30 // var markersArray = []; 31 // var destinationIcon = 'https://chart.googleapis.com/chart?' + 32 // 'chst=d_map_pin_letter&chld=D|FF0000|000000'; 33 // var originIcon = 'https://chart.googleapis.com/chart?' + 34 // 'chst=d_map_pin_letter&chld=O|FFFF00|000000'; 35 // var map = new google.maps.Map(document.getElementById('tm-hero'), { 36 // center: {lat: 51.45, lng: -2.58}, 37 // zoom: 6 38 // }); 39 // var geocoder = new google.maps.Geocoder; 40 // $('#tm-hero').css({'position':'fixed'}); 41 42 var service = new google.maps.DistanceMatrixService; 43 service.getDistanceMatrix({ 44 origins: [origin], 45 destinations: [destination], 46 travelMode: 'DRIVING', 47 unitSystem: google.maps.UnitSystem.IMPERIAL, 48 avoidHighways: false, 49 avoidTolls: false 50 }, function(response, status) { 51 if (status !== 'OK') { 52 console.error('Distance Matrix error: ' + status); 53 callback(null); 54 return; 55 } 56 57 if (response.rows[0].elements[0].status !== 'OK') { 58 console.error('Distance Matrix error: ' + response.rows[0].elements[0].status); 59 callback(null); 60 return;s 61 } 62 63 // console.log('DM response: ', response); 64 65 var originList = response.originAddresses; 66 67 for (var i = 0; i < originList.length; i++) { 68 var results = response.rows[i].elements; 69 // geocoder.geocode({'address': originList[i]}, 70 // showGeocodedAddressOnMap(false)); 71 for (var j = 0; j < results.length; j++) { 72 // geocoder.geocode({'address': destinationList[j]}, 73 // showGeocodedAddressOnMap(true)); 74 callback(results[j].distance.text); 75 // $('#distance').val(results[j].distance.text); 76 } 77 } 78 }); 79} 80 81function isInt(n) { 82 return typeof n == 'number' && n % 1 == 0; 83} 84 85/** 86 * @param {string} code 87 * @returns {string} 88 */ 89function getPaysafeErrorMessage(code) { 90 switch (code) { 91 case '9001': 92 return "Sorry, we cannot connect to the banks right now. Please try again later."; 93 case '9002': 94 return "Sorry, there was an error communicating with the banks. Please try again later."; 95 case '9003': 96 return "Please check the card details you have entered are all present and correct."; 97 case '9004': 98 return "Sorry, there was an error. Our team have been notified and will attempt to contact you."; 99 case '9015': 100 return "Sorry, there was an error. Our team have been notified and will attempt to contact you."; 101 case '9034': 102 return "Sorry, there was an error. Our team have been notified and will attempt to contact you."; 103 case '9035': 104 return "Sorry, there was an error. Our team have been notified and will attempt to contact you."; 105 case '9036': 106 return "Sorry, there was an error. Our team have been notified and will attempt to contact you."; 107 case '9037': 108 return "Sorry, there was an error communicating with the card company. Please try again later."; 109 case '9039': 110 return "Sorry, there was an error with the 3D Secure service. Please try again later or try another card."; 111 case '9040': 112 return "Sorry, there was an error with the 3D Secure service. Please try again later or try another card"; 113 case '9041': 114 return "Sorry, there was an error. Our team have been notified and will attempt to contact you."; 115 case '9042': 116 return "You appear to have cancelled the transaction during security checks. If not, please try again."; 117 case '9043': 118 return "Please check the name you entered matches the card details"; 119 case '9044': 120 return "Sorry, there was an error. If your card was issued in a non-UK country please call us to rectify."; 121 case '9045': 122 return "Please check the postcode you entered matches that registered to the card."; 123 case '9046': 124 return "Sorry, there was an error. Our team have been notified and will attempt to contact you."; 125 case '9047': 126 return "Please check the town you entered matches that registered to the card."; 127 case '9048': 128 return "Please check the address you entered matches that registered to the card."; 129 case '9049': 130 return "Please check the address you entered matches that registered to the card."; 131 case '9050': 132 return "Sorry, there was an error. Our team have been notified and will attempt to contact you."; 133 case '9051': 134 return "Sorry, there was an error. Our team have been notified and will attempt to contact you."; 135 case '9052': 136 return "Sorry, there was an error. Our team have been notified and will attempt to contact you."; 137 } 138 139 return "Sorry, an unknown error occurred.";
140} 141 142/** 143 * Roughly converts the phone number to E.164 format. 144 * @param {string} phone 145 * @returns {string} 146 */ 147function convertPhoneNumber(phone) { 148 if (phone.startsWith('44')) { 149 phone = '+' + phone 150 } else if (!phone.startsWith('+')) { 151 phone = '+44' + phone; 152 } 153 return phone.replace(/[ -]/g, '').replace('+440', '+44'); 154} 155 156$(document).ready(function() { 157 // TODO: enqueue these in the proper way 158 if ($(".britannia-form-removals")[0]) { 159 // $.getScript(britanniaForms.asset_url + '/js/third-party/jquery.nouislider.all.min.js'); 160 $.getScript(britanniaForms.asset_url + '/js/removals.js'); 161 } 162 163 if ($(".britannia-form-book-survey")[0]) { 164 $.getScript(britanniaForms.asset_url + '/js/book-survey.js'); 165 } 166 167 if ($(".britannia-form-storage")[0]) { 168 $.getScript(britanniaForms.asset_url + '/js/storage.js'); 169 $.getScript('https://hosted.paysafe.com/js/v1/latest/paysafe.min.js'); 170 } 171 172 if ($(".britannia-form-shredding")[0]) { 173 $.getScript(britanniaForms.asset_url + '/js/shredding.js'); 174 $.getScript('https://hosted.paysafe.com/js/v1/latest/paysafe.min.js'); 175 } 176 177 if ($(".britannia-form-shredding-track")[0]) { 178 $.getScript(britanniaForms.asset_url + '/js/shredding-track.js'); 179 } 180 181 if ($(".britannia-form-van-hire")[0]) { 182 $.getScript(britanniaForms.asset_url + '/js/van-hire.js'); 183 $.getScript('https://hosted.paysafe.com/js/v1/latest/paysafe.min.js'); 184 } 185}); 186 187function get_paysafe_details(branch) { 188 let accountId; 189 let apiKey; 190 let url = getBackendDomain() + '/frontend-api/getauth.php'; 191 192 if (testMode || useLandoBackend) { 193 apiKey = 'T1QtMTEwMjExMDpCLXFhMi0wLTY2ZTI1YmFiLTAtMzAyZDAyMTQ1OGY5OGJhZDkyOTUxN2ZkNjFlY2E2OWUzOWM1ODc0MWI1NTQ2MDViMDIxNTAwOGI2YmNmYjA1MzM3YjhjZDY3NWJhZDE2ZGI5MmUwODFhNjVhODczYw=='; 194 accountId = 1002783660; 195 } else { 196 apiKey = "T1QtMjMxNzYyOkItcDEtMC01YzFhMzE5OC0wLTMwMmQwMjE1MDA4ZTI2N2NhMjMxNTc1OWI1Njk4NGY1NWI4OWM1MTM2YTdkNzAxODg4MDIxNDQ4MjU0MjkyOTYxNTQ2OTY3NDZjNzk4ZWI1Njk0MmFlNzVlYjNiMTA="; 197 198 switch (branch) { 199 case 1: 200 accountId = 1002850414; 201 break; 202 case 2: 203 accountId = 1002854234; 204 break; 205 case 4: 206 accountId = 1002854224; 207 break; 208 default: 209 accountId = 1002850414; 210 } 211 } 212 213 return { 214 accountId: accountId, 215 apiKey: apiKey, 216 backendUrl: url, 217 testMode: testMode || useLandoBackend, 218 }; 219} 220 221function get_utm_tags() { 222 const tag_names = [ 223 'utm_source', 224 'utm_medium', 225 'utm_campaign', 226 'utm_term', 227 'utm_content', 228 'gclid', 229 ]; 230 231 const tags = {}; 232 233 const cookies = document.cookie.split(';'); 234 for (const cookie of cookies) { 235 const [key, value] = cookie.split('='); 236 if (tag_names.includes(key.trim())) { 237 tags[key.trim()] = value; 238 } 239 } 240 241 return tags; 242}
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.