var fullAlert2 = '1'; var haveQTA = 0; var total_member = 0; var gameover = ''; //var sidArray=; var isMobile_check = ''; //Detect Device var isMobile = false; (function (a) { (/android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/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|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|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|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) ? isMobile = true: isMobile = false; })(navigator.userAgent || navigator.vendor || window.opera, true, false); if(isMobile) { //window.location.href="http://www.fisherprice.com.tw/a-film-by-you/mobile/index.php?v=20191105"; isMobileWeb='1'; }else{ isMobileWeb='0'; } // alert(isMobileWeb); /////////// Kuei Start //////////// function SetCookie(name,value) { var Days = 30; //此 cookie 将被保存 30 天 var exp = new Date(); //new Date("December 31, 9998"); exp.setTime(exp.getTime() + Days*24*60*60*1000); document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString(); } function getCookie(name)//取cookies函数 { var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)")); if(arr != null) return unescape(arr[2]); return null; } function delCookie(name)//删除cookie { var exp = new Date(); exp.setTime(exp.getTime() - 1); var cval=getCookie(name); if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString(); } function clickga(url){ ga('send','event',url,url,url); if(window.console) console.log('clickga:'+url); } var facebook_app_id = '536748037099401'; if(facebook_app_id!='') { window.fbAsyncInit = function() { FB.init({ appId : facebook_app_id, xfbml : true, version : 'v2.3' }); }; (function(d, s, id){ var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); } function checkLoginStatus(response) { if(window.console) console.log('checkLoginStatus'); if(response && response.status == 'connected') { /* if(window.console) { if(window.console) console.log('Access Token: ' + response.authResponse.accessToken); if(window.console) console.log(response); FB.api('/me', function(response) { console.log('Good to see you, ' + response.name + '.'); console.log(response); }); } */ FB.api('/me', function(response) { $('#_fb_name').val(response.name); $('#_fb_email').val(response.email); $('#_fb_uid').val(response.id); $('#_fb_gender').val(response.gender); $('#_fb_link').val(response.link); }); } else { } } function getQueryString_kuei(param) { var q = document.location.search || document.location.hash; if (param == null) { return q; } if (q) { var pairs = q.substring(1).split("&"); for (var i = 0; i < pairs.length; i++) { if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) { return pairs[i].substring((pairs[i].indexOf("=") + 1)); } } } } var utm_source = getQueryString_kuei('utm_source'); var utm_content = getQueryString_kuei('utm_content'); var utm_campaign = getQueryString_kuei('utm_campaign'); var utm_medium = getQueryString_kuei('utm_medium'); var utm_term = getQueryString_kuei('utm_term'); var utm_source_cookie = getCookie('utm_source'); var utm_content_cookie = getCookie('utm_content'); var utm_campaign_cookie = getCookie('utm_campaign'); var utm_medium_cookie = getCookie('utm_medium'); var utm_term_cookie = getCookie('utm_term'); if((utm_source=='' || utm_source==undefined) && utm_source_cookie!='') utm_source = utm_source_cookie; if((utm_content=='' || utm_content==undefined) && utm_content_cookie!='') utm_content = utm_content_cookie; if((utm_campaign=='' || utm_campaign==undefined) && utm_campaign_cookie!='') utm_campaign = utm_campaign_cookie; if((utm_medium=='' || utm_medium==undefined) && utm_medium_cookie!='') utm_medium = utm_medium_cookie; if((utm_term=='' || utm_term==undefined) && utm_term_cookie!='') utm_term = utm_term_cookie; function IsNumber(string,sign) { var number; if (string==null) return false; if ((sign!=null) && (sign!='-') && (sign!='+')) { alert('IsNumber(string,sign)的參數出錯:\nsign為null或"-"或"+"'); return false; } number = new Number(string); if (isNaN(number)) { return false; } else if ((sign==null) || (sign=='-' && number<0) || (sign=='+' && number>0)) { return true; } else return false; } function ValidEmail(emailtoCheck) { var regExp = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; if ( emailtoCheck.match(regExp) ) return true; else return false; } function checkField() { if($('#t-name').val()=='' || $('#t-name').val()=='姓名'){ msg_trigger('msg-alert','請填寫您的姓名!!'); return false; } //$('#t-county').val(''); if($('#t-tel').val()=='' || $('#t-tel').val()=='手機號碼'){ msg_trigger('msg-alert','請填寫您的手機號碼!!'); return false; } if (($('#t-tel').val()!="") && (IsNumber($('#t-tel').val())==false)) { msg_trigger('msg-alert','手機電話需全為數字!!(請勿以符號或全形數字輸入)'); return false; } if (($('#t-tel').val()!="") && ($('#t-tel').val().length != 10)) { msg_trigger('msg-alert','手機電話號碼有問題請檢查!! 謝謝!!(請勿以符號或全形數字輸入)'); return false; } if ($('#t-tel').val().substring(2,0)!='09') { msg_trigger('msg-alert','請填寫正確的手機號碼!! 謝謝!!'); return false; } if($('#t-car-no-1').val()=='' || ($('#t-car-no-1').val().length < 2)){ msg_trigger('msg-alert','請填寫您的車牌號碼!!'); return false; } if($('#t-car-no-2').val()=='' || ($('#t-car-no-2').val().length < 2)){ msg_trigger('msg-alert','請填寫您的車牌號碼!!'); return false; } if($('#t-car-type').val()=='' || ($('#t-car-type').val().length < 3)){ msg_trigger('msg-alert','請填寫您的車款!!'); return false; } console.log($('#t-car-type').val()+' length = '+$('#t-car-type').val().length); if (!$('#t-county').val() || $('#t-county').val()=='選擇縣市') { msg_trigger('msg-alert',"請選擇縣市!"); return false; } console.log($('#t-county').val()); /* if (!$('#t-district').val() || $('#t-district').val()=='選擇區域') { msg_trigger('msg-alert',"請選擇區域!"); return false; } */ console.log('t-district = '+$('#t-district').val()); console.log('服務廠:'+store_name); console.log('BRANCHFULLNM:'+BRANCHFULLNM); if (store_name=='') { msg_trigger('msg-alert',"請選擇服務廠!"); return false; } if (!$('#t-time').val()) { msg_trigger('msg-alert',"服務人員聯絡時段!"); return false; } console.log($('#t-time').val()); if(!$('#t-agree').prop("checked")){ msg_trigger('msg-alert','請詳細閱讀並同意個人資料提供聲明.'); return false; } return true; } function getCid() { try { var trackers = ga.getAll(); var i, len; for (i = 0, len = trackers.length; i < len; i += 1) { if (trackers[i].get('trackingId') === 'UA-136675633-1') { return trackers[i].get('clientId'); } } } catch(e) {console.log('error');} } var cid = ''; $().ready(function(){ //add facebook input $( "body" ).append(""); var json_callback = function(msg){ //alert(msg); if(window.console) console.log(msg); var json = [msg]; var s = msg.Statuss; if(s=='success') { msg_trigger('msg-alert','送出成功,感謝您的洽詢! 服務人員將盡速與您聯繫!') $("#try-tracking").attr('src', 'tracking-try-submit.html'); $('#t-name').val(''); $('#t-tel').val(''); $('#t-car-type').val(''); $('#t-car-no-1').val(''); $('#t-car-no-2').val(''); $('#t-note').val(''); $('#t-agree').prop( "checked", false ); //$('#t-county').prop('selectedIndex',0); //$('#t-district').prop('selectedIndex',0); $('#t-county').val('').trigger('change'); $('#t-time').prop('selectedIndex',0); //$("#t-county").val($("#t-county option:first").val()); //$("#t-district").val($("#t-district option:first").val()); $("#t-time").val($("#t-time option:first").val()); $('#t-store-list').html(''); } else if(s=='already') { msg_trigger('msg-alert','您已經填寫過了!'); //$('#g-uploading').removeClass('active') clickga('重複填寫'); } else if(s=='shareSuccess') swal('分享成功'); else { //$('#g-uploading').removeClass('active') msg_trigger('msg-alert',s); } already_click = ''; } var ad1 = ''; var ad2 = ''; var area = ''; var shop = ''; var user_date = ''; var already_click = ''; $('#fb-share').bind('click', function() { fb_share(); }); if(window.console) console.log('actCode = '+actCode); if(gameover!='1'){ //send $('#try-submit').bind('click', function() { //cid = getCid(); if(window.console) {console.log('cid = '+cid);} if(window.console) {console.log('確認送出 click');} console.log('ADDR = '+ADDR); console.log('DLRCD = '+DLRCD); console.log('COMPNM = '+COMPNM); console.log('BRANCHID = '+BRANCHID); console.log('BRANCHFULLNM = '+BRANCHFULLNM); console.log('ZIPNM = '+ZIPNM); console.log('COMPID = '+COMPID); console.log('DISTIRCT = '+DISTIRCT); var a = checkField(); if(a){ if(already_click==''){ already_click = '1'; $.ajax({ url: 'https://sp.artstudio.com.tw/toyota_tire_inquiry.php', crossDomain: true, dataType: 'jsonp', contentType: "application/json", jsonpCallback: 'json_callback', data: { actCode: '201911_tire_inquiry', uname: $('#t-name').val(), phone: $('#t-tel').val(), email: $('#t-email').val(), car_no1: $('#t-car-no-1').val(), car_no2: $('#t-car-no-2').val(), car_type: $('#t-car-type').val(), ad1: $('#t-county').val(), ad2: $('#t-district').val(), address: ADDR, store_name: store_name, file1: $('#t-time').val(), user_message: $('#t-note').val(), DLRCD: DLRCD, COMPNM: COMPNM, BRANCHID: BRANCHID, BRNHCD: BRNHCD, BRANCHFULLNM: BRANCHFULLNM, ZIPNM: ZIPNM, DISTIRCT: DISTIRCT, COMPID: COMPID, utm_campaign:utm_campaign, utm_medium:utm_medium, utm_term:utm_term, utm_source:utm_source, utm_content:utm_content, isMobileWeb:isMobileWeb }, success:json_callback //error: json_callback }).done(function(data){ //dddone(); }); } } }); } }); $( window ).load(function() { if(window.console){console.log(window.location.host);} });