1// home page custom js 2var headprepend = "<!-- Global site tag (gtag.js) - Google Analytics -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=UA-46718346-7\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'UA-46718346-7');\n</script>\n\n<!-- Google Tag Manager -->\n<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\nnew Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\nj=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n})(window,document,'script','dataLayer','GTM-M46RMVP');</script>\n<!-- End Google Tag Manager -->"; 3var headappend = ""; 4var tagManagerbody = "<!-- Google Tag Manager (noscript) -->\n<noscript><iframe src=\"https://www.googletagmanager.com/ns.html?id=GTM-M46RMVP\"\nheight=\"0\" width=\"0\" style=\"display:none;visibility:hidden\"></iframe></noscript>\n<!-- End Google Tag Manager (noscript) -->"; 5var zendesk = ''; 6$('head').prepend(headprepend); 7$('head').append(headappend); 8$('body').prepend(tagManagerbody); //ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]); 9 10 11// var themeColorMeta = ''; 12// $("head").append(themeColorMeta); 13 14 15$.getScript(folderName + "/assets/layouts/js/utilityFn.js", function () {// alert("Script loaded but not necessarily executed."); 16}); 17$(".click-global").on("click", function (e) { 18 e.stopPropagation(); 19 $(".dropdown-menu-international").toggleClass("show"); 20}); 21var top5Reviews = ""; 22//alert(); 23$.getJSON('./in.co.zerowaste.instacash-reviews.json', function (data) { 24 var result = data; // result = result.sort(function(a, b) { 25 // return (new Date(parseInt(b.comments[0].userComment.lastModified.seconds)*1000)) - (new Date(parseInt(a.comments[0].userComment.lastModified.seconds)*1000)) 26 // }) 27 //console.log(result); 28 //alert(result); 29 var topRev = data.filter(getTopReviews); 30 //console.log(topRev); 31 var looplength = ""; 32 if(topRev.length < 6){ 33 looplength = topRev.length 34 }else{ 35 looplength = 6 36 } 37 for (var i = 0; i < looplength; i++) { 38 // var randCol = flatColors[Math.floor(Math.random() * flatColors.length)]; 39 var revName = ""; 40 41 if (!topRev[i].authorName) { 42 revName = "Anonymous"; 43 } else { 44 revName = topRev[i].authorName; 45 } 46 47 var reviewImg = revName[0]; 48 var reviewTxt = topRev[i].comments[0].userComment.text; 49 var reviewName = revName; 50 top5Reviews += "<div>\n <div class=\"clearfix\">\n <div class=\"text-center\">\n <i class=\"homeicon-quote-left fs-40 text-primary mb-3\"></i>\n </div>\n <div class=\"w-md-80 text-center mx-md-auto mb-4\">\n <blockquote class=\"lead text-black\">" + reviewTxt + "</blockquote>\n </div>\n <div class=\"w-lg-50 mx-auto\">\n <div class=\"reviewStarRating\"><span id=\"reviewStar\" class=\"sprites\"></span><span id=\"reviewStar\" class=\"sprites\"></span><span id=\"reviewStar\" class=\"sprites\"></span><span id=\"reviewStar\" class=\"sprites\"></span><span id=\"reviewStar\" class=\"sprites\"></span></div>\n <div class=\"ml-3\">\n <h4 class=\"h6 mb-0\">" + reviewName + "</h4>\n </div>\n </div>\n </div>\n </div>"; 51 } 52}).done(function (data) { 53 $("#thinkers").append(top5Reviews); 54 $('.center').slick({ 55 //dots: true, 56 centerMode: true, 57 infinite: true, 58 speed: 300, 59 slidesToShow: 3, 60 slidesToScroll: 1, 61 autoplay: true, 62 arrows: false, 63 responsive: [// { 64 // breakpoint: 992, 65 // settings: { 66 // slidesToShow: 2, 67 // slidesToScroll: 1, 68 // } 69 // }, 70 { 71 breakpoint: 768, 72 settings: { 73 slidesToShow: 1, 74 slidesToScroll: 1 75 } 76 }, { 77 breakpoint: 480, 78 settings: { 79 slidesToShow: 1, 80 slidesToScroll: 1 81 } 82 }] 83 }).on('setPosition', function (event, slick) { 84 //slick.$slides.css('height', slick.$slideTrack.height() + 'px'); 85 }); 86}); 87 88function getTopReviews(element, index, array) { 89 return element.comments[0].userComment.starRating > 4 && element.comments[0].userComment.text.length > 20 && element.authorName; 90} 91
92window.mobileAndTabletcheck = function () { 93 var check = false; 94 95 (function (a) { 96 if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true; 97 })(navigator.userAgent || navigator.vendor || window.opera); 98 99 return check; 100}; 101 102function getVariantAndPhone(nameArr) { 103 function getProductVariant(productList) { 104 var productList = cleanProductNames(nameArr); 105 //console.log(productList); 106 var baseName = ''; 107 var baseLen = -1; 108 109 while (1) { 110 baseLen = baseLen + 1; 111 baseName = baseName + productList[0][baseLen]; 112 113 for (var j in range(0, productList.length)) { 114 if (baseName.toLowerCase() != productList[j].toLowerCase().slice(0, baseLen + 1)) return [baseName.slice(0, -1), baseName.length - 1]; 115 } 116 } 117 } 118 119 function cleanProductNames(productList) { 120 var i = 0; 121 122 for (var pname in productList) { 123 productList[i] = strip(productList[pname]); 124 i = i + 1; 125 } 126 127 return productList; 128 } 129 130 var base = getProductVariant(nameArr); 131 var productVariantList = [strip(base[0].replace('(', '').replace(')', '')), []]; 132 133 for (var pname in nameArr) { 134 productVariantList[1].push(strip(nameArr[pname].slice(base[1]).replace('(', '').replace(')', ''))); 135 } 136 137 return productVariantList; 138} 139 140function mobileAutoDetectSection() { 141 var nameArr = []; 142 143 if (window.mobileAndTabletcheck()) { 144 if (navigator.userAgent.indexOf("iPhone") >= 0) { 145 $(".deviceVariant").hide(); 146 } else { 147 var __adDebug = (location.search.indexOf('adDebug=1') !== -1); 148 var __autoDetectPostLanding = function (model) { 149 if (__adDebug) { alert('AUTO-DETECT model sent: "' + (model || '(empty)') + '"\n\nuserAgentData (UA-CH): ' + (navigator.userAgentData ? 'present' : 'ABSENT') + '\n\nUA: ' + navigator.userAgent); } 150 $.post('phoneNew.php', { model: model || '' }, function (res) { 151 if (__adDebug) { alert('AUTO-DETECT phoneNew.php response:\n\n' + res); } 152 //console.log(res); 153 // $(".deviceVariant").html(res); 154 // return 155 var result = JSON.parse(res); 156 if(result.status == "Error"){ 157 $(".deviceVariant").hide(); 158 }else{ 159 var autoDetectSection = ""; 160 161 if (result.length === 1) { 162 var productImage = result[0].image; 163 var productName = result[0].name; 164 var uptoPrice = result[0].upto; 165 var link = result[0].link; 166 var productId = result[0].id; 167 autoDetectSection += "<li class=\"item\">\n<img onerror='this.src = 'this.src='https://instacash.blob.core.windows.net/static/img/products/default.png'' src=" + productImage + " alt=" + productName + ">\n<p>" + productName + "</p>\n <small>Get upto " + currencySymbol + " " + moneyConvert(parseInt(uptoPrice)) + "</small>\n <a href=\"javascript:void(0)\" class=\"btn btn-primary greensmall\" data-webUrl=" + link + " data-id=" + productId + " data-name=" + productName + ">Get Exact Quote</a>\n<input id=\"radio1\" style='visibility:hidden' type=\"radio\" name=\"variant\" checked data-webUrl="+ link +" data-id=" + productId + " data-name=" + productName + "> </li>"; 168 $("[id='appendAutoDet']").html(autoDetectSection); 169 $(".deviceVariant").show(); 170 } else { 171 for (var i = 0; i < result.length; i++) { 172 nameArr.push(result[i].name); 173 } 174 var variantArr = getVariantAndPhone(nameArr); 175 var productImage = result[0].image; 176 var productName = variantArr[0]; 177 // var firstPart = "<img onerror='this.src = 'https://instacash.blob.core.windows.net/static/img/products/default.png'' src=" + productImage + " alt=" + productName + "><p>" + productName + "</p>"; 178 var firstPart = `<img onerror='this.src='https://instacash.blob.core.windows.net/static/img/products/default.png'' src=`+productImage+` alt=`+productName+`> 179 <h3>` + productName +`</h3>`; 180 181 for (var i = 0; i < variantArr[1].length; i++) { 182 //autoDetectSection += "<div class=\"flex-grow-1 detect-margin\">\n<small>Get upto " + currencySymbol + " " + moneyConvert(parseInt(result[i].upto)) + "</small><a href=\"javascript:void(0)\" data-webUrl=" + result[i].link + " data-id=" + result[i].id + " data-name=" + result[i].name + " class=\"btn btn-primary btn-sm greensmall\">" + variantArr[1][i] + "</a></div>"; 183 autoDetectSection += `<li class="variantLi"> 184 <input id="radio`+i+`" type="radio" name="variant" checked data-webUrl=`+ result[i].link +` data-id=` + result[i].id + ` data-name=` + result[i].name + `> 185 <label for="radio`+i+`" class="radio">`+variantArr[1][i]+` <br/><small>Get upto ` + currencySymbol + ` ` + moneyConvert(parseInt(result[i].upto)) + `</small></label> 186 </li>`; 187 } 188 $("[id='appendAutoDet']").html("<li>" + firstPart + "</li><li class='text-right'><ul class='appVariant'>"+autoDetectSection+"</ul><a class='btn btn-primary greensmall' href='javascript:void(0)'>Sell Now</a></li>"); 189 $(".deviceVariant").show(); 190 } 191 } 192 }); 193 }; 194 if (navigator.userAgentData && navigator.userAgentData.getHighEntropyValues) { 195 navigator.userAgentData.getHighEntropyValues(['model']).then(function (h) { __autoDetectPostLanding(h && h.model ? h.model : ''); }).catch(function () { __autoDetectPostLanding(''); }); 196 } else { 197 __autoDetectPostLanding(''); 198 } 199 } 200 } else {// alert(false); 201 } 202} 203 204mobileAutoDetectSection(); 205$("[id='appendAutoDet']").on("click", ".greensmall",function (e) { 206 $(".app-loader").fadeIn("slow"); 207 $(".app-wrapper").fadeOut("slow"); 208 var productId = $("input[type='radio']:checked").attr('data-id'); 209 var weburl = $("input[type='radio']:checked").attr('data-weburl'); 210 // alert(weburl); 211 // alert(productId); 212 $.post(folderName + 'getData.php', { 213 'type': 'currentDevicePrice', 214 'productId': productId 215 }, function (result) { 216 var res = JSON.parse(result); 217 if (res.status == "Success") { 218 setMultipleBackendSessioncb("set", '{"productId": "' + productId + '", "uptoPrice"
218:"' + res.msg.maximumTotal + '"}', function (res) { 219 if (res.status == "Success") { 220 $(".app-loader").fadeOut("slow"); 221 $(".app-wrapper").fadeIn("slow"); 222 window.location.href = "sell/" + weburl; 223 } else {} 224 }); 225 } else {} 226 }); 227}); 228 229 230 231$(".chat-click").on("click", function () { 232 $zopim(function () { 233 $zopim.livechat.window.show(); 234 }); 235}); 236 237$(".logoutBtn").on("click", function(e) { 238 239 $.post(folderName + "logout", function(res) { 240 if (res == true) { 241 signOut(); 242 window.location.reload(); 243 } 244 }) 245 e.preventDefault(); 246}); 247 248function onLoad() { 249 gapi.load('auth2', function() { 250 gapi.auth2.init(); 251 }); 252} 253 254function signOut() { 255 var auth2 = gapi.auth2.getAuthInstance(); 256 auth2.signOut().then(function() { 257 console.log('User signed out.'); 258 }); 259} 260 261 262var devicesJson; 263var listHtml = ""; 264var loadLi = "<li class=\"first text-center\">\n<img onerror='this.src = 'this.src='https://instacash.blob.core.windows.net/static/img/products/default.png'' src=\"https://instacash.blob.core.windows.net/static/live/in-new/images/custom-load.svg\" alt=\"\">\n<p>Loading.. please wait..</p>\n</li>"; 265var allDHeading = '<li class="searchHead">Devices</li>'; 266$(".searchLst").html(loadLi); 267var recentLiFirst; 268var localRecent = localStorage.getItem('recentSearch'); 269var recentUl = "<ul></ul>"; 270var recentSrch = ""; 271var recentLi = ""; 272 273if (localRecent) { 274 recentSrch = JSON.parse(localRecent); 275} else { 276 $(".recent-txt").hide(); 277} 278 279for (var i = 0; i < recentSrch.length; i++) { 280 recentLi += "<li taindex='1' data-device-id=" + recentSrch[i].id + " data-term-search=" + recentSrch[i].name.toLowerCase().replace(/ /g, '') + " data-brand=" + recentSrch[i].brandName + " data-weburl=" + recentSrch[i].websiteURL + " class=\"searchDeviceListClick recentList\"><a href=\"javascript:void(0)\">" + recentSrch[i].model + "</a></li>"; 281} 282 283if (recentLi == "") { 284 recentLiFirst = ''; 285} else { 286 recentLiFirst = '<li class="searchHead">Recent Searches</li>'; 287} 288 289$.post(folderName + 'getData.php', { 290 'type': 'allDeviceJson' 291}, function (result) { 292 var res = JSON.parse(result); 293 294 if (res.status == "Success") { 295 devicesJson = res.msg; 296 297 for (var i = 0; i < 10; i++) { 298 listHtml += "<li taindex='1' data-device-id=" + devicesJson[i].id + " data-term-search=" + devicesJson[i].name.toLowerCase().replace(/ /g, '') + " data-brand=" + devicesJson[i].brandName + " data-weburl=" + devicesJson[i].websiteURL + " class=\"searchDeviceListClick\"><a href=\"javascript:void(0)\">" + devicesJson[i].model + "</a></li>"; 299 } 300 } else { 301 deviceJson = false; 302 } 303 304 $(".searchLst").html(recentLiFirst + recentLi + allDHeading + listHtml); 305}); 306 307var resultsD = []; 308$(".searchDevice input[type='text']").on("keyup", function (e) { 309 // if(e.which != 38 && e.which != 40){ 310 var searchTerm = $(this).val().toLowerCase(); 311 312 if (searchTerm == "") { 313 listHtml = ""; 314 315 for (var i = 0; i < 10; i++) { 316 listHtml += "<li taindex='1' data-device-id=" + devicesJson[i].id + " data-term-search=" + devicesJson[i].name.toLowerCase().replace(/ /g, '') + " data-brand=" + devicesJson[i].brandName + " data-weburl=" + devicesJson[i].websiteURL + " class=\"searchDeviceListClick\"><a href=\"javascript:void(0)\">" + devicesJson[i].model + "</a></li>"; 317 } 318 319 $(".searchLst").html(recentLiFirst + recentLi + allDHeading + listHtml); 320 } else { 321 var searchedJson = []; 322 listHtml = ""; 323 324 for (var l = 0; l < devicesJson.length; l++) { 325 var found = devicesJson[l].name.toLowerCase().match(searchTerm); 326 327 if (found) { 328 searchedJson.push(devicesJson[l]); 329 } 330 } 331 332 if (searchedJson.length) { 333 for (var i = 0; i < searchedJson.length; i++) { 334 listHtml += "<li taindex='1' data-device-id=" + searchedJson[i].id + " data-term-search=" + searchedJson[i].name.toLowerCase().replace(/ /g, '') + " data-brand=" + searchedJson[i].brandName + " data-weburl=" + searchedJson[i].websiteURL + " class=\"searchDeviceListClick\"><a href=\"javascript:void(0)\">" + searchedJson[i].model + "</a></li>"; 335 } 336 } else { 337 listHtml = "<li class=\"searchDeviceListClick\"><a href=\"javascript:void(0)\">No Device Found</a></li> "; 338 } 339 340 $(".searchLst").html(allDHeading + listHtml); 341 } 342}); 343$(document).on("click",function (e) { 344 // alert(); 345 $(".searchLst").hide(); 346 $(".dropdown-menu-international").removeClass("show"); 347}); 348$(".recent-txt").on("click", function (e) { 349 e.stopPropagation(); 350 $(".searchDevice input[type='text']").focus().trigger("click"); // $(".searchLst").show(); 351 // // $(".searchDevice input[type='text']").trigger("click"); 352}); 353$(".searchDevice input[type='text']").on("click", function (e) { 354 e.stopPropagation(); 355 $(".searchLst").show(); 356}); 357$(window).on('load', function (e) { 358 $(".app-loader").fadeOut("slow"); 359 $(".app-wrapper").fadeIn("slow"); 360}); 361$(document).on("click", ".searchDeviceListClick", function () { 362 $(".app-loader").fadeIn("slow"); 363 $(".app-wrapper").fadeOut("slow"); // alert(); 364 365 var productId = $(this).attr('data-device-id'); 366 var weburl = $(this).attr('data-weburl'); 367 $.post(folderName + 'getData.php', { 368 'type': 'currentDevicePrice', 369 'productId': productId 370 }, function (result) { 371 // console.log(result); 372 var res = JSON.parse(result); 373 374 if (res.status == "Success") { 375 setMultipleBackendSessioncb("set", '{"productId": "' + productId + '", "uptoPrice"
375:"' + res.msg.maximumTotal + '"}', function (res) { 376 if (res.status == "Success") { 377 $(".app-loader").fadeOut("slow"); 378 $(".app-wrapper").fadeIn("slow"); 379 // window.location.href = "sell/" + weburl; 380 window.location.href = folderName + weburl 381 } else { 382 $(".app-loader").fadeOut("slow"); 383 $(".app-wrapper").fadeIn("slow"); 384 } 385 }); 386 } else { 387 $(".app-loader").fadeOut("slow"); 388 $(".app-wrapper").fadeIn("slow"); 389 } 390 }); 391}); 392 393function focus(e) { 394 var list = document.getElementById("mainSearchUl"); // targets the <ul> 395 396 var first; // targets the first <li> 397 398 var maininput = document.getElementById("mainSearchInput"); // targets the input, which triggers the functions populating the list 399 400 switch (e.keyCode) { 401 case 38: 402 // if the UP key is pressed 403 first = list.firstChild; 404 405 if (document.activeElement == (maininput || first)) { 406 break; 407 } // stop the script if the focus is on the input or first element 408 else { 409 document.activeElement.parentNode.previousSibling.firstChild.focus(); 410 } // select the element before the current, and focus it 411 412 413 break; 414 415 case 40: 416 // if the DOWN key is pressed 417 first = list.firstChild; 418 419 if (document.activeElement == maininput) { 420 first.firstChild.focus(); 421 } // if the currently focused element is the main input --> focus the first <li> 422 else { 423 document.activeElement.parentNode.nextSibling.firstChild.focus(); 424 } // target the currently focused element -> <a>, go up a node -> <li>, select the next node, go down a node and focus it 425 426 427 break; 428 } 429} 430 431isCookie = getCookie('ICUID'); 432 433if (isCookie == null) { 434 if (checkPerameterExist("utm_source", queryString)) { 435 date = new Date(); 436 ctime = date.getTime(); 437 $.post(folderName + 'setUTMDB.php', { 438 'type': 'setUTMDB', 439 'IP': remoteAdd, 440 'ctime': ctime, 441 'deviceType': 'web', 442 'UTMData': queryString, 443 'additionalInfo': '', 444 'version': '' 445 }, function (res) { 446 // console.log(res); 447 response = $.parseJSON(res); 448 449 if (response['status'] == 'Success') { 450 createCookie("ICUID", response['msg'], 30); 451 createCookie("utm_source", checkPerameterExist("utm_source", queryString, 1), 30); 452 } 453 }); 454 } 455} else { 456 if (getCookie('utm_source') != checkPerameterExist("utm_source", queryString, 1) && checkPerameterExist("utm_source", queryString)) { 457 date = new Date(); 458 ctime = date.getTime(); 459 $.post(folderName + 'setUTMDB.php', { 460 'type': 'setUTMDB', 461 'IP': remoteAdd, 462 'ctime': ctime, 463 'deviceType': 'web', 464 'UTMData': queryString, 465 'additionalInfo': '', 466 'version': '' 467 }, function (res) {}); 468 } 469} 470 471function createCookie(name, value, days) { 472 var date, expires; 473 474 if (days) { 475 date = new Date(); 476 date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000); 477 expires = "; expires=" + date.toGMTString(); 478 } else { 479 expires = ""; 480 } 481 482 document.cookie = name + "=" + value + expires + "; path=/"; 483} 484 485function setUserCountryCookie(flag) { 486 userCountryCode = document.querySelector("meta[name=userCountryCode]").getAttribute("content").toUpperCase(); 487 488 $('.geoCross').hide(); 489 if (flag != 'stay') { 490 window.location = flag; 491 }else{ 492 createCookie('ICgeoCross', userCountryCode, 7); 493 } 494} 495 496function getCookie(name) { 497 var dc = document.cookie; 498 var prefix = name + "="; 499 var begin = dc.indexOf("; " + prefix); 500 501 if (begin == -1) { 502 begin = dc.indexOf(prefix); 503 if (begin != 0) return null; 504 } else { 505 begin += 2; 506 var end = document.cookie.indexOf(";", begin); 507 508 if (end == -1) { 509 end = dc.length; 510 } 511 } // because unescape has been deprecated, replaced with decodeURI 512 //return unescape(dc.substring(begin + prefix.length, end)); 513 514 515 return decodeURI(dc.substring(begin + prefix.length, end)); 516} 517 518var isValue = 0; 519 520function checkPerameterExist(param, queryString, isvalue) { 521 sURLVariables = queryString.split('&'); 522 523 for (i = 0; i < sURLVariables.length; i++) { 524 sParameterName = sURLVariables[i].split('='); 525 526 if (sParameterName[0] === param) { 527 if (isvalue == 0) { 528 return sParameterName[1] === "" ? false : true; 529 } else { 530 return sParameterName[1] === "" ? false : sParameterName[1]; 531 } 532 } 533 } 534 535 return false;
536} 537 538 539 540var countCode; 541 542 543// document.cookie.split(';').filter(function(item) { 544// console.log(item.indexOf('ICgeoCross')) 545// return item.indexOf('ICgeoCross') 546// } 547 548if (document.cookie.indexOf('ICgeoCross') > -1) { 549 //console.log(document.cookie); //$("meta[name='userCountryCode']").attr("content", "SG"); 550} else { 551 $.getJSON('https://api.ipify.org?format=jsonp&callback=?', function (data) { 552 $.get('https://ipapi.co/' + data.ip + '/json/', function (data) { 553 countCode = data.country; 554 $("meta[name='userCountryCode']").attr("content", countCode); 555 556 if (document.querySelector("meta[name=userCountryCode]")) { 557 var metaCountryCode = document.querySelector("meta[name=userCountryCode]").getAttribute("content").toUpperCase(); 558 559 if (metaCountryCode === "MY" || metaCountryCode === "SG") { 560 setTimeout(function () { 561 $('.geoCross').css("display","flex"); 562 if (metaCountryCode === "MY") { 563 $(".geoCountryName").html("Malaysia").show(); 564 $(".stay-here .sprites").attr("id", "malaysia") 565 } else if (metaCountryCode === "SG") { 566 $(".geoCountryName").html("Singapore").show(); 567 $(".stay-here .sprites").attr("id", "singapore") 568 } 569 }, 2000); 570 } 571 } 572 }); 573 }); 574} 575 576$(".visit-click").on("click", function () { 577 if (countCode == "MY") { 578 setUserCountryCookie("https://getinstacash.com.my/?ucc=" + countCode + "&" + htttpHost + "&utm_medium=web_popup&utm_campaign=ucc_link&utm_term=ic_international&utm_content=ic_international"); 579 } else { 580 setUserCountryCookie("https://getinstacash.com.sg/?ucc=" + countCode + "&" + htttpHost + "&utm_medium=web_popup&utm_campaign=ucc_link&utm_term=ic_international&utm_content=ic_international"); 581 } 582}); // Back to top 583 584var btn = $('#button'); 585$(window).scroll(function () { 586 if ($(window).scrollTop() > 300) { 587 btn.addClass('show'); 588 } else { 589 btn.removeClass('show'); 590 } 591}); 592btn.on('click', function (e) { 593 e.preventDefault(); 594 $('html, body').animate({ 595 scrollTop: 0 596 }, '300'); 597}); 598$(".dataType").typed({ 599 strings: ["Price", "Pickup", "Payment"], 600 loop: !0, 601 backDelay: 1e3, 602 typeSpeed: 75, 603 backSpeed: 50 604}); 605window.addEventListener('DOMContentLoaded', function (event) { 606 setTimeout(function () { 607 window.$zopim || function (d, s) { 608 var z = $zopim = function $zopim(c) { 609 z._.push(c); 610 }, 611 $ = z.s = d.createElement(s), 612 e = d.getElementsByTagName(s)[0]; 613 614 z.set = function (o) { 615 z.set._.push(o); 616 }; 617 618 z._ = []; 619 z.set._ = []; 620 $.async = !0; 621 $.setAttribute("charset", "utf-8"); 622 $.src = "https://v2.zopim.com/?2xn7hyX7VWiVkouAyGvhXQo9DHaDqONS"; 623 z.t = +new Date(); 624 $.type = "text/javascript"; 625 e.parentNode.insertBefore($, e); 626 }(document, "script"); // $zopim(function() { 627 // $zopim.livechat.window.show(); 628 // // $zopim.livechat.setEmail('[email protected]'); 629 // }); 630 }, 5000); 631}); 632 633window.onscroll = function() { 634if($(window).width() < 768){ 635 if ((window.innerHeight + window.scrollY) >= (document.body.offsetHeight - 250)) { 636 // alert(document.body.offsetHeight); 637 $(".zopim[data-test-id='ChatWidgetMobileButton']").fadeOut("slow"); 638 }else{ 639 $(".zopim").fadeIn("slow"); 640 } 641} 642};
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.