/**** 基本參數讀取 *******/ var now_system_time = 1760458432000; var is_mobile = 0; var adminzone = 0; /**** 基本參數讀取(end) *******/ /* * 管理區共用js處理 */ $(document).ready(function () { var viewTopSite = $('input[name="viewTopSite"]').val(); if(viewTopSite>0){ $('html, body').animate({scrollTop: $('#nav_show-product').offset().top}, viewTopSite); } //回首頁 $('.backIndex').click(function(){ location.href = '/'; }); //註冊頁 $('.register_homeBtn_M').click(function(){ location.href = '/Main/register'; }); //確認是否18歲 $('.check18YearOld').click(function(){ var val = $(this).data('val'); if(val==1){ $('.gradind_bg').hide(); var type = $("input[name='donotRemindAgain']:checked").map(function() { return $(this).val(); }).get(); if(type==1){ $.ajax({ url:'/Main/saveCookie', type:'post', dataType:'json', data:{key:'over18YearOld',value:1}, success:function(json){ },error:function(){ } }); } }else{ window.location.href = "https://google.com"; } }); //導向登入頁 $('body').on("click",".responseLogin",function () { waiting(languageObj['pageJomp']); setTimeout(function(){ window.location = '/Main/login'; waiting_close(); },1000); }); //使用VIP序號 $('.useNumber').click(function(){ var post = new Object; $.each($('.parameNumber'),function(key,val){ post[$(this).data('index')] = $(this).val(); }); $.ajax({ url:'/Main/useNumber', type:'post', dataType:'json', data:post, beforeSend: function () { //處理中 waiting(languageObj['loaging']); }, success:function(json){ if(json['errorMsg']==''){ if(json['redirectUrl']!=''){ window.open(json['redirectUrl'],'',config='height=1000,width=800'); windowObj = window.open([json['redirectUrl']]); //視窗有可能被瀏覽器阻擋 if(windowObj==null){ toastAlert(1,languageObj['promptMessage'],json['successMsg'],true,'領取額外Bonuse',json['redirectUrl']); }else{ toastAlert(1,languageObj['promptMessage'],json['successMsg']); } }else{ toastAlert(1,languageObj['promptMessage'],json['successMsg']); } }else{ toastAlert(0,languageObj['errorMsg'],json['errorMsg']); } $.each($('.parameNumber'),function(key,val){ $(this).val(''); }); },error:function(){ }, complete: waiting_close }); }); //切換語系 $('.changeLanguage').click(function(){ var code = $(this).data('value'); $.ajax({ url:'/CommonAjax/changeLanguage', type:'post', dataType:'json', data:{code:code}, success:function(json){ if(json['errorMsg']==''){ location.reload(); }else{ toastAlert(0,languageObj['errorMsg'],languageObj['errorMsg']); } //console.log(json); },error:function(){ } }); }); //左側連結 $('.leftLink').click(function(){ var code = $(this).data('code'); var url = $('input[name="'+code+'"]').val(); window.open(url); // switch(code){ // case 'fb': // window.open('https://www.facebook.com/profile.php?id=100088679027940'); // break; // case 'ig': // window.open('https://www.instagram.com/jinmaliyulecheng'); // break; // case 'yt': // window.open('https://www.youtube.com/@user-jm1fb7fx2s'); // break; // case 'line': // window.open('https://liff.line.me/1645278921-kWRPP32q/?accountId=099nsrtf'); // break; // } saveVisitorRecord('social',code); }); //右側連結 $('.rightLink').click(function(){ var code = $(this).data('code'); var url = $('input[name="'+code+'"]').val(); switch(code){ case 'teamviewer': case 'bignox': case 'apple_tw': case 'apple_vn': case 'apple': fbq('trackCustom', 'Download', {promotion: code}); window.open(url); break; case 'google_tw': case 'google_vn': case 'google': case 'apk': getVersionNumber(url,'apk'); break; } saveVisitorRecord('download',code); }); //遊戲介紹 $('.gameInfo').click(function(){ var gameCode = $(this).data('game'); saveVisitorRecord('info',gameCode); }); }); function getVersionNumber(url,fileExtension){ $.ajax({ url:'/Main/getVersionNumber', type:'post', dataType:'json', data:{}, success:function(json){ window.open(url+json+'.'+fileExtension); },error:function(){ } }); } function saveVisitorRecord(classification,code){ $.ajax({ url:'/Ajax/saveVisitorRecord', type:'post', dataType:'json', data:{code:code,classification:classification}, success:function(json){ },error:function(){ } }); }$(document).ready(function(){ //默認產品 var defaultMenuProduct = $('input[name="defaultMenuProduct"]').val(); if(defaultMenuProduct==''){ getProduct('point'); }else{ getProduct(defaultMenuProduct); } //手機板儲值優惠按鈕 $('.float_buyIcon').click(function(){ var webSite = $('input[name="webSite"]').val(); var thisMethod = $('input[name="thisMethod"]').val(); if(thisMethod!='index'){ window.location.href = webSite+"?nav=show-product"; }else{ getProduct('point'); $('.tab-pane').removeClass('active'); $('.nav-link').removeClass('active');//所有主頁籤 $('#show-product').addClass('active');//主頁籤 $('#nav_show-product').addClass('active'); $('#proKind-point').addClass('active');//儲值專區裡第一個項目頁籤 //window.location.hash = "#nav_show-product"; $('html, body').animate({scrollTop: $('#nav_show-product').offset().top}, 1000); } }); $('.selectProduct').click(function(){ var item = $(this).data('item'); setMenuCookie('subMenuProduct',item); getProduct(item); }); //google廣告事件 gtag('event', 'conversion', { 'send_to': 'AW-11021988146/WoCxCLzN-vEYELLi2Icp', 'transaction_id': '' }); getBounceAds(); //顯示遊戲介紹模態框 $('.showGameInfoModal').click(function(){ $('.showGameInfoModalName').html($(this).data('name')); $('.showGameInfoModalInfo').html($(this).data('info')); $('.showGameInfoModalIframe').empty(); //if($(this).data('url')!=''){ //$('.showGameInfoModalIframe').append(''); //}else{ //} $('.showGameInfoModalIframe').append(''); }); //顯示最新消息 $('.showNewsDetails').click(function(){ var id = $(this).data('id'); $.ajax({ url:'ajax/getNewsData', type:'post', dataType:'json', data:{id:id}, success:function(json){ if(json['errorMsg']==''){ $('.showNewsModalTitle').html(json.data.title); $('.showNewsModalContent').html(json.data.content); } },error:function(){ } }) }); //MOMO快速選擇金額 $(document).on('click','.fastSetMomoPayment',function(){ var amount = $(this).data('amount'); $('input[name="paymentMomo"]').val(amount); }); //MOMO手機快速選擇金額 $(document).on('click','.fastSetMomoPhonePayment',function(){ var amount = $(this).data('amount'); $('input[name="paymentMomoPhone"]').val(amount); }); //產品明細 $('#checkBuyModal').on('show.bs.modal', function (event) { var button = $(event.relatedTarget); var modal = $(this); if($('.user').data('token')==''||$('.user').data('token')==null){ }else{ modal.find('#thisProductImg').html(''); if(button.data('img')!=''){ modal.find('#thisProductImg').html(''); } modal.find('.productName').text(button.data('name')); modal.find('.productPrice').text(button.data('price')); modal.find('.productPoint').text(button.data('point')); if(button.data('price')<190){ $('.btnPay_neweb').css('display','none'); }else{ $('.btnPay_neweb').css('display','block'); } if(button.data('kind')=='point'){ $('input[name="productBuyCellphone"]').attr('disabled','true'); }else{ $('input[name="productBuyCellphone"]').removeAttr('disabled'); } $('input[name="thisId"]').val(button.data('id')); $('input[name="productType"]').val(button.data('kind')); } }); $('.enterBuy').click(function(){ var payment = 0; var code = $(this).data('code'); var account = $('.user').data('account'); var createTime = Date.now(); var subPayCode = $('input[name="subPayCode"]:checked').val(); var url = ''; var check = true; switch(code){ case 'momophonecard': var momoPhoneCardSeri = $('input[name="momoPhoneCardSeri"]').val(); var momoPhoneCardCode = $('input[name="momoPhoneCardCode"]').val(); payment = $('input[name="paymentMomoPhone"]').val(); subPayCode = $('select[name="subPayCodeMomoPhone"]').val(); url = $('.site').data('buy')+'?payCode='+'momo'+'&&payment='+payment+'&&account='+account+'&&createTime='+createTime+'&&subPayCode='+subPayCode+'&&momoPhoneCardSeri='+momoPhoneCardSeri+'&&momoPhoneCardCode='+momoPhoneCardCode; break; case 'momo': payment = $('input[name="paymentMomo"]').val(); subPayCode = $('select[name="subPayCodeMomo"]').val(); url = $('.site').data('buy')+'?payCode='+code+'&&payment='+payment+'&&account='+account+'&&createTime='+createTime+'&&subPayCode='+subPayCode; break; case 'sonet': payment = $('select[name="paymentSonet"]').val(); subPayCode = $('select[name="subPayCodeSonet"]').val(); url = $('.site').data('buy')+'?payCode='+code+'&&payment='+payment+'&&account='+account+'&&createTime='+createTime+'&&subPayCode='+subPayCode; break; case 'bluenew': payment = $('input[name="paymentBluenew"]').val(); url = $('.site').data('buy')+'?payCode='+code+'&&payment='+payment+'&&account='+account+'&&createTime='+createTime; break; case 'jkos': payment = $('input[name="paymentJkos"]').val(); url = $('.site').data('buy')+'?payCode='+code+'&&payment='+payment+'&&account='+account+'&&createTime='+createTime; break; case 'gash': payment= $('input[name="paymentGash"]').val(); url = $('.site').data('buy')+'?payCode='+code+'&&payment='+payment+'&&account='+account+'&&createTime='+createTime+'&&subPayCode=COPGAM05'; break; default: url = $('.site').data('buy')+'?payCode='+code+'&&payment='+payment+'&&account='+account+'&&createTime='+createTime; break; } if(payment==0||payment==''){ check = false; toastAlert(0,languageObj['errorMsg'],languageObj['inputRechargeAmount']);//請輸入儲值金額 } if(account==''){ check = false; toastAlert(0,languageObj['errorMsg'],languageObj['pleaseLoginFirst']);//請先登入 } if(code=='sonet'&&subPayCode==null){ check = false; toastAlert(0,languageObj['errorMsg'],languageObj['choosePaymentMethod']);//請選擇付款方式 } if(check){ fbq('track', 'Purchase', {currency: "TWD", value: 30.00}); window.open(url, '', config='height=高度,width=寬度'); gtag(); } }); //初始化排行榜 getLeaderboardData($('input[name="leaderboardInit"]').val()); //排行榜類別頁籤 $('.leaderboardNav').click(function(){ $('.leaderboardNav').removeClass('active'); $(this).addClass('active'); var getCode = $(this).data('code'); getLeaderboardData(getCode); }); //送出表單內容 $('.saveFrame').click(function(){ var code = $(this).data('code'); var obj = new Object; $.each($('.'+code+'Frame'),function(key,val){ var getKey = $(this).attr('name'); obj[getKey] = $(this).val(); }); $.ajax({ url:'/ajax/saveFrame', type:'post', dataType:'json', data:{code:code,obj:obj}, success:function(json){ if(json['errorMsg']==''){ $.each($('.'+code+'Frame'),function(key,val){ $(this).val(''); }); toastAlert(1,languageObj['promptMessage'],languageObj['success']); getCaptcha(); }else{ toastAlert(0,languageObj['errorMsg'],json['errorMsg']); } },error:function(){ } }) }); $('.middleNav').click(function(){ var code = $(this).data('code'); var item = $(this).data('item'); setMenuCookie('defaultMenuActive',item); getCaptcha(); saveVisitorRecord('nav',code); }); });//end_ready /* * 取得排行榜資料 */ function getLeaderboardData(code){ $('#show-kind').empty(); $('.leaderboardPage').empty(); var html = ''; html = ''; $.ajax({ url:'/CommonAjax/getLeaderboardData', type:'post', dataType:'json', data:{code:code}, success:function(json){ if(json['errorMsg']==''){ html += ''; $.each(json['title'],function(key,val){ html += ''; }); html += ''; $.each(json['data'],function(key,row){ html += ''; $.each(row,function(rowKey,data){ html += ''; }); html += ''; }); } html += '
'+val+'
'; if(rowKey=='point'||rowKey=='winPoint'){ html += ''+data+''; }else{ html += ''+data+''; } html += '
'; $('#show-kind').append(html); },error:function(){ } }) } /* * 千位數逗號 */ function AppendComma(n) { if (!/^((-*\d+)|(0))$/.test(n)) { var newValue = /^((-*\d+)|(0))$/.exec(n); if (newValue != null) { if (parseInt(newValue, 10)) { n = newValue; } else { n = '0'; } } else { n = '0'; } } if (parseInt(n, 10) == 0) { n = '0'; } else { n = parseInt(n, 10).toString(); } n += ''; var arr = n.split('.'); var re = /(\d{1,3})(?=(\d{3})+$)/g; return arr[0].replace(re, '$1,') + (arr.length == 2 ? '.' + arr[1] : ''); } /* * 取彈跳廣告 */ function getBounceAds(){ var html = ''; $.ajax({ url:'/ajax/getBounceAds', type:'post', dataType:'json', data:{}, success:function(json){ //console.log(json); if(json['errorMsg']==''){ var issetAds = new Array; $.each(json.data,function(key,val){ html += ''; issetAds.push(key); }); $('.modalDiv').append(html); $.each(issetAds,function(key,val){ $('.bd-example-modal-lg-'+val).modal('show'); }); } },error:function(){ } }) } /* * 取得商品 */ function getProduct(item){ var jsonCode = $('input[name="productJson"]').val(); var userAccount = $('input[name="userAccount"]').val(); var manageUrl = $('input[name="manageUrl"]').val(); var thisLang = $('input[name="thisLang"]').val(); var html = ''; // $.ajax({ // url:'/ajax/getProduct', // type:'post', // dataType:'json', // data:{item:item}, // success:function(json){ $('.showPrdouctData').empty(); if(jsonCode!=''&&jsonCode!=null){ //if(json['errorMsg']==''){ //var getData = json.data[item]; var formatArray = JSON.parse(jsonCode); var getData = formatArray[item]; if(getData!=null){ $.each(getData,function(key,val){ html += '
'; html += '
'+val['name']+'
'; html += '
'; html += '
金幣'+(val['coinBeforeDiscount']>0 ? val['coinBeforeDiscount'] : val['point'])+''; if(val['productType']=='point'){ html += '
'; html += ''; html += '
'; html += '

+'+val['discountPercentage']+'%

'; html += '

='+val['point']+'

'; html += '
'; html += '
'; } if(val['productType']=='serialNumber'){ html += '
'+val['discountBonus']+'
'; } html += '
'; html += '
'; if(val['img']!=''){ html += ''; } html += '
'; html += '
'; if(userAccount!=''){ html += ''; html += '
'; html += '
'; html += '
'; html += val['content']; html += '
'; html += '
'; }); }else{ html += '
'; html += ''; html += '
'; } }else{ html += '
'; html += ''; html += '
'; } $('.showPrdouctData').append(html); // },error:function(){ // } // }) } function setMenuCookie(key,val){ $.ajax({ url:'/ajax/setMenuCookie', type:'post', dataType:'json', data:{key:key,val:val}, success:function(json){ },error:function(){ } }) } /********* ' . includes/js/home_Main_index.js . ' 不存在***********/