$(document).ready(function () { LanguageSwitching(); var timer = null; timer = setInterval(function () { $(".zhedang").hide(); }, 400) document.addEventListener('gesturestart', function (e) { e.preventDefault(); }); document.addEventListener('dblclick', function (e) { e.preventDefault(); }); document.addEventListener('touchstart', function (event) { if (event.touches.length > 1) { event.preventDefault(); } }); $(".SLdetaileHeaderImg").on("click", function () { window.history.back(); }) let url = window.location.search; var theRequest = new Object(); if (url.indexOf("?") != -1) { var str = url.substr(1); strs = str.split("&"); for (var i = 0; i < strs.length; i++) { theRequest[strs[i].split("=")[0]] = unescape(decodeURI(strs[i].split("=")[1])); } } var lastTouchEnd = 0; document.addEventListener('touchend', function (event) { var now = (new Date()).getTime(); if (now - lastTouchEnd <= 300) { event.preventDefault(); } lastTouchEnd = now; }, false); $("#Goregister").on("click", function () { window.location.href = "register.html"; }) var timer = null; function publicBox(publicText) { $(".AlertBox").show(); $(".AlertBoxChilds").html(publicText); timer = setInterval(function () { $(".AlertBox").hide(); }, 2000) } function publicBoxBack(publicText) { $(".AlertBox").show(); $(".AlertBoxChilds").html(publicText); timer = setInterval(function () { $(".AlertBox").hide(); // window.history.back(); $(location).attr("href", 'index.html'); // if (theRequest.type1 == undefined && theRequest.m3u8 == undefined) { // window.location.href = theRequest.sta; // } else if (theRequest.m3u8 != undefined) { // window.location.href = theRequest.sta + "?m3u8=" + theRequest.m3u8; // } else { // window.location.href = theRequest.sta + "?type1=" + theRequest.type1; // } }, 2000) } $(".LoginBtn").on("click", function () { clearInterval(timer); var languageParameter = localStorage.getItem('language') || 'CN'; if ( languageParameter == 'CN') { if ($("#account").val() == "") { publicBox("請填寫帳號"); } else if ($("#password").val() == "") { publicBox("請填寫密碼"); } else if (!/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,12}$/.test($("#account").val())) { publicBox("賬號格式錯誤"); } else if (!/^\d{6}$/.test($("#password").val())) { publicBox("密碼格式錯誤"); } else { $.ajax({ type: "post", url: "https://www.bibidd.com/bibidd/usertest/slUserLogin", dataType: "json", data: { account: $("#account").val(), password: $("#password").val() }, success: function (res) { if (res.code == "200") { localStorage.setItem("uid", res.user_id); localStorage.setItem("username", $("#account").val()); publicBoxBack("登錄成功") } else if (res.code == "201") { publicBox("賬號和密碼不匹配") } else if (res.code == "202") { publicBox("參數不正確"); } else if (res.code == "203") { publicBox("該帳戶未註冊"); } } }) } }else{ if ($("#account").val() == "") { publicBox("Please fill in the account number"); } else if ($("#password").val() == "") { publicBox("Please fill in the password") } else if (!/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,12}$/.test($("#account").val())) { publicBox("Account format error") } else if (!/^\d{6}$/.test($("#password").val())) { publicBox("Wrong password format"); } else { $.ajax({ type: "post", url: "https://www.bibidd.com/bibidd/usertest/slUserLogin", dataType: "json", data: { account: $("#account").val(), password: $("#password").val() }, success: function (res) { if (res.code == "200") { localStorage.setItem("uid", res.user_id); localStorage.setItem("username", $("#account").val()); publicBoxBack("Login successful") } else if (res.code == "201") { publicBox("Account and password do not match") } else if (res.code == "202") { publicBox("Incorrect parameters"); } else if (res.code == "203") { publicBox("The account is not registered"); } } }) } } }) function LanguageSwitching() { var languageParameter = localStorage.getItem('language') || 'CN'; if ( languageParameter == 'CN') { // 切换中文语言 $('.LoginTitle').text(' 登錄 '); $('#account').attr('placeholder','長度 8-12位數字+字母'); $('#password').attr('placeholder','密碼(6位數字密碼)'); $('.registerShuoming').text('請牢記賬號密碼,丟失將無法找回'); $('.LoginBtn').text('登錄'); $('.LoginTextLeft').text('沒有帳號?'); $('.LoginTextRight').text('註冊'); }else if (!languageParameter || languageParameter == 'EN'){ // 切换英文语言 $('.LoginTitle').text(' Sign In '); $('#account').attr('Length 8-12 digits + letters'); $('#password').attr('Password (6-digit password)'); $('.LoginBtn').text('Sign In'); $('.LoginTextLeft').text('Don’t have account? '); $('.LoginTextRight').text('Sign Up'); } } })