$(document).on('ready', function() { // Lang $('.tc-lang').on('click', function () { var loca = document.location.href; if (loca.indexOf("/en/") >= 0) { document.location.href = document.location.href.replace('/en/','/tc/'); }else if (loca.indexOf("/sc/") >= 0) { document.location.href = document.location.href.replace('/sc/','/tc/'); } }); $('.sc-lang').on('click', function () { var loca = document.location.href; if (loca.indexOf("/en/") >= 0) { document.location.href = document.location.href.replace('/en/','/sc/'); }else if (loca.indexOf("/tc/") >= 0) { document.location.href = document.location.href.replace('/tc/','/sc/'); } }); $('.en-lang').on('click', function () { var loca = document.location.href; if (loca.indexOf("/tc/") >= 0) { document.location.href = document.location.href.replace('/tc/','/en/'); }else if (loca.indexOf("/sc/") >= 0) { document.location.href = document.location.href.replace('/sc/','/en/'); } }); var urlhfef = window.location.href; var urlsplit = urlhfef.split("?",2); var allurlparams = urlsplit[1]; var urlwithoutparams = 'https://' + window.location.hostname + window.location.pathname; $.urlParam = function(name){ var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href); if (results==null){ return null; } else{ return results[1] || 0; } } //const regex1 = RegExp('^1[A-Z0-9]{6}$'); var regex0 = RegExp('^1[A-Z]{1}[0-9]{1}[A-Z]{1}[0-9]{1}[A-Z]{1}[0-9]{1}$'); var regex1 = RegExp('^1[0-9]{1}[A-Z]{1}[0-9]{1}[A-Z]{1}[0-9]{1}[A-Z]{1}$'); var regex2 = RegExp('^6(([A-Z0-9]{5})([0-9]{6}))$'); var regex3 = RegExp('^M(([0-9]{8}))[C|P]$'); var regex4 = RegExp('^2[0-9A-Z-_]{1,10}$'); //var swear_words_arr = new Array("FUCK","CUNT","XXX","DICK","DLLM"); //extened to swear word arr.js var i; var referralCode = $.urlParam('r'); if ((referralCode != null) && (referralCode != 0)) { referralCode = referralCode.toUpperCase().replace(/%20/g, " "); //referralCode = referralCode; for(var i=0; i <= (swear_words_arr.length); i++){ if (referralCode.indexOf(swear_words_arr[i]) >= 0){ window.history.replaceState("null", "Title", urlwithoutparams); urlhfef = urlwithoutparams; referralCode = ""; $("#refCODE").text("- - - -"); }else{ if (regex0.test(referralCode)) { $("#refCODE").text(referralCode); }else if (regex1.test(referralCode)) { $("#refCODE").text(referralCode); }else if (regex2.test(referralCode)) { $("#refCODE").text(referralCode); }else if (regex3.test(referralCode)) { $("#refCODE").text(referralCode); }else if (regex4.test(referralCode)) { $("#refCODE").text(referralCode); }else{ referralCode = ""; $("#refCODE").text("- - - -"); } } } }else{ referralCode = ""; $("#refCODE").text("- - - -"); } if( /Android|iPhone|iPad|iPod/i.test(navigator.userAgent) ) { $("#downloadN").show(); $("#floatdownloadN").show(); $(".copybtn").show(); $("#qrcodes").hide(); }else{ $("#downloadN").hide(); $("#floatdownloadN").hide(); $("#qrcodes").show(); $(".copybtn").hide(); } if( /iPhone|iPad|iPod/i.test(navigator.userAgent) ) { $('.apple_app').attr('href','itms-apps://?action=today&referrer=app-store&itscg=10000&itsct=app-appstore_dev-nav-200917'); //window.location.href = "itms-apps://?action=today&referrer=app-store&itscg=10000&itsct=app-appstore_dev-nav-200917"; }else{ $('.apple_app').attr('href','https://www.apple.com/app-store/'); //window.location.href = "https://www.apple.com/app-store/"; } var qrcode = new QRCode("qrcode"); qrcode.makeCode(urlhfef); $(".copybtn").click(function(){ // var $temp = $(""); // $("body").append($temp); // $temp.val($("#refCODE").text()).select(); // document.execCommand('copy'); // $temp.remove(); //var copyText = document.getElementById("refCODE"); var copyText = $("#refCODE").text(); var docSTORE = document.createElement('input'); document.body.appendChild(docSTORE); docSTORE.value = copyText; docSTORE.select(); docSTORE.setSelectionRange(0, 99999); document.execCommand('copy', false); //alert(docSTORE.value); docSTORE.remove(); $("#copied").addClass('ondisplay'); setTimeout(function() { $("#copied").removeClass('ondisplay'); }, 2000) }); $(".downloadN").click(function(){ var copyText = $("#refCODE").text(); var docSTORE = document.createElement('input'); document.body.appendChild(docSTORE); docSTORE.value = copyText; docSTORE.select(); docSTORE.setSelectionRange(0, 99999); document.execCommand('copy', false); //alert(docSTORE.value); docSTORE.remove(); if( /iPhone|iPad|iPod/i.test(navigator.userAgent) ) { //window.location.href = "https://www.apple.com/app-store/"; window.location.href = "itms-apps://?action=today&referrer=app-store&itscg=10000&itsct=app-appstore_dev-nav-200917"; }else if( /Android/i.test(navigator.userAgent) ) { window.location.href = "https://play.google.com/store/apps"; } //window.location.href = "https://bit.ly/citicwebsite"; }); $('.slider-img').slick({ slidesToShow: 1, infinite: true, autoplay : true, autoplaySpeed: 6000, centerPadding: '0px', responsive: [ { breakpoint: 768, settings: { centerPadding: '30px', slidesToShow: 1, } } ] }); $('.slider-img').on('afterChange', function(event, slick, currentSlide){ var currentSlideNew = $('.slider-img').slick('slickCurrentSlide') ; $(".tutor_step li").removeClass('currentStep'); $(".tutor_step li").eq(currentSlideNew).toggleClass('currentStep'); //console.log(currentSlideNew); }); }); $(document).ready(function() { var urlhfef = window.location.href; var urlsplit = urlhfef.split("?",2); var allurlparams = urlsplit[1]; $.urlParam = function(name){ var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href); if (results==null){ return null; } else{ return results[1] || 0; } } var referralCode = $.urlParam('referralCode'); // $('meta').each(function(){ // var value = $(this).attr('content'); // var newvalue = value.replace(/%%refC%%/ig, referralCode); // $(this).attr('content', newvalue); // //console.log(this); // }); });